【问题标题】:How to trigger Apache camel route from my java method如何从我的 java 方法触发 Apache 骆驼路由
【发布时间】:2014-09-18 11:57:14
【问题描述】:

我是 Apache Camel 的新手。

我的要求是在我的代码流中从方法 A() 触发 Apache 骆驼路由。我还需要将 A() 的对象参数传递给路由。我不想使用 amq、file 等组件。

代码:

public void A(MyObjectType param) {
    //Need to call camel route with "param"
}

最好的方法是什么?

【问题讨论】:

  • 你想对路线做什么?该参数将如何使用?
  • 路由将根据传递的输入参数对象对特定用例进行过滤,并进一步将流程传递给下游代码。例如:- 路由将检查 { inputObjectParam.Customer.Location == 'US' } 然后将其路由到路由 A 否则将其路由到路由 B

标签: apache routing apache-camel


【解决方案1】:

你可以使用 ProducerTemplate 选项,ProducerTemplate template = exchange.getContext().createProducerTemplate() 然后你可以做 template.sendBody sendBody 方法可以直接调用骆驼路由。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多