Spring integration 使用持久订户的Spring批处理分区作业

Spring integration 使用持久订户的Spring批处理分区作业,spring-integration,spring-batch,spring-jms,Spring Integration,Spring Batch,Spring Jms,我们在10服务器JBoss EAP 5.2集群中使用Spring批处理和作业分区。由于JBoss消息传递中的一个问题,我们需要为分区步骤中的回复消息使用一个主题。在我们看到JBoss消息传递出现故障(在启动作业的服务器上)并将其从集群中删除之前,一切都很正常。它会恢复,但主分区不会拾取从分区步骤发送的消息。我在JMX控制台中看到主题中的消息,但也看到订阅和消息是不持久的。因此,我希望将分区步骤应答的通信转换为持久订阅。我似乎无法用一个文档的方式来实现这一点。这是我对分区步骤和关联bean的当前配

我们在10服务器JBoss EAP 5.2集群中使用Spring批处理和作业分区。由于JBoss消息传递中的一个问题,我们需要为分区步骤中的回复消息使用一个主题。在我们看到JBoss消息传递出现故障(在启动作业的服务器上)并将其从集群中删除之前,一切都很正常。它会恢复,但主分区不会拾取从分区步骤发送的消息。我在JMX控制台中看到主题中的消息,但也看到订阅和消息是不持久的。因此,我希望将分区步骤应答的通信转换为持久订阅。我似乎无法用一个文档的方式来实现这一点。这是我对分区步骤和关联bean的当前配置

入站网关配置

<int:channel id="springbatch.slave.jms.request"/>
<int:channel id="springbatch.slave.jms.response" />

<int-jms:inbound-gateway 
    id="springbatch.master.inbound.gateway" 
    connection-factory="springbatch.listener.jmsConnectionFactory" 
    request-channel="springbatch.slave.jms.request" 
    request-destination="springbatch.partition.jms.requestsQueue" 
    reply-channel="springbatch.slave.jms.response" 
    concurrent-consumers="${springbatch.partition.concurrent.consumers}" 
    max-concurrent-consumers="${springbatch.partition.concurrent.maxconsumers}"
    max-messages-per-task="${springbatch.partition.concurrent.maxmessagespertask}"
    reply-time-to-live="${springbatch.partition.reply.time.to.live}"
    /> 
<int:channel id="jms.requests">
    <int:dispatcher task-executor="springbatch.partitioned.jms.taskExecutor" />
</int:channel>
<int:channel id="jms.reply" />

<int-jms:outbound-gateway id="outbound-gateway"
    auto-startup="false" connection-factory="springbatch.jmsConnectionFactory"
    request-channel="jms.requests"
    request-destination="springbatch.partition.jms.requestsQueue"
    reply-channel="jms.reply"
    reply-destination="springbatch.partition.jms.repliesQueue"
    correlation-key="JMSCorrelationID">
    <int-jms:reply-listener />
</int-jms:outbound-gateway>

</code>

出站网关配置

<int:channel id="springbatch.slave.jms.request"/>
<int:channel id="springbatch.slave.jms.response" />

<int-jms:inbound-gateway 
    id="springbatch.master.inbound.gateway" 
    connection-factory="springbatch.listener.jmsConnectionFactory" 
    request-channel="springbatch.slave.jms.request" 
    request-destination="springbatch.partition.jms.requestsQueue" 
    reply-channel="springbatch.slave.jms.response" 
    concurrent-consumers="${springbatch.partition.concurrent.consumers}" 
    max-concurrent-consumers="${springbatch.partition.concurrent.maxconsumers}"
    max-messages-per-task="${springbatch.partition.concurrent.maxmessagespertask}"
    reply-time-to-live="${springbatch.partition.reply.time.to.live}"
    /> 
<int:channel id="jms.requests">
    <int:dispatcher task-executor="springbatch.partitioned.jms.taskExecutor" />
</int:channel>
<int:channel id="jms.reply" />

<int-jms:outbound-gateway id="outbound-gateway"
    auto-startup="false" connection-factory="springbatch.jmsConnectionFactory"
    request-channel="jms.requests"
    request-destination="springbatch.partition.jms.requestsQueue"
    reply-channel="jms.reply"
    reply-destination="springbatch.partition.jms.repliesQueue"
    correlation-key="JMSCorrelationID">
    <int-jms:reply-listener />
</int-jms:outbound-gateway>

</code>


迈克尔的评论;目前没有办法为
配置主题-在请求/回复场景中使用主题是非常罕见的,我们没有预料到这一需求

请随便开一家店


另一种方法是为请求连接出站通道适配器,为应答连接入站通道适配器。但是,执行此操作时需要对
replyChannel
标题进行一些特殊处理-请参阅。

您使用的是哪个版本的Spring Batch?最新版本不需要返回消息,如果这是一个更好的选择,可以轮询作业存储库。我们正在运行Spring Batch 2.2.7。最近的版本,我想你指的是3.x。从2.2.7升级到3.0的工作量是多少?从2.2.x升级到3.x的工作量应该很小,因为唯一主要的新功能是实现JSR-352。在3.x版本中,除此之外没有什么其他的事情发生。在我的脑海中,我知道你需要升级模式版本…除此之外,我不会期望任何惊天动地的事情。我正在升级SpringBatch(和SpringCore)。您是否有显示存储库轮询而不是回复消息的示例配置?我查看了3.0.6的文档和示例作业。我不确定如何配置以使用不同的侦听器。您是否仍然使用入站和出站网关,但不配置回复通道并指定不同于replyListener的侦听器?