配置“重试延迟” MQ系列
我希望有人可以帮助我 - 我在基于 EJB / JMS 的应用程序中使用 JBoss 5.1 和 MQ Series 7。我的应用程序中有几个消息驱动的 Bean,每个都监听 MQ Series 消息队列。当处理消息期间遇到错误时,我需要能够配置“重试延迟”,以便 mq 系列在尝试重新传递消息之前等待一段时间。我已经广泛梳理了 MQ Series 文档,但尚未找到在 MQ Series 中完成此操作的方法。我知道 JBoss 默认 JMS 提供程序有办法做到这一点,但我目前仅限于使用 MQ 系列。由于我无法设置重试延迟 - 当我收到一条失败的消息时,我的应用程序就会陷入传递消息并不断回滚的紧密循环中。谁能帮助我了解 MQ 系列中是否有一些配置选项允许我在重新传递失败的消息之前等待 X 毫秒?
I'm hoping someone can help me - I'm using JBoss 5.1 and MQ Series 7 in an EJB / JMS based application. I have several message driven beans in my application, each listening on an MQ Series message queue. When an error is encountered during the processing of a message, I need to be able to configure a 'retry delay', so that mq series waits some period of time before attempting to redeliver the message. I have combed through MQ Series documentation extensively, and have not yet found a way to accomplish this in MQ Series. I know that the JBoss default JMS provider has a way to do this, but I am currently limited to using MQ Series. Since I haven't been able to set a retry delay - when I have a message that fails, my application gets stuck in a tight loop of delivering the message and rolling back continuously. Can anyone help me understand if there is some config option in MQ Series that will allow me to wait X milliseconds before redelivering a failed message?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能是一个为此类问题打造一些基础设施的机会。
由于您可以在消息进入 bean 时查看 JMSDeliveryCount(在处理它之前——考虑提交范围),并且您可以看到它已经进行了几次回滚,因此将消息发送到暂存队列,但附加jms 属性中的目标队列名称,以便您稍后可以使用它。
可以按一定时间间隔运行一个简单的进程来清除暂存队列(例如每 5 分钟)并将消息发送到路由队列。
另一个进程可以位于路由队列上并查看 jms 属性(其中添加了目标队列名称)并将消息发送到原始目标。
这是一个穷人的经纪人,但它会实现目标。确实,没有太多内置功能可以真正实现您想要的功能。
This is likely to be an opportunity to craft a little infrastructure for such an issue.
Since you can look at the JMSDeliveryCount when the message has entered the bean (before you process it -- consider commit scope) and you can see that it has had a couple of rollbacks already, send the message around to a staging queue but attach the destination queue name in the jms properties so you can use it later.
A simple process can run on some interval to clear the staging queue (every 5 minutes for example) and send the message on to a routing queue.
Another process can sit on the routing queue and look at the jms properties (which added the destination queue name to) and send the message along to the orginal destination.
It's a poor man's broker but it will acheive the goal. It is true that there is not much built in to really do what you want.
我想你运气不好。据我所知,在这种情况下,您可以调整的唯一参数是重试消息的最大次数(BOTHRESH)以及异常/回退队列的名称(BOQUEUE),如果重试次数超过最大次数
帕尔
I think you're out of luck. As far as I know the only parameters you can tweak in this scenario is the max number of times the message will be retried (BOTHRESH) and the name of the exception/backout queue (BOQUEUE) where the message will be sent if the number of retry attempts exceeds the max.
Paal
您可以指定重试限制,以便在指定尝试次数后停止连续回滚。
You can specify a retry limit so that the continuous rollback will stop after a specified attempts.