2017-03-26 3 views
0

파일 처리를 위해 Spring Integration을 사용하고 있습니다. 내 구성은 다음과 같습니다통합 자 채널이 작동하지 않는 큐 채널

<int:channel id="startChannel"> 
<int:splitter input-channel="startChannel" output-channel="parseChannel" ref="splitter" method="split" /> 
<int:channel id="parseChannel"> 
    <int:queue size="50"/> 
</int:channel> 
<int:service-activator input-channel="parseChannel" output-channel="aggregatChannel" ref="process" method="process" /> 
<int:channel id="aggregateChannel"> 
    <int:queue size="50"/> 
</int:channel> 
<int:aggregate input-channel="aggregateChannel" output-channel="postProcessingChannel" ...(other attributes) /> 
<int:channel id="postProcessingChannel"> 
    <int:queue size="50"/> 
</int:channel> 
<int:channel id="outboundChannel"> 
    <int:queue size="50"/> 
</int:channel> 
<int:service-activator input-channel="postProcessingChannel" output-channel="outbound-channel" ... /> 
<int:outbound-adapter channel="outputChannel" ... /> 

..global poller 
..global taskexecutor of size 40 

내 구성은 수집기까지 잘 작동합니다. Aggregator는 postProcessingChannel에 메시지를 넣을 수 있지만 postProcessing 채널에서 읽는 사람은 없습니다.

자세히 살펴보면, - 1) 사후 처리 채널은 용량에 대한 메시지로 채워집니다. 2) 메시지는 postPostProcessing 채널에 메시지를 넣을 수 없으므로 집계 구현에서 스레드가 차단됩니다.

내 질문에 왜 스레드가 PostProcessingchannel에서 읽는 중입니까? JProfiler에서 알 수 있듯이 많은 스레드가 유휴 상태이거나 아무 것도하지 않습니다.

누군가이 문제를 이해할 수 있도록 도와주세요.

+0

아마도'postProcessingChannel'에 대한'service-activator'는'auto-startup = "false"로 표시되어 있을까요? –

+0

No..its는 기본값을 사용합니다. 구성은 애그리 게이터 전후의 서비스 활성화 자에 대해 동일합니다. –

+0

글쎄, 기본 작업 스케줄러의 크기는 10입니다. 모든 "대기열"설계처럼 모든 스케줄러 스레드가 사용 중입니다. 크기를 늘리거나 아키텍처를 다시 생각해보십시오. 큐를 어디서나 사용하지 마십시오. –

답변

0

많은 대기열 채널이 있습니다. 일반적으로 모든 채널을 대기열 채널로 만들 필요는 없습니다.

더 많은 구성이있는 경우 기본적으로 taskScheduler 빈에서 스레드 부족이 발생합니다. 기본적으로 스레드는 10 개뿐입니다.

기본적으로 각 대기열 채널이 스레드를 1 초 동안 차단하므로 (receiveTimeout) 응용 프로그램에 10 개에 가까운 대기열 채널이있는 경우 스레드가 부족합니다.

대기열 채널 수를 줄이는 것을 고려하십시오. (내가 말했듯이, 일반적으로 그렇게 많이 가질 필요가 없으므로 모든 구성 요소 사이에 다른 스레드로 전달할 필요가 없습니다).

또는 예약 된 작업에 사용 가능한 스레드를 늘리려면 Configuring the Task Scheduler을 참조하십시오.

+0

I 40 크기의 taskExecutor를 사용하고 있습니다. –

+0

저는 'taskScheduler'는 실행 프로그램이 아니라고 말했습니다. –

+0

감사합니다. –

관련 문제