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

Reply via email to