What is the difference between a channel adapter and a messaging gateway pattern?

前端 未结 3 1092
长情又很酷
长情又很酷 2021-01-30 17:07

No matter how much I read about those two patterns I just can\'t see the difference.

3条回答
  •  深忆病人
    2021-01-30 17:23

    In Spring Integration, the pattern name Channel Adapter applies to any unidirectional inbound or outbound adapter. In other words, an inbound channel adapter supports an in-only message exchange, and an outbound channel adapter supports an out-only exchange.

    Any bidirectional, or request-reply, adapter is known as a Gateway in Spring Integration

    CHANNEL ADAPTER

    A Channel Adapter connects an application to the messaging system In Spring Integration we chose to constrict the definition to include only connections that are unidirectional, so a unidirectional message flow begins and ends in a channel adapter. Many different kinds of channel adapters exist, ranging from a method-invoking channel adapter to a web service channel adapter

    a channel adapter is placed at the beginning and the end of a unidirectional message flow.

    MESSAGING GATEWAY

    In Spring Integration, a Messaging Gateway is a connection that’s specific to bidirectional messaging. If an incoming request needs to be serviced by multiple threads but the invoker needs to remain unaware of the messaging system, an inbound gateway provides the solution. On the outbound side, an incoming message can be used in a synchronous invocation, and the result is sent on the reply channel.

    For example, outbound gateways can be used for invoking web services and for synchronous request-reply interactions over JMS.

    A gateway can also be used midstream in a unidirectional message flow. As with the channel adapter, we’ve constrained the definition of messaging gateway a bit in comparison to Enterprise Integration Patterns.

    reference: Spring Integration in Action

提交回复
热议问题