spring-integration - Spring Batch 从 2.2 迁移到 4.x(分区作业的 XML 配置)
问题描述
我正在将带有 XML 配置的 Spring Batch 分区作业迁移到 Spring batch 4.x。我试图利用 MessageChannelPartitionHandler 的改进,它通过回复通道和数据源轮询来查找远程步骤的完成。
当我使用此配置时:
<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>
该步骤已完成,但我在日志中看到错误。
no output-channel or replyChannel header available
我查看了该类,发现我可以向 MessageChannelPartitionHandler 类添加一个 replyChannel 属性。如果我添加以下内容:
<property name="replyChannel" ref="claim.acp.process.partitioned.jms.reply"/>
我收到错误提示需要可轮询通道。
如何创建可轮询通道(假设来自同一个 JMS 队列)?
解决方案
您需要显示其余的配置。
如果您对结果使用 DB 轮询,请将output-channel
jms 出站网关上的设置为"nullChannel"
,通过 JMS 收到的回复将被丢弃。
或者,使用出站通道适配器(而不是网关)(以及从站上的入站通道适配器)。这样可以避免完全返回答复。
您必须设置pollRepositoryForResults
为true
.
回答您的具体问题
<int:channel id="replies>
<int:queue />
<int:channel>
推荐阅读
- javascript - 将事件侦听器添加到动态表中的每一行?
- javascript - 为 javascript 创建 Repl.it 布尔函数时出现问题
- c# - 在从不重新分配字段的情况下复制方法主体中的字段引用以读取它有什么好处?
- django - 如何在 Django 和 Python 中使用 JWT(JSON Web 令牌)来创建用于注册和登录的 REST API
- ajax - Laravel BadMethodCallException:方法 [signdoc] 不存在
- python - 对于训练和验证集,CNN 模型的准确度永远不会很高
- amazon-dynamodb - 是否可以在 DynamoDBMapper 保存表达式中使用“ADD”函数
- wpf - WPF OnKeyDown Alt+Key 组合产生哔声
- mysql - MySQL (InnoDB) 死锁
- c++ - C ++矩阵 - 获取最低值与其后列中的最高值在同一行中的列数