2016-11-14 10 views
0

私はApache Camelでmutlicastを単一のルートで1回以上使用したいという要件があります。すなわち、マルチキャスト内のマルチキャスト。apache camelで複数のmutlicastを使用できますか?

<routeContext id="myRoute" xmlns="http://camel.apache.org/schema/spring"> 
     <route id="myRouteId"> 
      <from uri="activemq:queue:{{XXXX.queue}}" /> 
     .... 
      <multicast parallelProcessing="true"> 
       <pipeline> 
        ##everything working fine here 
       </pipeline> 
       <pipeline> 
        <multicast> 
         <pipeline> 
          <log message="Inserting in database now"></log> 
          <transform> 
           <method ref="insertBean" method="myBatchInsertion"></method> 
          </transform> 
           <choice> 
           <when> 
            <simple>${in.header.myCount} == ${properties:batch.size} </simple> 
            <to uri="sql:{{sql.core.insertMyQuery}}?batch=true"></to> 
            <log message="Inserted rows ${body}"></log> 
           </when> 
          </choice> 
         </pipeline> 
        </multicast> 
        </pipeline> 
       </multicast> 
      </route> 
     </routeContext> 

これは可能ですか? これを実行しようとすると、プログラムが正常に実行されません。 実行に失敗したのは、複数のマルチキャストの結果ですか? 誰でも助けることができますか? 私は以下のリンクからリファレンスを得ました: http://camel.apache.org/multicast.html

+0

あなたはそれが実行されていない場合でも、達成したいものを表示するためにいくつかのコードをあなたの質問を編集することができ、私は従ってください終了しませんか? –

答えて

0

なぜパイプラインを使用しますか?それはデフォルトでパイプラインです。

また、すべてのlogステートメントとtransformステートメントとchoiceステートメントをマルチキャストの外部に置くこともできます。また、エンドポイントを動的に生成しているので、ヘッダーに値を入れ、動的エンドポイントにrecipientlistを使用します。マルチキャストは、ハードコードされたエンドポイント用です。次に例を示します。

<route> 
    <from uri="direct:a" /> 
    <!-- use comma as a delimiter for String based values --> 
    <recipientList delimiter=","> 
    <header>myHeader</header> 
    </recipientList> 
</route> 

http://camel.apache.org/recipient-list.html

+1

私は内部マルチキャストの下で実行されている複数のプロセスを持っています、なぜ私はパイプラインを使用したのですか? – KayV

関連する問題