Camel Java DSL - routing on ENUM in header - conent based router or dynamic router?

You can use the recipient list EIP camel.apache.org/recipient-list.html.

You can use the recipient list EIP camel.apache.org/recipient-list.html And then for example use a java bean to compute the uri where the message should go. From("seda:a") .recpientList(). Method(MyBean.

Class, "whereToGo"); And in the bean you can use bean parameter binding. camel.apache.org/bean-binding.html camel.apache.org/parameter-binding-annot... So you can bind the header as follows: public class MyBean { public String whereToGo(String body, @Header("foo") SourceSysEnum sys) { ... } } If you don't need the message body, then you can omit that parameter.

You could use a Processor combined with a Routing Slip to accomplish this using a switch statement. I'm not sure how much more efficient this will be unless you have a ton of enum values. It will, however, give you more flexibility should you need to add more complicated logic in the future.

From("seda:a") . Process(new SourceSysRoutingSlipProvider()) . RoutingSlip(SourceSysRoutingSlipProvider.

HEADER_NAME); public class SourceSysRoutingSlipProvider : Processor { public static String HEADER_NAME="sourceSystemRoutes"; public void process(Exchange exchange) throws Exception { Message in = exchange.getIn(); switch( in. GetHeader("sourceSystem") ) { case SourceSysEnum. SYSTEM1: in.

SetHeader(HEADER_NAME, "seda:b"); break; case SourceSysEnum. SYSTEM2: in. SetHeader(HEADER_NAME, "seda:c"); break; ... default: in.

SetHeader(HEADER_NAME, "seda:d"); break; } } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions