This issue was initially discussed here:
Partitioned jobs using reply destination
However, I want to clarify what I am seeing. First of all, this is for a system with 40+ partitioned jobs operating on a multiple server cluster. The configuration of the inbound gateway now is:
<int-jms:inbound-gateway id="springbatch.inbound.gateway"
connection-factory="springbatch.jmsConnectionFactory"
request-channel="springbatch.slave.jms.request"
request-destination="requestsQueue"
reply-channel="springbatch.slave.jms.response"
concurrent-consumers="2"
max-concurrent-consumers="2"/>
The outbound gateway is:
<int-jms:outbound-gateway
id="outbound-gateway-1"
auto-startup="false"
connection-factory="jmsConnectionFactory"
request-channel="partitioned.jms.requests"
request-destination="jms.requestsQueue"
reply-channel="partitioned.jms.reply"
reply-destination="jms.repliesQueue"
correlation-key="JMSCorrelationID">
<int-jms:reply-listener/>
</int-jms:outbound-gateway>
Then I added a job listener to start and stop the outbound gateway on job start and stop. When I start the system up, the JBoss JMX Console shows that there are 2 consumers on the request queue and no consumers on the response queue as expected.
When the partitioned job is started, the job listener calls start on the gateway and I see it added as a handler. Then another handler is also added ( a BridgeHandler
from replyListener
??) and the reply queue now show 2 consumers on the reply queue. The messages are sent, processed, response returned, and picked up by the gateway reply listener and the job completes.The listener then calls stop on the gateway and it is removed as a handler. The reply queue still has the one 1 extra consumer.
If I try to run the partitioned job a second time, the listener calls start on the gateway and there are 2 consumers on the reply queue. The messages are sent, processed, response returned. The messages appear in the reply queue but they are never picked up and the job hangs.
So, it appears that the stopping and starting of the outbound gateway may not be enough.
- If the extra handler is from the replyListener, then does the job listener also need to stop and start it?
- If the extra handler is from something else, how can I control it?
- How can I further isolate and resolve the problem?
Thanks