Class TestRabbitTemplate

  • All Implemented Interfaces:
    java.util.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.ReturnCallback, 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 java.lang.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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.springframework.amqp.core.Message doSendAndReceiveWithFixed​(java.lang.String exchange, java.lang.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, java.lang.String exchange, java.lang.String routingKey, boolean mandatory, org.springframework.amqp.core.Message message)  
      void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)  
      protected boolean useDirectReplyTo()  
      • Methods inherited from class org.springframework.amqp.rabbit.core.RabbitTemplate

        addAfterReceivePostProcessors, addBeforePublishPostProcessors, 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, determineConfirmsReturnsCapability, doReceiveNoWait, doSend, doSendAndReceive, doSendAndReceiveWithTemporary, doStart, doStop, execute, expectedQueueNames, getAfterReceivePostProcessors, getEncoding, getExchange, getMessageConverter, getMessagePropertiesConverter, getRoutingKey, getUnconfirmed, getUnconfirmedCount, getUUID, handleConfirm, handleReturn, handleReturn, initDefaultStrategies, invoke, isChannelLocallyTransacted, isConfirmListener, isMandatoryFor, isReturnListener, isRunning, isUsePublisherConnection, nullSafeExchange, nullSafeRoutingKey, onMessage, onMessage, receive, receive, receive, receive, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveAndReply, receiveAndReply, receiveAndReply, receiveAndReply, receiveAndReply, receiveAndReply, removeAfterReceivePostProcessor, removeBeforePublishPostProcessor, 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, setReceiveConnectionFactorySelectorExpression, setReceiveTimeout, setRecoveryCallback, setReplyAddress, setReplyErrorHandler, setReplyTimeout, setRetryTemplate, setReturnCallback, 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, getTransactionalResourceHolder, isChannelTransacted, 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.amqp.rabbit.listener.api.ChannelAwareMessageListener

        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 Detail

      • TestRabbitTemplate

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

      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)
                                   throws org.springframework.beans.BeansException
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware
        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,
                                    java.lang.String exchange,
                                    java.lang.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​(java.lang.String exchange,
                                                                                  java.lang.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