0

currently I am working with mule. I have 3 flow: RequestFlow, ServiceResponse, and SendResponse.

Flow

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:

  1. After it reach request-reply component on the first flow, it will directly go to the third flow.
  2. And then, after mule processed all the operation on the third flow, it will send the response back to the request-reply component.
  3. Do some logging (logger component on first flow)
  4. Then, go to the flow, processed all the operation
  5. Processed the third flow again

That's why, after all the process has been finished, my application will:

  1. Generate 2 files (1 contain request xml and 1 contain json response)
  2. Return the request xml to http

However, It's not what I want. The flow that I need is:

  1. Mule processed the operation on first flow until the request-reply component
  2. Go to the second flow and processed all the component
  3. After it finish with second flow, it will goes to third flow. Proceed all the component
  4. Send the reply back to request-reply component on the first flow
  5. Do some logging (logger component in first flow)
  6. And finish

Result from this application should be:

  1. 1 File contain JSON response
  2. JSON Response on http

So, how to do so? Thanks in advance.

4

1 回答 1

1

您没有显示使用senderVM 出站端点发送到路径的消息的流request-reply:我假设它是一个负责将消息发送到服务器的流。

似乎您错过的只是一个 VM 出站端点SendResponse,它将消息发送到response路径,VM 入站在request-reply.

PS。当然,假设服务器将JMS 相关 ID从请求消息传播到响应消息,否则 Mule(也不是任何客户端)可能永远将响应重新连接到请求并且request-reply会失败。

聚苯乙烯。您不需要allrequest-reply.

于 2014-05-22T13:45:32.103 回答