在MQ系列中配置“重试延迟" [英] Configuring a 'retry delay' in MQ Series

查看:114
本文介绍了在MQ系列中配置“重试延迟"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人可以帮助我-我正在基于EJB/JMS的应用程序中使用JBoss 5.1和MQ系列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?

推荐答案

这可能是为此类问题构建一些基础架构的机会.

This is likely to be an opportunity to craft a little infrastructure for such an issue.

由于您可以在消息进入bean时查看JMSDeliveryCount(在处理它之前-考虑提交范围),并且可以看到它已经进行了两次回滚,因此可以将消息发送到暂存队列中但请在jms属性中附加目标队列名称,以便以后使用.

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.

一个简单的过程可以间隔一定的时间来清除登台队列(例如每隔5分钟),然后将邮件发送到路由队列.

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.

另一个进程可以坐在路由队列上,查看jms属性(将目标队列名称添加到该属性),然后将消息发送到原始目标.

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.

这篇关于在MQ系列中配置“重试延迟"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆