Stopping a JMSConsumer started in a RecipientList

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

Stopping a JMSConsumer started in a RecipientList

Tim Mullender
First off, thanks for a great tool!

We are using Apache Camel 2.24.2 on JDK1.8

The simplest form of our route is:

from("servlet:?matchOnUriPrefix=true&servletName=Name”).recipientList(simple("amqp:queue:${header.queue}.req?replyTo=${header.queue}.resp&replyToType=Exclusive"))

The aim is to send an HTTP request to one of several AMQP queues, determined by an HTTP header, and get a response back (the broker doesn’t support temporary queues, hence the replyTo param)

This all works reasonably well until  a queue is deleted at which point the JMSConsumer still attempts to reconnect to the queue every 5 seconds.

The stop method in JmsEndpoint does not stop anything because there is a running message listener, I don’t want to stop the whole route/context as other queues are still in use.  

Is there a way to be able to stop the consumer associated with a specific queue?

Thanks

Tim




--


* <http://wandisco.com/>*

**The *LiveData* Company
*Find out more 
*wandisco.com <http://wandisco.com/>*



 
<https://www.wandisco.com/liveanalytics>


THIS MESSAGE AND ANY ATTACHMENTS
ARE CONFIDENTIAL, PROPRIETARY AND MAY BE PRIVILEGED
*


If this message was
misdirected, WANdisco, Inc. and its subsidiaries, ("WANdisco") does not
waive any confidentiality or privilege. If you are not the intended
recipient, please notify us immediately and destroy the message without
disclosing its contents to anyone. Any distribution, use or copying of this
email or the information it contains by other than an intended recipient is
unauthorized. The views and opinions expressed in this email message are
the author's own and may not reflect the views and opinions of WANdisco,
unless the author is authorized by WANdisco to express such views or
opinions on its behalf. All email sent to or from this address is subject
to electronic storage and review by WANdisco. Although WANdisco operates
anti-virus programs, it does not accept responsibility for any damage
whatsoever caused by viruses being passed.
Reply | Threaded
Open this post in threaded view
|

Re: Stopping a JMSConsumer started in a RecipientList

Claus Ibsen-2
Hi

Try to look in JMX to see what consumer / services there are. Also if
you use ActiveMQ it also has its mbeans where you can control
lifecycle of stuff

On Tue, Nov 12, 2019 at 4:08 PM Tim Mullender
<[hidden email]> wrote:

>
> First off, thanks for a great tool!
>
> We are using Apache Camel 2.24.2 on JDK1.8
>
> The simplest form of our route is:
>
> from("servlet:?matchOnUriPrefix=true&servletName=Name”).recipientList(simple("amqp:queue:${header.queue}.req?replyTo=${header.queue}.resp&replyToType=Exclusive"))
>
> The aim is to send an HTTP request to one of several AMQP queues, determined by an HTTP header, and get a response back (the broker doesn’t support temporary queues, hence the replyTo param)
>
> This all works reasonably well until  a queue is deleted at which point the JMSConsumer still attempts to reconnect to the queue every 5 seconds.
>
> The stop method in JmsEndpoint does not stop anything because there is a running message listener, I don’t want to stop the whole route/context as other queues are still in use.
>
> Is there a way to be able to stop the consumer associated with a specific queue?
>
> Thanks
>
> Tim
>
>
>
>
> --
>
>
> * <http://wandisco.com/>*
>
> **The *LiveData* Company
> *Find out more
> *wandisco.com <http://wandisco.com/>*
>
>
>
>
> <https://www.wandisco.com/liveanalytics>
>
>
> THIS MESSAGE AND ANY ATTACHMENTS
> ARE CONFIDENTIAL, PROPRIETARY AND MAY BE PRIVILEGED
> *
>
>
> If this message was
> misdirected, WANdisco, Inc. and its subsidiaries, ("WANdisco") does not
> waive any confidentiality or privilege. If you are not the intended
> recipient, please notify us immediately and destroy the message without
> disclosing its contents to anyone. Any distribution, use or copying of this
> email or the information it contains by other than an intended recipient is
> unauthorized. The views and opinions expressed in this email message are
> the author's own and may not reflect the views and opinions of WANdisco,
> unless the author is authorized by WANdisco to express such views or
> opinions on its behalf. All email sent to or from this address is subject
> to electronic storage and review by WANdisco. Although WANdisco operates
> anti-virus programs, it does not accept responsibility for any damage
> whatsoever caused by viruses being passed.



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: Stopping a JMSConsumer started in a RecipientList

Tim Mullender
Thanks Claus, unfortunately I don’t have an option to change the broker so I’m not able to use ActiveMQ

From browsing the MBeans in JConsole and a quick look at the source code I don’t see that the JmsProducer or  QueueReplyManager are available through JMX.  I can access the routes, endpoints and processors etc but the only consumer listed is the ServletConsumer

The only Java reference I can see to the producer is in the ProducerCache that is part of RecipientList and as it’s private the only way I can see to access it is through reflection (I told myself I wouldn’t do this, but... ;-))

If you have any other ideas, I’m happy to give them a go

Tim

> On 12 Nov 2019, at 19:08, Claus Ibsen <[hidden email]> wrote:
>
> Hi
>
> Try to look in JMX to see what consumer / services there are. Also if
> you use ActiveMQ it also has its mbeans where you can control
> lifecycle of stuff
>
> On Tue, Nov 12, 2019 at 4:08 PM Tim Mullender
> <[hidden email]> wrote:
>>
>> First off, thanks for a great tool!
>>
>> We are using Apache Camel 2.24.2 on JDK1.8
>>
>> The simplest form of our route is:
>>
>> from("servlet:?matchOnUriPrefix=true&servletName=Name”).recipientList(simple("amqp:queue:${header.queue}.req?replyTo=${header.queue}.resp&replyToType=Exclusive"))
>>
>> The aim is to send an HTTP request to one of several AMQP queues, determined by an HTTP header, and get a response back (the broker doesn’t support temporary queues, hence the replyTo param)
>>
>> This all works reasonably well until  a queue is deleted at which point the JMSConsumer still attempts to reconnect to the queue every 5 seconds.
>>
>> The stop method in JmsEndpoint does not stop anything because there is a running message listener, I don’t want to stop the whole route/context as other queues are still in use.
>>
>> Is there a way to be able to stop the consumer associated with a specific queue?
>>
>> Thanks
>>
>> Tim
>>
>>
>>
>>
>> --
>>
>>
>> * <http://wandisco.com/>*
>>
>> **The *LiveData* Company
>> *Find out more
>> *wandisco.com <http://wandisco.com/>*
>>
>>
>>
>>
>> <https://www.wandisco.com/liveanalytics>
>>
>>
>> THIS MESSAGE AND ANY ATTACHMENTS
>> ARE CONFIDENTIAL, PROPRIETARY AND MAY BE PRIVILEGED
>> *
>>
>>
>> If this message was
>> misdirected, WANdisco, Inc. and its subsidiaries, ("WANdisco") does not
>> waive any confidentiality or privilege. If you are not the intended
>> recipient, please notify us immediately and destroy the message without
>> disclosing its contents to anyone. Any distribution, use or copying of this
>> email or the information it contains by other than an intended recipient is
>> unauthorized. The views and opinions expressed in this email message are
>> the author's own and may not reflect the views and opinions of WANdisco,
>> unless the author is authorized by WANdisco to express such views or
>> opinions on its behalf. All email sent to or from this address is subject
>> to electronic storage and review by WANdisco. Although WANdisco operates
>> anti-virus programs, it does not accept responsibility for any damage
>> whatsoever caused by viruses being passed.
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


--


* <http://wandisco.com/>*

**The *LiveData* Company
*Find out more 
*wandisco.com <http://wandisco.com/>*



 
<https://www.wandisco.com/liveanalytics>


THIS MESSAGE AND ANY ATTACHMENTS
ARE CONFIDENTIAL, PROPRIETARY AND MAY BE PRIVILEGED
*


If this message was
misdirected, WANdisco, Inc. and its subsidiaries, ("WANdisco") does not
waive any confidentiality or privilege. If you are not the intended
recipient, please notify us immediately and destroy the message without
disclosing its contents to anyone. Any distribution, use or copying of this
email or the information it contains by other than an intended recipient is
unauthorized. The views and opinions expressed in this email message are
the author's own and may not reflect the views and opinions of WANdisco,
unless the author is authorized by WANdisco to express such views or
opinions on its behalf. All email sent to or from this address is subject
to electronic storage and review by WANdisco. Although WANdisco operates
anti-virus programs, it does not accept responsibility for any damage
whatsoever caused by viruses being passed.
Reply | Threaded
Open this post in threaded view
|

restart stopped route automatically due to exception

Bing Lu
hi, is there a way to automatically restart a route that got stopped due to some exception caused by server patching, queue unavailable for a short period of time? I am using sjmsbatch and one of the route is stopped and never restarted during the maintenance window because it caught an exception and stopped
Reply | Threaded
Open this post in threaded view
|

Re: Stopping a JMSConsumer started in a RecipientList

Claus Ibsen-2
In reply to this post by Tim Mullender
Hi

You can set the cache size of the recipient list to 0 or so to turn it
off, then camel ought to stop the jms endpoint et all after its done
using it.

On Wed, Nov 13, 2019 at 3:35 PM Tim Mullender
<[hidden email]> wrote:

>
> Thanks Claus, unfortunately I don’t have an option to change the broker so I’m not able to use ActiveMQ
>
> From browsing the MBeans in JConsole and a quick look at the source code I don’t see that the JmsProducer or  QueueReplyManager are available through JMX.  I can access the routes, endpoints and processors etc but the only consumer listed is the ServletConsumer
>
> The only Java reference I can see to the producer is in the ProducerCache that is part of RecipientList and as it’s private the only way I can see to access it is through reflection (I told myself I wouldn’t do this, but... ;-))
>
> If you have any other ideas, I’m happy to give them a go
>
> Tim
>
> > On 12 Nov 2019, at 19:08, Claus Ibsen <[hidden email]> wrote:
> >
> > Hi
> >
> > Try to look in JMX to see what consumer / services there are. Also if
> > you use ActiveMQ it also has its mbeans where you can control
> > lifecycle of stuff
> >
> > On Tue, Nov 12, 2019 at 4:08 PM Tim Mullender
> > <[hidden email]> wrote:
> >>
> >> First off, thanks for a great tool!
> >>
> >> We are using Apache Camel 2.24.2 on JDK1.8
> >>
> >> The simplest form of our route is:
> >>
> >> from("servlet:?matchOnUriPrefix=true&servletName=Name”).recipientList(simple("amqp:queue:${header.queue}.req?replyTo=${header.queue}.resp&replyToType=Exclusive"))
> >>
> >> The aim is to send an HTTP request to one of several AMQP queues, determined by an HTTP header, and get a response back (the broker doesn’t support temporary queues, hence the replyTo param)
> >>
> >> This all works reasonably well until  a queue is deleted at which point the JMSConsumer still attempts to reconnect to the queue every 5 seconds.
> >>
> >> The stop method in JmsEndpoint does not stop anything because there is a running message listener, I don’t want to stop the whole route/context as other queues are still in use.
> >>
> >> Is there a way to be able to stop the consumer associated with a specific queue?
> >>
> >> Thanks
> >>
> >> Tim
> >>
> >>
> >>
> >>
> >> --
> >>
> >>
> >> * <http://wandisco.com/>*
> >>
> >> **The *LiveData* Company
> >> *Find out more
> >> *wandisco.com <http://wandisco.com/>*
> >>
> >>
> >>
> >>
> >> <https://www.wandisco.com/liveanalytics>
> >>
> >>
> >> THIS MESSAGE AND ANY ATTACHMENTS
> >> ARE CONFIDENTIAL, PROPRIETARY AND MAY BE PRIVILEGED
> >> *
> >>
> >>
> >> If this message was
> >> misdirected, WANdisco, Inc. and its subsidiaries, ("WANdisco") does not
> >> waive any confidentiality or privilege. If you are not the intended
> >> recipient, please notify us immediately and destroy the message without
> >> disclosing its contents to anyone. Any distribution, use or copying of this
> >> email or the information it contains by other than an intended recipient is
> >> unauthorized. The views and opinions expressed in this email message are
> >> the author's own and may not reflect the views and opinions of WANdisco,
> >> unless the author is authorized by WANdisco to express such views or
> >> opinions on its behalf. All email sent to or from this address is subject
> >> to electronic storage and review by WANdisco. Although WANdisco operates
> >> anti-virus programs, it does not accept responsibility for any damage
> >> whatsoever caused by viruses being passed.
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
>
>
> --
>
>
> * <http://wandisco.com/>*
>
> **The *LiveData* Company
> *Find out more
> *wandisco.com <http://wandisco.com/>*
>
>
>
>
> <https://www.wandisco.com/liveanalytics>
>
>
> THIS MESSAGE AND ANY ATTACHMENTS
> ARE CONFIDENTIAL, PROPRIETARY AND MAY BE PRIVILEGED
> *
>
>
> If this message was
> misdirected, WANdisco, Inc. and its subsidiaries, ("WANdisco") does not
> waive any confidentiality or privilege. If you are not the intended
> recipient, please notify us immediately and destroy the message without
> disclosing its contents to anyone. Any distribution, use or copying of this
> email or the information it contains by other than an intended recipient is
> unauthorized. The views and opinions expressed in this email message are
> the author's own and may not reflect the views and opinions of WANdisco,
> unless the author is authorized by WANdisco to express such views or
> opinions on its behalf. All email sent to or from this address is subject
> to electronic storage and review by WANdisco. Although WANdisco operates
> anti-virus programs, it does not accept responsibility for any damage
> whatsoever caused by viruses being passed.



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: restart stopped route automatically due to exception

Claus Ibsen-2
In reply to this post by Bing Lu
Hi

What Camel version are you using? And can you maybe show some code
snippet of that route that was stopped. And maybe something from the
logs that points to how it was stopped.
Also if you are using JMS then have you setup your connection pool
with re-connection logic et all.


On Wed, Nov 13, 2019 at 4:10 PM Bing Lu <[hidden email]> wrote:
>
> hi, is there a way to automatically restart a route that got stopped due to some exception caused by server patching, queue unavailable for a short period of time? I am using sjmsbatch and one of the route is stopped and never restarted during the maintenance window because it caught an exception and stopped



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: Stopping a JMSConsumer started in a RecipientList

Tim Mullender
In reply to this post by Claus Ibsen-2
Brilliant, setting the cache size on the recipient list to -1 seems to do the job.  

Thank you very much

Tim

> On 13 Nov 2019, at 15:16, Claus Ibsen <[hidden email]> wrote:
>
> Hi
>
> You can set the cache size of the recipient list to 0 or so to turn it
> off, then camel ought to stop the jms endpoint et all after its done
> using it.
>
> On Wed, Nov 13, 2019 at 3:35 PM Tim Mullender
> <[hidden email]> wrote:
>>
>> Thanks Claus, unfortunately I don’t have an option to change the broker so I’m not able to use ActiveMQ
>>
>> From browsing the MBeans in JConsole and a quick look at the source code I don’t see that the JmsProducer or  QueueReplyManager are available through JMX.  I can access the routes, endpoints and processors etc but the only consumer listed is the ServletConsumer
>>
>> The only Java reference I can see to the producer is in the ProducerCache that is part of RecipientList and as it’s private the only way I can see to access it is through reflection (I told myself I wouldn’t do this, but... ;-))
>>
>> If you have any other ideas, I’m happy to give them a go
>>
>> Tim
>>
>>> On 12 Nov 2019, at 19:08, Claus Ibsen <[hidden email]> wrote:
>>>
>>> Hi
>>>
>>> Try to look in JMX to see what consumer / services there are. Also if
>>> you use ActiveMQ it also has its mbeans where you can control
>>> lifecycle of stuff
>>>
>>> On Tue, Nov 12, 2019 at 4:08 PM Tim Mullender
>>> <[hidden email]> wrote:
>>>>
>>>> First off, thanks for a great tool!
>>>>
>>>> We are using Apache Camel 2.24.2 on JDK1.8
>>>>
>>>> The simplest form of our route is:
>>>>
>>>> from("servlet:?matchOnUriPrefix=true&servletName=Name”).recipientList(simple("amqp:queue:${header.queue}.req?replyTo=${header.queue}.resp&replyToType=Exclusive"))
>>>>
>>>> The aim is to send an HTTP request to one of several AMQP queues, determined by an HTTP header, and get a response back (the broker doesn’t support temporary queues, hence the replyTo param)
>>>>
>>>> This all works reasonably well until  a queue is deleted at which point the JMSConsumer still attempts to reconnect to the queue every 5 seconds.
>>>>
>>>> The stop method in JmsEndpoint does not stop anything because there is a running message listener, I don’t want to stop the whole route/context as other queues are still in use.
>>>>
>>>> Is there a way to be able to stop the consumer associated with a specific queue?
>>>>
>>>> Thanks
>>>>
>>>> Tim
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>> * <http://wandisco.com/>*
>>>>
>>>> **The *LiveData* Company
>>>> *Find out more
>>>> *wandisco.com <http://wandisco.com/>*
>>>>
>>>>
>>>>
>>>>
>>>> <https://www.wandisco.com/liveanalytics>
>>>>
>>>>
>>>> THIS MESSAGE AND ANY ATTACHMENTS
>>>> ARE CONFIDENTIAL, PROPRIETARY AND MAY BE PRIVILEGED
>>>> *
>>>>
>>>>
>>>> If this message was
>>>> misdirected, WANdisco, Inc. and its subsidiaries, ("WANdisco") does not
>>>> waive any confidentiality or privilege. If you are not the intended
>>>> recipient, please notify us immediately and destroy the message without
>>>> disclosing its contents to anyone. Any distribution, use or copying of this
>>>> email or the information it contains by other than an intended recipient is
>>>> unauthorized. The views and opinions expressed in this email message are
>>>> the author's own and may not reflect the views and opinions of WANdisco,
>>>> unless the author is authorized by WANdisco to express such views or
>>>> opinions on its behalf. All email sent to or from this address is subject
>>>> to electronic storage and review by WANdisco. Although WANdisco operates
>>>> anti-virus programs, it does not accept responsibility for any damage
>>>> whatsoever caused by viruses being passed.
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>>
>> --
>>
>>
>> * <http://wandisco.com/>*
>>
>> **The *LiveData* Company
>> *Find out more
>> *wandisco.com <http://wandisco.com/>*
>>
>>
>>
>>
>> <https://www.wandisco.com/liveanalytics>
>>
>>
>> THIS MESSAGE AND ANY ATTACHMENTS
>> ARE CONFIDENTIAL, PROPRIETARY AND MAY BE PRIVILEGED
>> *
>>
>>
>> If this message was
>> misdirected, WANdisco, Inc. and its subsidiaries, ("WANdisco") does not
>> waive any confidentiality or privilege. If you are not the intended
>> recipient, please notify us immediately and destroy the message without
>> disclosing its contents to anyone. Any distribution, use or copying of this
>> email or the information it contains by other than an intended recipient is
>> unauthorized. The views and opinions expressed in this email message are
>> the author's own and may not reflect the views and opinions of WANdisco,
>> unless the author is authorized by WANdisco to express such views or
>> opinions on its behalf. All email sent to or from this address is subject
>> to electronic storage and review by WANdisco. Although WANdisco operates
>> anti-virus programs, it does not accept responsibility for any damage
>> whatsoever caused by viruses being passed.
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


--


* <http://wandisco.com/>*

**The *LiveData* Company
*Find out more 
*wandisco.com <http://wandisco.com/>*



 
<https://www.wandisco.com/liveanalytics>


THIS MESSAGE AND ANY ATTACHMENTS
ARE CONFIDENTIAL, PROPRIETARY AND MAY BE PRIVILEGED
*


If this message was
misdirected, WANdisco, Inc. and its subsidiaries, ("WANdisco") does not
waive any confidentiality or privilege. If you are not the intended
recipient, please notify us immediately and destroy the message without
disclosing its contents to anyone. Any distribution, use or copying of this
email or the information it contains by other than an intended recipient is
unauthorized. The views and opinions expressed in this email message are
the author's own and may not reflect the views and opinions of WANdisco,
unless the author is authorized by WANdisco to express such views or
opinions on its behalf. All email sent to or from this address is subject
to electronic storage and review by WANdisco. Although WANdisco operates
anti-virus programs, it does not accept responsibility for any damage
whatsoever caused by viruses being passed.
Reply | Threaded
Open this post in threaded view
|

Re: restart stopped route automatically due to exception

Bing Lu
In reply to this post by Bing Lu
should i use cachingconnectionfactory instead of just mqconnectionfactory in sjms component? i am using 2.23.1
  exception below
Exception caught closing session: JMSCMQ0002: The method 'MQBACK' failed.. This exception is ignored. message:{"@timestamp":"2019-11-09T23:20:50.983-05:00","@version":"1","message":"Exception caught closing session: JMSCMQ0002: The method 'MQBACK' failed.. This exception is ignored.","logger_name":"org.apache.camel.component.sjms.batch.SjmsBatchConsumer","thread_name":"Camel (camel-1) thread #43 - SjmsBatchConsumefrom
Sent from Yahoo Mail on Android
 
  On Wed, Nov 13, 2019 at 10:08 AM, Bing Lu<[hidden email]> wrote:   hi, is there a way to automatically restart a route that got stopped due to some exception caused by server patching, queue unavailable for a short period of time? I am using sjmsbatch and one of the route is stopped and never restarted during the maintenance window because it caught an exception and stopped