RabbitMQ 主题交换队列上的消息
注意:使用 RabbitMQ .NET 库
我的 RabbitMQ 上有一个名为 FXTO.HK 的主题交换和 FXTO.# 的绑定密钥 服务器将消息发布到该队列。
在客户端,队列具有唯一且随机的名称,但使用相同的绑定键 FXTO.#
我们使用客户端库中的 Subscription 类,该类工作正常:即。所有客户端同时收到该消息。
但是,在 RabbitMQ 管理 UI 中,服务器队列 (FXTO.HK) 显示队列中包含所有消息(它们不会从队列中删除)。
我的设置有什么问题吗?这些消息什么时候会从服务器队列中删除?
Note: Using RabbitMQ .NET library
I have a Topic Exchange on my RabbitMQ called FXTO.HK and a binding key of FXTO.#
The server publishes messages to this queue.
On the client side, the queues have a unique and random name but use the same binding key of FXTO.#
We use the Subscription class from the library on the client side which works fine: ie. the message is received by all clients at the same time.
However, in RabbitMQ management UI, the server queue (FXTO.HK) is showing to have all the messages in the queue (they are not removed from the queue).
Am I doing anything wrong in my setup? When will these messages be removed from the server queue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个问题更适合 RabbitMQ Discuss 邮件列表。
这强烈表明您在使用消息后没有确认消息。看看 这个 例如,我发现您需要调用 Subscription.Ack 在每个之后调用
Subscription.Next
(或在 NoAck 模式)This question is better suited to the RabbitMQ Discuss mailing list.
This strongly suggests you're not ack'ing messages after consuming them. Looking at this example, I see you need to call Subscription.Ack after each call to
Subscription.Next
(or start theSubscription
in NoAck mode)我不太清楚你的问题中的“客户端”和“服务器”是什么意思。 RabbitMQ 不理解客户端和服务器,只是将自己视为每个人的服务器。发布者和消费者本质上都不是客户端或服务器。
你说“我的 RabbitMQ 上有一个名为 FXTO.HK 的主题交换,并且绑定密钥为 FXTO。# 服务器将消息发布到此队列。”,但这没有意义。消息是否发布到
FXTO.HK
交换 或其他一些队列?我认为混乱可能是您问题的根源:FXTO.??
路由密钥的消息被发布到交换(即您有“交换”在publish
函数的参数中设置),并使用FXTO.#
绑定键绑定一个或多个队列,这些消息将被复制到每个绑定队列中。这些消息将保留在每个队列中,直到它们在无确认模式下被消耗或被确认。如果您碰巧有一个与绑定到交换器的交换器同名的队列(例如,交换器FXTO.HK
通过一些绑定密钥绑定到队列FXTO.HK
) ,不会因为它们共享相同的名称而发生特殊行为。消息将被复制到每个匹配的绑定队列(包括 FXTO.HK)中,并将保留在该队列中,直到消费者连接到它并确认它们。发布
参数中设置“交换”,或者您正在使用默认交换),则称为< code>FXTO.HK,您的消息将保留在该队列中,直到消费者连接到该队列并接收/确认它们。不会发生交换/扇出路由。I'm not quite sure what "client" and "server" mean in your question. RabbitMQ doesn't understand clients and servers other than considering itself a server for everyone. Neither publishers nor consumers are inherently clients or servers.
You say "I have a Topic Exchange on my RabbitMQ called FXTO.HK and a binding key of FXTO.# The server publishes messages to this queue.", but that doesn't make sense. Are messages being published to the
FXTO.HK
exchange or some other queue? I think that confusion may be at the root of your issue:FXTO.??
routing keys are being published to an exchange (i.e. you have "exchange" set in the parameters to thepublish
function) with one or more queues bound to it with the binding key ofFXTO.#
, those messages will be duplicated into each bound queue. Those messages will remain in each queue until they are consumed in no-ack mode or acknowledged. If you happen to have a queue with the same name as the exchange bound to the exchange (e.g exchangeFXTO.HK
is bound to queueFXTO.HK
with some binding key), no special behavior will occur as a result of their sharing the same name. Messages will be duplicated into each matching bound queue includingFXTO.HK
, and will sit in that queue until a consumer connects to it and acknowledges them.publish
or you're using the default exchange) calledFXTO.HK
, your messages will remain in that queue until a consumer connects to that queue and receives them/acknowledges them. No exchange/fanout routing will occur.