gpt4 book ai didi

spring - (Spring 批处理)即使 JOB 成功完成,带有回复的可轮询 channel 也包含 block 响应

转载 作者:行者123 更新时间:2023-12-02 00:49:55 25 4
gpt4 key购买 nike

我有以下 block 写入器配置,可以从 Spring Batch 远程分块获取回复:

    <bean id="chunkWriter" class="org.springframework.batch.integration.chunk.ChunkMessageChannelItemWriter" scope="step">
<property name="messagingOperations" ref="messagingGateway" />
<property name="replyChannel" ref="masterChunkReplies" />
<property name="throttleLimit" value="5" />
<property name="maxWaitTimeouts" value="30000" />
</bean>

<bean id="messagingGateway" class="org.springframework.integration.core.MessagingTemplate">
<property name="defaultChannel" ref="masterChunkRequests" />
<property name="receiveTimeout" value="2000" />
</bean>

<!-- Remote Chunking Replies From Slave -->
<jms:inbound-channel-adapter id="masterJMSReplies"
destination="remoteChunkingRepliesQueue"
connection-factory="remoteChunkingConnectionFactory"
channel="masterChunkReplies">
<int:poller fixed-delay="10" />
</jms:inbound-channel-adapter>

<int:channel id="masterChunkReplies">
<int:queue />
<int:interceptors>
<int:wire-tap channel="loggingChannel"/>
</int:interceptors>
</int:channel>

我的远程分块步骤运行完美,所有数据都以非常好的性能处理,所有步骤都以 COMPLETED 状态结束。但问题是 masterChunkReplies 队列 channel 在作业结束后包含 ChunkResponses。文档没有任何说明,这是正常状态吗?

问题是我无法运行新作业,因为它随后崩溃于:

Message contained wrong job instance id ["
+ jobInstanceId + "] should have been [" + localState.getJobId() + "]."

有一个简单的解决方法,在作业开始时清理 masterChunkReplies 队列 channel ,但我不确定它是否正确......

您能澄清一下吗?

最佳答案

加里,我找到了根本原因。

在从属设备上,如果我更改以下 block 消费者 JMS 适配器:

<jms:message-driven-channel-adapter id="slaveRequests"
connection-factory="remoteChunkingConnectionFactory"
destination="remoteChunkingRequestsQueue"
channel="chunkRequests"
concurrent-consumers="10"
max-concurrent-consumers="50"
acknowledge="transacted"
receive-timeout="5000"
idle-task-execution-limit="10"
idle-consumer-limit="5"

/>

对于

<jms:inbound-channel-adapter id="jmsRequests" connection-factory="remoteChunkingConnectionFactory"
destination="remoteChunkingRequestsQueue"
channel="chunkRequests"
acknowledge="transacted"
receive-timeout="5000"
>
<int:poller fixed-delay="100"/>
</jms:inbound-channel-adapter>

然后就可以了,ma​​sterChunkReplies队列在作业结束时被完全消耗。无论如何,任何在从属设备上并行消费 chunkRequests 的尝试都是行不通的。 MasterChunkReplies 队列包含未消耗的 ChunkResponse。因此开始新工作以

结束
Message contained wrong job instance id ["
+ jobInstanceId + "] should have been [" + localState.getJobId() + "]."

Gary,这是否意味着从属设备不能并行消费 ChunkRequest?

关于spring - (Spring 批处理)即使 JOB 成功完成,带有回复的可轮询 channel 也包含 block 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34621885/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com