Spring integration MessageChannelPartitionHandler使用来自QueueChannel的第一个可用回复,因此完成了错误的作业

Spring integration MessageChannelPartitionHandler使用来自QueueChannel的第一个可用回复,因此完成了错误的作业,spring-integration,Spring Integration,我看到的问题与这里所说的相同 我有多个正在运行的作业,其中的步骤使用下面定义的相同父分区hanldler'parentPartitionHandler' 我所有的作业都有类似的配置,如下所示,第二步“studentPartitionAndProcessStep”是分区步骤 <job id="studentLoadJob" xmlns="http://www.springframework.org/schema/batch" job-repository="jobReposito

我看到的问题与这里所说的相同

我有多个正在运行的作业,其中的步骤使用下面定义的相同父分区hanldler'parentPartitionHandler'

我所有的作业都有类似的配置,如下所示,第二步“studentPartitionAndProcessStep”是分区步骤

<job id="studentLoadJob" xmlns="http://www.springframework.org/schema/batch"
     job-repository="jobRepository" restartable="true" parent="abstractJob">
    <step id="studentLoadStep" parent="parentLoadStep" next="studentPartitionAndProcessStep"/>
    <step id="studentPartitionAndProcessStep" next="studentCleanupStep">
        <partition partitioner="filePartitioner" handler="studentPartitionHandler"/>
    </step>
    <step id="studentCleanupStep" parent="parentCleanupStep"/>
</job>

<bean id="studentPartitionHandler"
      parent="parentPartitionHandler">
    <property name="stepName" value="studentPartitionStep"/>
</bean>
我在这里使用了相同的主配置

我遇到的问题是聚合器似乎正确地收集了组的消息,但在MessageChannelPartitionHandler中,下面的语句接收到第一条可用消息,而没有从消息中获取头信息

Message<Collection<StepExecution>> message = (Message<Collection<StepExecution>>) messagingGateway.receive(replyChannel);
因此,PartitionHandler处理jobExecutionA而不是jobExecutionB的结果,因此它完成了一个错误的作业

MessageChannelPartitionHandler似乎在我的配置中使用来自QueueChannel outboundReplies的回复,而不考虑correlationId,而是第一条可用的消息。它有时工作,但有时不工作,当我调试时,我发现与这里的帖子一样的事情发生在我身上

我有什么地方做错了吗?如果您需要,我可以提供更多配置

编辑: 所有网关都工作正常。我还尝试使用适配器和添加标头enricher,以便将replyChannel对象添加到标头。我添加了一个header enricher元素,但我可能用错了,因为当聚合消息hanlder抛出没有可用的outputChannel或replyChannel头时。 所有分区请求都在outboundRequests通道上发送到rabbit队列,从机将在该队列中使用来自InboundRequestsAnnel的请求,service activator在该队列中处理这些请求,并发送回outboundStaging通道上的应答队列。在主机端,聚合器从inboundStaging通道读取分区响应消息。您能指出在使用适配器时,我到底需要在哪里使用header enricher吗

<int:channel id="outboundRequests">
    <int:dispatcher task-executor="taskExecutor" failover="true"/>
</int:channel>

<int:channel id="inboundStaging"/>
<int:channel id="inboundRequests"/>
<int:channel id="outboundStaging"/>
<int:channel id="setHeaderPartionHandlerReplyChannel"/>


<int-amqp:outbound-channel-adapter
        id="filePartitionRequestOutboundGateway"
        channel="outboundRequests"
        amqp-template="rabbitTemplate"
        exchange-name="${rabbitmq.classflow.exchange}"
        routing-key="${rabbitmq.classflow.batch.partition.routingkey}"
        mapped-request-headers="*"
        />


<int-amqp:inbound-channel-adapter
        id="filePartitionRequestInboundGateway"
        concurrent-consumers="${rabbitmq.classflow.batch.partition.consumers}"
        channel="inboundRequests"
        receive-timeout="60000000"
        queue-names="${rabbitmq.classflow.batch.partition.queuename.request}"
        connection-factory="rabbitConnectionFactory"
        mapped-request-headers="*"
        />

<int:header-enricher input-channel="setHeaderPartionHandlerReplyChannel" output-channel="outboundRequests">
    <int:header-channels-to-string/>
</int:header-enricher>

<int:service-activator ref="stepExecutionRequestHandler" input-channel="inboundRequests"
                       output-channel="outboundStaging"/>


<int-amqp:outbound-channel-adapter
        id="filePartitionRepyOutboundGateway"
        channel="outboundStaging"
        amqp-template="rabbitTemplate"
        exchange-name="${rabbitmq.classflow.exchange}"
        routing-key="${rabbitmq.classflow.batch.partition.queuename.reply.routingkey}"
        mapped-request-headers="*"
 />

<int-amqp:inbound-channel-adapter
        id="filePartitionRepyInboundGateway"
        channel="inboundStaging"
        queue-names="${rabbitmq.classflow.batch.partition.queuename.reply}"
        connection-factory="rabbitConnectionFactory"
        concurrent-consumers="${rabbitmq.classflow.batch.tenant.job.consumers}"
        mapped-request-headers="*"
   />

<int:aggregator ref="parentPartitionHandler"
                send-partial-result-on-expiry="true"
                send-timeout="60000000"
                input-channel="inboundStaging"/>

<bean id="parentPartitionHandler"
      class="org.springframework.batch.integration.partition.MessageChannelPartitionHandler">
    <property name="gridSize" value="3"/>
    <property name="messagingOperations">
        <bean class="org.springframework.integration.core.MessagingTemplate">
            <property name="defaultChannel" ref="setHeaderPartionHandlerReplyChannel"/>
            <property name="receiveTimeout" value="60000000"/>
        </bean>
    </property>
    <property name="stepName" value="parentPartitionStep"/>
</bean>
日志记录:

13:46:09.566[SimpleAsyncTaskExecutor-1]调试o.s.b.i.p.MessageChannelPartitionHandler-发送请求:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={replyChannel=org.springframework.integration.channel。QueueChannel@f89f170,correlationId=56:studentPartitionStep,sequenceSize=1,sequenceNumber=0,id=b39d71de-b469-667f-2d77-e59db6e0e25a,timestamp=1425494769566}]MessageChannelPartitionHandler.java:222 13:46:09.566[SimpleAsyncTaskExecutor-1]调试o.s.i.channel.DirectChannel-在通道“SetHeaderPartitionHandlerReplyChannel”上显示,消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={replyChannel=org.springframework.integration.channel。QueueChannel@f89f170,correlationId=56:studentPartitionStep,sequenceSize=1,sequenceNumber=0,id=b39d71de-b469-667f-2d77-e59db6e0e25a,时间戳=1425494769566}]AbstractMessageChannel.java:334 13:46:09.567[SimpleAsyncTaskExecutor-1]调试o.s.i.channel.DirectChannel-在通道“loggerChannel”上显示,消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={replyChannel=org.springframework.integration.channel。QueueChannel@f89f170,correlationId=56:studentPartitionStep,sequenceSize=1,sequenceNumber=0,id=b39d71de-b469-667f-2d77-e59db6e0e25a,时间戳=1425494769566}]AbstractMessageChannel.java:334 13:46:09.567[SimpleAsyncTaskExecutor-1]调试o.s.i.handler.LoggingHandler-org.springframework.integration.handler.LoggingHandler0收到消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[作业执行ID=56,stepExecutionId=269,stepName=studentPartitionStep]]={replyChannel=org.springframework.integration.channel。QueueChannel@f89f170,correlationId=56:studentPartitionStep,sequenceSize=1,sequenceNumber=0,id=b39d71de-b469-667f-2d77-e59db6e0e25a,timestamp=1425494769566}]AbstractMessageHandler.java:72 13:46:09.568[SimpleAsyncTaskExecutor-1]调试o.s.i.handler.LoggingHandler-[Payload StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep][标题]={replyChannel=org.springframework.integration.channel。QueueChannel@f89f170,correlationId=56:studentPartitionStep,sequenceSize=1,sequenceNumber=0,id=b39d71de-b469-667f-2d77-e59db6e0e25a,timestamp=1425494769566}]LoggingHandler.java:160 13:46:09.568[SimpleAsyncTaskExecutor-1]调试o.s.i.channel.DirectChannel-postSend sent=true(在通道“loggerChannel”上),消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={replyChannel=org.springframework.integration.channel。QueueChannel@f89f170,correlationId=56:studentPartitionStep,sequenceSize= 1,sequenceNumber=0,id=b39d71de-b469-667f-2d77-e59db6e0e25a,时间戳=1425494769566}]AbstractMessageChannel.java:349 13:46:09.568[SimpleAsyncTaskExecutor-1]调试o.s.i.t.MessageTransformingHandler-org.springframework.integration.transformer.MessageTransformingHandler0收到的消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[作业执行ID=56,stepExecutionId=269,stepName=studentPartitionStep]]={replyChannel=org.springframework.integration.channel。QueueChannel@f89f170,correlationId=56:studentPartitionStep,sequenceSize=1,sequenceNumber=0,id=b39d71de-b469-667f-2d77-e59db6e0e25a,timestamp=1425494769566}]AbstractMessageHandler.java:72 13:46:09.568[SimpleAsyncTaskExecutor-1]调试o.s.b.f.s.DefaultListableBeanFactory-返回单例bean“integrationEvaluationContext”AbstractBeanFactory的缓存实例。java:247 13:46:09.570[SimpleAsyncTaskExecutor-1]调试o.s.b.f.s.DefaultListableBeanFactory-返回singleton bean'IntegrationHeaderChannel Registry'AbstractBeanFactory的缓存实例。java:247 13:46:09.572[SimpleAsyncTaskExecutor-1]调试o.s.i.c.DefaultHeaderChannel注册表-注册的org.springframework.integration.channel。QueueChannel@f89f170同于771064f6-d5ae-4f50-b827-00c225a36c86:1 defaultheaderChannel注册表。java:167 13:46:09.572[SimpleAsyncTaskExecutor-1]调试o.s.b.f.s.DefaultListableBeanFactory-返回单例bean“integrationEvaluationContext”AbstractBeanFactory的缓存实例。java:247 13:46:09.572[SimpleAsyncTaskExecutor-1]调试o.s.b.f.s.DefaultListableBeanFactory-返回单例bean“IntegrationHeaderChannel注册表”AbstractBeanFactory的缓存实例。java:247 13:46:09.573[SimpleAsynctaskeExecutor-1]调试o.s.i.t.MessageTransformingHandler-handler'org.springframework.integration.transformer.MessageTransformingHandler0'发送回复消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[作业执行ID=56,stepExecutionId=269,stepName=studentPartitionStep]]={correlationId=56:studentPartitionStep,replyChannel=771064f6-d5ae-4f50-b827-00c225a36c86:1,sequenceSize=1,sequenceNumber=0,id=77608d25-cff4-4f3d-9f60-829f05f7bd6f,时间戳=1425494769573}AbstractReplyProducingMessageHandler.java:238 13:46:09.573[SimpleAsyncTaskExecutor-1]调试o.s.i.channel.ExecutionChannel-在通道“outboundRequests”上显示,消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={correlationId=56:studentPartitionStep,replyChannel=771064f6-d5ae-4f50-b827-00c225a36c86:1,sequenceSize=1,sequenceNumber=0,id=77608d25-cff4-4f3d-9f60-829f05f7bd6f,时间戳=1425494769573}AbstractMessageChannel.java:334 13:46:09.574[SimpleAsyncTaskExecutor-1]调试o.s.i.channel.DirectChannel-在通道“loggerChannel”上显示,消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={correlationId=56:studentPartitionStep,replyChannel=771064f6-d5ae-4f50-b827-00c225a36c86:1,sequenceSize=1,sequenceNumber=0,id=77608d25-cff4-4f3d-9f60-829f05f7bd6f,时间戳=1425494769573}AbstractMessageChannel.java:334 13:46:09.574[SimpleAsynctaskeExecutor-1]调试o.s.i.handler.LoggingHandler-org.springframework.integration.handler.LoggingHandler0收到消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={correlationId=56:studentPartitionStep,replyChannel=771064f6-d5ae-4f50-b827-00c225a36c86:1,sequenceSize=1,sequenceNumber=0,id=77608d25-cff4-4f3d-9f60-829f05f7bd6f,时间戳=1425494769573}AbstractMessageHandler.java:72 13:46:09.574[SimpleAsyncTaskExecutor-1]调试o.s.i.handler.LoggingHandler-[Payload StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep][标题]={correlationId=56:studentPartitionStep,replyChannel=771064f6-d5ae-4f50-b827-00c225a36c86:1,sequenceSize=1,sequenceNumber=0,id=77608d25-cff4-4f3d-9f60-829f05f7bd6f,时间戳=1425494769573}LoggingHandler.java:160 13:46:09.574[SimpleAsyncTaskExecutor-1]调试o.s.i.channel.DirectChannel-postSend sent=true(在通道“loggerChannel”上),消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={correlationId=56:studentPartitionStep,replyChannel=771064f6-d5ae-4f50-b827-00c225a36c86:1,sequenceSize=1,sequenceNumber=0,id=77608d25-cff4-4f3d-9f60-829f05f7bd6f,时间戳=1425494769573}AbstractMessageChannel.java:349 13:46:09.575[SimpleAsynctaskeExecutor-1]调试o.s.i.channel.ExecutionChannel-postSend sent=true(在通道“outboundRequests”上),消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]][标头={相关性] Id=56:studentPartitionStep,replyChannel=771064f6-d5ae-4f50-b827-00c225a36c86:1,sequenceSize=1,sequenceNumber=0,Id=77608d25-cff4-4f3d-9f60-829f05f7bd6f,时间戳=1425494769573}]AbstractMessageChannel.java:349 13:46:09.575[taskExecutor-3]调试o.s.i.a.o.AMQOutboundEndpoint-org.springframework.integration.amqp.outbound.AMQOutboundEndpoint0收到消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[作业执行ID=56,stepExecutionId=269,stepName=studentPartitionStep]]={correlationId=56:studentPartitionStep,replyChannel=771064f6-d5ae-4f50-b827-00c225a36c86:1,sequenceSize=1,sequenceNumber=0,id=77608d25-cff4-4f3d-9f60-829f05f7bd6f,时间戳=1425494769573}AbstractMessageHandler.java:72 13:46:09.577[SimpleAsyncTaskExecutor-1]调试o.s.i.channel.DirectChannel-postSend sent=true,在通道“SetHeaderPartitionHandlerReplyChannel”上,消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={replyChannel=org.springframework.integration.channel。QueueChannel@f89f170,correlationId=56:studentPartitionStep,sequenceSize=1,sequenceNumber=0,id=b39d71de-b469-667f-2d77-e59db6e0e25a,时间戳=1425494769566}]AbstractMessageChannel.java:349 13:46:09.578[taskExecutor-3]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[correlationId]将被映射,匹配模式=*AbstractHeaderMapper.java:240 13:46:09.578[taskExecutor-3]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[sequenceSize]将被映射,匹配模式=*AbstractHeaderMapper.java:240 13:46:09.578[taskExecutor-3]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[sequenceNumber]将被映射,匹配的模式=*AbstractHeaderMapper.java:240 13:46:09.579[taskExecutor-3]调试o.s.amqp.rabbit.core.RabbitTemplate-在RabbitMQ通道上执行回调:缓存的兔子通道:AMQChannelamqp://localuser@127.0.0.1:5672/activfounlocal,13 RabbitTemplate.java:1043 13:46:09.579[taskExecutor-3]调试o.s.amqp.rabbit.core.RabbitTemplate-在exchange上发布消息[classflow.topic],routingKey=[partition.request.]RabbitTemplate.java:1071 13:46:09.579[taskExecutor-3]调试o.s.i.a.o.AMQOutboundEndpoint-handler'org.springframework.integration.amqp.outbound.AMQOutboundEndpoint0'未对请求消息生成任何答复:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={correlationId=56:studentPartitionStep,replyChannel=771064f6-d5ae-4f50-b827-00c225a36c86:1,sequenceSize=1,sequenceNumber=0,id=77608d25-cff4-4f3d-9f60-829f05f7bd6f,时间戳=1425494769573}AbstractReplyProducingMessageHandler.java:184 13:46:09.580[SimpleAsyncTaskExecutor-1]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[amqp_ReceivedDrootingKey]将被映射,匹配模式=AbstractHeaderMapper.java:240 13:46:09.580[SimpleAsynctaskeExecutor-1]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[amqp_deliveryMode]将被映射,匹配模式=*AbstractHeaderMapper.java:240 13:46:09.580[SimpleAsyncTaskExecutor-1]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[amqp_receivedExchange]将被映射,匹配模式=*AbstractHeaderMapper.java:240 13:46:09.580[SimpleAsyncTaskExecutor-1]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[contentType]将被映射,匹配的模式=*AbstractHeaderMapper.java:240 13:46:09.581[SimpleAsynctaskeExecutor-1]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[amqp_redelivered]将被映射,匹配模式=*AbstractHeaderMapper.java:240 13:46:09.581[SimpleAsynctaskeExecutor-1]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[amqp_deliveryTag]将被映射,匹配模式=*AbstractHeaderMapper.java:240 13:46:09.581[SimpleAsyncTaskExecutor-1]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[correlationId]将被映射,匹配的模式=*AbstractHeaderMapper.java:240 13:46:09.581[SimpleAsyncTaskExecutor-1]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[sequenceSize]将被映射,匹配的模式=*AbstractHeaderMapper.java:240 13:46:09.581[SimpleAsyncTaskExecutor-1]调试o.s.i.a.s.DefaultAmqpHeaderMapper-headerName=[sequenceNumber]将被映射,匹配的模式=*AbstractHeaderMapper.java:240 13:46:09.581[SimpleAsyncTaskExecutor-1]调试o.s.i.channel.DirectChannel-在通道“inboundRequests”上显示,消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={amqp_ReceivedUseringKey=partition.request.,amqp_deliveryMode=PERSISTENT,correlationId=56:studentPartitionStep,sequenceSize=1,amqp_receivedExchange=classflow.topic,contentType=application/x-java-serialized-object,amqp_redelivered=false,amqp_deliveryTag=1,sequenceNumber=0,id=e51f8ed9-03df-0f90-b9c2-c3542bda76c6,时间戳=1425494769581}]AbstractMessageChannel.java:334 13:46 :09.581[SimpleAsyncTaskExecutor-1]调试o.s.i.channel.DirectChannel-在通道“loggerChannel”上显示,消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[作业执行ID=56,stepExecutionId=269,stepName=studentPartitionStep]]={amqp_ReceivedUseringKey=partition.request.,amqp_deliveryMode=PERSISTENT,correlationId=56:studentPartitionStep,sequenceSize=1,amqp_receivedExchange=classflow.topic,contentType=application/x-java-serialized-object,amqp_redelivered=false,amqp_deliveryTag=1,sequenceNumber=0,id=e51f8ed9-03df-0f90-b9c2-c3542bda76c6,时间戳=1425494769581}]AbstractMessageChannel.java:334 13:46:09.581[SimpleAsynctaskeExecutor-1]调试o.s.i.handler.LoggingHandler-org.springframework.integration.handler.LoggingHandler0收到消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={amqp_ReceivedUseringKey=partition.request.,amqp_deliveryMode=PERSISTENT,correlationId=56:studentPartitionStep,sequenceSize=1,amqp_receivedExchange=classflow.topic,contentType=application/x-java-serialized-object,amqp_redelivered=false,amqp_deliveryTag=1,sequenceNumber=0,id=e51f8ed9-03df-0f90-b9c2-c3542bda76c6,时间戳=1425494769581}]AbstractMessageHandler.java:72 13:46:09.582[SimpleAsyncTaskExecutor-1]调试o.s.i.handler.LoggingHandler-[Payload StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep][标题]={amqp_ReceivedUseringKey=partition.request.,amqp_deliveryMode=PERSISTENT,correlationId=56:studentPartitionStep,sequenceSize=1,amqp_receivedExchange=classflow.topic,contentType=application/x-java-serialized-object,amqp_redelivered=false,amqp_deliveryTag=1,sequenceNumber=0,id=e51f8ed9-03df-0f90-b9c2-c3542bda76c6,时间戳=1425494769581}]java:160 13:46:09.582[SimpleAsyncTaskExecutor-1]调试o.s.i.channel.DirectChannel-postSend sent=true(在通道“loggerChannel”上),消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]]={amqp_ReceivedUseringKey=partition.request.,amqp_deliveryMode=PERSISTENT,correlationId=56:studentPartitionStep,sequenceSize=1,amqp_receivedExchange=classflow.topic,contentType=application/x-java-serialized-object,amqp_redelivered=false,amqp_deliveryTag=1,sequenceNumber=0,id=e51f8ed9-03df-0f90-b9c2-c3542bda76c6,时间戳=1425494769581}]AbstractMessageChannel.java:349 13:46:09.582[SimpleAsyncTaskExecutor-1]调试o.s.i.h.ServiceActivationHandler-ServiceActivator for[org.springframework.integration.handler]。MethodInvokingMessageProcessor@d15c892]收到的消息:[有效负载StepExecutionRequest内容=StepExecutionRequest:[jobExecutionId=56,stepExecutionId=269,stepName=studentPartitionStep]][Headers={amqp_ReceivedUseringKey=partition.request.,amqp_deliveryMode=PERSISTENT,correlationId=56:studentPartitionStep,sequenceSize=1,amqp_receivedExchange=classflow.topic,contentType=application/x-java-serialized-object,amqp_redelivered=false,amqp_deliveryTag=1,sequenceNumber=0,id=e51f8ed9-03df-0f90-b9c2-c3542bda76c6,时间戳=1425494769581}]AbstractMessageHandler.java:72 13:46:09.599[SimpleAsyncTaskExecutor-1]调试o.s.b.f.s.DefaultListableBeanFactory-返回singleton bean'studentPartitionStep'AbstractBeanFactory的缓存实例。java:247 13:46:09.658[SimpleAsynctaskeExecutor-1]调试o.s.b.f.s.DefaultListableBeanFactory-返回singleton bean的缓存实例'org.springframework.transaction.config.internalTransactionAdvisor'AbstractBeanFactory.java:247 13:46:09.659[SimpleAsyncTaskExecutor-1]调试o.s.batch.core.step.AbstractStep-执行:id=269 AbstractStep.java:183

谢谢
Mallikarjun

这在Spring Batch 3.0.3中是固定的,只要不将特定的replyChannel注入分区处理程序

spring批处理集成现在是main的一部分

编辑

回应您上次关于使用适配器而不是网关的评论

是;网关负责保持replyChannel标头的完整性。使用适配器时需要一些额外的配置:

添加一个带有元素see的header enricher;这会将live header通道对象转换为通道注册表的键。 配置适配器以映射replyChannel标头,例如映射的请求标头=*。
网关不需要这样做,因为它在收到回复时保存了对出站消息的引用。

我将spring batch版本从3.0.1更改为3.0.3。我在上面的帖子中注释掉了分区处理程序中的replyChanel引用。现在的问题是,分区处理程序会无限期地等待,并且不会返回在receivecurrentReplyChannel上。我验证了聚合器已处理组并将消息回复到outputChannel“outboundReplies”,但我从分区处理程序对此进行了评论。请不要
在注释中添加代码;无法阅读-请改为编辑您的问题。从聚合器中删除输出通道在您链接到的示例中没有输出通道,聚合器将自动将应答返回到分区处理程序中的内部应答通道。对不起,在上面发布的配置中,我使用的是带有输出通道的聚合器。是的,我引用的帖子没有使用它。我将从配置中删除输出通道并重试。您好,从聚合器AbstractMessageHandler中删除输出通道后,handleMessage不会抛出可用的outputChannel或replyChannel标头。。我是否需要添加replyChaneel作为标题的一部分?否;这意味着您不知何故丢失了内部回复通道——如果您使用的是Michael的配置,则不应发生这种情况;如果使用当前配置编辑问题,可能会更好。
Message<Collection<StepExecution>> message = (Message<Collection<StepExecution>>) messagingGateway.receive(replyChannel);
<int:channel id="outboundRequests">
    <int:dispatcher task-executor="taskExecutor" failover="true"/>
</int:channel>

<int:channel id="inboundStaging"/>
<int:channel id="inboundRequests"/>
<int:channel id="outboundStaging"/>
<int:channel id="setHeaderPartionHandlerReplyChannel"/>


<int-amqp:outbound-channel-adapter
        id="filePartitionRequestOutboundGateway"
        channel="outboundRequests"
        amqp-template="rabbitTemplate"
        exchange-name="${rabbitmq.classflow.exchange}"
        routing-key="${rabbitmq.classflow.batch.partition.routingkey}"
        mapped-request-headers="*"
        />


<int-amqp:inbound-channel-adapter
        id="filePartitionRequestInboundGateway"
        concurrent-consumers="${rabbitmq.classflow.batch.partition.consumers}"
        channel="inboundRequests"
        receive-timeout="60000000"
        queue-names="${rabbitmq.classflow.batch.partition.queuename.request}"
        connection-factory="rabbitConnectionFactory"
        mapped-request-headers="*"
        />

<int:header-enricher input-channel="setHeaderPartionHandlerReplyChannel" output-channel="outboundRequests">
    <int:header-channels-to-string/>
</int:header-enricher>

<int:service-activator ref="stepExecutionRequestHandler" input-channel="inboundRequests"
                       output-channel="outboundStaging"/>


<int-amqp:outbound-channel-adapter
        id="filePartitionRepyOutboundGateway"
        channel="outboundStaging"
        amqp-template="rabbitTemplate"
        exchange-name="${rabbitmq.classflow.exchange}"
        routing-key="${rabbitmq.classflow.batch.partition.queuename.reply.routingkey}"
        mapped-request-headers="*"
 />

<int-amqp:inbound-channel-adapter
        id="filePartitionRepyInboundGateway"
        channel="inboundStaging"
        queue-names="${rabbitmq.classflow.batch.partition.queuename.reply}"
        connection-factory="rabbitConnectionFactory"
        concurrent-consumers="${rabbitmq.classflow.batch.tenant.job.consumers}"
        mapped-request-headers="*"
   />

<int:aggregator ref="parentPartitionHandler"
                send-partial-result-on-expiry="true"
                send-timeout="60000000"
                input-channel="inboundStaging"/>

<bean id="parentPartitionHandler"
      class="org.springframework.batch.integration.partition.MessageChannelPartitionHandler">
    <property name="gridSize" value="3"/>
    <property name="messagingOperations">
        <bean class="org.springframework.integration.core.MessagingTemplate">
            <property name="defaultChannel" ref="setHeaderPartionHandlerReplyChannel"/>
            <property name="receiveTimeout" value="60000000"/>
        </bean>
    </property>
    <property name="stepName" value="parentPartitionStep"/>
</bean>