从Camel调用Bean方法而不进行绑定/处理交换

时间:2016-12-06 19:55:02

标签: java binding apache-camel javabeans interception

是否可以使用未绑定到任何交换的bean,并在Camel拦截过程中触发某种服务启动方法?

interceptFrom("a").bean(service, "method")

方法看起来像

public void method() {
  //just do something that has nothing to do with the exchange
}

对于Camel 2.12.2

我得到的例外是:

Caused by: org.apache.camel.InvalidPayloadException: No body available of type: java.util.function.Function but has value: ...

另一个在同一个Stacktrace中:

Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: ... to the required type: java.util.function.Function with value ...

1 个答案:

答案 0 :(得分:0)

我可以用InOnly模式做到这一点,但我仍然不确定。