且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在队列上设置 ActiveMQ redeliveryPolicy?

更新时间:2023-01-28 08:06:03

我按照上面的方法在工厂中设置它,但只有在将连接工厂创建为 Spring bean 而不是通过 XBean 时才能正常工作,如上所示.这是因为 xsd 不允许您将 redeliveryPolicy 设置为对象,而只能将其设置为字符串.在 Spring 的 DefaultMessageListenerContainer 中将缓存级别设置为 Consumer 后,一切正常.

I got it working by setting it on the factory as done above but only when creating the connection factory as a Spring bean and not through XBean as shown above. This is because the xsd doesn't allow you to set the redeliveryPolicy as an object, but merely as a String. After setting the cache level to Consumer in Spring's DefaultMessageListenerContainer, it all worked.

在队列上,您似乎可以简单地设置传递策略...奇怪,因为我想对不同的队列/主题进行不同的设置.试想一下,您有一个又慢又快的队列,或者您连接到的外部系统需要更多时间来恢复.也许这个功能还有待实现

On the queue , it seems that you simple can set a delivery policy... Strange, as I would like to have different settings for different queue's/topics. Just imagine you have a slow and faster queue, or a external system that you connect to that needs more time to recover.. Maybe this feature is still to be implemented