0
votes

I am migrating Spring Batch Partition Jobs with XML configuration to Spring batch 4.x. I am trying to take advantage to an improvement in the MessageChannelPartitionHandler where it looks for completion of remote steps with both a reply channel and a datasource polling.

When I use this configuration:

<int:channel id="partitioned.jms.requests">
            <int:dispatcher task-executor="springbatch.partitioned.jms.taskExecutor"/>    
</int:channel>
<int:channel id="partitioned.jms.reply" />

    <bean id="partitioned.jms.handler" class="org.springframework.batch.integration.partition.MessageChannelPartitionHandler">
        <property name="messagingOperations">
            <bean class="org.springframework.integration.core.MessagingTemplate">
                <property name="defaultChannel" ref="partitioned.jms.requests"/>
            </bean>
        </property>
        <property name="stepName" value="process.partitioned.step"/>        
        <property name="gridSize" value="${process.step.partitioned.gridSize}"/>        
        <property name="dataSource" ref="springbatch.repositoryDataSource" />
        <property name="pollInterval" value="${springbatch.partition.verification.interval}"/>          
    </bean>

The step completes but I see an error in the logs.

no output-channel or replyChannel header available

I looked at the class and see I can add a replyChannel property to the MessageChannelPartitionHandler class. If I add the following:

<property name="replyChannel" ref="claim.acp.process.partitioned.jms.reply"/>      

I get error back that a pollable channel is needed.

How do I create a pollable channel (assuming from the same JMS queue)?

1

1 Answers

0
votes

You need to show the rest of your configuration.

If you are using DB polling for the results, set the output-channel on the jms outbound gateway to "nullChannel" and the replies received over JMS will be discarded.

Or, use an outbound channel adapter (instead of a gateway) (and an inbound-channel-adapter on the slaves). That avoids the replies being returned altogether.

You have to set pollRepositoryForResults to true.

To answer your specific question

<int:channel id="replies>
    <int:queue />
<int:channel>