1

I am setting a workflow using Spring integration. Basically is this:

Poll Database → Split rows → HTTP Post to web API → Filter: (if OK) → Write To File → Delete row from DDBB

I am using a JDBC poller and an HTTP outbound gateway. I've managed to read the database, split the results to handle the rows one by one, and then post the data to a rest service, using json.

But after that, in the output of the http gateway, i get the POST result.

In this use case, i'd need to have the original object i send to the Http gateway, because i have to write some of its data to a text file, and then use its ID to delete from the original record in the table table.

Is there any way to make the HTTP gateway output include both the POST result and the original POJO it receives in the input?

JavyDev
  • 15
  • 3

1 Answers1

0

Add a header enricher before the gateway to copy the payload into a header; you can then reference the header later in the flow.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • I think that headers will be send with message? – Shakirov Ramil Oct 28 '20 at 14:11
  • Not with HTTP - by default only a certain set of headers are mapped; you have to [configure the gateway to map additional headers](https://docs.spring.io/spring-integration/docs/current/reference/html/http.html#http-header-mapping). – Gary Russell Oct 28 '20 at 14:21