You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by J P <jp...@gmail.com> on 2021/11/11 21:05:30 UTC

ActiveMQ redeliveryPolicy not working as documented?

I have also been fiddling around with the ActiveMQ redeliveryPolicy (again),
but can NOT get it to work like the documentation says:
   https://activemq.apache.org/redelivery-policy

My requirement:

If you submit a failing message to the broker,
I would like it to stay in the queue forever (until it succeeds, or is
manually deleted)
and the broker should just try a re-send every 60 secs.

I add
  schedulerSupport="true"
in the <broker> tag,
plus this config:

        <plugins>
            <redeliveryPlugin fallbackToDeadLetter="false"
                              sendToDlqIfMaxRetriesExceeded="false">
                <redeliveryPolicyMap>
                    <redeliveryPolicyMap>
                        <defaultEntry>
                            <redeliveryPolicy maximumRedeliveries="-1"
                                              useExponentialBackOff="false"
                                              redeliveryDelay="60000"

maximumRedeliveryDelay="60000" />
                        </defaultEntry>
                    </redeliveryPolicyMap>
                </redeliveryPolicyMap>
            </redeliveryPlugin>
        </plugins>

With this config, for a "poison-pill" I'm just expecting it to be
redelivered once every 60 secs forever.

But the actual/observed ActiveMQ behaviour is:

Intitally, re-send the msg once per second, 13 times  (incidentally, this
is 7+6 if you follow the pattern below)
Then wait 60 secs.

Then resend once per second, 5 times.
Wait 60 secs.

Then resend once per second, 4 times.
Wait 60 secs.

Then resend once per second, 3 times.
Wait 60 secs.

Then resend once per second, 2 times.
Wait 60 secs.

After this (4-5 minutes), it will finally follow
the configured policy, and resend once every 60 secs.

But why does it always start by resending MULTIPLE times once per second,
seemingly ignoring the config specified?

I have not found any documentation to explain this behaviour.

Re: ActiveMQ redeliveryPolicy not working as documented?

Posted by J P <jp...@gmail.com>.
Thank you, Gary!

That was helpful clarifications :)

So turned out then, I could just add
  jms.redeliveryPolicy.maximumRedeliveries=0
to the connection-string, to disable the client-side stuff,
which apparently was what messed things up ---- seems to work fine now :)

Thanks a lot!

Re: ActiveMQ redeliveryPolicy not working as documented?

Posted by Gary Tully <ga...@gmail.com>.
note, in Artemis, there is only broker side redelivery, so it is
easier to comprehend and configure at the address level
https://activemq.apache.org/components/artemis/documentation/latest/undelivered-messages.html

On Fri, 12 Nov 2021 at 10:10, Gary Tully <ga...@gmail.com> wrote:
>
> the doc may not be in the correct place, your link if for client side
> redelivery.
> There are two types of redelivery, client side and server side via the
> plugin. Server side kicks in when the client side ends.
>
> Note from one of the tests, to have 'only' the server side plugin do
> work, the client side has disabled redelivery.
> https://github.com/apache/activemq/blob/main/activemq-unit-tests/src/test/java/org/apache/activemq/broker/BrokerRedeliveryTest.java#L76
>
> the broker redelivery plugin, while configured similar to client side,
> has some doc at the end of:
> https://activemq.apache.org/message-redelivery-and-dlq-handling.html
>
> On Thu, 11 Nov 2021 at 21:05, J P <jp...@gmail.com> wrote:
> >
> > I have also been fiddling around with the ActiveMQ redeliveryPolicy (again),
> > but can NOT get it to work like the documentation says:
> >    https://activemq.apache.org/redelivery-policy
> >
> > My requirement:
> >
> > If you submit a failing message to the broker,
> > I would like it to stay in the queue forever (until it succeeds, or is
> > manually deleted)
> > and the broker should just try a re-send every 60 secs.
> >
> > I add
> >   schedulerSupport="true"
> > in the <broker> tag,
> > plus this config:
> >
> >         <plugins>
> >             <redeliveryPlugin fallbackToDeadLetter="false"
> >                               sendToDlqIfMaxRetriesExceeded="false">
> >                 <redeliveryPolicyMap>
> >                     <redeliveryPolicyMap>
> >                         <defaultEntry>
> >                             <redeliveryPolicy maximumRedeliveries="-1"
> >                                               useExponentialBackOff="false"
> >                                               redeliveryDelay="60000"
> >
> > maximumRedeliveryDelay="60000" />
> >                         </defaultEntry>
> >                     </redeliveryPolicyMap>
> >                 </redeliveryPolicyMap>
> >             </redeliveryPlugin>
> >         </plugins>
> >
> > With this config, for a "poison-pill" I'm just expecting it to be
> > redelivered once every 60 secs forever.
> >
> > But the actual/observed ActiveMQ behaviour is:
> >
> > Intitally, re-send the msg once per second, 13 times  (incidentally, this
> > is 7+6 if you follow the pattern below)
> > Then wait 60 secs.
> >
> > Then resend once per second, 5 times.
> > Wait 60 secs.
> >
> > Then resend once per second, 4 times.
> > Wait 60 secs.
> >
> > Then resend once per second, 3 times.
> > Wait 60 secs.
> >
> > Then resend once per second, 2 times.
> > Wait 60 secs.
> >
> > After this (4-5 minutes), it will finally follow
> > the configured policy, and resend once every 60 secs.
> >
> > But why does it always start by resending MULTIPLE times once per second,
> > seemingly ignoring the config specified?
> >
> > I have not found any documentation to explain this behaviour.

Re: ActiveMQ redeliveryPolicy not working as documented?

Posted by Gary Tully <ga...@gmail.com>.
the doc may not be in the correct place, your link if for client side
redelivery.
There are two types of redelivery, client side and server side via the
plugin. Server side kicks in when the client side ends.

Note from one of the tests, to have 'only' the server side plugin do
work, the client side has disabled redelivery.
https://github.com/apache/activemq/blob/main/activemq-unit-tests/src/test/java/org/apache/activemq/broker/BrokerRedeliveryTest.java#L76

the broker redelivery plugin, while configured similar to client side,
has some doc at the end of:
https://activemq.apache.org/message-redelivery-and-dlq-handling.html

On Thu, 11 Nov 2021 at 21:05, J P <jp...@gmail.com> wrote:
>
> I have also been fiddling around with the ActiveMQ redeliveryPolicy (again),
> but can NOT get it to work like the documentation says:
>    https://activemq.apache.org/redelivery-policy
>
> My requirement:
>
> If you submit a failing message to the broker,
> I would like it to stay in the queue forever (until it succeeds, or is
> manually deleted)
> and the broker should just try a re-send every 60 secs.
>
> I add
>   schedulerSupport="true"
> in the <broker> tag,
> plus this config:
>
>         <plugins>
>             <redeliveryPlugin fallbackToDeadLetter="false"
>                               sendToDlqIfMaxRetriesExceeded="false">
>                 <redeliveryPolicyMap>
>                     <redeliveryPolicyMap>
>                         <defaultEntry>
>                             <redeliveryPolicy maximumRedeliveries="-1"
>                                               useExponentialBackOff="false"
>                                               redeliveryDelay="60000"
>
> maximumRedeliveryDelay="60000" />
>                         </defaultEntry>
>                     </redeliveryPolicyMap>
>                 </redeliveryPolicyMap>
>             </redeliveryPlugin>
>         </plugins>
>
> With this config, for a "poison-pill" I'm just expecting it to be
> redelivered once every 60 secs forever.
>
> But the actual/observed ActiveMQ behaviour is:
>
> Intitally, re-send the msg once per second, 13 times  (incidentally, this
> is 7+6 if you follow the pattern below)
> Then wait 60 secs.
>
> Then resend once per second, 5 times.
> Wait 60 secs.
>
> Then resend once per second, 4 times.
> Wait 60 secs.
>
> Then resend once per second, 3 times.
> Wait 60 secs.
>
> Then resend once per second, 2 times.
> Wait 60 secs.
>
> After this (4-5 minutes), it will finally follow
> the configured policy, and resend once every 60 secs.
>
> But why does it always start by resending MULTIPLE times once per second,
> seemingly ignoring the config specified?
>
> I have not found any documentation to explain this behaviour.