testcontainers_gleam/rabbitmq

RabbitMQ container configuration.

Wraps Testcontainers.RabbitMQContainer to provide typed builders for a RabbitMQ container. Use new to create a default configuration, customize with with_* functions, then build to get a Container.

Default image: rabbitmq:3-alpine, port: 5672, timeout: 60s, credentials: guest/guest, vhost: “/”.

Example

import testcontainers_gleam
import testcontainers_gleam/rabbitmq

let config = rabbitmq.new()
let container = rabbitmq.build(config)
let assert Ok(running) = testcontainers_gleam.start_container(container)
let url = rabbitmq.connection_url(running)

Types

Configuration for a RabbitMQ container.

pub type RabbitmqConfig

Values

pub fn build(config: RabbitmqConfig) -> container.Container

Build a Container from this RabbitMQ configuration.

pub fn connection_url(container: container.Container) -> String

Get the RabbitMQ connection URL (e.g. "amqp://guest:guest@localhost:32768/").

pub fn default_image() -> String

Get the default Docker image name (without tag).

pub fn default_port() -> Int

Get the default port (5672).

pub fn new() -> RabbitmqConfig

Create a new RabbitMQ container configuration with defaults.

Default image: rabbitmq:3-alpine, port: 5672, timeout: 60s, credentials: guest/guest, vhost: “/”.

pub fn port(container: container.Container) -> Int

Get the host-mapped port for the RabbitMQ container.

pub fn with_check_image(
  config: RabbitmqConfig,
  pattern: String,
) -> RabbitmqConfig

Set the regex pattern to validate the image name.

pub fn with_cmd(
  config: RabbitmqConfig,
  cmd: List(String),
) -> RabbitmqConfig

Set the command to run in the container.

pub fn with_image(
  config: RabbitmqConfig,
  image: String,
) -> RabbitmqConfig

Override the Docker image.

pub fn with_password(
  config: RabbitmqConfig,
  password: String,
) -> RabbitmqConfig

Override the password (default “guest”).

pub fn with_port(
  config: RabbitmqConfig,
  port: Int,
) -> RabbitmqConfig

Override the exposed port (default 5672).

pub fn with_reuse(
  config: RabbitmqConfig,
  reuse: Bool,
) -> RabbitmqConfig

Enable or disable container reuse across test runs.

pub fn with_username(
  config: RabbitmqConfig,
  username: String,
) -> RabbitmqConfig

Override the username (default “guest”).

pub fn with_virtual_host(
  config: RabbitmqConfig,
  vhost: String,
) -> RabbitmqConfig

Override the virtual host (default “/”).

pub fn with_wait_timeout(
  config: RabbitmqConfig,
  timeout: Int,
) -> RabbitmqConfig

Override the wait timeout in milliseconds (default 60000).

Search Document