Broker redelivery predispatch check across consumers is not working

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Broker redelivery predispatch check across consumers is not working

djdkedev
Hello,

I want to add the redelivery counter check at embedded broker level but
across consumers. Once redelivery counter is exceeded then message should
enter into DLQ. I observed that, when client terminates without sending ack
"INDIVIDUAL_ACKNOWLEDGE" then message is redelivered to another consumer
even though redeliver counter set into the redelivery plugin is exceeded?
The client has set jms.redeliveryPolicy.maximumRedeliveries=0.

*
code snippet:*
                        broker.setSchedulerSupport(true);
                         RedeliveryPlugin redeliveryPlugin = new RedeliveryPlugin();

                        redeliveryPlugin.setSendToDlqIfMaxRetriesExceeded(true);
                        redeliveryPlugin.setFallbackToDeadLetter(true);
                       
                        RedeliveryPolicy queueEntry = new RedeliveryPolicy();
                        queueEntry.setRedeliveryDelay(1000);
                        queueEntry.setInitialRedeliveryDelay(5000);
                        queueEntry.setMaximumRedeliveries(1);
                        queueEntry.setPreDispatchCheck(true);
                        queueEntry.setDestination(new ActiveMQQueue(<queuename>));
                       
                RedeliveryPolicy defaultEntry = new RedeliveryPolicy();
                defaultEntry.setInitialRedeliveryDelay(5000);
                defaultEntry.setMaximumRedeliveries(1);
                defaultEntry.setPreDispatchCheck(true);
               
                RedeliveryPolicyMap redeliveryPolicyMap = new
RedeliveryPolicyMap();
                redeliveryPolicyMap.setDefaultEntry(defaultEntry);
               
redeliveryPolicyMap.setRedeliveryPolicyEntries(Arrays.asList(queueEntry));

                redeliveryPlugin.setRedeliveryPolicyMap(redeliveryPolicyMap);

                LoggingBrokerPlugin logPlugin = new LoggingBrokerPlugin();
                logPlugin.setLogAll(true);
               
                broker.setPlugins(new BrokerPlugin[]{redeliveryPlugin, logPlugin});

Could you please help?

Thanks,
Dhananjay





--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: Broker redelivery predispatch check across consumers is not working

Tim Bain
Two things:

1. You have max redeliveries set to 0 for the consumers but 1 for the
broker. Is the behavior in the face of that mismatch what's in question
here? Do you get correct behavior if the settings match?

2. How many times does the message get redelivered? Your description didn't
say that explicitly, but it sounds like it was delivered twice (redelivered
once), which would be correct for the broker configuration. Is that an
accurate description of what happened?

Tim

On Mon, Oct 29, 2018, 10:19 AM djdkedev <[hidden email]> wrote:

> Hello,
>
> I want to add the redelivery counter check at embedded broker level but
> across consumers. Once redelivery counter is exceeded then message should
> enter into DLQ. I observed that, when client terminates without sending ack
> "INDIVIDUAL_ACKNOWLEDGE" then message is redelivered to another consumer
> even though redeliver counter set into the redelivery plugin is exceeded?
> The client has set jms.redeliveryPolicy.maximumRedeliveries=0.
>
> *
> code snippet:*
>                         broker.setSchedulerSupport(true);
>                          RedeliveryPlugin redeliveryPlugin = new
> RedeliveryPlugin();
>
>
> redeliveryPlugin.setSendToDlqIfMaxRetriesExceeded(true);
>                         redeliveryPlugin.setFallbackToDeadLetter(true);
>
>                         RedeliveryPolicy queueEntry = new
> RedeliveryPolicy();
>                         queueEntry.setRedeliveryDelay(1000);
>                         queueEntry.setInitialRedeliveryDelay(5000);
>                         queueEntry.setMaximumRedeliveries(1);
>                         queueEntry.setPreDispatchCheck(true);
>                         queueEntry.setDestination(new
> ActiveMQQueue(<queuename>));
>
>                 RedeliveryPolicy defaultEntry = new RedeliveryPolicy();
>                 defaultEntry.setInitialRedeliveryDelay(5000);
>                 defaultEntry.setMaximumRedeliveries(1);
>                 defaultEntry.setPreDispatchCheck(true);
>
>                 RedeliveryPolicyMap redeliveryPolicyMap = new
> RedeliveryPolicyMap();
>                 redeliveryPolicyMap.setDefaultEntry(defaultEntry);
>
> redeliveryPolicyMap.setRedeliveryPolicyEntries(Arrays.asList(queueEntry));
>
>
> redeliveryPlugin.setRedeliveryPolicyMap(redeliveryPolicyMap);
>
>                 LoggingBrokerPlugin logPlugin = new LoggingBrokerPlugin();
>                 logPlugin.setLogAll(true);
>
>                 broker.setPlugins(new BrokerPlugin[]{redeliveryPlugin,
> logPlugin});
>
> Could you please help?
>
> Thanks,
> Dhananjay
>
>
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Broker redelivery predispatch check across consumers is not working

djdkedev
This post was updated on .
Thank you for quick response.

ActiveMQ Version:5.15.6

I want to test the broker redelivery predispatch check, therefore
jms.redeliveryPolicy.maximumRedeliveries is set to zero at consumer level.
Even though there is no mismatch, the redelivery counter goes beyond what is
set in the redelivery plugin.The message got redelivered more than 20 times.
I observed the same behavior when jms.redeliveryPolicy.maximumRedeliveries
is 1 or 0 on client side.
I kept it zero because
http://activemq.2283324.n4.nabble.com/redeliveryPlugin-seems-to-have-problems-with-defaultEntry-td4685094.html
suggested to keep it zero to avoid conflict between client redelivery and
broker redelivery.

Message:ActiveMQTextMessage {commandId = 6, responseRequired = true,
messageId = ID:T320-2881-1540869039378-6:1:1:1:1, originalDestination =
null, originalTransactionId = null, producerId =
ID:T320-2881-1540869039378-6:1:1:1, destination = queue://DATAITEM_QUEUE,
transactionId = null, expiration = 0, timestamp = 1540869039752, arrival =
0, brokerInTime = 1540869039763, brokerOutTime = 1540869640172,
correlationId = ee0676b859f9af68, replyTo = null, persistent = false, type =
null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
null, compressed = false, userID = null, content =
org.apache.activemq.util.ByteSequence@619a52c3, marshalledProperties = null,
dataStructure = null, *redeliveryCounter = 21*, size = 0, properties = null,
readOnlyProperties = true, readOnlyBody = true, droppable = false,
jmsXGroupFirstForConsumer = false, text = Item:1,
CorelationId:ee0676b859f9af68}

The client session is non-transacted and acknowledge is INDIVIDUAL_ACKNOWLEDGE.

Hope this helps.





--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: Broker redelivery predispatch check across consumers is not working

Arjen van der Meijden
We have roughly the same issue, did you find a solution yet?
We use Stomp queue consumers with which we had a message that caused a
crash, the consumer restarted, crashed again, etc.

Obviously the crashing part is our responsibility, but we wanted to see
if we could prevent endless resends from ActiveMQ and ran into this same
scenario with redelivery regardless of redeliveryPolicy-rules.

Best regards,

Arjen

On 30-10-2018 04:32, djdkedev wrote:

> Thank you for quick response.
>
> ActiveMQ Version:5.15.6
>
> I want to test the broker redelivery predispatch check, therefore
> jms.redeliveryPolicy.maximumRedeliveries is set to zero at consumer level.
> Even though there is no mismatch, the redelivery counter goes beyond what is
> set in the redelivery plugin.The message got redelivered more than 20 times.
> I observed the same behavior when jms.redeliveryPolicy.maximumRedeliveries
> is 1 or 0 on client side.
> I kept it zero because
> http://activemq.2283324.n4.nabble.com/redeliveryPlugin-seems-to-have-problems-with-defaultEntry-td4685094.html
> suggested to keep it zero to avoid conflict between client redelivery and
> broker redelivery.
>
> Message:ActiveMQTextMessage {commandId = 6, responseRequired = true,
> messageId = ID:T320-2881-1540869039378-6:1:1:1:1, originalDestination =
> null, originalTransactionId = null, producerId =
> ID:T320-2881-1540869039378-6:1:1:1, destination = queue://DATAITEM_QUEUE,
> transactionId = null, expiration = 0, timestamp = 1540869039752, arrival =
> 0, brokerInTime = 1540869039763, brokerOutTime = 1540869640172,
> correlationId = ee0676b859f9af68, replyTo = null, persistent = false, type =
> null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> null, compressed = false, userID = null, content =
> org.apache.activemq.util.ByteSequence@619a52c3, marshalledProperties = null,
> dataStructure = null, *redeliveryCounter = 21*, size = 0, properties = null,
> readOnlyProperties = true, readOnlyBody = true, droppable = false,
> jmsXGroupFirstForConsumer = false, text = Item:1,
> CorelationId:ee0676b859f9af68}
>
> Hope this helps.
>
>
>
>
>
> --
> Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Broker redelivery predispatch check across consumers is not working

Tim Bain
This sounds like a bug. Can one of you please submit a bug in JIRA for it?

Tim

On Fri, Nov 2, 2018, 3:42 AM Arjen van der Meijden <[hidden email]
wrote:

> We have roughly the same issue, did you find a solution yet?
> We use Stomp queue consumers with which we had a message that caused a
> crash, the consumer restarted, crashed again, etc.
>
> Obviously the crashing part is our responsibility, but we wanted to see
> if we could prevent endless resends from ActiveMQ and ran into this same
> scenario with redelivery regardless of redeliveryPolicy-rules.
>
> Best regards,
>
> Arjen
>
> On 30-10-2018 04:32, djdkedev wrote:
> > Thank you for quick response.
> >
> > ActiveMQ Version:5.15.6
> >
> > I want to test the broker redelivery predispatch check, therefore
> > jms.redeliveryPolicy.maximumRedeliveries is set to zero at consumer
> level.
> > Even though there is no mismatch, the redelivery counter goes beyond
> what is
> > set in the redelivery plugin.The message got redelivered more than 20
> times.
> > I observed the same behavior when
> jms.redeliveryPolicy.maximumRedeliveries
> > is 1 or 0 on client side.
> > I kept it zero because
> >
> http://activemq.2283324.n4.nabble.com/redeliveryPlugin-seems-to-have-problems-with-defaultEntry-td4685094.html
> > suggested to keep it zero to avoid conflict between client redelivery and
> > broker redelivery.
> >
> > Message:ActiveMQTextMessage {commandId = 6, responseRequired = true,
> > messageId = ID:T320-2881-1540869039378-6:1:1:1:1, originalDestination =
> > null, originalTransactionId = null, producerId =
> > ID:T320-2881-1540869039378-6:1:1:1, destination = queue://DATAITEM_QUEUE,
> > transactionId = null, expiration = 0, timestamp = 1540869039752, arrival
> =
> > 0, brokerInTime = 1540869039763, brokerOutTime = 1540869640172,
> > correlationId = ee0676b859f9af68, replyTo = null, persistent = false,
> type =
> > null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> > null, compressed = false, userID = null, content =
> > org.apache.activemq.util.ByteSequence@619a52c3, marshalledProperties =
> null,
> > dataStructure = null, *redeliveryCounter = 21*, size = 0, properties =
> null,
> > readOnlyProperties = true, readOnlyBody = true, droppable = false,
> > jmsXGroupFirstForConsumer = false, text = Item:1,
> > CorelationId:ee0676b859f9af68}
> >
> > Hope this helps.
> >
> >
> >
> >
> >
> > --
> > Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Broker redelivery predispatch check across consumers is not working

Arjen van der Meijden
Sure I created this issue: https://issues.apache.org/jira/browse/AMQ-7090

Best regards,

Arjen

On 2-11-2018 13:32, Tim Bain wrote:

> This sounds like a bug. Can one of you please submit a bug in JIRA for it?
>
> Tim
>
> On Fri, Nov 2, 2018, 3:42 AM Arjen van der Meijden <[hidden email]
> wrote:
>
>> We have roughly the same issue, did you find a solution yet?
>> We use Stomp queue consumers with which we had a message that caused a
>> crash, the consumer restarted, crashed again, etc.
>>
>> Obviously the crashing part is our responsibility, but we wanted to see
>> if we could prevent endless resends from ActiveMQ and ran into this same
>> scenario with redelivery regardless of redeliveryPolicy-rules.
>>
>> Best regards,
>>
>> Arjen
>>
>> On 30-10-2018 04:32, djdkedev wrote:
>>> Thank you for quick response.
>>>
>>> ActiveMQ Version:5.15.6
>>>
>>> I want to test the broker redelivery predispatch check, therefore
>>> jms.redeliveryPolicy.maximumRedeliveries is set to zero at consumer
>> level.
>>> Even though there is no mismatch, the redelivery counter goes beyond
>> what is
>>> set in the redelivery plugin.The message got redelivered more than 20
>> times.
>>> I observed the same behavior when
>> jms.redeliveryPolicy.maximumRedeliveries
>>> is 1 or 0 on client side.
>>> I kept it zero because
>>>
>> http://activemq.2283324.n4.nabble.com/redeliveryPlugin-seems-to-have-problems-with-defaultEntry-td4685094.html
>>> suggested to keep it zero to avoid conflict between client redelivery and
>>> broker redelivery.
>>>
>>> Message:ActiveMQTextMessage {commandId = 6, responseRequired = true,
>>> messageId = ID:T320-2881-1540869039378-6:1:1:1:1, originalDestination =
>>> null, originalTransactionId = null, producerId =
>>> ID:T320-2881-1540869039378-6:1:1:1, destination = queue://DATAITEM_QUEUE,
>>> transactionId = null, expiration = 0, timestamp = 1540869039752, arrival
>> =
>>> 0, brokerInTime = 1540869039763, brokerOutTime = 1540869640172,
>>> correlationId = ee0676b859f9af68, replyTo = null, persistent = false,
>> type =
>>> null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>>> null, compressed = false, userID = null, content =
>>> org.apache.activemq.util.ByteSequence@619a52c3, marshalledProperties =
>> null,
>>> dataStructure = null, *redeliveryCounter = 21*, size = 0, properties =
>> null,
>>> readOnlyProperties = true, readOnlyBody = true, droppable = false,
>>> jmsXGroupFirstForConsumer = false, text = Item:1,
>>> CorelationId:ee0676b859f9af68}
>>>
>>> Hope this helps.
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Sent from:
>> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html