如何在camel路由中设置bean集成方法调用的头文件

时间:2016-05-05 14:35:00

标签: java spring apache-camel

根据bean集成的方法调用设置标头所需的帮助。 在我的应用程序中我使用自定义POJO,之前我实际上通过电线发送消息我想要在交换机上设置标题,但不想在我的bean中做它而宁愿在我的春天做DSL是为路线编写的。 我知道通常从方法返回的值作为消息的主体发送到下一个端点但我想发送作为标头返回的值。 我附上了我需要的路线样本,并希望:

<route id="someRoute">
<from ref="InboundAsyncEndpoint" />
<to  uri="bean:validatorBean?method=validateMessageInternals(MyCostomMessagePojo obj)" />
<choice>
    <when>
        <simple>
            ${body.getMetaData().getFinalDestinationName()} == 'AMQEndpoint'
        </simple>
        <to uri="bean:payloadAndHeaderExtractor?extractHeader(MyCostomMessagePojo obj)" /> 
        <to uri="bean:payloadAndHeaderExtractor?extractPayload(MyCostomMessagePojo obj)" /> <!-- i want the headers being set on the exchange from the map that is returnd from the previous bean and method -->
        <to uri="activemq:someQueue"
    </when>
    <otherwise>
        ...
        ...
    </otherwise>
</choice>

1 个答案:

答案 0 :(得分:0)

您可以通过以下方式执行此操作:

def app
  Sinatra::Application
end

希望这有帮助。

R上。

相关问题