1
votes

As I was looking through the documentation on spring integration's outbound channel adapter I saw that the amqp-template was an optional field. I also noticed that the exchange name and routing key appear on both the Rabbit Template and the outbound channel adapter.

If I did not provide an amqp-template what would the adapter use for the connection factory.

AND

If I specified 1 set of properties in the rabbit template and another in the outbound channel adapter and then gave the outbound channel adapter the rabbit template, which properties would be used? (Not that I would do that I am just curious which component gets their properties used over the other)

1

1 Answers

0
votes

If I did not provide an amqp-template what would the adapter use for the connection factory.

It requires one from the context with the bean name amqpTemplate (AmqpOutboundChannelAdapterParser):

String amqpTemplateRef = element.getAttribute("amqp-template");
if (!StringUtils.hasText(amqpTemplateRef)) {
    amqpTemplateRef = "amqpTemplate";

Properties like exchange and routingKey are used for each message(AmqpOutboundEndpoint):

this.amqpTemplate.convertAndSend(exchangeName, routingKey, requestMessage.getPayload(),

The ConfirmCallback and ReturnCallback are configured for that AmqpTemplate from the AmqpOutboundEndpoint. However in this case you can't use shared bean and have to provide the separate one.

All other RabbitTemplate specific options must be provided on that bean definition. And <int-amqp:outbound-channel-adapter> doesn't have them.