kill -9 in message listener

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

kill -9 in message listener

raster3
Hi,
Lets say there are 2 similar message listeners in two different jvms.
They receive numbers as text messages.
in 1st listener 3 will cause a Kill -9 of the listener process using Processbuilder and some means to detect process id.
In 2nd listener 4 will cause  a Kill -9 of the listener process using Processbuilder and some means to detect process id.
if kill -9 is executed in one listener (when message or rather its thread is inside the listener method) is it safe to assume the message will be received by the other listener?  Or will this message be lost?

Thanks.
Raster
Reply | Threaded
Open this post in threaded view
|

Re: kill -9 in message listener

Tim Bain
The message will only be delivered to another consumer if it hasn't yet
been acknowledged.  And whether that has happened at the point your process
dies depends on what your acknowledgement mode is.  The default is
auto-ack, where a message is acked as soon as it is delivered to a
consumer, even if it hasn't been successfully processed.  But there are
other acknowledgement modes, as well as transactions, and the behavior
you'll see depends on exactly which options you're using.  The wiki has
lots more detail about both acknowledgement modes and transactions.

Keep in mind that a kill -9 will sever TCP connections without cleanly
shutting them down, so the remote (broker) end won't close until the
timeout expires, which can lead to undesirable effects in some
circumstances. So think about whether what you're doing is actually the
right choice, compared to calling System.exit() or something similar.

Tim

On Jul 28, 2016 4:50 AM, "raster3" <[hidden email]> wrote:

> Hi,
> Lets say there are 2 similar message listeners in two different jvms.
> They receive numbers as text messages.
> in 1st listener 3 will cause a Kill -9 of the listener process using
> Processbuilder and some means to detect process id.
> In 2nd listener 4 will cause  a Kill -9 of the listener process using
> Processbuilder and some means to detect process id.
> if kill -9 is executed in one listener (when message or rather its thread
> is
> inside the listener method) is it safe to assume the message will be
> received by the other listener?  Or will this message be lost?
>
> Thanks.
> Raster
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/kill-9-in-message-listener-tp4714620.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: kill -9 in message listener

raster3

Hi,

Sorry for late reply.
So what will happen when the listener is in a JMS transaction?
How do I control this timeout?
Where is this wiki?

Raster
Reply | Threaded
Open this post in threaded view
|

Re: kill -9 in message listener

raster3
Got it to work when using spring boot at both sender and listener.
Is there anything I must do to make it work when sender is in plain java without spring but listener is using spring boot
Reply | Threaded
Open this post in threaded view
|

Re: kill -9 in message listener

artnaseef
Normally, the operation of message acknowledgement and redelivery should have nothing to do with publisher settings.  With that said, there are some broker configurations that change operation in non-obvious ways, such as the "optimized dispatch" option.

Are these persistent messages delivered to a Queue?

On Thu, Sep 1, 2016 at 10:13 AM, raster3 [via ActiveMQ] <[hidden email]> wrote:
Got it to work when using spring boot at both sender and listener.
Is there anything I must do to make it work when sender is in plain java without spring but listener is using spring boot


If you reply to this email, your message will be added to the discussion below:
http://activemq.2283324.n4.nabble.com/kill-9-in-message-listener-tp4714620p4716060.html
To start a new topic under ActiveMQ - User, email [hidden email]
To unsubscribe from ActiveMQ - User, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: kill -9 in message listener

raster3
Yes they are to a queue.
Reply | Threaded
Open this post in threaded view
|

Re: kill -9 in message listener

artnaseef
OK, persistent messages to a queue I expect to always be redelivered after a missing acknowledgement on a dropped connection.

If a repeatable missing message redelivery in this case can be demonstrated, I would be interested to look at the code.

As mentioned above, timing comes into play, and it is possible that the message will be redelivered later than expected (redeliveries may not maintain ordering).


On Fri, Sep 2, 2016 at 11:46 AM, raster3 [via ActiveMQ] <[hidden email]> wrote:
Yes they are to a queue.



If you reply to this email, your message will be added to the discussion below:
http://activemq.2283324.n4.nabble.com/kill-9-in-message-listener-tp4714620p4716116.html
To start a new topic under ActiveMQ - User, email [hidden email]
To unsubscribe from ActiveMQ - User, click here.
NAML