【问题标题】:Out of order messages in JbossJboss中的乱序消息
【发布时间】:2015-06-25 11:44:23
【问题描述】:

我们在消息驱动 bean (MDB) 中遇到了问题。当MDB同时收到多条消息时,开始乱序处理消息。 (执行顺序与接收顺序不同)

例如:

消息的原始顺序:Message 1, Message 2, Message 3

但在应用程序级别onMessage() 调用顺序不正确。

例如:Message 2, Message 1, Message 3

我们在MDB 中使用EJB3 消息驱动注释,而Jboss 版本是Jboss EAP 6.4,实现是HornetQ

  @MessageDriven(activationConfig = { 
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
 
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/Queue1"),
 
        @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
 
        @ActivationConfigProperty(propertyName = "reconnectAttempts", propertyValue = "-1"),
 
        @ActivationConfigProperty(propertyName = "minSessions", propertyValue = "1"),
 
        @ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "1"),
 
        @ActivationConfigProperty(propertyName = "maxMessagesPerSessions", propertyValue = "1"),
 
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")}, name = "MessageDrivenBeanEJB")

如何确保消息消费顺序与接收顺序一致?

【问题讨论】:

  • 您使用的是哪个队列以及您有多少个 MDB?
  • @Kayaman 哦,对不起,我应该提一下……我们正在使用 HornetQ。这取决于使用多少MDB?我们有 8 个用于不同功能的 MDB。实际上,我们不想担心其中 7 个队列中消息的顺序。但在其他队列中,我们担心接收消息的原始顺序。

标签: java jakarta-ee jboss ejb message-driven-bean


【解决方案1】:

HornetQ 的配置属性名称不正确。试试

@ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1"),

您应该找出您指定的其他哪些参数对于 HornetQ 是正确的,因为这些参数看起来像是早期 JBoss Messaging 化身的参数。

【讨论】:

  • 感谢您的快速回复。将尝试此配置并更新状态。有关此的任何文档?
  • 快速浏览时我找不到太多。您可能需要参考 HornetQ 源代码。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-13
  • 1970-01-01
  • 2020-02-17
  • 2017-01-05
  • 1970-01-01
相关资源
最近更新 更多