I'm still looking for help...

Maybe I made it a bit involved with the test case; here's a simpler example:

  <onException>
    <exception>java.lang.Exception</exception>
    # mark the exception as handled
    <handled><constant>true</constant></handled>
    # put an error code into the message body
    <bean name="ExceptionProcessor"/>
    # remove the exception from the exchange
    <removeProperty name="CamelExceptionCaught"/>
    <removeProperty name="CamelFailureEndpoint"/>
    # unfortunately, the message still exits from both routes
  </onException>

  <route id="route1">
    <from uri="direct:route1"/>
    <bean name="PreProcessor"/>
    <to uri="direct:route2"/>
    # we need the message to return from route2 for post-processing, even if
an exception was thrown
    <bean name="PostProcessor"/>
    <log logName="com.test" message="XXXXX TEST PASSED XXXXX"/>
  </route>

  <route id="route2">
    <from uri="direct:route2"/>
    # one of these processors throws an exception
    <bean name="DoSomething"/>
    <bean name="DoSomethingElse"/>
    <bean name="DoSomethingElseAgain"/>
  </route>

If an exception is thrown in route2, how can I make it so that...
* processing stops in route2
* processing continues in route1

Specifically, I want this scenario:
* bean "PreProcessor" gets invoked
* bean "DoSomething" gets invoked
* bean "DoSomethingElse" gets invoked and throws an exception
* *bean "DoSomethingElseAgain" does NOT get invoked*
* onException catches the exception
* bean "ExceptionProcessor" gets invoked
* *bean "PostProcessor" gets invoked*

Note, the real-life scenario is more complex, so it's not good enough to
just invoke bean "PostProcessor" from inside the onException definition.

Any ideas?

--
View this message in context: 
http://camel.465427.n5.nabble.com/onException-exits-from-all-routes-tp4754324p4757622.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to