my dog learned polymorphism*
The moose likes Other Application Frameworks and the fly likes Need help in using apache camel routing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Need help in using apache camel routing" Watch "Need help in using apache camel routing" New topic
Author

Need help in using apache camel routing

bhushan devare
Greenhorn

Joined: Jun 15, 2011
Posts: 12
Hello
I am new to apache camel. I have following route in my camelContex.

<camel:from uri="direct:sendSampleBean"/>
<camel:to uri="beanwnValidator?method=checkForName"/>
<camel:choice>
<camel:when>
<camel:simple>${body} == true </camel:simple>
<camel:to uri="beanwnValidator?method=validate"/>
</camel:when>
</camel:choice>

Actually I am sending 'SampleBean' in body, then want to check if 'name' is null or not in bean and returning boolean result. for this I have method, 'checkForName'. If name present then I want to do another validation by calling 'validate' method by using same bean 'SampleBean'.
My problem is that while calling 'validate' method its taking 'boolean' as parameter whereas method is expecting the 'SampleBean'. How to keep flowing same datatype throughout the route?
Please help me. Thanks in advance.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 394
Just a curiosity and if possible, can you write the java code that is similiar to the routing?
By that I mean can we solve this routing using simple java code before we use Camel routing?
bhushan devare
Greenhorn

Joined: Jun 15, 2011
Posts: 12
Hi,
Actually I have java code for the same, what I am trying to do is that I want to move all this in XML(routes) so that it will be more configurable. Means suppose(for current example of validation) if in future I have to remove any validation then I will just need to update my XML file(routes that I have written) & I don't need to touch my java class. Also it is more easy to use any other validation or any other thing.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 394
Got your intention.

Now, I'm slow. So would it still possible for you to post the code so that I can see the WHAT before I can attempt to do the HOW?
bhushan devare
Greenhorn

Joined: Jun 15, 2011
Posts: 12
Hey
I was trying different combination & I got the solution, may be need to test well. But if I replace <camel:simple>${body} == true </camel:simple> by <camel:simple>${in.body} </camel:simple> then it is solving my problem.

H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 394
So your Java DSL look like?




Then Spring DSL equivalent?

bhushan devare
Greenhorn

Joined: Jun 15, 2011
Posts: 12
yes right. I am using spring DSL
 
 
subject: Need help in using apache camel routing
 
Similar Threads
Camel in Action question
EL problem
c:forEach performance hit
Invoking a Camel end point deployed in remote Server from JUnit test case
Surprising problem in calling bean from JSP