使用在 apache camel 直接端点上设置的选项 [英] Use options set on apache camel direct endpoint
问题描述
我正在构建一个路由滑动 bean,除了动态路由之外,我还想向收件人列表的端点发送一个参数.
I am building a routing slip bean and want to apart from the dynamic routing also to send a parameter to the endpoints of the recipients list.
我希望使用类似direct:test?param=value"的东西,其中 param 和 value 设置在路由单 POJO 内
I wish to use something like "direct:test?param=value", where param and value are set inside the routing slip POJO
根据我对直接组件的理解,单个直接:测试"端点将接收所有路由交换,但是我需要一种方法来读取从路由单发送的参数
From what I understand from the direct component, a single "direct:test" endpoint will receive all the routed exchanges, however I need a way to read the param send from the routing slip
如何将此参数用于接收交换的端点?是交易所的财产吗?
How can I use this param to the endpoint which receives the exchange? Is it a property of the exchange?
推荐答案
Pan,
我会使用骆驼的 header 功能.它非常通用,您可以使用 predicates 处理一些不错的 DSL 或 spring 控件,或者在bean/处理器 通过执行 myExchange.getIn().getHeader("foo").
I'd use the header functionality of camel. It's quite versatile and you can handle it using predicates for some nice DSL or spring control, or in a bean/processor by doing myExchange.getIn().getHeader("foo").
这篇关于使用在 apache camel 直接端点上设置的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!