I have my camel bundle deployed in service mix and it runs well for some times and now after many runs the same bundle tells the below exception.
org.apache.camel.runtimeexception :java.lang.illegalstateexception: bundlecontext is no longer valid
The same scenario was working fine some runs and suddenly for some consecutive runs it throws the above errors.
Will restart of smx or uninstall of the bundle resolve the issue? this is the third time I am facing this issue and all the time a small restart solved it. Please suggest if this is some other problem.
After My Comment below
I have used in the code i have used like below code.
<choice>
<when>
<simple>some condition</simple>
</when>
<when>
<simple>some other condition</simple>
<stop/>
<when>
</choice>
<!--Still more code and logic exists-->
If I have used here and that is the problem here what should I do to exit when the second condition comes.
Is there any way I can stop the further execution here? that is what is the way to stop the execution for that particular request alone and not stop the route? In this scenario there are other requests which will not be affected by this stop and will work for other requests.
I think in the http://camel.apache.org/intercept.html link it says that to use to stop further execution but will it stop the route any way.
Will this cause the bundle no longer valid scenario. From this there arises a question where what will be the spring config equivalent of CamelContext.stop() ?
After My another Comment below which directs here.
Also we work in an environment where the camel has more customized bundles which ease our development. This has more specifically loading the routes dynamically. Will this be one reason where the routes may not be properly started when we give camelCOntext.Start() etc....?
From the camel route, I cann't tell anything is wrong. As you just asked another question I just post my answer here:
stop element in the route only works for the exchange, which means the exchange which is routed to this point won't be processed any more. If you want to stop the route or camel context you need call the CamelContext.stop().
If can do it in Spring configuration by using camel-controlbus component.