I am using NMS ActiveMQ .NET client to pull messages from the queue using
MessageConsumer.ReceiveNoWait method.
The consumer application attempts to pull all pending messages every second.
I am trying to configure messages to be resent, but oddly it does not work
as expected.
I have tried using the configuration file of both consumer application and
broker (not both at once), and with each configuration the behavior is
slightly different, bot both behaviors are not as expected regarding the
configured values.

1. Configuration of consumer application
I have used the following URL:
"failover:(tcp://a.b.c.d:61616,tcp://e.f.g.h:61616)?
nested.jms.prefetchPolicy.all=50&
nested.jms.redeliveryPolicy.maximumRedeliveries=5&
nested.jms.redeliveryPolicy.useExponentialBackOff=true&
nested.jms.redeliveryPolicy.backOffMultiplier=2&
nested.jms.redeliveryPolicy.initialRedeliveryDelay=65000&
nested.jms.redeliveryPolicy.maximumRedeliveryDelay=-1"

In this case each message was redelivered 5 times, once a second or two,
before being sent to DLQ, disregarding the other parameters. I have tried
other combinations such as useExponentialBackOff=false and
initialRedeliveryDelay=0 with redeliveryDelay=65000, with no improvement.

This behavior is problematic because sometimes it takes close to a minute to
handle a message, which will cause the message to be resent because the
consumer will not commit the session on time.

2. Configuration of ActiveMQ broker in activemq.xml file
I have used the following XML element under <broker>:
        <plugins>
            <redeliveryPlugin fallbackToDeadLetter="true"
                              sendToDlqIfMaxRetriesExceeded="true">
                <redeliveryPolicyMap>
                    <redeliveryPolicyMap>
                        <redeliveryPolicyEntries>
                            <redeliveryPolicy queue="xxx"
                                              maximumRedeliveries="2"
                                              redeliveryDelay="65000"/>
                        </redeliveryPolicyEntries>
                    </redeliveryPolicyMap>
                </redeliveryPolicyMap>
            </redeliveryPlugin>
        </plugins>

As a result, message was being pulled from the queue many times almost every
second, with one interval of 65 seconds. Here is a snippet from the consumer
log file, showing timestamps of pulling a specific message:
[2018-04-05 04:53:47,847]
[2018-04-05 04:53:47,847]
[2018-04-05 04:53:48,863]
[2018-04-05 04:53:48,863]
[2018-04-05 04:53:50,900]
[2018-04-05 04:53:50,900]
[2018-04-05 04:53:52,903]
[2018-04-05 04:53:52,904]
[2018-04-05 04:53:53,924]
[2018-04-05 04:53:53,924]
[2018-04-05 04:53:55,939]
[2018-04-05 04:53:55,939]
[2018-04-05 04:53:57,957]
[2018-04-05 04:53:57,957]
[2018-04-05 04:54:05,077]
[2018-04-05 04:54:05,077]
[2018-04-05 04:54:06,107]
[2018-04-05 04:54:06,107]
[2018-04-05 04:54:07,133]
[2018-04-05 04:54:07,133]
[2018-04-05 04:54:08,153]
[2018-04-05 04:54:08,153]
[2018-04-05 04:54:09,181]
[2018-04-05 04:54:09,181]
[2018-04-05 04:54:10,199]
[2018-04-05 04:54:10,199]
[2018-04-05 04:55:15,789]
[2018-04-05 04:55:15,789]
[2018-04-05 04:55:17,822]
[2018-04-05 04:55:17,822]
[2018-04-05 04:55:18,845]
[2018-04-05 04:55:18,845]
[2018-04-05 04:55:20,876]
[2018-04-05 04:55:20,876]
[2018-04-05 04:55:22,893]
[2018-04-05 04:55:22,893]

This behavior imposes a problem for our production environment, because it
will overload the consumer when message handling will fail.

All applications - producer, consumer and ActiveMQ broker are running on
Windows Server 2012 in Azure.
Any help will be greatly appreciated.



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html

Reply via email to