Hi Bill, I don't think there is a way to distinguish the two - when they're passed to the console callback, they'll be identical. We need to fix that.
Adding a isV2 attribute to the event sounds like a good approach. Let me know, I'd like to patch that into 0.24 and trunk so it will be available in future releases. -K ----- Original Message ----- > From: "Bill Freeman" <[email protected]> > To: "users" <[email protected]> > Sent: Thursday, July 25, 2013 12:24:34 PM > Subject: Telling v1 events from v2 events using qmf.console python QMF library > > I've started working on detecting when a queue has been deleted. One > possibility is to track the queueDelete QMF events. > > I noticed that I get 2 of each event (using an older qmf.console that has > been patched as recently discussed to allow v2 to happen at all). Using > pdb to crawl up the stack, I confirmed that one is a v1 event, and the > other is a v2 event. > > I'd like to discard one, preferably the v1, so that I know my code will > still work in a future when the brokers aren't sending v1 events anymore. > But at the point that the Console.event callback is called, I don't see how > to distinguish the two. For objectProps and objectStatis I can get an > ObjectID instance and use its isV2 attribute, but I don't believe that's > available for Event instances. > > It would be easy enough for me to also patch the Event constructor (it > knows because of the presence or absence of a dict as the v2Map constructor > argument) to mark the Event object suitably. (I'm thinking of adding an > isV1 boolean that I'll check with getattr(event, 'isV1', False) so that the > code will do the right thing with a future where only v2 events are > delivered by code that knows nothing about the flag.) > > But am I missing an existing easier solution? > > Bill > -- -K --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
