Class AbstractConnectionFactory

    • Field Detail

      • logger

        protected final Log logger
    • Constructor Detail

      • AbstractConnectionFactory

        public AbstractConnectionFactory​(com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory)
        Create a new AbstractConnectionFactory for the given target ConnectionFactory, with no publisher connection factory.
        Parameters:
        rabbitConnectionFactory - the target ConnectionFactory
    • Method Detail

      • setPublisherConnectionFactory

        public void setPublisherConnectionFactory​(@Nullable
                                                  AbstractConnectionFactory publisherConnectionFactory)
        Set a custom publisher connection factory; the type does not need to be the same as this factory.
        Parameters:
        publisherConnectionFactory - the factory.
        Since:
        2.3.2
      • getContextStopped

        protected boolean getContextStopped()
      • getRabbitConnectionFactory

        public com.rabbitmq.client.ConnectionFactory getRabbitConnectionFactory()
        Return a reference to the underlying Rabbit Connection factory.
        Returns:
        the connection factory.
        Since:
        1.5.6
      • getUsername

        public String getUsername()
        Return the user name from the underlying rabbit connection factory.
        Specified by:
        getUsername in interface ConnectionFactory
        Returns:
        the user name.
        Since:
        1.6
      • setUsername

        public void setUsername​(String username)
      • setPassword

        public void setPassword​(String password)
      • setHost

        public void setHost​(String host)
      • setConnectionThreadFactory

        public void setConnectionThreadFactory​(ThreadFactory threadFactory)
        Set the ThreadFactory on the underlying rabbit connection factory.
        Parameters:
        threadFactory - the thread factory.
        Since:
        1.5.3
      • setAddressResolver

        public void setAddressResolver​(com.rabbitmq.client.AddressResolver addressResolver)
        Set an AddressResolver to use when creating connections; overrides setAddresses(String), setHost(String), and setPort(int).
        Parameters:
        addressResolver - the resolver.
        Since:
        2.1.15
      • setUri

        public void setUri​(URI uri)
        Parameters:
        uri - the URI
        Since:
        1.5
        See Also:
        ConnectionFactory.setUri(URI)
      • setUri

        public void setUri​(String uri)
        Parameters:
        uri - the URI
        Since:
        1.5
        See Also:
        ConnectionFactory.setUri(String)
      • setVirtualHost

        public void setVirtualHost​(String virtualHost)
      • setPort

        public void setPort​(int port)
      • setRequestedHeartBeat

        public void setRequestedHeartBeat​(int requestedHeartBeat)
      • setConnectionTimeout

        public void setConnectionTimeout​(int connectionTimeout)
      • setAddresses

        public void setAddresses​(String addresses)
        Set addresses for clustering. This property overrides the host+port properties if not empty.
        Parameters:
        addresses - list of addresses with form "host[:port],..."
      • getConnectionListener

        protected ConnectionListener getConnectionListener()
        A composite connection listener to be used by subclasses when creating and closing connections.
        Returns:
        the connection listener
      • getChannelListener

        protected ChannelListener getChannelListener()
        A composite channel listener to be used by subclasses when creating and closing channels.
        Returns:
        the channel listener
      • setConnectionListeners

        public void setConnectionListeners​(List<? extends ConnectionListener> listeners)
      • setChannelListeners

        public void setChannelListeners​(List<? extends ChannelListener> listeners)
      • setRecoveryListener

        public void setRecoveryListener​(com.rabbitmq.client.RecoveryListener recoveryListener)
        Set a RecoveryListener that will be added to each connection created.
        Parameters:
        recoveryListener - the listener.
        Since:
        2.0
      • addChannelListener

        public void addChannelListener​(ChannelListener listener)
      • setExecutor

        public void setExecutor​(Executor executor)
        Provide an Executor for use by the Rabbit ConnectionFactory when creating connections. Can either be an ExecutorService or a Spring ThreadPoolTaskExecutor, as defined by a <task:executor/> element.
        Parameters:
        executor - The executor.
      • setCloseTimeout

        public void setCloseTimeout​(int closeTimeout)
        How long to wait (milliseconds) for a response to a connection close operation from the broker; default 30000 (30 seconds).
        Parameters:
        closeTimeout - the closeTimeout to set.
      • getCloseTimeout

        public int getCloseTimeout()
      • setCloseExceptionLogger

        public void setCloseExceptionLogger​(ConditionalExceptionLogger closeExceptionLogger)
        Set the strategy for logging close exceptions; by default, if a channel is closed due to a failed passive queue declaration, it is logged at debug level. Normal channel closes (200 OK) are not logged. All others are logged at ERROR level (unless access is refused due to an exclusive consumer condition, in which case, it is logged at INFO level).
        Parameters:
        closeExceptionLogger - the ConditionalExceptionLogger.
        Since:
        1.5
      • getBeanName

        @Nullable
        protected String getBeanName()
        Return a bean name of the component or null if not a bean.
        Returns:
        the bean name or null.
        Since:
        1.7.9
      • setShuffleAddresses

        @Deprecated
        public void setShuffleAddresses​(boolean shuffleAddresses)
        Deprecated.
        since 2.3 in favor of
        When addresses are provided and there is more than one, set to true to shuffle the list before opening a new connection so that the connection to the broker will be attempted in random order.
        Parameters:
        shuffleAddresses - true to shuffle the list.
        Since:
        2.1.8
        See Also:
        .
      • hasPublisherConnectionFactory

        public boolean hasPublisherConnectionFactory()
      • createBareConnection

        protected final Connection createBareConnection()
      • getDefaultHostName

        protected final String getDefaultHostName()
      • shutdownCompleted

        public void shutdownCompleted​(com.rabbitmq.client.ShutdownSignalException cause)
        Specified by:
        shutdownCompleted in interface com.rabbitmq.client.ShutdownListener