seaworthy.containers.rabbitmq

RabbitMQ container definition.

class RabbitMQContainer(name='rabbitmq', image='rabbitmq:alpine', wait_patterns=('Server startup complete', ), vhost='/vhost', user='user', password='password', **kwargs)[source]

RabbitMQ container definition.

Todo

Write more docs.

base_kwargs()[source]

Add a tmpfs entry for /var/lib/rabbitmq to avoid unnecessary disk I/O and environment entries for the configured vhost and user creds.

broker_url()[source]

Returns a “broker URL” for use with Celery.

clean()[source]

Remove all data by using rabbitmqctl to eval rabbit_mnesia:reset().

exec_rabbitmqctl(command, args=[], rabbitmqctl_opts=['-q'])[source]

Execute a rabbitmqctl command inside a running container.

Parameters:
  • command – the command to run
  • args – a list of args for the command
  • rabbitmqctl_opts – a list of extra options to pass to rabbitmqctl
Returns:

a tuple of the command exit code and output

exec_rabbitmqctl_list(resources, args=[], rabbitmq_opts=['-q', '--no-table-headers'])[source]

Execute a rabbitmqctl command to list the given resources.

Parameters:
  • resources – the resources to list, e.g. 'vhosts'
  • args – a list of args for the command
  • rabbitmqctl_opts – a list of extra options to pass to rabbitmqctl
Returns:

a tuple of the command exit code and output

list_queues()[source]

Run the list_queues command (for the default vhost) and return a list of tuples describing the queues.

Returns:A list of 2-element tuples. The first element is the queue name, the second is the current queue size.
list_users()[source]

Run the list_users command and return a list of tuples describing the users.

Returns:A list of 2-element tuples. The first element is the username, the second a list of tags for the user.
list_vhosts()[source]

Run the list_vhosts command and return a list of vhost names.

wait_for_start()[source]

Wait for the RabbitMQ process to be come up.