2016-06-22 35 views
0

私は複数のcamelContextを作成しており、各camelContextは独自のカスタムスレッドプールを使用したいと考えています。しかし、ログには、私のすべてのcamelContextが同じスレッドプールを使用していることが表示されます。私は何が欠けていますか?キャメルのコンテキスト上のスレッドプールの設定

メインキャメルコンテキスト

<camelContext id="routeLoader_route"> 
    (no threadpool defined) 

    <route id="RouteCreator" > 
     <from uri="file://jsonFilePath" /> 
     <bean ref="routeMonitor" method="loadJsontoCreateRoute" /> 
    </route> 

    (some other routes defined) 
</camelContext> 

方法 "loadJsontoCreateRouteは" 3つのJSONファイルを読み込んで

  1. 終点 "ファイル:// XXX1 /アウト" から接続するための3つのルートを作成します。エンドポイント「direct-vm:out.test」
  2. エンドポイント「file:// xxx2/out」エンドポイント「direct-vm:out.test」
  3. e ndpoint "ファイル:// xxx3 /アウト" "直接-VMを:out.test" エンドポイントにdynamicRoute方法がFTPコンポーネント

    のURIを返します

    <camelContext id="test_out_route"> 
        <threadPoolProfile id="outTestThreadPoolProfile" defaultProfile="true" poolSize="1" maxPoolSize="1" maxQueueSize="1000" rejectedPolicy="CallerRuns"/> 
    
        <route id="outboundTestingRouter"> 
         <from uri="direct-vm:out.test"/> 
         <doTry> 
          <log message="Outbound Test -- START" loggingLevel="INFO" /> 
          <recipientList> 
           <method ref="outTestBean" method="dynamicRoute" /> 
          </recipientList> 
         <doFinally> 
          <log message="Outbound Test-- END" loggingLevel="INFO" /> 
          <stop/> 
         </doFinally> 
         </doTry> 
        </route> 
    
        (Some other routes defined) 
    </camelContext> 
    

別のラクダのコンテキスト

ログイン

20160623 09:48:04.297 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:04.524 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- END 
20160623 09:48:04.526 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:04.527 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:04.634 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- END 
20160623 09:48:04.636 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:04.652 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- END 
20160623 09:48:04.653 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:04.749 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- END 
20160623 09:48:04.749 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:04.827 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- END 
20160623 09:48:04.827 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:04.890 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- END 
20160623 09:48:04.937 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- END 
20160623 09:48:04.937 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:04.999 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- END 
20160623 09:48:05.140 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:05.358 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- END 
20160623 09:48:05.358 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:05.469 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- END 
20160623 09:48:05.471 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:05.593 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- END 
20160623 09:48:05.905 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- START 
20160623 09:48:05.999 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- END 

ライン3ログの10行目にすることは以上1つのoutboundTestingRouterのルートがあることを示し、同時に実行されているプールのサイズoutTestThreadPoolProfile私のスレッドプールが1

に制限されながら、これは、スレッドプールoutTestThreadPoolProfileがoutboundTestingRouterルート

何によって使用されていないことを示し、私が望むのは、最大値を制限することです。ルートoutboundTestingRouterの同時使用数。

答えて

0

うまくいくように見えます。ロギングステートメントはあなたのスレッドプールを使用していないと言いますか?注意すべき

もの:

1)あなたのルートは、既定のテンプレートをオフにするために、スレッドプールを活用する必要があります。

2)あなたはいつも手動に似た構文を持つ通常のコンポーネントにスレッドプールを割り当てることができます。executorServiceRef =「outTestThreadPoolProfile」が、あなたのデフォルトのスレッドプールのプロファイルが機能していない場合)あなたは、コンポーネントのドキュメント

3をチェックしてください単純に標準のThreadPoolタグを使用して、コンポーネントに直接割り当てることができる独立したスレッドプールを作成することができます。

+0

スレッドプールのサイズとログを編集して、なぜスレッドプールが使用されていないのかを説明しています。 – hk6279

+0

スレッドプールのルール構文で試し、手動でサービスエグゼキュータを提供してください。

+0

threadpoolタグをoutboundTestingRouterルートに追加した後、それが動作します。 Direct-VMコンポーネントが呼び出し側のスレッドを使用していると思うので、スレッドプールが機能しているのがわかりません。 – hk6279

関連する問題