我在我的项目中使用spring集成。以下是我的应用程序中的流程。我什么时候发布消息给" domainEventChannel" ,它通过变压器,然后消息被发送到 inputFromTransformer 通道,并由此消息在链中它通过分离器,变换器和过滤器。我已经配置了 output-channel =" domainEventQueueChannel" ,这是一个队列频道。
我能够跟踪消息直到过滤器,但它们永远不会到达QueueChannel。
我是否可以从链中向队列通道发送消息?
<int:transformer ref="partitionlessTransformer" method="transform"
input-channel="domainEventChannel" output-channel="inputFromTransformer" />
<!-- Chain which has the output channel as queue channel-->
<int:chain input-channel="inputFromTransformer"
output-channel="domainEventQueueChannel">
<int:splitter ref="messageSplitter" method="split" />
<int:transformer ref="jsonToObjectTransformer" />
<int:filter ref="autopayModelProcessTransFilter"></int:filter>
</int:chain>
<!-- Queue Channel-->
<int:channel id="domainEventQueueChannel">
<int:queue capacity="10" />
</int:channel>
<!-- service activator which polls queueChannel -->
<int:service-activator id="domainEventReconProcessServiceActivator"
input-channel="domainEventQueueChannel" ref="domainEventReconProcessServiceActivator" method="intiateAutopayProcessTransRecon">
<int:poller task-executor="domainEventReconProcessServicetaskExecutor" fixed-rate="10" >
</int:poller>
</int:service-activator>
<task:executor id="domainEventReconProcessServicetaskExecutor"
pool-size="10" queue-capacity="10" />
更新2#: 当我添加以下配置时,一切正常。消息从队列通道流向服务激活器:
<int:chain input-channel="domainEventQueueChannel"
output-channel="nullChannel">
<int:service-activator id="domainEventReconProcessServiceActivator"
ref="domainEventReconProcessServiceActivator" method="intiateAutopayProcessTransRecon" />
<int:poller task-executor="domainEventReconProcessServicetaskExecutor" fixed-rate="10"></int:poller>
</int:chain>
更新3#: 随着链的到位,我看到服务激活器的轮询器轮询queueChannel。但是没有链条,轮询器根本就没有开始我根本看不到轮询器日志。
随着链条到位:
2015-09-08 09:29:31.438 DEBUG 12817 --- [ask-scheduler-8] o.s.integration.channel.QueueChannel : preSend on channel 'domainEventQueueChannel', message: GenericMessage [payload=com.autopayprocesstransrecon.resource.DomainEvent@6ac4fcc0, headers={sequenceNumber=1, correlationId=7a91b5fb-b1aa-464a-2e1b-5309652a0520, id=25ae85aa-e0df-6c72-9a54-2e8dac3c5ddc, sequenceSize=1, timestamp=1441718971437}]
2015-09-08 09:29:31.438 DEBUG 12817 --- [ask-scheduler-8] o.s.integration.channel.QueueChannel : postSend (sent=true) on channel 'domainEventQueueChannel', message: GenericMessage [payload=com.autopayprocesstransrecon.resource.DomainEvent@6ac4fcc0, headers={sequenceNumber=1, correlationId=7a91b5fb-b1aa-464a-2e1b-5309652a0520, id=25ae85aa-e0df-6c72-9a54-2e8dac3c5ddc, sequenceSize=1, timestamp=1441718971437}]
2015-09-08 09:29:31.438 DEBUG 12817 --- [ask-scheduler-8] o.s.integration.channel.DirectChannel : postSend (sent=true) on channel 'inputFromTransformer', message: GenericMessage [payload=[{"eventInfo":{"eventId":"4535345353","eventName":"AutopayModelsExtracted","parentEventId":"4535345353"},"numOfAutopayModels":20,"message":"Published autopaymodels needed to be processed"}], headers={id=7a91b5fb-b1aa-464a-2e1b-5309652a0520, timestamp=1441718971410}]
2015-09-08 09:29:31.438 DEBUG 12817 --- [ask-scheduler-8] o.s.integration.channel.DirectChannel : postSend (sent=true) on channel 'domainEventChannel', message: GenericMessage [payload={domainevents={0=[{"eventInfo":{"eventId":"4535345353","eventName":"AutopayModelsExtracted","parentEventId":"4535345353"},"numOfAutopayModels":20,"message":"Published autopaymodels needed to be processed"}]}}, headers={id=438c63c8-1ed1-6516-110e-c3478aca35c8, timestamp=1441718971409}]
2015-09-08 09:29:31.438 DEBUG 12817 --- [etaskExecutor-1] o.s.integration.channel.QueueChannel : postReceive on channel 'domainEventQueueChannel', message: GenericMessage [payload=com.autopayprocesstransrecon.resource.DomainEvent@6ac4fcc0, headers={sequenceNumber=1, correlationId=7a91b5fb-b1aa-464a-2e1b-5309652a0520, id=25ae85aa-e0df-6c72-9a54-2e8dac3c5ddc, sequenceSize=1, timestamp=1441718971437}]
2015-09-08 09:29:31.438 DEBUG 12817 --- [etaskExecutor-1] o.s.i.endpoint.PollingConsumer : Poll resulted in Message: GenericMessage [payload=com.autopayprocesstransrecon.resource.DomainEvent@6ac4fcc0, headers={sequenceNumber=1, correlationId=7a91b5fb-b1aa-464a-2e1b-5309652a0520, id=25ae85aa-e0df-6c72-9a54-2e8dac3c5ddc, sequenceSize=1, timestamp=1441718971437}]
2015-09-08 09:29:31.438 DEBUG 12817 --- [etaskExecutor-1] o.s.i.handler.MessageHandlerChain : org.springframework.integration.handler.MessageHandlerChain#1 received message: GenericMessage [payload=com.autopayprocesstransrecon.resource.DomainEvent@6ac4fcc0, headers={sequenceNumber=1, correlationId=7a91b5fb-b1aa-464a-2e1b-5309652a0520, id=25ae85aa-e0df-6c72-9a54-2e8dac3c5ddc, sequenceSize=1, timestamp=1441718971437}]
2015-09-08 09:29:31.438 DEBUG 12817 --- [etaskExecutor-1] o.s.i.handler.ServiceActivatingHandler : ServiceActivator for [org.springframework.integration.handler.MethodInvokingMessageProcessor@72193fb5] (org.springframework.integration.handler.MessageHandlerChain#1$child.domainEventReconProcessServiceActivator) received message: GenericMessage [payload=com.autopayprocesstransrecon.resource.DomainEvent@6ac4fcc0, headers={sequenceNumber=1, correlationId=7a91b5fb-b1aa-464a-2e1b-5309652a0520, id=25ae85aa-e0df-6c72-9a54-2e8dac3c5ddc, sequenceSize=1, timestamp=1441718971437}]`
没有链:
2015-09-08 09:48:02.572 DEBUG 13043 --- [ask-scheduler-1] o.s.i.splitter.MethodInvokingSplitter : org.springframework.integration.splitter.MethodInvokingSplitter@53abfc07 received message: GenericMessage [payload=[{"eventInfo":{"eventId":"4535345353","eventName":"AutopayModelsExtracted","parentEventId":"4535345353"},"numOfAutopayModels":20,"message":"Published autopaymodels needed to be processed"}], headers={id=f477f025-e92f-f896-9ac4-2ce1b91fb895, timestamp=1441720082572}]
2015-09-08 09:48:02.574 DEBUG 13043 --- [ask-scheduler-1] o.s.i.t.MessageTransformingHandler : org.springframework.integration.transformer.MessageTransformingHandler@2c8c16c0 received message: GenericMessage [payload={"eventInfo":{"eventId":"4535345353","eventName":"AutopayModelsExtracted","parentEventId":"4535345353"},"numOfAutopayModels":20,"message":"Published autopaymodels needed to be processed"}, headers={sequenceNumber=1, correlationId=f477f025-e92f-f896-9ac4-2ce1b91fb895, id=1364077a-6d5c-87f9-7d7c-3d144e45d661, sequenceSize=1, timestamp=1441720082574}]
2015-09-08 09:48:02.599 DEBUG 13043 --- [ask-scheduler-1] o.s.integration.filter.MessageFilter : org.springframework.integration.filter.MessageFilter@80bfa9d received message: GenericMessage [payload=com.autopayprocesstransrecon.resource.DomainEvent@fd57501, headers={sequenceNumber=1, correlationId=f477f025-e92f-f896-9ac4-2ce1b91fb895, id=c2a324c8-9eb0-66e0-73a1-5595ed87b3ae, sequenceSize=1, timestamp=1441720082599}]
hey I am in filter and my result would betrue
2015-09-08 09:48:02.599 DEBUG 13043 --- [ask-scheduler-1] o.s.integration.channel.QueueChannel : preSend on channel 'domainEventQueueChannel', message: GenericMessage [payload=com.autopayprocesstransrecon.resource.DomainEvent@fd57501, headers={sequenceNumber=1, correlationId=f477f025-e92f-f896-9ac4-2ce1b91fb895, id=c2a324c8-9eb0-66e0-73a1-5595ed87b3ae, sequenceSize=1, timestamp=1441720082599}]
2015-09-08 09:48:02.599 DEBUG 13043 --- [ask-scheduler-1] o.s.integration.channel.QueueChannel : postSend (sent=true) on channel 'domainEventQueueChannel', message: GenericMessage [payload=com.autopayprocesstransrecon.resource.DomainEvent@fd57501, headers={sequenceNumber=1, correlationId=f477f025-e92f-f896-9ac4-2ce1b91fb895, id=c2a324c8-9eb0-66e0-73a1-5595ed87b3ae, sequenceSize=1, timestamp=1441720082599}]
2015-09-08 09:48:02.599 DEBUG 13043 --- [ask-scheduler-1] o.s.integration.channel.DirectChannel : postSend (sent=true) on channel 'inputFromTransformer', message: GenericMessage [payload=[{"eventInfo":{"eventId":"4535345353","eventName":"AutopayModelsExtracted","parentEventId":"4535345353"},"numOfAutopayModels":20,"message":"Published autopaymodels needed to be processed"}], headers={id=f477f025-e92f-f896-9ac4-2ce1b91fb895, timestamp=1441720082572}]
2015-09-08 09:48:02.599 DEBUG 13043 --- [ask-scheduler-1] o.s.integration.channel.DirectChannel : postSend (sent=true) on channel 'domainEventChannel', message: GenericMessage [payload={domainevents={0=[{"eventInfo":{"eventId":"4535345353","eventName":"AutopayModelsExtracted","parentEventId":"4535345353"},"numOfAutopayModels":20,"message":"Published autopaymodels needed to be processed"}]}}, headers={id=bf6f4f20-52bb-27e4-df97-4112ad4be3b5, timestamp=1441720082571}]
2015-09-08 09:48:03.616 DEBUG 13043 --- [ask-scheduler-3] o.s.i.e.SourcePollingChannelAdapter : Received no Message during the poll, returning 'false'
2015-09-08 09:48:04.634 DEBUG 13043 --- [ask-scheduler-4] o.s.i.e.SourcePollingChannelAdapter : Received no Message during the poll, returning 'false'
答案 0 :(得分:1)
这只是意味着消息没有通过过滤器。
(过滤器正在删除该消息)。