You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by majid <mo...@peerius.com> on 2015/03/10 19:25:11 UTC

Camel stop routes and start

Hi all,

I have a camel application where I am parsing a large XML file and doing
some operations on the items of the file. I want to be able to stop/and
re-start manually the application.

So when I stop all the routes of my camel context while the application is
processing the file, and restart again, the camel context seems to have
somewhere in the cache the old file instead the new one I have put in the
folder.

Does anyone have an idea on how I can mark everything as completed even if
the I stop the process in the middle ?

Cheers
Majid



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-stop-routes-and-start-tp5763950.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel stop routes and start

Posted by Antoine DESSAIGNE <an...@gmail.com>.
Hi everyone,

Indeed there's a trick for forcing the shutdown of a context (or a
particular route). You need to retrieve the currentShutdownTaskFuture of
the DefaultShutdownStategy and call cancel(true) on it.

Also, you can have more than 100 camel contexts in a single JVM, we're
doing it. But of course, your server needs to have enough memory :)

Antoine.

2015-03-13 10:05 GMT+01:00 Willem Jiang <wi...@gmail.com>:

> Camel Context holds the reference of components, languages, data formats.
> You cannot share the direct:endpoint across the camel context.
>
> I don’t think it’s not a good choice to create 100 camel contexts in a
> single JVM.
>
> Can you try to create a new route instead restart the one route?
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
> On March 11, 2015 at 11:24:34 PM, majid (mohamed.elgabbouch@peerius.com)
> wrote:
> > I finally stopping the whole camel context.
> >
> > I am wondering how costly is the operation of creation many camel
> contexts
> > (one per customer) ?
> > I will have around 100 camel context in my JVM, is it expensive ? or
> should
> > I use only one ?
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Camel-stop-routes-and-start-tp5763950p5764011.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>

Re: Camel stop routes and start

Posted by Willem Jiang <wi...@gmail.com>.
Camel Context holds the reference of components, languages, data formats. You cannot share the direct:endpoint across the camel context.

I don’t think it’s not a good choice to create 100 camel contexts in a single JVM.

Can you try to create a new route instead restart the one route?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 11, 2015 at 11:24:34 PM, majid (mohamed.elgabbouch@peerius.com) wrote:
> I finally stopping the whole camel context.
>  
> I am wondering how costly is the operation of creation many camel contexts
> (one per customer) ?
> I will have around 100 camel context in my JVM, is it expensive ? or should
> I use only one ?
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-stop-routes-and-start-tp5763950p5764011.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: Camel stop routes and start

Posted by majid <mo...@peerius.com>.
I finally stopping the whole camel context.

I am wondering how costly is the operation of creation many camel contexts
(one per customer) ?
I will have around 100 camel context in my JVM, is it expensive ? or should
I use only one ? 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-stop-routes-and-start-tp5763950p5764011.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel stop routes and start

Posted by harald <su...@rainyday.de>.
Hmm .. you are stopping the route (shutdown) while processing a big XML file. A stopRoute is not like a kill (doesn’t exist - afair). Looking into the DefaultShutdownStrategy documentation might be of help. Do you see any warnings about the route shutdown within the logs?

Re: Camel stop routes and start

Posted by majid <mo...@peerius.com>.
Hi Harald,

Yes, I can but I am using the same camel context for other tasks, I stop
these routes and restart them when need and keep others.





--
View this message in context: http://camel.465427.n5.nabble.com/Camel-stop-routes-and-start-tp5763950p5763957.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel stop routes and start

Posted by harald <su...@rainyday.de>.
Hi Majid,

you wrote that you stop all routes, have you tried to stop the CamelContext instead? According to [1] stopping and restarting the whole CamelContext it is performing a ‘cold’ start. That’s what I would try next.

Regards,
harald


[1] http://camel.apache.org/lifecycle.html