How to trigger Apache camel route from my java method

时光怂恿深爱的人放手 提交于 2021-02-07 11:13:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!