Class RabbitTemplateConfigurer

java.lang.Object
org.springframework.boot.amqp.autoconfigure.RabbitTemplateConfigurer

public class RabbitTemplateConfigurer extends Object
Configure RabbitTemplate with sensible defaults tuned using configuration properties.

Can be injected into application code and used to define a custom RabbitTemplate whose configuration is based upon that produced by auto-configuration.

Since:
4.0.0
Author:
Stephane Nicoll, Yanming Zhou
  • Constructor Details

    • RabbitTemplateConfigurer

      public RabbitTemplateConfigurer(RabbitProperties rabbitProperties)
      Creates a new configurer that will use the given rabbitProperties.
      Parameters:
      rabbitProperties - properties to use
  • Method Details

    • setMessageConverter

      public void setMessageConverter(@Nullable org.springframework.amqp.support.converter.MessageConverter messageConverter)
      Set the MessageConverter to use or null if the out-of-the-box converter should be used.
      Parameters:
      messageConverter - the MessageConverter
    • setRetrySettingsCustomizers

      public void setRetrySettingsCustomizers(@Nullable List<RabbitTemplateRetrySettingsCustomizer> retrySettingsCustomizers)
      Set the RabbitTemplateRetrySettingsCustomizer instances to use.
      Parameters:
      retrySettingsCustomizers - the retry settings customizers
    • getRabbitProperties

      protected final RabbitProperties getRabbitProperties()
    • configure

      public void configure(org.springframework.amqp.rabbit.core.RabbitTemplate template, org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)
      Configure the specified RabbitTemplate. The template can be further tuned and default settings can be overridden.
      Parameters:
      template - the RabbitTemplate instance to configure
      connectionFactory - the ConnectionFactory to use
    • createRetryTemplate

      protected RetryTemplate createRetryTemplate(RabbitProperties.Retry properties)