0

I would like to make two sequential calls one after the other, but using the same request message for both calls. But as shown in my sample code, the response from the first post call becomes the request of the second call by default. What is the most elegant solution for this pattern in spring integration

 public IntegrationFlow test() {
   return IntegrationFlows
       .from("testChannel")
       .handle(httpConfigurations.postCall1())
       .handle(httpConfigurations.postCall2())
       .get();
 }

1 Answers1

2

Before the first .handle add a header enricher with an expression to copy the payload to a header.

Before the second .handle use a .transform() to copy the header back to the payload.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179