首页 文章

使用持久订阅者的Spring批量分区作业

提问于
浏览
2

我们在10服务器JBoss EAP 5.2集群中使用Spring Batch和作业分区 . 由于JBoss消息传递中存在问题,我们需要使用分区步骤的回复消息主题 . 一直都工作正常,直到我们看到JBoss Messaging出现故障(在启动作业的服务器上)并将其从集群中删除 . 它恢复但主分区不会接收从分区步骤发送的消息 . 我在JMX-Console中看到主题中的消息,但也看到订阅和消息是非持久的 . 因此,我想将分区步骤的通信回复到持久订阅中 . 我似乎无法以文档的方式来做到这一点 . 这是我当前对分区步骤和关联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>

1 回答

  • 1

    继迈克尔的评论;目前没有办法为 <reply-listener/> 配置主题 - 它预计会有这个要求 .

    随意打开JIRA Issue against Spring Integration .

    另一种方法是连接请求的出站通道适配器和回复的入站通道适配器 . 但是,在执行此操作时需要对 replyChannel 标头进行一些特殊处理 - 请参阅the docs here for more information about that .

相关问题