You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tim Mullender <ti...@wandisco.com.INVALID> on 2019/11/12 15:08:12 UTC

Stopping a JMSConsumer started in a RecipientList

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.

Re: Stopping a JMSConsumer started in a RecipientList

Posted by Tim Mullender <ti...@wandisco.com.INVALID>.
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 <cl...@gmail.com> 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
> <ti...@wandisco.com.invalid> 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 <cl...@gmail.com> 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
>>> <ti...@wandisco.com.invalid> 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.

Re: Stopping a JMSConsumer started in a RecipientList

Posted by Claus Ibsen <cl...@gmail.com>.
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
<ti...@wandisco.com.invalid> 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 <cl...@gmail.com> 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
> > <ti...@wandisco.com.invalid> 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

Re: restart stopped route automatically due to exception

Posted by Claus Ibsen <cl...@gmail.com>.
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 <mf...@yahoo.com.invalid> 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

Re: restart stopped route automatically due to exception

Posted by Bing Lu <mf...@yahoo.com.INVALID>.
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<mf...@yahoo.com> 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  

restart stopped route automatically due to exception

Posted by Bing Lu <mf...@yahoo.com.INVALID>.
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

Re: Stopping a JMSConsumer started in a RecipientList

Posted by Tim Mullender <ti...@wandisco.com.INVALID>.
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 <cl...@gmail.com> 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
> <ti...@wandisco.com.invalid> 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.

Re: Stopping a JMSConsumer started in a RecipientList

Posted by Claus Ibsen <cl...@gmail.com>.
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
<ti...@wandisco.com.invalid> 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