This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help in using apache camel routing

 
bhushan devare
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 471
4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 471
4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 471
4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So your Java DSL look like?




Then Spring DSL equivalent?

 
bhushan devare
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes right. I am using spring DSL
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic