简体   繁体   English

ActiveMQ代理关闭。 生产者异步发送消息。 如何对生产者发送的邮件执行重新传递? 如何使用死信队列

[英]ActiveMQ Broker down. Producer sending messages asynchronously. How to perform re delivery for messages send by Producer? How to use dead letter queue

I have a scenario where my ActiveMQ broker is down. 我的ActiveMQ代理关闭了。 My producer is trying to send messages to this broker in an asynchronous manner ( connectionfactory.setUseAsyncSend(true) ). 我的生产者正在尝试以异步方式( connectionfactory.setUseAsyncSend(true) )将消息发送到此代理。 Since broker is down no messages reach the broker. 由于代理关闭,因此没有消息到达代理。 I want to perform redelivery for this failed messages, and put them onto a deadletter queue if a fixed number of redelivery attempts are made. 我要对此失败的消息执行重新交付,如果尝试进行固定的重新交付次数,则将它们放入死信队列。 If possible send these messages from deadletter queue once the broker is up. 代理启动后,如有可能,请从死信队列发送这些消息。 I am using JMSTemplate to send messages and code is in Java. 我正在使用JMSTemplate发送消息,并且代码使用Java。

Any help is really appreciated. 任何帮助都非常感谢。

If your broker is down, you won't be able to write to the DLQ, because that's also located on the broker! 如果您的代理关闭,则您将无法写入DLQ,因为它也位于代理上!

The best bet you have is to just handle this failure scenario properly, and do a proper stop until your health check deems the broker is back up. 您最好的选择就是正确处理此故障情况,并进行适当的停止,直到您的运行状况检查认为代理已备份为止。 The docs aren't so clear about it, but it seems like async sending is ideal when you can tolerate some message loss; 文档尚不十分清楚,但是当您可以容忍某些消息丢失时,异步发送似乎是理想的选择。 it may be async sends don't at first give you an Exception if something goes wrong, so you might need to use synchronous if you can't tolerate message loss. 可能是异步发送,如果出现问题,起初不会给您提供Exception ,因此,如果您不能容忍消息丢失,则可能需要使用同步。

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

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