2
votes

I'm quite new to Spring Integration and EIP. Currently I'm trying to call a service/webservice via Service Activator/ Outbound Gateway. When putting a message into the channel and call the service the message itself got lost and will be replaced by the response. Is there a way to keep the original message and only append the response to it?

Best regards Patrick

1

1 Answers

1
votes

First of all you can place a request message into headers, using a Header Enricher endpoint: https://docs.spring.io/spring-integration/reference/html/message-transformation.html#header-enricher.

Then after receiving response and following downstream, you can extract that original message from those headers.

Second: you may consider to use a Content Enricher instead of general service activator: https://docs.spring.io/spring-integration/reference/html/message-transformation.html#payload-enricher. So, you will be able to keep an original payload and extend it to the reply content.

And lastly: you can do whatever you need inside a custom service activator method. So, you receive a message there, send request, get a response and combine both of them together to return some reply message.