I have a Camel route that is routing Order instances:
from("direct:start")
.choice()
.when(order.getProduct() == Product.Widget)
.to("direct:widgets")
.when(order.getProduct() == Product.Fizz)
.to("direct:fizzes")
.otherwise()
.to("direct:allOtherProducts");
So if a particular Order is an order of a Widget, it needs to be routed to direct:widgets, etc.
I’m choking on what to put inside each when(...) method. What I have is not legal Camel DSL syntax, and is used for illustrating what I want to accomplish.
So I ask: what do I put in each when(...) method to accomplish the sort of routing I’m looking for? Thanks in advance!
You should put the value of your order.getProduct() in a header and use it like that ::
EDIT :
You could use a process (i.e : in DSL ) :
Bean declaration :
The class :