• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Need help in using apache camel routing

 
Greenhorn
Posts: 12
  • 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="bean:ownValidator?method=checkForName"/>
<camel:choice>
<camel:when>
<camel:simple>${body} == true </camel:simple>
<camel:to uri="bean:ownValidator?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.
 
Ranch Hand
Posts: 491
5
  • 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
  • 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: 491
5
  • 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
  • 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: 491
5
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes right. I am using spring DSL
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!