Class LocalizedQueueConnectionFactory

  • All Implemented Interfaces:
    ConnectionFactory, RoutingConnectionFactory, DisposableBean

    public class LocalizedQueueConnectionFactory
    extends Object
    implements ConnectionFactory, RoutingConnectionFactory, DisposableBean
    A RoutingConnectionFactory that determines the node on which a queue is located and returns a factory that connects directly to that node. The RabbitMQ management plugin is called over REST to determine the node and the corresponding address for that node is injected into the connection factory. A single instance of each connection factory is retained in a cache. If the location cannot be determined, the default connection factory is returned. This connection factory is typically configured to connect to all the servers in a fail-over mode.

    getTargetConnectionFactory(Object) is invoked by the SimpleMessageListenerContainer, when establishing a connection, with the lookup key having the format '[queueName]'.

    All ConnectionFactory methods delegate to the default

    Since:
    1.2
    Author:
    Gary Russell
    • Constructor Detail

      • LocalizedQueueConnectionFactory

        public LocalizedQueueConnectionFactory​(ConnectionFactory defaultConnectionFactory,
                                               Map<String,​String> nodeToAddress,
                                               String[] adminUris,
                                               String vhost,
                                               String username,
                                               String password,
                                               boolean useSSL,
                                               Resource sslPropertiesLocation)
        Parameters:
        defaultConnectionFactory - the fallback connection factory to use if the queue can't be located.
        nodeToAddress - a Map of node to address: ([email protected] : server1:5672)
        adminUris - the rabbitmq admin addresses (https://host:port, ...) must be the same length as addresses.
        vhost - the virtual host.
        username - the user name.
        password - the password.
        useSSL - use SSL.
        sslPropertiesLocation - the SSL properties location.
      • LocalizedQueueConnectionFactory

        public LocalizedQueueConnectionFactory​(ConnectionFactory defaultConnectionFactory,
                                               Map<String,​String> nodeToAddress,
                                               String[] adminUris,
                                               String vhost,
                                               String username,
                                               String password,
                                               boolean useSSL,
                                               String keyStore,
                                               String trustStore,
                                               String keyStorePassPhrase,
                                               String trustStorePassPhrase)
        Parameters:
        defaultConnectionFactory - the fallback connection factory to use if the queue can't be located.
        nodeToAddress - a Map of node to address: ([email protected] : server1:5672)
        adminUris - the rabbitmq admin addresses (https://host:port, ...) must be the same length as addresses.
        vhost - the virtual host.
        username - the user name.
        password - the password.
        useSSL - use SSL.
        keyStore - the key store resource (e.g. "file:/foo/keystore").
        trustStore - the trust store resource (e.g. "file:/foo/truststore").
        keyStorePassPhrase - the pass phrase for the key store.
        trustStorePassPhrase - the pass phrase for the trust store.
      • LocalizedQueueConnectionFactory

        public LocalizedQueueConnectionFactory​(ConnectionFactory defaultConnectionFactory,
                                               String[] addresses,
                                               String[] adminUris,
                                               String[] nodes,
                                               String vhost,
                                               String username,
                                               String password,
                                               boolean useSSL,
                                               @Nullable
                                               Resource sslPropertiesLocation)
        Parameters:
        defaultConnectionFactory - the fallback connection factory to use if the queue can't be located.
        addresses - the rabbitmq server addresses (host:port, ...).
        adminUris - the rabbitmq admin addresses (https://host:port, ...)
        nodes - the rabbitmq nodes corresponding to addresses ([email protected], ...) must be the same length as addresses.
        vhost - the virtual host.
        username - the user name.
        password - the password.
        useSSL - use SSL.
        sslPropertiesLocation - the SSL properties location.
      • LocalizedQueueConnectionFactory

        public LocalizedQueueConnectionFactory​(ConnectionFactory defaultConnectionFactory,
                                               String[] addresses,
                                               String[] adminUris,
                                               String[] nodes,
                                               String vhost,
                                               String username,
                                               String password,
                                               boolean useSSL,
                                               String keyStore,
                                               String trustStore,
                                               String keyStorePassPhrase,
                                               String trustStorePassPhrase)
        Parameters:
        defaultConnectionFactory - the fallback connection factory to use if the queue can't be located.
        addresses - the rabbitmq server addresses (host:port, ...).
        adminUris - the rabbitmq admin addresses (https://host:port, ...).
        nodes - the rabbitmq nodes corresponding to addresses ([email protected], ...) must be the same length as addresses.
        vhost - the virtual host.
        username - the user name.
        password - the password.
        useSSL - use SSL.
        keyStore - the key store resource (e.g. "file:/foo/keystore").
        trustStore - the trust store resource (e.g. "file:/foo/truststore").
        keyStorePassPhrase - the pass phrase for the key store.
        trustStorePassPhrase - the pass phrase for the trust store.