Class SimpleConnectionFactoryBuilder

java.lang.Object
interlok.rabbitmq.ConnectionFactoryBuilder
interlok.rabbitmq.SimpleConnectionFactoryBuilder
Direct Known Subclasses:
BasicConnectionFactoryBuilder

@ComponentProfile(summary="Simple RabbitMQ Connection Builder", since="4.3.0") public class SimpleConnectionFactoryBuilder extends ConnectionFactoryBuilder
A simple connection factory for RabbitMQ.

This is the simplest connection factory possible; everything required to connect must be specified as part of the broker-url. In the event that you want to have obfuscated passwords then you want to use BasicConnectionFactoryBuilder instead.

If you don't override the username and password in the broker-url then it's likely to default to guest/guest which is the underlying SDK default.

  • Constructor Details

    • SimpleConnectionFactoryBuilder

      public SimpleConnectionFactoryBuilder()
  • Method Details

    • build

      public com.rabbitmq.client.ConnectionFactory build() throws Exception
      Description copied from class: ConnectionFactoryBuilder
      Build the connection factory.
      Specified by:
      build in class ConnectionFactoryBuilder
      Throws:
      Exception
    • withBrokerUrl

      public <T extends SimpleConnectionFactoryBuilder> T withBrokerUrl(String s)
    • setBrokerUrl

      public void setBrokerUrl(String brokerUrl)
      The RabbitMQ Broker URL.

      Everything including the username and password may be defined on the broker url so you can configure something like amqp://admin:admin@localhost:5672/vhost as required.

      Since you may well have sensitive information in the URL, you can also use the external %sysprop{} and %env{} syntax in order to derive the broker URL from system properties or the environment, so %env{CLOUDAMQP_URL} is perfectly reasonable.

    • getBrokerUrl

      public String getBrokerUrl()
      The RabbitMQ Broker URL.

      Everything including the username and password may be defined on the broker url so you can configure something like amqp://admin:admin@localhost:5672/vhost as required.

      Since you may well have sensitive information in the URL, you can also use the external %sysprop{} and %env{} syntax in order to derive the broker URL from system properties or the environment, so %env{CLOUDAMQP_URL} is perfectly reasonable.