testcontainers-cpp 0.2.0
Native C++20 Testcontainers over the Docker Engine API
Loading...
Searching...
No Matches
testcontainers::modules::RabbitMQContainer Class Reference

A running RabbitMQ broker: connection getters plus the owned container. More...

#include <testcontainers/modules/RabbitMQ.hpp>

Public Member Functions

const std::string & host () const noexcept
 The address a client in the test process connects to.
std::uint16_t amqp_port () const noexcept
 The host port published for AMQP 0-9-1 (container port 5672).
std::uint16_t management_port () const noexcept
 The host port published for the management HTTP API/UI (container port 15672).
const std::string & username () const noexcept
const std::string & password () const noexcept
const std::string & vhost () const noexcept
std::string amqp_url () const
 The AMQP connection URI, e.g.
std::string management_url () const
 The management base URL, e.g.
Containercontainer () noexcept
 The underlying container handle: exec rabbitmqctl / rabbitmq-diagnostics, read logs, stop() early, keep() it past the test.
const Containercontainer () const noexcept

Friends

class RabbitMQImage

Detailed Description

A running RabbitMQ broker: connection getters plus the owned container.

Move-only — it owns the core Container, whose destructor force-removes the broker (RAII teardown; container().keep() or reuse opt out, see Container).

Member Function Documentation

◆ host()

const std::string & testcontainers::modules::RabbitMQContainer::host ( ) const
inlinenoexcept

The address a client in the test process connects to.

Resolved once, when the container started.

◆ amqp_port()

std::uint16_t testcontainers::modules::RabbitMQContainer::amqp_port ( ) const
inlinenoexcept

The host port published for AMQP 0-9-1 (container port 5672).

Resolved once, when the container started.

◆ management_port()

std::uint16_t testcontainers::modules::RabbitMQContainer::management_port ( ) const
inlinenoexcept

The host port published for the management HTTP API/UI (container port 15672).

Meaningful only for a -management image variant; with a plain image the port is published but nothing listens on it.

◆ username()

const std::string & testcontainers::modules::RabbitMQContainer::username ( ) const
inlinenoexcept

◆ password()

const std::string & testcontainers::modules::RabbitMQContainer::password ( ) const
inlinenoexcept

◆ vhost()

const std::string & testcontainers::modules::RabbitMQContainer::vhost ( ) const
inlinenoexcept

◆ amqp_url()

std::string testcontainers::modules::RabbitMQContainer::amqp_url ( ) const

The AMQP connection URI, e.g.

amqp://guest:guest@localhost:32771.

For the default vhost "/" no path segment is emitted: in an AMQP URI an absent path means the client's default vhost ("/" in every mainstream client), and unlike the equivalent explicit /%2F spelling it also survives URI parsers that skip percent-decoding. Any other vhost is appended percent-encoded as one path segment ("/orders", "/a%2Fb"). Clients taking discrete arguments instead of a URI (rabbitmq-c's amqp_login, SimpleAmqpClient) use host() / amqp_port() / username() / password() / vhost() directly.

◆ management_url()

std::string testcontainers::modules::RabbitMQContainer::management_url ( ) const

The management base URL, e.g.

http://localhost:32772. REST endpoints live under /api/... and take HTTP basic auth with username() / password().

◆ container() [1/2]

Container & testcontainers::modules::RabbitMQContainer::container ( )
inlinenoexcept

The underlying container handle: exec rabbitmqctl / rabbitmq-diagnostics, read logs, stop() early, keep() it past the test.

◆ container() [2/2]

const Container & testcontainers::modules::RabbitMQContainer::container ( ) const
inlinenoexcept

◆ RabbitMQImage

friend class RabbitMQImage
friend