Hi All,

I have a Camel Proxy that pushes "BeanInvokation" exchanges  to a camel
route, and I want to route these messages depending on the method name that
is invoked.

Is there any way to extract this information and put into an header so to
use it in a <choice>?


For example, considering the following XML code:

<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring
">
<proxy id="myServiceProxy" serviceInterface="org.example.MyService"
serviceUrl="direct:entry" />

<route>
<from uri="direct:entry" />
<setHeader headerName="methodName">
 <?? how to extract the method name ??>
</setHeader>

<choice>
<when>
<simple>${header.methodName} == 'myMethod1'</simple>
<to uri="log:endoint_1?showAll=true" />
</when>
<when>
<simple>${header.methodName} == 'myMethod2'</simple>
<to uri="log:endoint_2?showAll=true" />
</when>
<otherwise>
<throwException ref="unsupportedException" />
</otherwise>
</choice>
</route>
</camelContext>


I'm searching for a solution to be used between the two <setHeader> tags.

I know I can write a processor, but I will have problems deploying it to
the classpath where I put the route, so I need a solution that rely on the
default camel capability (like using simple language or other expression
languages available with camel).


Any idea?
Thank you all!

Cristiano

Reply via email to