Niels Bertram created CAMEL-7705:
------------------------------------

             Summary: DynamicRouter hangs thread after bean binding failure
                 Key: CAMEL-7705
                 URL: https://issues.apache.org/jira/browse/CAMEL-7705
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.13.2
            Reporter: Niels Bertram


I have come across a rather complex problem that results in servicemix going 
into a limbo state not allowing me to deinstall or reinstall the camel context 
that causes the issue. I replicated the issue in a camel blueprint test with a 
very scaled down version of the actual implementation - just enough to show how 
and why it fails (see attached zip of the maven project).

Here is how it works (or better does not work):

The example contains a route called {{SessionResourceRoute}} that simply 
accepts a message payload and hands it over to a bean called 
{{DynamicSourceRouter}} which has a route method annotated with 
{{@DynamicRouter}}.

The routing slip method looks something like that (full detail in code 
attached):
{code:java}
@DynamicRouter
public String route(
  @Header(Exchange.SLIP_ENDPOINT) String previous,
  @Header(SOURCE_ADAPTER) String sourceAdapter,
  @XPath(value = "/child::node()/local-name()") String messageType,
  @XPath(value = "/child::node()/@version") String messageVersion,
  Exchange exchange) {
  ...
{code}

The "logic" within the dynamic router will resolve to send the payload onto 
another route defined in {{OneSessionResourceRoute}}. This route will send the 
request message to a CXF endpoint that is configured to return a soap fault.

When the cxf route fails, the dynamic route method on the 
{{DynamicSourceRouter}} is called again to work out if there are others that 
need to be called. Unfortunately when the route returns from the CXF the 
message is the CXFPayload containing the soap fault and when camel tries to 
extract the XPath values out of the failed exchange, itself will fall over and 
then the thread just hangs.

I understand that this is fixable but I simply like to point out that the 
dynamic router will make the context thread hang and in my case turns 
servicemix into a wobble. It also is not very intuitive for someone not as well 
versed with camel as to what actually is happening.

To replicate the issue, simply run the maven project as

{{mvn clean test}}

OR manually 

- import 
{{\[project.basedir\]/src/test/resources/SessionResourceMock-soapui-project.xml}}
 into SoapUI and start the mock
- use your favourite IBE to run unit test {{SessionResourceManagerFailureTest}}

You will see that the test has to be stopped with CTRL+C or Z or you'll have to 
kill the test process in the IDE ...



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to