Search code examples
jbosssoaeaijboss-esb

What is the difference between One-way MEP and Request-response MEP?


In the JBossESB Programmer’s manual it is mentioned as:

“All interactions between clients and services within JBossESB occur through the exchange of Messages. In order to encourage loose coupling we recommend a message-exchange pattern based on one-way messages, i.e., requests and responses are independent messages, correlated where necessary by the infrastructure or application.”

But if requests and responses are independent messages for one-way MEP, then what is its difference between Request-response MEP?

And what is the actual advantage of using each of them?


Solution

  • Request-response

    • AKA synchronous interaction, call-return.
    • A sends a request to B and waits.
    • B will process the request and send the response.
    • A gets the response and moves on.

    One-way

    • AKA asynchronous interaction, fire-and-forget.
    • A sends a request/message to B, but does not wait for a response. It moves on to do other things.
    • B will process the request/message and will be done.

    Sync-over-async

    • The paragraph you quoted is alluding to this pattern...
    • If A-to-B uses one-way, what should we do if the results of processing the request/message need to be communicated back to A?
    • One option is to use the sync-over-async pattern:
    • A sends a one-way request/message to B. This message typically contains a correlation identifier. A moves on to do other things.
    • B will process the request/message.
    • When the processing is done, B (or some other component that was called in the processing) will send an independent one-way message back to A with the results of processing.
    • This second message can come milisseconds, minutes, hours after the original A-to-B request/message was sent. But it contains the same correlation identifier.
    • This second message goes back to A or some other callback endpoint or queue that was pre-configured or indicated in the original message.
    • Hohpe and Woolf call this pattern "request-reply". But I think this name is somewhat confusing (too close to "request-response").