5. Spring Integration - Reference
This part of the reference documentation provides a quick introduction to the AMQP support within the Spring Integration project.
5.1. Spring Integration AMQP Support
This brief chapter covers the relationship between the Spring Integration and the Spring AMQP projects.
5.1.1. Introduction
The Spring Integration project includes AMQP Channel Adapters and Gateways that build upon the Spring AMQP project. Those adapters are developed and released in the Spring Integration project. In Spring Integration, “Channel Adapters” are unidirectional (one-way), whereas “Gateways” are bidirectional (request-reply). We provide an inbound-channel-adapter, an outbound-channel-adapter, an inbound-gateway, and an outbound-gateway.
Since the AMQP adapters are part of the Spring Integration release, the documentation is available as part of the Spring Integration distribution. We provide a quick overview of the main features here. See the Spring Integration Reference Guide for much more detail.
5.1.2. Inbound Channel Adapter
To receive AMQP Messages from a queue, you can configure an <inbound-channel-adapter>
.
The following example shows how to configure an inbound channel adapter:
<amqp:inbound-channel-adapter channel="fromAMQP"
queue-names="some.queue"
connection-factory="rabbitConnectionFactory"/>
5.1.3. Outbound Channel Adapter
To send AMQP Messages to an exchange, you can configure an <outbound-channel-adapter>
.
You can optionally provide a 'routing-key' in addition to the exchange name.
The following example shows how to define an outbound channel adapter:
<amqp:outbound-channel-adapter channel="toAMQP"
exchange-name="some.exchange"
routing-key="foo"
amqp-template="rabbitTemplate"/>
5.1.4. Inbound Gateway
To receive an AMQP Message from a queue and respond to its reply-to address, you can configure an <inbound-gateway>
.
The following example shows how to define an inbound gateway:
<amqp:inbound-gateway request-channel="fromAMQP"
reply-channel="toAMQP"
queue-names="some.queue"
connection-factory="rabbitConnectionFactory"/>
5.1.5. Outbound Gateway
To send AMQP Messages to an exchange and receive back a response from a remote client, you can configure an <outbound-gateway>
.
You can optionally provide a 'routing-key' in addition to the exchange name.
The following example shows how to define an outbound gateway:
<amqp:outbound-gateway request-channel="toAMQP"
reply-channel="fromAMQP"
exchange-name="some.exchange"
routing-key="foo"
amqp-template="rabbitTemplate"/>