Using a9s RabbitMQ for PCF

This topic describes how to use a9s RabbitMQ for Pivotal Cloud Foundry (PCF) after it has been successfully installed.

Use a9s RabbitMQ for PCF with an App

To use a9s RabbitMQ for PCF with an app, create a service instance and bind it to your app by following the steps below. For more information on managing service instances, see Managing Service Instances with the cf CLI.

View the Service

After the tile is installed, run cf marketplace to see a9s-rabbitmq and its service plans:

$ cf marketplace
Getting services from marketplace in org test / space test as admin...
service         plans                                             description
a9s-rabbitmq36  rabbitmq-single-small, rabbitmq-cluster-small,    This is the anynines rabbitmq 36 service.
                rabbitmq-single-big, rabbitmq-cluster-big

For more information on available service plans, see Configure Service Plans.

Create a Service Instance

To provision a RabbitMQ database, run cf create-service SERVICE-NAME PLAN-NAME INSTANCE-NAME where INSTANCE-NAME is any name you want to give the instance you create.

$ cf create-service a9s-rabbitmq36 rabbitmq-single-small my-rabbitmq-service

Note: This may take several minutes.

Run the cf services command to list all your service instances. To view the status of a specific service instance, run cf service INSTANCE-NAME.

Bind an App to a Service Instance

After you create your database, run cf bind-service APP-NAME INSTANCE-NAME to bind the service to your app:

$ cf bind-service a9s-rabbitmq-app my-rabbitmq-service

Restage or Restart Your App

To enable your app to access the service instance, run cf restage APP-NAME or cf restart APP-NAME.

Obtain Credentials for Accessing Your Service Instance

After you bind a service instance to an app, PCF stores the credentials of your RabbitMQ database in the environment variables of the app. Run cf env APP-NAME to display the environment variables.

You can find the credentials in the VCAP_SERVICES key.

$ cf env a9s-rabbitmq-app
Getting env variables for app a9s-rabbitmq-app in org test / space test as admin...

  "a9s-rabbitmq": [
    "credentials": {
     "default_database": "d22906",
     "hosts": [
     "password": "EXAMPLE-PASSWORD",
     "uri": "EXAMPLE-URI",
     "username": "EXAMPLE-USERNAME"
    "label": "a9s-rabbitmq",
    "name": "my-rabbitmq-service",
    "plan": "rabbitmq-single-small",
    "tags": [
     "document store",
     "eventual consistent"

You can use the host, username, and password to connect to your database with a RabbitMQ client.

Delete a Service Instance

Warning: This operation cannot be undone, and the data is lost when the service instance is deleted. If you want to keep your data, you must back up your database before deleting the service instance.

Follow the steps below to unbind the service instance from all apps and then delete it.

List Available Services

Run cf services to list available service instances and get the name of the service instance you want to delete.

$ cf services

Getting services in org test / space test as admin...

name                  service          plan                    bound apps         last operation
my-rabbitmq-service   a9s-rabbitmq36   rabbitmq-single-small   a9s-rabbitmq-app   create succeeded

This example shows that my-rabbitmq-service is bound to the a9s-rabbitmq-app app.

Unbind a Service Instance

Run cf unbind-service APP-NAME INSTANCE-NAME to unbind the service instance from your app.

$ cf unbind-service a9s-rabbitmq-app my-rabbitmq-service

Delete a Service Instance

Run cf delete-service INSTANCE-NAME to delete the service instance:

$ cf delete-service my-rabbitmq-service

Note: This may take several minutes.

Deleting a service instance deprovisions the corresponding infrastructure resources. Run the cf services command to view the deletion status.

Change Service Plan

Run cf update-service INSTANCE-NAME -p PLAN-NAME to modify your service instance to use a different service plan. You may want to use a larger service plan that provides more CPU, RAM, and storage. For more information, see Update a Service Instance.

$ cf update-service my-rabbitmq-service -p a-bigger-plan

You may choose to upgrade your service plan in one of the following ways:

  • From rabbitmq-single-small to rabbitmq-single-big

  • From rabbitmq-cluster-small to rabbitmq-cluster-big

Add a Graphite Endpoint

If you want to monitor your RabbitMQ service instance with Graphite, you can specify an endpoint to send data to with the cf update-service command. This command expects the -c flag and a JSON string containing the graphite and metrics_prefix keys.

$ cf update-service my-rabbitmq-service -c '{ "graphite": [""], "metrics_prefix": "" }'

Add a Syslog Endpoint

You can stream your syslog to a third-party service using the cf update-service command and the -c flag. In this case, the command expects a JSON string containing the syslog key.

$ cf update-service my-rabbitmq-service -c '{ "syslog": [""] }'
Create a pull request or raise an issue on the source for this page in GitHub