-
1. Re: Using process node vs the to node
davsclaus Feb 20, 2009 2:02 AM (in response to brett_brettl)Yes you can rewrite it.
However they different options is there for a reason.
1)
Process is the interface/method that Camel uses internally in the routing engine to route message. You can view it as: consume -> process -> process -> process... as how Camel when you go far down in the routing engine.
Process can also be used by end users so you can write some Java Code what should happen.
This is expressed in the DSL as: .process or .processRef
2)
To is used to route to an Endpoint destination, that can be more or less anything. For example all the Camel components such as: JMS, HTTP, File etc. etc.
And even java code using the Bean, see next
3)
Bean is a very key component in Camel. In fact on the front page its highlighted as one of Camels key assets.
You can route to a Bean (aka POJO) to allow Camel to invoke any arbitrary code you have. This allows you to be 100% in your code on any Camel class/interface. This is called non invasive API. So you can reuse/use any code you have. Imagine you have a .jar file with some existing code. Just route it to your Bean and maybe give Camel a hint which method to invoke
This can be done using .bean, .beanRef or .to("bean:myBean"
Choosing Process over Bean. I regard best practice to use Bean instead of Process so you can use any code you have and dont have to be dependt on any Camel .jars. The code is just plain Java code and any developers know how to do this. Also unit testing is easier as you dont have to find out how to instantiate any camel classes to pass in into your method.
-
2. Re: Using process node vs the to node
brett_brettl Feb 20, 2009 4:01 PM (in response to davsclaus)Thank you for the clarification.
Brett