This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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: 462
    
    4
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: 462
    
    4
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: 462
    
    4
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
 
GeeCON Prague 2014
 
subject: Need help in using apache camel routing