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.

Go and RabbitMQ

For Go we recommend the package.

In this Go example, the code only makes a server verified connection.

package main

import (


func failOnError(err error, msg string) {
    if err != nil {
        log.Fatalf("%s: %s", msg, err)
        panic(fmt.Sprintf("%s: %s", msg, err))

func main() {

    conn, err := amqp.Dial("amqps://user:[email protected]:10194/Rabbity")
  failOnError(err, "Failed to connect to RabbitMQ")
    defer conn.Close()

Note that the failonError function shortens the Go error handling.

The main method starts by creating the connection. The RabbitMQ password is passed to the Dial function. A DialTLS function also exists, but the use of amqps in the URL is sufficient to turn on TLS connections.

Using defer ensures that the connection is closed when exiting.

The rest of the Go code, as with previous examples, opens a channel, creates the exchange and sends a message.

message := "This is not a message, this is a go tribute to a message"
    routingKey := "tributes"
    exchangeName := "postal"

    ch, err := conn.Channel()
    failOnError(err, "Failed to open a channel")
    defer ch.Close()

    err = ch.ExchangeDeclare(
        exchangeName, // name
        "direct",     // type
        true,         // durable
        false,        // auto-deleted
        false,        // internal
        false,        // no-wait
        nil,          // arguments
    failOnError(err, "Failed to declare an exchange")

    err = ch.Publish(
        exchangeName, // exchange
        routingKey,   // routing key
        false,        // mandatory
        false,        // immediate
            ContentType: "text/plain",
            Body:        []byte(message),
    failOnError(err, "Failed to publish a message")

Still Need Help?

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

Updated about a year ago

Go 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.