osgi6——camel配置学习

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yeyincai/article/details/47831483

1.camel多条路径

<camelContext errorHandlerRef="errorHandler" xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="direct:a"/>
        <choice>
            <when>
                <xpath>$foo = 'bar'</xpath>
                <to uri="direct:b"/>
            </when>
            <when>
                <xpath>$foo = 'cheese'</xpath>
                <to uri="direct:c"/>
            </when>
            <otherwise>
                <to uri="direct:d"/>
            </otherwise>
        </choice>
    </route>
</camelContext>

2.camel实现管道过滤

<route>
  <from uri="activemq:SomeQueue"/>
  <bean ref="foo"/>
  <bean ref="bar"/>
  <to uri="activemq:OutputQueue"/>
</route>


3.camel实现多传送

<camelContext errorHandlerRef="errorHandler" xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="direct:a"/>
        <multicast>
            <to uri="direct:b"/>
            <to uri="direct:c"/>
            <to uri="direct:d"/>
        </multicast>
    </route>
</camelContext>


4.camel实现心跳

 <camelContext id="scheduler" xmlns="http://camel.apache.org/schema/blueprint">
        
        <route>
            <from uri="timer://foo3?fixedRate=true&period=60000" />
            <to uri="bean:orderScheduler?method=scheduler"/>  
             <!--设置body的值-->
         <transform>
             <constant>Bye World</constant>
          </transform>
         <to uri="mock:test"/>  
          <!--输出日志-->
          <to uri="log:com.javarticles?level=INFO&amp;showAll=true"/>
        </route>
    </camelContext>


5.camel标签

<aggregate/><!--积聚-->
            <aop/>
            <bean/>
            <convertBodyTo type=""/>
            <delay/><!--延迟-->
            <doCatch/>
            <doFinally/>
            <doTry/>
            <dynamicRouter/>
            <enrich/><!--丰富-->
            <filter/>
            <intercept/>
            <loadBalance/>
            <loop/>
            <marshal/><!--编排-->
            <multicast/><!--组播-->
            <pipeline/><!--管道-->
            <policy ref=""/><!--政策-->
            <process ref=""/>
            <removeHeader headerName=""/>
            <rollback/>
            <sort/>
            <split/>
            <stop/>
            <threads/><!--螺纹-->
            <throttle/><!--节流阀-->
            <transform/><!--转换-->
            <inOnly/><!---->
            <unmarshal/><!--编码解码-->
            <validate/><!--验证-->
            <wireTap/><!--窃听-->

猜你喜欢

转载自blog.csdn.net/yeyincai/article/details/47831483