Class TestRabbitTemplate

java.lang.Object
org.springframework.amqp.rabbit.connection.RabbitAccessor
org.springframework.amqp.rabbit.core.RabbitTemplate
org.springframework.amqp.rabbit.test.TestRabbitTemplate
All Implemented Interfaces:
EventListener, org.springframework.amqp.core.AmqpTemplate, org.springframework.amqp.core.MessageListener, org.springframework.amqp.rabbit.connection.PublisherCallbackChannel.Listener, org.springframework.amqp.rabbit.core.RabbitOperations, org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener, org.springframework.amqp.rabbit.support.ListenerContainerAware, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>, org.springframework.context.Lifecycle

public class TestRabbitTemplate extends org.springframework.amqp.rabbit.core.RabbitTemplate implements org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
A RabbitTemplate that invokes @RabbitListener s directly. It currently only supports the queue name in the routing key. It does not currently support publisher confirms/returns.
Since:
2.0
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.amqp.rabbit.core.RabbitTemplate

    org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback, org.springframework.amqp.rabbit.core.RabbitTemplate.ReturnsCallback, org.springframework.amqp.rabbit.core.RabbitTemplate.TemplateConsumer

    Nested classes/interfaces inherited from interface org.springframework.amqp.rabbit.core.RabbitOperations

    org.springframework.amqp.rabbit.core.RabbitOperations.OperationsCallback<T extends Object>
  • Field Summary

    Fields inherited from class org.springframework.amqp.rabbit.connection.RabbitAccessor

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
    TestRabbitTemplate(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.springframework.amqp.core.Message
    doSendAndReceiveWithFixed(String exchange, String routingKey, org.springframework.amqp.core.Message message, org.springframework.amqp.rabbit.connection.CorrelationData correlationData)
     
    void
    onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
     
    protected void
    sendToRabbit(com.rabbitmq.client.Channel channel, String exchange, String routingKey, boolean mandatory, org.springframework.amqp.core.Message message)
     
    void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
     
    protected boolean
     

    Methods inherited from class org.springframework.amqp.rabbit.core.RabbitTemplate

    addAfterReceivePostProcessors, addBeforePublishPostProcessors, addConsumerArg, addListener, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertMessageIfNecessary, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveAsType, convertSendAndReceiveRaw, correlationConvertAndSend, destroy, doReceiveNoWait, doSend, doSendAndReceive, doSendAndReceiveWithTemporary, doStart, doStop, execute, expectedQueueNames, getAfterReceivePostProcessors, getDefaultReceiveQueue, getEncoding, getExchange, getMessageConverter, getMessagePropertiesConverter, getRoutingKey, getUnconfirmed, getUnconfirmedCount, getUUID, handleConfirm, handleReturn, initDefaultStrategies, invoke, isChannelLocallyTransacted, isConfirmListener, isMandatoryFor, isReturnListener, isRunning, isUsePublisherConnection, logReceived, nullSafeExchange, nullSafeRoutingKey, observeTheSend, onMessage, receive, receive, receive, receive, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndReply, receiveAndReply, receiveAndReply, receiveAndReply, receiveAndReply, receiveAndReply, removeAfterReceivePostProcessor, removeBeforePublishPostProcessor, removeConsumerArg, replyTimedOut, revoke, send, send, send, send, send, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, sendAndReceive, setAfterReceivePostProcessors, setBeanFactory, setBeanName, setBeforePublishPostProcessors, setConfirmCallback, setConnectionFactory, setCorrelationDataPostProcessor, setCorrelationKey, setDefaultReceiveQueue, setEncoding, setExchange, setMandatory, setMandatoryExpression, setMandatoryExpressionString, setMessageConverter, setMessagePropertiesConverter, setNoLocalReplyConsumer, setObservationConvention, setObservationEnabled, setReceiveConnectionFactorySelectorExpression, setReceiveTimeout, setRecoveryCallback, setReplyAddress, setReplyErrorHandler, setReplyTimeout, setRetryTemplate, setReturnsCallback, setRoutingKey, setSendConnectionFactorySelectorExpression, setTaskExecutor, setUseChannelForCorrelation, setUseDirectReplyToContainer, setUsePublisherConnection, setUserCorrelationId, setUserIdExpression, setUserIdExpressionString, setUseTemporaryReplyQueues, start, stop, waitForConfirms, waitForConfirmsOrDie

    Methods inherited from class org.springframework.amqp.rabbit.connection.RabbitAccessor

    afterPropertiesSet, convertRabbitAccessException, createConnection, getChannel, getConnection, getConnectionFactory, getObservationRegistry, getTransactionalResourceHolder, isChannelTransacted, obtainObservationRegistry, setChannelTransacted

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.context.ApplicationListener

    supportsAsyncExecution

    Methods inherited from interface org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener

    onMessage, onMessageBatch

    Methods inherited from interface org.springframework.amqp.core.MessageListener

    containerAckMode, isAsyncReplies, onMessageBatch

    Methods inherited from interface org.springframework.amqp.rabbit.core.RabbitOperations

    convertSendAndReceiveAsType, getConnectionFactory, invoke
  • Constructor Details

    • TestRabbitTemplate

      public TestRabbitTemplate(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Overrides:
      setApplicationContext in class org.springframework.amqp.rabbit.core.RabbitTemplate
      Throws:
      org.springframework.beans.BeansException
    • onApplicationEvent

      public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
    • useDirectReplyTo

      protected boolean useDirectReplyTo()
      Overrides:
      useDirectReplyTo in class org.springframework.amqp.rabbit.core.RabbitTemplate
    • sendToRabbit

      protected void sendToRabbit(com.rabbitmq.client.Channel channel, String exchange, String routingKey, boolean mandatory, org.springframework.amqp.core.Message message)
      Overrides:
      sendToRabbit in class org.springframework.amqp.rabbit.core.RabbitTemplate
    • doSendAndReceiveWithFixed

      protected org.springframework.amqp.core.Message doSendAndReceiveWithFixed(String exchange, String routingKey, org.springframework.amqp.core.Message message, org.springframework.amqp.rabbit.connection.CorrelationData correlationData)
      Overrides:
      doSendAndReceiveWithFixed in class org.springframework.amqp.rabbit.core.RabbitTemplate