concept outbound gateway in category java

appears as: outbound gateway, The outbound gateway, n outbound gateway
Spring Integration in Action

This is an excerpt from Manning's book Spring Integration in Action.

In the previous sections, you saw the inbound gateway and the outbound gateway. Both play a role in supporting request-reply messaging, but they were discussed separately thus far. That’s because each can be used when you’re limited in the assumptions you can make about the application on the other side. As you might expect, the two gateways can work well together when you have Spring Integration applications on both sides. Figure 9.4 captures this situation by reusing one of the diagrams from the introductory chapter, this time labeled specifically for JMS.

An outbound channel adapter is much like an outbound gateway except that it doesn’t send a response on a reply channel. Behind the scenes, the HTTP outbound channel adapter uses the RestTemplate from the Spring Framework. Therefore, the ResponseErrorHandler interface is implemented to determine what is an error. The error handler can be provided by setting an attribute on the outbound channel adapter element. If no custom error handler is provided, then an instance of DefaultResponseErrorHandler is used. This error handler may not give you the expected behavior. It treats only HTTP response codes of 4xx and 5xx as exceptional. This can lead to problems, for example, with a POST request for which the response is 301 (moved permanently). Such a response won’t be treated as exceptional, and messages will be silently dropped as the HTTP server discards them without any indication of a problem at the Spring Integration end. Following is an example configuration that posts messages to the configured URL: