英文:
Is it possible to call a Camel Route xml from Java method?
问题
尝试从Java方法调用Camel路由XML。能否在同一个方法中进行调用并返回?
英文:
I am trying to call a camel route xml from the Java method. Is it possible to call and return to the same method again?
答案1
得分: 1
是的,您可以使用ProducerTemplate来实现这一点。
如果您的调用方必须等待路由完成,您的路由必须是同步执行的(例如direct
路由)。有关更多细节,请参阅交换模式。
如果您期望从路由中获得响应,您应该使用生产者模板的其中一个request*
方法(而不是send*
方法)。
英文:
Yes, you can use a ProducerTemplate for that.
If your caller has to wait for the route to complete, your route must be executed synchronously (for example direct
routes). See exchange pattern for more details.
If you expect a response from the route you should use one of the request*
methods of the producer template (not the send*
methods).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论