Reputation: 11
I'm working on an orchestration layer where using spring integration, I'm want to process the request as follows:
<int:recipient-list-router id="cfRequestRouter" input-channel="cfRequestChannel">
<int:recipient channel="Op1RequestChannel"/> <!-- Calls Op1 Gateway -->
<int:recipient channel="Op2RequestChannel"/> <!-- Calls Op2 Gateway -->
<int:recipient channel="Op3RequestChannel"/> <!-- Calls Op3 Gateway -->
<int:recipient channel="AsyncOp4RequestChannel"/> <!-- Calls Op4 Gateway -->
</int:recipient-list-router>
The request is 1st sent to Op1RequestChannel, which in turn is sent to a Op1 to process the request. After successful processing by Op1 Gateway, the original request is sent to Op2 Gateway. I have to use some of the information from the response received from Op2 Gateway and combine it with the original request received on cfRequestChannel and send it to AsyncOp4RequestChannel for further processing after the request is processed by Op3 Gateway.
I tried the Claim Check pattern to store the response from Op2RequestChannel and have it stored as a response header returned on Op2 Gateway but not sure how to take the header from this response and pass it on to AsyncOp4RequestChannel. Also, how can I do a claim check out and within a transformer to retrieve data to add as payload before sending it on to Op4 Gateway.
Any suggestions on how to do this?
Update:
Message comes in on cfRequestChannel (the request is a combination of all fields required for each of the 4 flows)
--> call Op1 Flow (REST API call) to validate eligibility
--> On receiving Http 200, send to Op2 flow --> Op2 flow (REST API call) creates a unique Id on successful processing. If anything other than Http 200, send it back to client as error
--> If Op2 flow is successful, call Op3 flow (REST API call), which updates another system. The response contains status field which can have 2 values - Approved, Pending. If Approved, gather the unique Id from Op2 flow and few fields from original message and send to Op4 flow for logging. If Pending, use a generic message to call Op4 flow. If error occurs during Op3 flow, send back to client.
--> If Op3 flow is successful, make an asyc call to Op4 and return right away with success code to client
Upvotes: 1
Views: 263
Reputation: 4187
If your AsyncOp4 is using not just the original message, but also the response from Op2, you will need to either use a content enricher to enrich or completely transform that message into a different one and then send the transformed message to AsyncOp4
Upvotes: 1
Reputation: 174494
Use an enricher to call the Op2 flow; the enricher can be used to add content to the payload and/or headers.
Upvotes: 0