is there any way to route a ServiceMix message by operation specified in that message?
I've tried googling it but was unable to find any way to complete this simple task, maybe I am doing it wrong in first place?
I've got an adapter that dispatches 2 types of messages. 2 other adapters have to catch them and give a response. Both messages have identical bodies (for example let it be some <product>...</product>
) but the operation differs (for example update
and create
). How do I route that messages to different adapters?
Thanks in advance.
Found an answer here: http://fernandoribeiro.eti.br/2009/06/06/multiple-operations-in-apache-camel-routes/
import org.apache.camel.builder.RouteBuilder;
public final class SampleRouteBuilder extends RouteBuilder {
public void configure() {
from("jbi:service:http://www.fernandoribeiro.eti.br/SampleService")
.choice()
.when(header("jbi.operation")
.isEqualTo("{http://www.fernandoribeiro.eti.br}FirstOperation"))
.when(header("jbi.operation")
.isEqualTo("{http://www.fernandoribeiro.eti.br}SecondOperation"));
}
}