2016-06-22 5 views
0

여러 개의 camelContext가 생성되었으며 각각의 camelContext에서 고유 한 사용자 정의 스레드 풀을 사용하고자합니다. 그러나 로그에는 내 모든 camelContext가 동일한 스레드 풀을 사용하고 있음을 보여줍니다. 내가 뭘 놓치고 있니?카멜 컨텍스트의 스레드 풀 구성

홈페이지 낙타는 방법 "loadJsontoCreateRoute는"세 JSON 파일을 읽고 다음 세 가지 경로를 생성합니다

<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> 

상황이

  1. 엔드 포인트에서 연결 "파일 : // XXX1 인/아웃" 엔드 포인트 "direct-vm : out.test"
  2. 엔드 포인트 "file : // xxx2/out"엔드 포인트 "direct-vm : out.test"
  3. 전자 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 호선 로그가 풀 크기 outTestThreadPoolProfile 내 스레드 1

에 한계가있는 동안 1 개 이상 outboundTestingRouter 경로가 동시에 실행되고 있다는 것을 보여줍니다의 10 라인이 스레드 풀의 outTestThreadPoolProfile이 outboundTestingRouter 경로에서 사용하지 않는 것을 나타냅니다

무엇 내가 원하는 것은 최대를 제한하는 것입니다. 경로 outboundTestingRouter의 동시 사용 수입니다.

답변

0

흠! 로깅 성명서가 귀하의 쓰레드 풀을 사용하지 않는다고 말하는 것은 어떻습니까?

유의할 것들 :

1) 귀하의 경로는 기본 템플릿의 떨어져 만들 수있는 스레드 풀을 활용해야합니다.

2) 당신은 항상 수동으로 일반적으로 유사 구문을 사용하여 구성 요소에 스레드를 할당 할 수 있습니다 프로필 스레드 기본가 작동하지 않는 경우 executorServiceRef = "outTestThreadPoolProfile"하지만 당신이 구성 요소의 설명서

3)을 확인하기 단순히 표준 ThreadPool 태그를 사용하여 구성 요소에 직접 할당 할 수있는 격리 된 스레드 풀을 만들 수 있습니다.

+0

스레드 풀 크기와 로그를 편집하여 왜 스레드 풀이 사용되고 있지 않은지 설명합니다. – hk6279

+0

스레드 풀 규칙 구문을 시도하고 수동으로 서비스 실행 프로그램을 제공하십시오.

+0

threadpool 태그를 outboundTestingRouter 경로에 추가 한 후 작동합니다. 직접적인 VM 구성 요소가 호출자 스레드를 사용하고 있다고 생각합니다. 그 이유는 스레드 풀이 작동하고있는 것을 볼 수없는 이유입니다. – hk6279