问题
I am new to Apache Camel.
My requirement is to trigger an Apache camel route in my code flow from method A(). Also I need to pass the object param of A() to the route. I do not want to use amq, file etc components.
code :
public void A(MyObjectType param) {
//Need to call camel route with "param"
}
What's the best way to do this?
回答1:
You can use the ProducerTemplate option, ProducerTemplate template = exchange.getContext().createProducerTemplate() and then you can do template.sendBody The sendBody method can invoke a camel route directly.
来源:https://stackoverflow.com/questions/25911995/how-to-trigger-apache-camel-route-from-my-java-method