When wiring your Mule services together, new users sometimes get confused about when to use an outbound router and when it’s sufficient to simply get a reply. Following is a description of the three message styles you can use to get a response from your Mule services.
Request-Response
In simple scenarios, a service receives a request on a synchronous inbound endpoint, processes the request, and then sends it back to the caller as a reply. For example, if a user enters a value in an HTML form, and you want to transform that value and display the results in the same page, you can simply configure a synchronous inbound endpoint on the service that does the transformation. This scenario does not use an outbound router. This is the request-response message style.
Synchronous
If you need to pass the message to a second service for additional processing, you would configure an outbound router on the first service to pass the message to the second service. You then configure a synchronous inbound endpoint on the second service so that it passes the message back to the first service, which sends it back to the caller as a reply. This is the synchronous message style.
Asynchronous Request-Response
In the most complex scenario, you can enable request-response messaging and allow the back-end process to be forked to invoke other services, returning a reply asynchronously based on the results of multiple service invocations. This is the asynchronous request-response message style.
Note that if you simply want to put a message on a SEDA queue and no response to the caller is required, you can use the asynchronous message style. For more information, see Mule messaging styles (includes configuration examples) and using message routers in the Mule 2.x User’s Guide (login is required, but registration is free and only takes a moment).