Class RabbitMQContainer

java.lang.Object
org.testcontainers.containers.FailureDetectingExternalResource
org.testcontainers.containers.GenericContainer<RabbitMQContainer>
org.testcontainers.containers.RabbitMQContainer
All Implemented Interfaces:
AutoCloseable, org.junit.rules.TestRule, org.testcontainers.containers.Container<RabbitMQContainer>, org.testcontainers.containers.ContainerState, org.testcontainers.containers.traits.LinkableContainer, org.testcontainers.containers.wait.strategy.WaitStrategyTarget, org.testcontainers.lifecycle.Startable

public class RabbitMQContainer extends org.testcontainers.containers.GenericContainer<RabbitMQContainer>
Testcontainers implementation for RabbitMQ.

Supported image: rabbitmq

Exposed ports:

  • 5671 (AMQPS)
  • 5672 (AMQP)
  • 15671 (HTTPS)
  • 15672 (HTTP)
  • Constructor Details

    • RabbitMQContainer

      @Deprecated public RabbitMQContainer()
      Deprecated.
      Creates a RabbitMQ container using the official RabbitMQ docker image.
    • RabbitMQContainer

      public RabbitMQContainer(String dockerImageName)
      Creates a RabbitMQ container using a specific docker image.
      Parameters:
      dockerImageName - The docker image to use.
    • RabbitMQContainer

      public RabbitMQContainer(org.testcontainers.utility.DockerImageName dockerImageName)
  • Method Details

    • configure

      protected void configure()
      Overrides:
      configure in class org.testcontainers.containers.GenericContainer<RabbitMQContainer>
    • containerIsStarted

      protected void containerIsStarted(com.github.dockerjava.api.command.InspectContainerResponse containerInfo)
      Overrides:
      containerIsStarted in class org.testcontainers.containers.GenericContainer<RabbitMQContainer>
    • getAdminPassword

      public String getAdminPassword()
      Returns:
      The admin password for the admin account
    • getAdminUsername

      public String getAdminUsername()
      Returns:
      The admin user for the admin account
    • getAmqpPort

      public Integer getAmqpPort()
    • getAmqpsPort

      public Integer getAmqpsPort()
    • getHttpsPort

      public Integer getHttpsPort()
    • getHttpPort

      public Integer getHttpPort()
    • getAmqpUrl

      public String getAmqpUrl()
      Returns:
      AMQP URL for use with AMQP clients.
    • getAmqpsUrl

      public String getAmqpsUrl()
      Returns:
      AMQPS URL for use with AMQPS clients.
    • getHttpUrl

      public String getHttpUrl()
      Returns:
      URL of the HTTP management endpoint.
    • getHttpsUrl

      public String getHttpsUrl()
      Returns:
      URL of the HTTPS management endpoint.
    • withAdminUser

      public RabbitMQContainer withAdminUser(String adminUsername)
      Sets the user for the admin (default is
      guest
      )
      Parameters:
      adminUsername - The admin user.
      Returns:
      This container.
    • withAdminPassword

      public RabbitMQContainer withAdminPassword(String adminPassword)
      Sets the password for the admin (default is
      guest
      )
      Parameters:
      adminPassword - The admin password.
      Returns:
      This container.
    • withSSL

      public RabbitMQContainer withSSL(org.testcontainers.utility.MountableFile keyFile, org.testcontainers.utility.MountableFile certFile, org.testcontainers.utility.MountableFile caFile, RabbitMQContainer.SslVerification verify, boolean failIfNoCert, int verificationDepth)
    • withSSL

      public RabbitMQContainer withSSL(org.testcontainers.utility.MountableFile keyFile, org.testcontainers.utility.MountableFile certFile, org.testcontainers.utility.MountableFile caFile, RabbitMQContainer.SslVerification verify, boolean failIfNoCert)
    • withSSL

      public RabbitMQContainer withSSL(org.testcontainers.utility.MountableFile keyFile, org.testcontainers.utility.MountableFile certFile, org.testcontainers.utility.MountableFile caFile, RabbitMQContainer.SslVerification verify)
    • withPluginsEnabled

      @Deprecated public RabbitMQContainer withPluginsEnabled(String... pluginNames)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withBinding

      @Deprecated public RabbitMQContainer withBinding(String source, String destination)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withBinding

      @Deprecated public RabbitMQContainer withBinding(String vhost, String source, String destination)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withBinding

      @Deprecated public RabbitMQContainer withBinding(String source, String destination, Map<String,Object> arguments, String routingKey, String destinationType)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withBinding

      @Deprecated public RabbitMQContainer withBinding(String vhost, String source, String destination, Map<String,Object> arguments, String routingKey, String destinationType)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withParameter

      @Deprecated public RabbitMQContainer withParameter(String component, String name, String value)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withPermission

      @Deprecated public RabbitMQContainer withPermission(String vhost, String user, String configure, String write, String read)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withUser

      @Deprecated public RabbitMQContainer withUser(String name, String password)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withUser

      @Deprecated public RabbitMQContainer withUser(String name, String password, Set<String> tags)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withPolicy

      @Deprecated public RabbitMQContainer withPolicy(String name, String pattern, Map<String,Object> definition)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withPolicy

      @Deprecated public RabbitMQContainer withPolicy(String vhost, String name, String pattern, Map<String,Object> definition)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withPolicy

      @Deprecated public RabbitMQContainer withPolicy(String name, String pattern, Map<String,Object> definition, int priority, String applyTo)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withOperatorPolicy

      @Deprecated public RabbitMQContainer withOperatorPolicy(String name, String pattern, Map<String,Object> definition)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withOperatorPolicy

      @Deprecated public RabbitMQContainer withOperatorPolicy(String name, String pattern, Map<String,Object> definition, int priority, String applyTo)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withVhost

      @Deprecated public RabbitMQContainer withVhost(String name)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withVhost

      @Deprecated public RabbitMQContainer withVhost(String name, boolean tracing)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withVhostLimit

      @Deprecated public RabbitMQContainer withVhostLimit(String vhost, String name, int value)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withQueue

      @Deprecated public RabbitMQContainer withQueue(String name)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withQueue

      @Deprecated public RabbitMQContainer withQueue(String vhost, String name)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withQueue

      @Deprecated public RabbitMQContainer withQueue(String name, boolean autoDelete, boolean durable, Map<String,Object> arguments)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withQueue

      @Deprecated public RabbitMQContainer withQueue(String vhost, String name, boolean autoDelete, boolean durable, Map<String,Object> arguments)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withExchange

      @Deprecated public RabbitMQContainer withExchange(String name, String type)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withExchange

      @Deprecated public RabbitMQContainer withExchange(String vhost, String name, String type)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withExchange

      @Deprecated public RabbitMQContainer withExchange(String name, String type, boolean autoDelete, boolean internal, boolean durable, Map<String,Object> arguments)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withExchange

      @Deprecated public RabbitMQContainer withExchange(String vhost, String name, String type, boolean autoDelete, boolean internal, boolean durable, Map<String,Object> arguments)
      Deprecated.
      use ContainerState.execInContainer(String...) instead
    • withRabbitMQConfig

      public RabbitMQContainer withRabbitMQConfig(org.testcontainers.utility.MountableFile rabbitMQConf)
      Overwrites the default RabbitMQ configuration file with the supplied one.
      Parameters:
      rabbitMQConf - The rabbitmq.conf file to use (in sysctl format, don't forget empty line in the end of file)
      Returns:
      This container.
    • withRabbitMQConfigSysctl

      public RabbitMQContainer withRabbitMQConfigSysctl(org.testcontainers.utility.MountableFile rabbitMQConf)
      Overwrites the default RabbitMQ configuration file with the supplied one. This function doesn't work with RabbitMQ < 3.7. This function and the Sysctl format is recommended for RabbitMQ >= 3.7
      Parameters:
      rabbitMQConf - The rabbitmq.config file to use (in sysctl format, don't forget empty line in the end of file)
      Returns:
      This container.
    • withRabbitMQConfigErlang

      public RabbitMQContainer withRabbitMQConfigErlang(org.testcontainers.utility.MountableFile rabbitMQConf)
      Overwrites the default RabbitMQ configuration file with the supplied one.
      Parameters:
      rabbitMQConf - The rabbitmq.config file to use (in erlang format)
      Returns:
      This container.