您的位置:首页 > 其它

camel动态设置路由执行

2018-01-26 22:02 337 查看

方式1 :
<toD />
标签

<toD uri="${in.header.nextUri}">


通过toD标签即可实现路由的动态跳转。

也结合条件判断使用动态跳转。

<choice>
<!-- 串行或分支执行 -->
<when>
<simple>${property.type} == 'serial' or ${property.type} == 'branch'</simple>
<toD uri="${property.nextUrl}" />
</when>
</choice>


方式2 :
<routingSlip/>
标签

<route>
<from uri="direct:a"/>
<routingSlip ignoreInvalidEndpoints="true"/>
<header>nextUri</header>
</routingSlip>
</route>


通过将下一个路由地址放入header中并设置key为nextUri即可实现动态跳转,其中
ignoreInvalidEndpoints=true
表示如果该动态地址不可用时可忽略。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  camel-动态路由