Reputation: 153
I am new to SI, but have read a lot now. I have to make 1 more call from flow, that was already implemented. I need this call to be not-blocking, so the chain does not wait for its execution - it is sent to another system, that might be down.
I need to send a message to 2 channels, so I used the recipient-list-router without any condition.
<int:recipient-list-router id="processEngineRouter" input-channel="newApplicationChannel">
<int:recipient channel="finishFlowChannel"/>
<int:recipient channel="processEngineChannel"/>
</int:recipient-list-router>
After the finishFlowChannel
is finished, the processEngineChannel
is called. This is fine, but the problem is, that the input newApplicationChannel
does wait also for the processEngineChannel
to finish, even tough I am using the Executor channel, that should be asynchronous.
<int:channel id="finishFlowChannel"/>
<int:chain input-channel="finishFlowChannel" output-channel="apiReplyChannel">
<!-- create response -->
<int:transformer ref="xxToYYTransformer"/>
</int:chain>
<int:channel id="processEngineChannel">
<int:dispatcher task-executor="taskExecutor"/>
</int:channel>
<int:chain input-channel="processEngineChannel">
<!-- transform x to y -->
<int:transformer ref="xToYTransformer"/>
<!-- call PE -->
<int:gateway request-channel="peRCh"/>
</int:chain>
and <task:executor id="taskExecutor"/>
where the task
prefix is from http://www.springframework.org/schema/task/spring-task.xsd version 3.1, no other settings.
Input channel for the router is
<int:channel id="newApplicationChannel"/>
<int:channel id="naRequestChannel"/>
<int:chain input-channel="naRequestChannel" output-channel="newApplicationChannel">
<int:transformer>
...
</int:transformer>
<si-xml:unmarshalling-transformer unmarshaller="xxMarshaller"/>
<!-- enrich header with necessary data -->
<int:header-enricher>
...
</int:header-enricher>
<!-- transform xx to yy -->
<int:transformer ref="xxToYyTransformer"/>
<!-- call yyy service -->
<int:gateway request-channel="yyyServiceRequestChannel"/>
</int:chain>
It worked, when I added the delayer
to the chain, but that is not very nice solution.
My question is, do I use the taskExecutor wrong? How else can I make the call asynchronous? I do not want to use queue, because I do not need to poll events repeatedly.
http-apr-8080-exec-2 14:39:23,530 DEBUG DirectChannel:224 - preSend on channel 'apiRequestChannel'
http-apr-8080-exec-2 14:39:23,534 DEBUG MessageHandlerChain:67 - org.springframework.integration.handler.MessageHandlerChain#4
http-apr-8080-exec-2 14:39:23,535 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler#4ac5c32e
http-apr-8080-exec-2 14:39:23,557 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler#4ac5c32e' sending reply
http-apr-8080-exec-2 14:39:23,557 DEBUG HeaderValueRouter:67 - (inner bean)#16 received message:
http-apr-8080-exec-2 14:39:23,558 DEBUG DirectChannel:224 - preSend on channel 'naRequestChannel', message:
http-apr-8080-exec-2 14:39:23,558 DEBUG MessageHandlerChain:67 - org.springframework.integration.handler.MessageHandlerChain#33 received message:
http-apr-8080-exec-2 14:39:23,558 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler@3cbcf04e received message:
http-apr-8080-exec-2 14:39:23,565 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler@3cbcf04e' sending reply
http-apr-8080-exec-2 14:39:23,566 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler#6a5c2445 received message:
http-apr-8080-exec-2 14:39:23,594 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler#6a5c2445' sending reply
http-apr-8080-exec-2 14:39:23,595 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler#47516490 received message:
http-apr-8080-exec-2 14:39:23,596 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler#47516490' sending reply
http-apr-8080-exec-2 14:39:23,596 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler@2342f67d received message:
http-apr-8080-exec-2 14:39:23,597 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler@2342f67d' sending reply
http-apr-8080-exec-2 14:39:23,598 DEBUG RequestReplyMessageHandlerAdapter:67 - (inner bean)#231 received message:
http-apr-8080-exec-2 14:39:23,600 DEBUG DirectChannel:224 - preSend on channel 'dossierAddEventRequestChannel', message:
http-apr-8080-exec-2 14:39:23,601 DEBUG PayloadTypeRouter:67 - (inner bean)#250 received message:
http-apr-8080-exec-2 14:39:23,602 DEBUG DirectChannel:224 - preSend on channel 'dossierAddEventRequestGenericChannel', message:
http-apr-8080-exec-2 14:39:23,602 DEBUG MessageHandlerChain:67 - org.springframework.integration.handler.MessageHandlerChain#41 received message:
http-apr-8080-exec-2 14:39:23,603 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler#23bdb02e received message: http-apr-8080-exec-2 14:39:23,603 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler#23bdb02e' sending reply http-apr-8080-exec-2 14:39:23,604 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler@54054c41 received message: http-apr-8080-exec-2 14:39:23,606 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler@54054c41' sending reply http-apr-8080-exec-2 14:39:23,606 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'dossierAddEventRequestGenericChannel', message: http-apr-8080-exec-2 14:39:23,607 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'dossierAddEventRequestChannel', message:
http-apr-8080-exec-2 14:39:23,607 DEBUG GatewayProxyFactoryBean:134 - Unable to attempt conversion of Message payload types. Component 'org.springframework.integration.gateway.GatewayProxyFactoryBean#2e29d50d' has no explicit ConversionService reference, and there is no 'integrationConversionService' bean within the context.
http-apr-8080-exec-2 14:39:23,608 DEBUG RequestReplyMessageHandlerAdapter:156 - handler '(inner bean)#231' sending reply Message: http-apr-8080-exec-2 14:39:23,608 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler@3f03c0ad received message:
http-apr-8080-exec-2 14:39:23,609 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler@3f03c0ad' sending reply http-apr-8080-exec-2 14:39:23,611 DEBUG RequestReplyMessageHandlerAdapter:67 - (inner bean)#232 received message: http-apr-8080-exec-2 14:39:23,612 DEBUG DirectChannel:224 - preSend http-apr-8080-exec-2 14:39:23,612 DEBUG ServiceActivatingHandler:67 - ServiceActivator for [org.springframework.integration.handler.MethodInvokingMessageProcessor@4149888e] received http-apr-8080-exec-2 14:39:23,614 DEBUG DirectChannel:224 - preSend on channel 'dossierServiceRequestRouter', message: http-apr-8080-exec-2 14:39:23,614 DEBUG PayloadTypeRouter:67 - (inner bean)#17 received message:
http-apr-8080-exec-2 14:39:23,615 DEBUG DirectChannel:224 - preSend on channel 'dossierServiceJaxbRequestChannel', message: http-apr-8080-exec-2 14:39:23,616 DEBUG MessageHandlerChain:67 - org.springframework.integration.handler.MessageHandlerChain#5 received message:
http-apr-8080-exec-2 14:39:23,616 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler#7d8e9adf received message: http-apr-8080-exec-2 14:39:23,634 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler#7d8e9adf' sending reply http-apr-8080-exec-2 14:39:23,635 DEBUG RequestReplyMessageHandlerAdapter:67 - (inner bean)#18 received message: [Payload=[#document: null]][Headers={timestamp=1372768763634, http-apr-8080-exec-2 14:39:23,636 DEBUG DirectChannel:224 - preSend on channel 'dossierServiceDocumentRequestChannel', message:
http-apr-8080-exec-2 14:39:23,636 DEBUG SimpleWebServiceOutboundGateway:67 - org.springframework.integration.ws.SimpleWebServiceOutboundGateway#0 received message: http-apr-8080-exec-2 14:39:24,206 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'dossierServiceDocumentRequestChannel', message: [Payload=[#document: null]][Headers={timestamp=1372768763636, id=a193877c-0faf-4573-b6b4-97ca3cd25f66, errorChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@3875c597, xp_dossierEvent_operator_username=afs-process, xp_dossierEvent_name=NewApplication, replyChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@3875c597, xp_dossierEvent_dateTime=2013-07-02T14:39:23, xp_dossierEvent_details=Nieuwe aanvraag aangemaakt, xp_dossierEvent_operator_name=AFS Proces, xp_endUser=nl.vwpfs.pos.bpf.EndUser@598ef578, xp_businessFunctionName=NewApplication}]
http-apr-8080-exec-2 14:39:24,206 DEBUG GatewayProxyFactoryBean:134 - Unable to attempt conversion of Message payload types. Component 'org.springframework.integration.gateway.GatewayProxyFactoryBean#1d59e6df' has no explicit ConversionService reference, and there is no 'integrationConversionService' bean within the context.
http-apr-8080-exec-2 14:39:24,207 DEBUG RequestReplyMessageHandlerAdapter:156 - handler '(inner bean)#18' sending reply Message:
http-apr-8080-exec-2 14:39:24,207 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler#79444986 received message: http-apr-8080-exec-2 14:39:24,218 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler#79444986' sending reply http-apr-8080-exec-2 14:39:24,219 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'dossierServiceJaxbRequestChannel', message: http-apr-8080-exec-2 14:39:24,219 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'dossierServiceRequestRouter', message:
http-apr-8080-exec-2 14:39:24,219 DEBUG GatewayProxyFactoryBean:134 - Unable to attempt conversion of Message payload types. Component 'dossierServiceGateway' has no explicit ConversionService reference, and there is no 'integrationConversionService' bean within the context.
http-apr-8080-exec-2 14:39:24,220 DEBUG ServiceActivatingHandler:156 - handler 'ServiceActivator for http-apr-8080-exec-2 14:39:24,220 DEBUG GatewayProxyFactoryBean:134 - Unable to attempt conversion of Message payload types. Component 'org.springframework.integration.gateway.GatewayProxyFactoryBean#5e970110' has no explicit ConversionService reference, and there is no 'integrationConversionService' bean within the context.
http-apr-8080-exec-2 14:39:24,221 DEBUG RequestReplyMessageHandlerAdapter:156 - handler '(inner bean)#232' sending reply Message: http-apr-8080-exec-2 14:39:24,221 DEBUG DirectChannel:224 - preSend on channel 'newApplicationChannel', message:
http-apr-8080-exec-2 14:39:24,221 DEBUG RecipientListRouter:67 - org.springframework.integration.router.RecipientListRouter#0 received message: http-apr-8080-exec-2 14:39:24,222 DEBUG DirectChannel:224 - preSend on channel 'finishFlowChannel', message: http-apr-8080-exec-2 14:39:24,222 DEBUG MessageHandlerChain:67 - org.springframework.integration.handler.MessageHandlerChain#35 received message: [Payload=nl.vwpfs.pos.xmlcdm.dossier.service.CreateDossierResponse@6b37695c
http-apr-8080-exec-2 14:39:24,222 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler@57316e85 received message: http-apr-8080-exec-2 14:39:24,223 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler@57316e85' sending reply http-apr-8080-exec-2 14:39:24,224 DEBUG DirectChannel:224 - preSend on channel 'apiReplyChannel', message: http-apr-8080-exec-2 14:39:24,224 DEBUG MessageTransformingHandler:67 - http-apr-8080-exec-2 14:39:24,235 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'apiReplyChannel', message: http-apr-8080-exec-2 14:39:24,236 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'finishFlowChannel', message:
http-apr-8080-exec-2 14:39:24,236 DEBUG ExecutorChannel:224 - preSend on channel 'processEngineChannel', message:
http-apr-8080-exec-2 14:39:24,239 DEBUG ExecutorChannel:237 - postSend (sent=true) on channel 'processEngineChannel', message:
taskExecutor-1 14:39:24,239 DEBUG MessageHandlerChain:67 - org.springframework.integration.handler.MessageHandlerChain#34 received message:
http-apr-8080-exec-2 14:39:24,239 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'newApplicationChannel', message:
taskExecutor-1 14:39:24,240 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler@289f6ae received message:
http-apr-8080-exec-2 14:39:24,240 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'naRequestChannel', message:
http-apr-8080-exec-2 14:39:24,241 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'apiRequestChannel', message:
taskExecutor-1 14:39:27,817 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler@289f6ae' sending reply Message:
taskExecutor-1 14:39:27,819 DEBUG RequestReplyMessageHandlerAdapter:67 - (inner bean)#235 received message:
taskExecutor-1 14:39:27,822 DEBUG DirectChannel:224 - preSend on channel 'sendToProcessEngineChannel', message:
taskExecutor-1 14:39:27,822 DEBUG MarshallingWebServiceOutboundGateway:67 - org.springframework.integration.ws.MarshallingWebServiceOutboundGateway#0 received message:
taskExecutor-1 14:39:28,094 DEBUG MarshallingWebServiceOutboundGateway:156 - handler 'org.springframework.integration.ws.MarshallingWebServiceOutboundGateway#0' sending reply
taskExecutor-1 14:39:28,095 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'sendToProcessEngineChannel', message:
taskExecutor-1 14:39:28,095 DEBUG GatewayProxyFactoryBean:134 - Unable to attempt conversion of Message payload types. Component 'org.springframework.integration.gateway.GatewayProxyFactoryBean#762589c3' has no explicit ConversionService reference, and there is no 'integrationConversionService' bean within the context.
taskExecutor-1 14:39:28,095 DEBUG RequestReplyMessageHandlerAdapter:156 - handler '(inner bean)#235' sending reply Message:
Upvotes: 0
Views: 1416
Reputation: 174664
It's working just fine...
...
http-apr-8080-exec-2 14:39:24,224 DEBUG DirectChannel:224 - preSend on channel 'apiReplyChannel', message:
http-apr-8080-exec-2 14:39:24,224 DEBUG MessageTransformingHandler:67 -
http-apr-8080-exec-2 14:39:24,235 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'apiReplyChannel', message:
http-apr-8080-exec-2 14:39:24,236 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'finishFlowChannel', message:
http-apr-8080-exec-2 14:39:24,236 DEBUG ExecutorChannel:224 - preSend on channel 'processEngineChannel', message:
http-apr-8080-exec-2 14:39:24,239 DEBUG ExecutorChannel:237 - postSend (sent=true) on channel 'processEngineChannel', message:
taskExecutor-1 14:39:24,239 DEBUG MessageHandlerChain:67 - org.springframework.integration.handler.MessageHandlerChain#34 received message:
http-apr-8080-exec-2 14:39:24,239 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'newApplicationChannel', message:
taskExecutor-1 14:39:24,240 DEBUG MessageTransformingHandler:67 - org.springframework.integration.transformer.MessageTransformingHandler@289f6ae received message:
http-apr-8080-exec-2 14:39:24,240 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'naRequestChannel', message:
http-apr-8080-exec-2 14:39:24,241 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'apiRequestChannel', message:
taskExecutor-1 14:39:27,817 DEBUG MessageTransformingHandler:156 - handler 'org.springframework.integration.transformer.MessageTransformingHandler@289f6ae' sending reply Message:
...
As you can see, the ...exec-2
thread sends the reply on apiReplyChannel
and then does the send on processEngineChannel
(preSend and postSend are back-to-back) and hands over to thread taskExecutor-1
which then starts processing the flow on that channel - chain, transformer etc.
The ...exec-2
thread goes on to complete its work (ending with postSend on apiRequestChannel
.
However, I see you have no output-channel on the processEngineChannel chain - the framework will attempt to send that reply to whatever's in the replyChannel
header of the message - if you want to discard that reply you should set the chain's output-channel
to nullChannel.
Upvotes: 0