currently I am working with mule. I have 3 flow: RequestFlow
, ServiceResponse
, and SendResponse
.
On the first flow, I processed the request (transform the request parameter, write it into wmq, etc). FYI, wmq on this flow can only be used for write.
On the second flow, I read the response from server via another wmq, transform it into json, and send to VM. FYI, wmq on this flow only can be used for read.
On the third flow, I tried to send back the response to the first flow and generate a file.
To send back the response from flow 3 to flow 1, I try to use request-reply
But, unfortunately, when I tried to send a request, I found out that:
- After it reach request-reply component on the first flow, it will directly go to the third flow.
- And then, after mule processed all the operation on the third flow, it will send the response back to the request-reply component.
- Do some logging (logger component on first flow)
- Then, go to the flow, processed all the operation
- Processed the third flow again
That's why, after all the process has been finished, my application will:
- Generate 2 files (1 contain request xml and 1 contain json response)
- Return the request xml to http
However, It's not what I want. The flow that I need is:
- Mule processed the operation on first flow until the request-reply component
- Go to the second flow and processed all the component
- After it finish with second flow, it will goes to third flow. Proceed all the component
- Send the reply back to request-reply component on the first flow
- Do some logging (logger component in first flow)
- And finish
Result from this application should be:
- 1 File contain JSON response
- JSON Response on http
So, how to do so? Thanks in advance.
You don't show the flow that consumes the messages sent to the
sender
path by the VM outbound endpoint inrequest-reply
: I'm assuming it's a flow that takes care of sending the message to the server.It seems that all you miss is an VM outbound endpoint in
SendResponse
that would send the message to theresponse
path, onto which the VM inbound is waiting in therequest-reply
.PS. Of course, it's assumed the the server propagates the JMS correlation ID from the request message to the response message, otherwise Mule (nor any client for that matter) could ever reconnect the response to the request and the
request-reply
would fail.PPS. You don't need an
all
router around the single VM outbound endpoint inrequest-reply
.