Python 如何确认两个AutoProxy[Queue]指向同一队列?

Python 如何确认两个AutoProxy[Queue]指向同一队列?,python,message-queue,Python,Message Queue,在开发消息总线的环境中,当我试图确保给定队列(或其代理)没有为同一消息类型注册两次时,我有点为难(!) 在调试测试时,在试图避免双重注册的函数中,我观察到: print(registration) # gives: RegisterHandlerQueue(messageType=<class 'TestMessage'>, handlerQueue=<AutoProxy[Queue] object,

在开发消息总线的环境中,当我试图确保给定队列(或其代理)没有为同一消息类型注册两次时,我有点为难(!)

在调试测试时,在试图避免双重注册的函数中,我观察到:

print(registration)  # gives:
RegisterHandlerQueue(messageType=<class 'TestMessage'>,
                     handlerQueue=<AutoProxy[Queue] object, 
                                   typeid 'Queue' at 0x21da2b12490>
                     )
# great, as expected

print(handlersQueues[registration.messageType])  # gives:
[<AutoProxy[Queue] object, typeid 'Queue' at 0x21da2b12670>]
# somewhat confusing (different memory address from above) 
# but probably ok.
# the storage structure has the form: {messageType:[queue1,queue2,...]}

print(registration.handlerQueue)  # gives:
<queue.Queue object at 0x00000214A15B28E0>
# very problematic: I cannot compare the handlerQueue stored
# in the registration message with the one stored in the 
# handlersQueues dictionary!

print({"test":registration.handlerQueue})  # gives:
{'test': <AutoProxy[Queue] object, typeid 'Queue' at 0x21da2b12490>}
# here it appears as soon as I place the queue in a dictionary,
# the proxy is stored instead. Interestingly, it has the same
# address as the proxy stored in the registration message.
打印(注册)#给出:
RegisterHandlerQueue(messageType=,
装卸工队列=
)
#很好,正如所料
打印(handlersQueues[registration.messageType])#给出:
[]
#有些混乱(与上面的内存地址不同)
#但可能没问题。
#存储结构的形式为:{messageType:[queue1,queue2,…]}
打印(registration.handlerQueue)#提供:
#非常有问题:我无法比较存储的handlerQueue
#在注册消息中与存储在
#Handlersques字典!
打印({“test”:registration.handlerQueue})给出:
{'test':}
#在这里,当我将队列放入字典中时,
#而是存储代理。有趣的是,它也有相同的功能
#作为代理存储在注册消息中的地址。
底线问题是:我如何验证两个AutoProxy[Queue]对象指向同一队列,或者一个AutoProxy指向给定队列?

可能与:有关,但使用RebuildProxyNorReferent函数似乎没有效果。