Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-2773

AmqpOutboundEndpoint doesn't allow to use default 'exchange' & 'routingKey' from RabbitTemplate

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 2.2 RC1
    • Fix Version/s: 2.2 RC2
    • Component/s: AMQP Support
    • Labels:

      Description

      A test config:

      <rabbit:queue name="si.test.queue" />
      
      <rabbit:direct-exchange name="si.test.exchange">
      	<rabbit:bindings>
                   <rabbit:binding queue="si.test.queue" key="si.test.binding" />
      	</rabbit:bindings>
      </rabbit:direct-exchange>
      
      <rabbit:template id="amqpTemplate" connection-factory="connectionFactory" exchange="si.test.exchange" routing-key="si.test.binding"/>
      
      <amqp:outbound-channel-adapter channel="toRabbit"/>
      

      So, we are expecting a Message in the "si.test.queue", but it was sended into ""-exchange via ""-routing-key, as they are configured in the AmqpOutboundEndpoint:

      private volatile String exchangeName = "";
      private volatile String routingKey = "";
      

      From the other side the RabbitTemplate#doSend has logic:

      if (exchange == null) {
      	// try to send to configured exchange
      	exchange = this.exchange;
      }
      if (routingKey == null) {
      	// try to send to configured routing key
              routingKey = this.routingKey;
      }
      

      So, or AmqpOutboundEndpoint fields should be NULL,
      or RabbitTemplate should use StringUtils.hasText

      And as I see it should be backported into 2.1

        Attachments

          Activity

            People

            • Assignee:
              abilan Artem Bilan
              Reporter:
              abilan Artem Bilan
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0.25d
                0.25d
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 0.25d
                0.25d