문제

I've setup a jms server with HornetQ as a JMS provider (Queue).

I have an application which acts as a producer and another one (different computer) as a consumer.

I understand that the JMS specification doesn't guarantee the order of delivery, but I'm looking for a way to do just that: receive the messages exactly in the order they have been sent, even if it's provider specific.

Any ideas?

도움이 되었습니까?

해결책

Apparently this can be achieved by disabling the consumer cache. This is done by changing the hornetq-jms.xml:

   <connection-factory name="ConnectionFactory">
      <connectors>
         <connector-ref connector-name="netty-connector"/>
      </connectors>
      <entries>
         <entry name="ConnectionFactory"/>
      </entries>

      <consumer-window-size>0</consumer-window-size> <!-- add this line -->
   </connection-factory>

다른 팁

Actually section 4.4.10.2 (Order of Message Sends) of the JMS specification is pretty clear about ordering.

If you have a single producer, and single consumer to a queue or topic subscription, message ordering is always guaranteed even in the presence of redeliveries.

If you have multiple consumers, the client buffering may be redelivered in case of rollbacks or closing your consumer, and the client buffer may be delivered out of ordering.

On HornetQ you also have the message group which entitles extra ordering constraints to the produced messages.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top