Did you try to use failover[1] ?
[1] http://camel.apache.org/load-balancer.html#LoadBalancer-Failover
Willem
lekkie wrote:
I have a use case that requires a certain endpoint to be re-used. Lets say
the re-usable endpoint is called router1.
The flow below causes a blockage on my route and leads to camel throwing
exception.
consumerEndPoint -> router1 -> someIntermediateEndPoint -> router1`->
someProviderEndpoint ........
This flow is an InOut exchange flow. What is happening is that, because the
first message passes through router1 and it is still waiting for a response,
router1` will wait forever. I think camel throws the exception below
08:29:12,569 | INFO | oLogger-thread-1 | Tracer |
rg.apache.camel.processor.Logger 88 | c66c0dd3-657a-4508-9295-c6f6b6d64a02
(route20) OnException[ExchangeTimedOutException] --> transform[
08:29:12,569 | ERROR | oLogger-thread-1 | DefaultErrorHandler |
rg.apache.camel.processor.Logger 202 | Failed delivery for exchangeId:
c66c0dd3-657a-4508-9295-c6f6b6d64a02. Processed by failure processor:
Channel[Transform(
08:29:33,653 | INFO | saction-thread-1 | Tracer |
rg.apache.camel.processor.Logger 88 | c36c48b5-e18d-498e-9fed-b340e0baeb05
vm://router1 --> OnException[ExchangeTimedOutException] <<<
Pattern:InOut, Headers:{operationName=null, nmrMessage=Message []},
BodyType:String, Body:
08:29:33,653 | INFO | saction-thread-1 | Tracer |
rg.apache.camel.processor.Logger 88 | c36c48b5-e18d-498e-9fed-b340e0baeb05
(route23) OnException[ExchangeTimedOutException] --> transform[
8:29:33,653 | ERROR | saction-thread-1 | DefaultErrorHandler |
rg.apache.camel.processor.Logger 202 | Failed delivery for exchangeId:
c36c48b5-e18d-498e-9fed-b340e0baeb05. Processed by failure processor:
Channel[
Loadbalancer is not resolving this as it still ends up sending to same
router.
See my camel snippets below:
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
trace="true">
<route>
<from uri="nmr:consumerEndPoint"/>
<loadBalance ref="roundRobinRef">
<to uri="vm:router1"/>
<to uri="vm:router2"/>
</loadBalance>
</route>
</camelContext>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
trace="true">
<route>
<from uri="nmr:someIntermediateEndPoint "/>
<loadBalance ref="roundRobinRef">
<to uri="vm:router1"/>
<to uri="vm:router2"/>
</loadBalance>
</route>
</camelContext>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
trace="true">
<route>
<from uri="nmr:someProviderEndPoint"/>
<to uri="mock:whatever"/>
</route>
</camelContext>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
trace="true">
<route>
<from uri="vm:router1"/>
<bean ref="router1ProcessorRecipientList" method="route"/>
</route>
</camelContext>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
trace="true">
<route>
<from uri="vm:router2"/>
<bean ref="router2ProcessorRecipientList" method="route"/>
</route>
</camelContext>
What EIP would be the most appropriate for this scenario?
kr.