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

问题描述

在消息总线的开发环境中,我想让自己陷入困境(!),因为我试图确保给定的队列(或其代理)没有为同一队列注册两次。消息类型。

在调试测试时,在试图避免重复注册函数中,我观察到了

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.

最重要的问题是:如何验证两个Autoproxy [Queue]对象指向同一队列或一个Autoproxy指向给定队列?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)