please unsubscribe me.


On Tue, Apr 11, 2017 at 3:15 PM, Fabian Gonzalez <
fabian.gonza...@mulesoft.com> wrote:

> Hello,
>
> This is my  first message so greetings for all.
> I am facing a situation  where activemq seems not to respect the order for
> dispatched messages when a redilevery is needed using activemq-client
> 5.14.3.
>
> I am sending 60 messages to a queue with a single consumer, and I've
> noticed that sometimes when a relivery of the message is needed, as a
> consequence of rollback, another message from those 60 message is served
> before the redelivered message. There is no maxRedelivery set.
>
> What I notice debugging ActiveMQMessageConsumer is that the following
> behaviour may occur:
>
> - The 60 messages are dispatched in order in:
>
> ActiveMQMessageConsumer:1376:
>
>     @Override
>     public void dispatch(MessageDispatch md) {
>         MessageListener listener = this.messageListener.get();
>         try {
>             clearMessagesInProgress();
>             ...
>
> unconsumedMessage is running so the message is sent to the listener.
>
> - a rollback is performed and the message is redelivered (with a default
> delay):
>
> ActiveMQMessageConsumer:1305:
>
>                         if (redeliveryDelay > 0 &&
> !unconsumedMessages.isClosed()) {
>                             // Start up the delivery again a little later.
>                             session.getScheduler().executeAfterDelay(new
> Runnable() {
>                                 @Override
>                                 public void run() {
>                                     try {
>                                         if (started.get()) {
>                                             start();
>                                         }
>                                     } catch (JMSException e) {
>
> session.connection.onAsyncException(e);
>                                     }
>                                 }
>                             }, redeliveryDelay);
>                         } else {
>                             start();
>                         }
>
> Periodically, the messages enqueued in the session are attempted to be
> consumed (as the unconsumedMessages from the consumer is not running they
> are not sent to the listener to be consumed and they are enqueued as
> unconsumedMessages).
> But if the thread scheduled from redelivery is started when the iteration
> from the unconsumed messages is being performed, the unconsumedMessages is
> started in:
>
>     public void start() throws JMSException {
>         if (unconsumedMessages.isClosed()) {
>             return;
>         }
>         started.set(true);
>         unconsumedMessages.start();
>         session.executor.wakeup();
>     }
>
> and the message that is being considered from session (in the other thread)
> is sent to the listener before the redelivered message, which may be an
> error in order.
>
> Is this the expected behaviour? I expected that the order was mantained in
> this cases.
>
> Thanks in advance for your help and clarification
>

Reply via email to