I am new at working with activemq and Camel.
I have these questions:
I have a bean and bean method, which are invoked by filter.
<filter>
<method ref="MyBean" method="CheckReceivedFilesByParameters"/>
<to uri="direct:b"/>
</filter>
Method CheckReceivedFilesByParameters returns boolean value. The next route starts succesfully if true. How can I invoke route (direct:b) when false. And I want to do this with xml. I tried to invoke method outside tag but with no luck.
<to uri="bean:MyBean?method=CheckReceivedFilesByParameters"/>
<filter>
<simple>false</simple>
<to uri="direct:b"/>
</filter>
How can I correctly pass parameters to MyBean method via Exchange message. What is best practice? Right now I'm doing by creating headers and later in my method I get headerValues. Example in my xml.
<setHeader headerName="RouteId">
<constant>Test1</constant>
</setHeader>
And then getting header in MyBean method value.
String routeId = exchange.getIn().getHeader("RouteId", String.class);
Should there'is some more "elegant" way. Like passing parameters. Like in servlets?
request.getParameter("par1")
Thanks in advance.
Ad 1)
The filter eip only routes if the expression is true, eg the method call returns true. So if the method call returns false, then the filter does not route to "direct:b".
Ad 2)
Read about parameter bindings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With