camel动态设置路由执行

方式1 :标签

"${in.header.nextUri}">

通过toD标签即可实现路由的动态跳转。
也结合条件判断使用动态跳转。

<choice>
    
    <when>
        <simple>${property.type} == 'serial' or ${property.type} == 'branch'simple>
        <toD uri="${property.nextUrl}" />
    when>
choice>

方式2 :标签

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

通过将下一个路由地址放入header中并设置key为nextUri即可实现动态跳转,其中ignoreInvalidEndpoints=true 表示如果该动态地址不可用时可忽略。

你可能感兴趣的:(Camel)