Creating Shovels With RabbitMQ Admin Http Api

Within RabbitMQ, sometimes you need to move messages from one queue to another. One tool for accomplishing this is the RabbitMQ Shovel plugin. While this tool works great, it is only accessible via the RabbitMQ management portal if you have administrative privileges. This could be a problem, depending on the organization that you’re working in.

As an alternative, you can interact with the Shovel plugin via HTTP calls.

You can create a new shovel by issuing a PUT statement to [your rabbit host]:[your rabbit port]/api/parameters/shovel/%2f/[your shovel name] with the following body:

    "src-uri":  "amqp://[your rabbit host]",
    "src-queue":  "[your source queue]",
    "dest-uri": "amqp://localhost",
    "dest-queue": [your destination queue]",
    "delete-after": "queue-length"

One thing to note is the delete-after member of the request body. This member states that the shovel should delete itself once every message that was in the source queue at shovel creation as been moved. The documentation shows this member as src-delete-after – that is incorrect.

With this API, you can offer the shovel functionality to everyone in your organization without relaxing security. Maybe you could even put it behind a Slack bot?

185 Words

2018-01-29 00:00 +0000