- class RabbitMqContainer(image: str = 'rabbitmq:latest', port: int | None = None, username: str | None = None, password: str | None = None, vhost: str | None = None, **kwargs)ΒΆ
Test container for RabbitMQ. The example below spins up a RabbitMQ broker and uses the pika client library to establish a connection to the broker.
Example
>>> import pika >>> from testcontainers.rabbitmq import RabbitMqContainer >>> with RabbitMqContainer("rabbitmq:3.9.10") as rabbitmq: ... connection = pika.BlockingConnection(rabbitmq.get_connection_params()) ... channel = connection.channel()