简体   繁体   English

ActiveMQ静态网络:断开连接后如何丢弃消息?

[英]ActiveMQ Static Network : How do I drop messages when disconnected?

I have a very simple static network. 我有一个非常简单的静态网络。 Broker A is always running and always sending messages on topic X. Broker B is statically configured to connect to Broker A, and has a consumer of topic X. 代理A始终运行,并且始终在主题X上发送消息。代理B被静态配置为连接到代理A,并且具有主题X的使用者。

B may not always be able to reach A. When B reconnects to A, it receives a burst of messages which occurred when they were disconnected. B可能并不总是能够到达A。当B重新连接到A时,它会收到一连串的消息,这些消息是在断开连接时发生的。 I do NOT want these messages. 我不要这些消息。 I've been researching and experimenting for two days now and cannot find a configuration that throws out the messages that occur during the periods where they are disconnected. 我已经进行了两天的研究和实验,无法找到一种配置来丢弃在断开连接期间发生的消息。 Can someone please point me in the right direction as to how to configure my brokers? 有人可以指导我如何配置经纪人吗? Much appreciated. 非常感激。

It appears that prefetch was the culprit in my case. 在我看来,预取是罪魁祸首。 Specifically, in the xml configuration of Broker B, I added a prefetchSize="1" to the networkConnector. 具体来说,在代理B的xml配置中,我向networkConnector添加了prefetchSize =“ 1”。 I am no longer seeing the burst of messages on reconnect. 我再也看不到重新连接时出现的大量消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM