You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Fabian González (JIRA)" <ji...@apache.org> on 2017/10/17 13:05:01 UTC

[jira] [Commented] (AMQ-6658) Messenger does not respect order after redelivery

    [ https://issues.apache.org/jira/browse/AMQ-6658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16207609#comment-16207609 ] 

Fabian González commented on AMQ-6658:
--------------------------------------

Hello, [~clebertsuconic]. I think the problem which causes out of order redeliver is the one I reported in AMQ-6775. Could you take a look at it?
Thanks and sorry for the inconveniences.

> Messenger does not respect order after redelivery
> -------------------------------------------------
>
>                 Key: AMQ-6658
>                 URL: https://issues.apache.org/jira/browse/AMQ-6658
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.14.3
>            Reporter: Fabian González
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)