camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Quinn Stevenson <qu...@pronoia-solutions.com>
Subject Re: Shutting down route with jms
Date Sat, 30 Jan 2016 17:29:49 GMT
I normally use the ControlBus EIP ( http://camel.apache.org/controlbus.html <http://camel.apache.org/controlbus.html>
) for this kind of thing - then I don’t have to write any custom processors or other supporting
code.


> On Jan 30, 2016, at 12:16 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> 
> See this FAQ
> http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
> 
> On Fri, Jan 29, 2016 at 8:24 PM, jamie3 <jamie3@gmail.com> wrote:
>> I have a Camel route as follows:
>> 
>> onException(EmitException.class)
>>                        .maximumRedeliveries(3)
>>                        .handled(true)
>>                        .delay(3000)
>>                        .process(new ShutdownRoute("Failed to send email"))
>>                        .end();
>> 
>> from("jms:queue:someQueue?acknowledgementModeName=CLIENT_ACKNOWLEDGE")
>> to(myProcessor);
>> 
>> class ShutdownRoute implements Processor {
>>        @Override
>>        public void process(Exchange exg) throws Exception {
>>                LOG.fatal("Shutting down service: " + message);
>>                exg.getContext().stop();
>>        }
>> }
>> 
>> 
>> myProcessor contains logic to send the message to another system. If that
>> system becomes unavailable I want to shutdown the camel route and stop
>> listening for JMS messages.
>> 
>> The JMS connection factory fetched from JNDI using WebSphere Application
>> Server and MQ.
>> 
>> I do receive the call back for ShutdownRoute however when I stop the camel
>> context, MQ shows that the JMS connections are still active. I've confirmed
>> that I cannot send anymore messages to the queue, thus the connection
>> factory is connected to MQ but not accepting messages.
>> 
>> Even if I stop the EAR file in WAS (which contains my camel route) the jms
>> connections are still active.
>> 
>> Also since I have CLIENT_ACKNOWLEDGE mode enabled the messages are placed
>> back onto the queue only when I restart WAS.
>> 
>> What I am trying to do is completely shutdown Camel and the connections to
>> MQ via JMS. Is this possible? Am I implementing this correctly, or is there
>> a better way?
>> 
>> 
>> 
>> 
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Shutting-down-route-with-jms-tp5777011.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message