You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ownedthx <se...@gmail.com> on 2010/02/23 21:01:59 UTC

Graceful shutdown and individual routes

Hi, 

I'm creating and tearing down temporary queues at runtime in my application. 
I'm getting an error I believe has been seen many times before by others:

Cannot publish to a deleted Destination: ... Cannot publish to a deleted
Destination: temp-queue://ID:...

I suspect it's because when I tear down RouteDefinitions own my own, then I
don't get the benefits of the new graceful shutdown feature.  

Essentially, I would like my queue to hang around until all messages have
been pulled from it, if all possible.  This would be better behavior for my
application, and I *think* stop this error from occuring.  (I'm not 100%
sure this temporary queue logic is the source of the error message, but it
did start showing up right after I added the feature into our application)

Roughly, this is what I'm currently doing:
// creating temporary routes
RouteBuilder builder = new RouteBuilde() { ...}

// save route definitions for teardown
RoutesDefinition routesDefinition = builder.getRouteCollection();

builder.addRoutesToCamelContext(camelContext)

... some time later ...

// destroy temporary routes
camel.removeRouteDefinitions(routesDefinitions.getRoutes());


Does that look right?  Is there something I can do better to destroy the
routes once all the messages have been processed?

Thanks!
Seth
-- 
View this message in context: http://old.nabble.com/Graceful-shutdown-and-individual-routes-tp27709462p27709462.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Graceful shutdown and individual routes

Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, Feb 28, 2010 at 6:28 PM, Seth Call <se...@gmail.com> wrote:
> On 2/24/10 10:05 AM, Seth Call wrote:
>>
>> On 2/24/10 1:02 AM, Claus Ibsen wrote:
>>>
>>> Hi
>>>
>>> You can use the in flight registry to see if there is any message
>>> ongoing in your route.
>>> And then wait until there are no more before stopping.
>>>
>>> But we could probably also add support for graceful shutdown on
>>> individual routes, leveraging the existing logic in Camel.
>>> Could you create a JIRA ticket?
>>>
>>>
>>>
>>> On Tue, Feb 23, 2010 at 9:01 PM, ownedthx<se...@gmail.com>  wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm creating and tearing down temporary queues at runtime in my
>>>> application.
>>>> I'm getting an error I believe has been seen many times before by
>>>> others:
>>>>
>>>> Cannot publish to a deleted Destination: ... Cannot publish to a deleted
>>>> Destination: temp-queue://ID:...
>>>>
>>>> I suspect it's because when I tear down RouteDefinitions own my own,
>>>> then I
>>>> don't get the benefits of the new graceful shutdown feature.
>>>>
>>>> Essentially, I would like my queue to hang around until all messages
>>>> have
>>>> been pulled from it, if all possible.  This would be better behavior for
>>>> my
>>>> application, and I *think* stop this error from occuring.  (I'm not 100%
>>>> sure this temporary queue logic is the source of the error message, but
>>>> it
>>>> did start showing up right after I added the feature into our
>>>> application)
>>>>
>>>> Roughly, this is what I'm currently doing:
>>>> // creating temporary routes
>>>> RouteBuilder builder = new RouteBuilde() { ...}
>>>>
>>>> // save route definitions for teardown
>>>> RoutesDefinition routesDefinition = builder.getRouteCollection();
>>>>
>>>> builder.addRoutesToCamelContext(camelContext)
>>>>
>>>> ... some time later ...
>>>>
>>>> // destroy temporary routes
>>>> camel.removeRouteDefinitions(routesDefinitions.getRoutes());
>>>>
>>>>
>>>> Does that look right?  Is there something I can do better to destroy the
>>>> routes once all the messages have been processed?
>>>>
>>>> Thanks!
>>>> Seth
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/Graceful-shutdown-and-individual-routes-tp27709462p27709462.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>> Thank you for the pointer Claus.  I also did as you asked regarding a JIRA
>> issue.
>>
>> https://issues.apache.org/activemq/browse/CAMEL-2497
>>
>> Regards,
>> Seth
>>
>>
> Wow, thanks Claus.  2.3 will have this eh? Very nice  :)
>

Yes it will be in 2.3.

The timing was good as I am currently writing on chapter 13 for the Camel book,
which happens to also cover starting and stopping / shutdown Camel in
a reliable manner.

Fell free to test it on your end with a 2.3-SNAPSHOT version
http://camel.apache.org/download.html



> Seth
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Graceful shutdown and individual routes

Posted by Seth Call <se...@gmail.com>.
On 2/24/10 10:05 AM, Seth Call wrote:
> On 2/24/10 1:02 AM, Claus Ibsen wrote:
>> Hi
>>
>> You can use the in flight registry to see if there is any message
>> ongoing in your route.
>> And then wait until there are no more before stopping.
>>
>> But we could probably also add support for graceful shutdown on
>> individual routes, leveraging the existing logic in Camel.
>> Could you create a JIRA ticket?
>>
>>
>>
>> On Tue, Feb 23, 2010 at 9:01 PM, ownedthx<se...@gmail.com>  wrote:
>>> Hi,
>>>
>>> I'm creating and tearing down temporary queues at runtime in my 
>>> application.
>>> I'm getting an error I believe has been seen many times before by 
>>> others:
>>>
>>> Cannot publish to a deleted Destination: ... Cannot publish to a 
>>> deleted
>>> Destination: temp-queue://ID:...
>>>
>>> I suspect it's because when I tear down RouteDefinitions own my own, 
>>> then I
>>> don't get the benefits of the new graceful shutdown feature.
>>>
>>> Essentially, I would like my queue to hang around until all messages 
>>> have
>>> been pulled from it, if all possible.  This would be better behavior 
>>> for my
>>> application, and I *think* stop this error from occuring.  (I'm not 
>>> 100%
>>> sure this temporary queue logic is the source of the error message, 
>>> but it
>>> did start showing up right after I added the feature into our 
>>> application)
>>>
>>> Roughly, this is what I'm currently doing:
>>> // creating temporary routes
>>> RouteBuilder builder = new RouteBuilde() { ...}
>>>
>>> // save route definitions for teardown
>>> RoutesDefinition routesDefinition = builder.getRouteCollection();
>>>
>>> builder.addRoutesToCamelContext(camelContext)
>>>
>>> ... some time later ...
>>>
>>> // destroy temporary routes
>>> camel.removeRouteDefinitions(routesDefinitions.getRoutes());
>>>
>>>
>>> Does that look right?  Is there something I can do better to destroy 
>>> the
>>> routes once all the messages have been processed?
>>>
>>> Thanks!
>>> Seth
>>> -- 
>>> View this message in context: 
>>> http://old.nabble.com/Graceful-shutdown-and-individual-routes-tp27709462p27709462.html 
>>>
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
> Thank you for the pointer Claus.  I also did as you asked regarding a 
> JIRA issue.
>
> https://issues.apache.org/activemq/browse/CAMEL-2497
>
> Regards,
> Seth
>
>
Wow, thanks Claus.  2.3 will have this eh? Very nice  :)

Seth

Re: Graceful shutdown and individual routes

Posted by Seth Call <se...@gmail.com>.
On 2/24/10 1:02 AM, Claus Ibsen wrote:
> Hi
>
> You can use the in flight registry to see if there is any message
> ongoing in your route.
> And then wait until there are no more before stopping.
>
> But we could probably also add support for graceful shutdown on
> individual routes, leveraging the existing logic in Camel.
> Could you create a JIRA ticket?
>
>
>
> On Tue, Feb 23, 2010 at 9:01 PM, ownedthx<se...@gmail.com>  wrote:
>    
>> Hi,
>>
>> I'm creating and tearing down temporary queues at runtime in my application.
>> I'm getting an error I believe has been seen many times before by others:
>>
>> Cannot publish to a deleted Destination: ... Cannot publish to a deleted
>> Destination: temp-queue://ID:...
>>
>> I suspect it's because when I tear down RouteDefinitions own my own, then I
>> don't get the benefits of the new graceful shutdown feature.
>>
>> Essentially, I would like my queue to hang around until all messages have
>> been pulled from it, if all possible.  This would be better behavior for my
>> application, and I *think* stop this error from occuring.  (I'm not 100%
>> sure this temporary queue logic is the source of the error message, but it
>> did start showing up right after I added the feature into our application)
>>
>> Roughly, this is what I'm currently doing:
>> // creating temporary routes
>> RouteBuilder builder = new RouteBuilde() { ...}
>>
>> // save route definitions for teardown
>> RoutesDefinition routesDefinition = builder.getRouteCollection();
>>
>> builder.addRoutesToCamelContext(camelContext)
>>
>> ... some time later ...
>>
>> // destroy temporary routes
>> camel.removeRouteDefinitions(routesDefinitions.getRoutes());
>>
>>
>> Does that look right?  Is there something I can do better to destroy the
>> routes once all the messages have been processed?
>>
>> Thanks!
>> Seth
>> --
>> View this message in context: http://old.nabble.com/Graceful-shutdown-and-individual-routes-tp27709462p27709462.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>      
>
>
>    
Thank you for the pointer Claus.  I also did as you asked regarding a 
JIRA issue.

https://issues.apache.org/activemq/browse/CAMEL-2497

Regards,
Seth



Re: Graceful shutdown and individual routes

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can use the in flight registry to see if there is any message
ongoing in your route.
And then wait until there are no more before stopping.

But we could probably also add support for graceful shutdown on
individual routes, leveraging the existing logic in Camel.
Could you create a JIRA ticket?



On Tue, Feb 23, 2010 at 9:01 PM, ownedthx <se...@gmail.com> wrote:
>
> Hi,
>
> I'm creating and tearing down temporary queues at runtime in my application.
> I'm getting an error I believe has been seen many times before by others:
>
> Cannot publish to a deleted Destination: ... Cannot publish to a deleted
> Destination: temp-queue://ID:...
>
> I suspect it's because when I tear down RouteDefinitions own my own, then I
> don't get the benefits of the new graceful shutdown feature.
>
> Essentially, I would like my queue to hang around until all messages have
> been pulled from it, if all possible.  This would be better behavior for my
> application, and I *think* stop this error from occuring.  (I'm not 100%
> sure this temporary queue logic is the source of the error message, but it
> did start showing up right after I added the feature into our application)
>
> Roughly, this is what I'm currently doing:
> // creating temporary routes
> RouteBuilder builder = new RouteBuilde() { ...}
>
> // save route definitions for teardown
> RoutesDefinition routesDefinition = builder.getRouteCollection();
>
> builder.addRoutesToCamelContext(camelContext)
>
> ... some time later ...
>
> // destroy temporary routes
> camel.removeRouteDefinitions(routesDefinitions.getRoutes());
>
>
> Does that look right?  Is there something I can do better to destroy the
> routes once all the messages have been processed?
>
> Thanks!
> Seth
> --
> View this message in context: http://old.nabble.com/Graceful-shutdown-and-individual-routes-tp27709462p27709462.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus