I have this Spring Integration code that receives a SOAP message and then replies it.
This is the configuration:
@Bean
public MessageChannel wsGatewayInboundChannel() {
return MessageChannels.direct(GATEWAY_INBOUND_CHANNEL_NAME).get();
}
@Bean
public MessageChannel wsGatewayOutboundChannel() {
return MessageChannels.direct(GATEWAY_OUTBOUND_CHANNEL_NAME).get();
}
@Bean
public IntegrationFlow soapMessageFlow(SimpleWebServiceInboundGateway webServiceInboundGateway) {
return IntegrationFlows.from(webServiceInboundGateway)
.log(LoggingHandler.Level.INFO)
.channel(SOAP_MESSAGE_SERVICE_CHANNEL_NAME).get();
}
@Bean
public SimpleWebServiceInboundGateway webServiceInboundGateway() {
SimpleWebServiceInboundGateway simpleWebServiceInboundGateway = new SimpleWebServiceInboundGateway();
simpleWebServiceInboundGateway.setRequestChannel(wsGatewayInboundChannel());
simpleWebServiceInboundGateway.setReplyChannel(wsGatewayOutboundChannel());
simpleWebServiceInboundGateway.setExtractPayload(false);
simpleWebServiceInboundGateway.setLoggingEnabled(true);
return simpleWebServiceInboundGateway;
}
And this is the service that processes the message:
@Service
public class SoapMessageService {
@ServiceActivator(inputChannel = SOAP_MESSAGE_SERVICE_CHANNEL_NAME, outputChannel = GATEWAY_OUTBOUND_CHANNEL_NAME)
public SoapMessage receive(SoapMessage request) {
//...
return reply;
}
}
This works fine.
I don't know how the reply channel works behind the curtains, but I want to be really sure that replies don't mix up. For instance, if I receive:
Request_1 from A, which reply is Reply_1
Request_2 from B, which reply is Reply_2
I want Reply_1 to be delivered to A and Reply_2 to be delivered to B and NOT Reply_1 being delivered to B and Reply_2 being delivered to A.
Can reply channel guarantee the behaviour previously described?
Thanks in advance.