Compose Database-as-a-Service Help and Documentation

Everything you need to know about Compose, Hosted or Enterprise, is here in our help system. Whether you run one database for your businesses' sole application or six different databases to support an entire corporation, we've got the information you need.

Python and RabbitMQ

This code uses the pika library, as recommended by the RabbitMQ developers.

Connection Parameters and TLS/SSL

Pika provides a class that can make a connection directly from the connection string provided on the Overview of your deployment. To change the vhost in the connection string, change the final piece of the path to the vhost you wish to connect to.

TLS/SSL is set to "True" along with any additional options. The example sets the TLS version to TLSv1.2, the version supported by Compose.

Example Code

#!/usr/bin/env python
import pika
import sys
import ssl

# connection string and initialization
parameters = pika.URLParameters('amqps://user:[email protected]')
parameters.ssl = True
parameters.ssl_options = dict(ssl_version=ssl.PROTOCOL_TLSv1_2)

connection = pika.BlockingConnection(parameters)
channel =
connection = pika.BlockingConnection(parameters)
channel =

message='This is not a message, this is a pythonic tribute to a message'




The example then connects to the deployment and posts a message to the postal exchange with the 'tributes' routing key.

If you wish to verify the example after it has run, and see the exchange or consume the message, see the Verifying Connections and Queue Activity page.

Still Need Help?

If this article didn't solve things, summon a human and get some help!

Updated about a year ago

Python and RabbitMQ

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.