| This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Integration 6.5.3! | 
Outbound Gateway
The following listing shows the possible properties for an AMQP Outbound Gateway:
- 
Java DSL 
- 
Java 
- 
XML 
@Bean
public IntegrationFlow amqpOutbound(AmqpTemplate amqpTemplate) {
    return f -> f.handle(Amqp.outboundGateway(amqpTemplate)
                    .routingKey("foo")) // default exchange - route to queue 'foo'
            .get();
}
@MessagingGateway(defaultRequestChannel = "amqpOutbound.input")
public interface MyGateway {
    String sendToRabbit(String data);
}@Bean
@ServiceActivator(inputChannel = "amqpOutboundChannel")
public AmqpOutboundEndpoint amqpOutbound(AmqpTemplate amqpTemplate) {
    AmqpOutboundEndpoint outbound = new AmqpOutboundEndpoint(amqpTemplate);
    outbound.setExpectReply(true);
    outbound.setRoutingKey("foo"); // default exchange - route to queue 'foo'
    return outbound;
}
@Bean
public MessageChannel amqpOutboundChannel() {
    return new DirectChannel();
}
@MessagingGateway(defaultRequestChannel = "amqpOutboundChannel")
public interface MyGateway {
    String sendToRabbit(String data);
}<int-amqp:outbound-gateway id="outboundGateway"               (1)
                           request-channel="myRequestChannel" (2)
                           amqp-template=""                   (3)
                           exchange-name=""                   (4)
                           exchange-name-expression=""        (5)
                           order="1"                          (6)
                           reply-channel=""                   (7)
                           reply-timeout=""                   (8)
                           requires-reply=""                  (9)
                           routing-key=""                     (10)
                           routing-key-expression=""          (11)
                           default-delivery-mode""            (12)
                           confirm-correlation-expression=""  (13)
                           confirm-ack-channel=""             (14)
                           confirm-nack-channel=""            (15)
                           confirm-timeout=""                 (16)
                           return-channel=""                  (17)
                           error-message-strategy=""          (18)
                           lazy-connect="true" />             (19)| 1 | The unique ID for this adapter. Optional. | 
| 2 | Message channel to which messages are sent to have them converted and published to an AMQP exchange. Required. | 
| 3 | Bean reference to the configured AMQP template.
Optional (defaults to amqpTemplate). | 
| 4 | The name of the AMQP exchange to which messages should be sent. If not provided, messages are sent to the default, no-name cxchange. Mutually exclusive with 'exchange-name-expression'. Optional. | 
| 5 | A SpEL expression that is evaluated to determine the name of the AMQP exchange to which messages should be sent, with the message as the root object. If not provided, messages are sent to the default, no-name exchange. Mutually exclusive with 'exchange-name'. Optional. | 
| 6 | The order for this consumer when multiple consumers are registered, thereby enabling load-balancing and failover.
Optional (defaults to Ordered.LOWEST_PRECEDENCE [=Integer.MAX_VALUE]). | 
| 7 | Message channel to which replies should be sent after being received from an AMQP queue and converted. Optional. | 
| 8 | The time the gateway waits when sending the reply message to the reply-channel.
This only applies if thereply-channelcan block — such as aQueueChannelwith a capacity limit that is currently full.
Defaults to infinity. | 
| 9 | When true, the gateway throws an exception if no reply message is received within theAmqpTemplate’s `replyTimeoutproperty.
Defaults totrue. | 
| 10 | The routing-keyto use when sending messages.
By default, this is an emptyString.
Mutually exclusive with 'routing-key-expression'.
Optional. | 
| 11 | A SpEL expression that is evaluated to determine the routing-keyto use when sending messages, with the message as the root object (for example, 'payload.key').
By default, this is an emptyString.
Mutually exclusive withrouting-key.
Optional. | 
| 12 | The default delivery mode for messages: PERSISTENTorNON_PERSISTENT.
Overridden if theheader-mappersets the delivery mode.
If the Spring Integration message headeramqp_deliveryModeis present, theDefaultHeaderMappersets the value.
If this attribute is not supplied and the header mapper does not set it, the default depends on the underlying Spring AMQPMessagePropertiesConverterused by theRabbitTemplate.
If that is not customized at all, the default isPERSISTENT.
Optional. | 
| 13 | Since version 4.2.
An expression defining correlation data.
When provided, this configures the underlying AMQP template to receive publisher confirms.
Requires a dedicated RabbitTemplateand aCachingConnectionFactorywith thepublisherConfirmsproperty set totrue.
When a publisherconfirmis received and correlation data is supplied, it is written to either theconfirm-ack-channelor theconfirm-nack-channel, depending on the confirmation type.
The payload of theconfirmis the correlation data, as defined by this expression.
The message has a header 'amqp_publishConfirm' set totrue(ack) orfalse(nack).
Fornackconfirmations, Spring Integration provides an additional headeramqp_publishConfirmNackCause.
Examples:headers['myCorrelationData']andpayload.
If the expression resolves to aMessage<?>instance (such as#this), the message
emitted on theack/nackchannel is based on that message, with the additional headers added.
Previously, a new message was created with the correlation data as its payload, regardless of type.
Also see Alternative Mechanism for Publisher Confirms and Returns.
Optional. | 
| 14 | The channel to which positive ( ack) publisher confirmations are sent.
The payload is the correlation data defined byconfirm-correlation-expression.
If the expression is#rootor#this, the message is built from the original message, with theamqp_publishConfirmheader set totrue.
Also see Alternative Mechanism for Publisher Confirms and Returns.
Optional (the default isnullChannel). | 
| 15 | The channel to which negative ( nack) publisher confirmations are sent.
The payload is the correlation data defined byconfirm-correlation-expression(if there is noErrorMessageStrategyconfigured).
If the expression is#rootor#this, the message is built from the original message, with theamqp_publishConfirmheader set tofalse.
When there is anErrorMessageStrategy, the message is anErrorMessagewith aNackedAmqpMessageExceptionpayload.
Also see Alternative Mechanism for Publisher Confirms and Returns.
Optional (the default isnullChannel). | 
| 16 | When set, the gateway will synthesize a negative acknowledgment (nack) if a publisher confirm is not received within this time in milliseconds. Pending confirms are checked every 50% of this value, so the actual time a nack is sent will be between 1x and 1.5x this value. Default none (nacks will not be generated). | 
| 17 | The channel to which returned messages are sent.
When provided, the underlying AMQP template is configured to return undeliverable messages to the adapter.
When there is no ErrorMessageStrategyconfigured, the message is constructed from the data received from AMQP, with the following additional headers:amqp_returnReplyCode,amqp_returnReplyText,amqp_returnExchange, andamqp_returnRoutingKey.
When there is anErrorMessageStrategy, the message is anErrorMessagewith aReturnedAmqpMessageExceptionpayload.
Also see Alternative Mechanism for Publisher Confirms and Returns.
Optional. | 
| 18 | A reference to an ErrorMessageStrategyimplementation used to buildErrorMessageinstances when sending returned or negatively acknowledged messages. | 
| 19 | When set to false, the endpoint attempts to connect to the broker during application context initialization.
This allows “fail fast” detection of bad configuration by logging an error message if the broker is down.
Whentrue(the default), the connection is established (if it does not already exist because some other component established it) when the first message is sent. | 
| return-channel Using a  | 
| The underlying AmqpTemplatehas a defaultreplyTimeoutof five seconds.
If you require a longer timeout, you must configure it on thetemplate. | 
Note that the only difference between the outbound adapter and outbound gateway configuration is the setting of the expectReply property.