如何使用MDB从队列中按顺序读取消息?
我有一个监听 WebSphere MQ 的 MDB。它不会按照队列接收的顺序拾取消息。我怎样才能让它按顺序读取?是否可以?我不应该使用 MDB 吗?
I have a MDB which listens to WebSphere MQ. It does not picks up the messages in the order that has been received by the Queue. How can i make it read it in that order? Is it possible? Should i not use a MDB.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一般来说,WMQ 按照消息接收的顺序传送消息。但是,有几件事可能会影响...
因此,当 MDB 接收无序消息时,这些因素中的任何一个或什至其中几个因素的组合都可能是原因。要么消除对消息顺序的依赖(最佳选择),要么返回设计并协调所有可能导致乱序处理的因素。
In general, WMQ delivers messages in the order that they were received. However, several things can impact that...
So when an MDB is receiving messages out of order any of these things, or even several of them in combination, may be at cause. Either eliminate the dependency on message sequence (best choice) or else go back over the design and reconcile all the factors that may lead to out-of-sequence processing.
为了添加到 T.Rob 的列表,MDB 使用应用程序服务器 WorkManager 来安排消息传递,因此消息顺序也取决于 WorkManager 启动工作项的顺序。这不在 WMQ 的控制范围内。如果将 MDB ServerSessionPool 深度限制为 1,则该限制将被删除,因为只会有一个运行中的工作实例,但代价是降低最大吞吐量。
如果您在 WebSphere 应用程序服务器中运行,那么带有 ListenerPorts 的非 ASF 模式可以保留消息顺序,但会受到一些事务/回退警告的影响。这里有一个支持技术说明:
http://www-01.ibm.com /support/docview.wss?uid=swg21446463
To add to T.Rob's list, MDBs use the application server WorkManager to schedule message delivery, so message order is also dependent on the order in which the WorkManager starts Work items. This is outside the control of WMQ. If you limit the MDB ServerSessionPool depth to one, then this limit is removed as there will only ever be one in-flight Work instance, but at the cost of reducing maximum throughput.
If you're running in WebSphere application server, then non-ASF mode with ListenerPorts can preserve message order subject to some transactional/backout caveats. There's a support technote here:
http://www-01.ibm.com/support/docview.wss?uid=swg21446463