2016-04-20 12 views
-1

私はラクダの新作です。上のビーン・メソッドが "hi"を返すと別のルートを呼び出さなければならないような方法でラクダのルートを書きたいと思います。しかし、それは以下のコードでは起こりません。私に解決策を教えてください。キャメル・コンテンツ・ベースのルーティング

はここに私のコードです:

<?xml version="1.0" encoding="UTF-8"?> 

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" 
    xmlns:jaxrs="http://cxf.apache.org/jaxrs" 
    xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd 
     http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd 
     http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> 

<camelContext xmlns="http://camel.apache.org/schema/spring"> 
    <route id="firstRoute"> 
     <from uri="activemq:queue:test.queue" /> 
     <doTry> 
      <to uri="bean:myBean?method=appendCamel(1,hell)" /> 
       <log message="TEST LOG" /> 
      <when> 
       <xpath>${in.body} = 'hi'</xpath> 
       <to uri="stream:out" /> 
      </when> 
      <doCatch> 
       <exception>java.lang.Exception</exception> 
      </doCatch> 
     </doTry> 
     <to uri="stream:out" /> 
     <to uri="bean:myBean?method=appendCamel2(34)" /> 
     <to uri="stream:out" /> 
     <to uri="direct:nextRoute" /> 
    </route> 

    <route> 
     <from uri="direct:nextRoute" /> 
     <to uri="stream:out" /> 
    </route> 
</camelContext> 
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
    <property name="brokerURL" value="vm://localhost?broker.persistent=false" /> 
</bean> 
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
    <property name="connectionFactory" ref="connectionFactory" /> 
</bean> 

<bean id="myBean" class="Camel.CamelHelloWorldSid.MyBean" /> 

答えて

0
<camelContext xmlns="http://camel.apache.org/schema/spring"> 
    <route id="firstRoute"> 
     <from uri="activemq:queue:test.queue" /> 
     <doTry> 
      <to uri="bean:myBean?method=appendCamel(1,hell)" /> 
       <log message="TEST LOG" /> 
      <when> 
       <simple>${in.body} == 'hi'</simple> 
       <to uri="direct:nextRoute" /> 
      </when> 
      <doCatch> 
       <exception>java.lang.Exception</exception> 
      </doCatch> 
     </doTry> 
     <to uri="stream:out" /> 
     <to uri="bean:myBean?method=appendCamel2(34)" /> 
     <to uri="stream:out" /> 
     <to uri="direct:nextRoute" /> 
    </route> 

    <route> 
     <from uri="direct:nextRoute" /> 
     <to uri="stream:out" /> 
    </route> 
</camelContext> 
関連する問題