0
0
RabbitmqConceptBeginner · 3 min read

RabbitMQ Shovel: What It Is and How It Works

In RabbitMQ, Shovel is a plugin that automatically moves messages from one queue or broker to another. It acts like a bridge to transfer messages reliably between different RabbitMQ servers or clusters, even across networks.
⚙️

How It Works

Think of RabbitMQ Shovel as a conveyor belt that picks up messages from one place and delivers them to another. It continuously watches a source queue or exchange and moves messages to a destination queue or exchange, even if they are on different RabbitMQ servers.

This process is automatic and reliable. If the connection breaks, Shovel will try to reconnect and continue moving messages without losing any. It works in the background, so your applications don’t have to worry about the message transfer details.

Shovel can be configured to move messages in real-time or in batches, and it supports filtering and transforming messages during transfer. This makes it useful for linking different parts of a system or migrating data between RabbitMQ clusters.

💻

Example

This example shows how to configure a Shovel to move messages from a source queue on one RabbitMQ server to a destination queue on another server using the RabbitMQ management plugin.

json
{
  "component": "shovel",
  "name": "my-shovel",
  "value": {
    "src-uri": "amqp://source_user:source_pass@source_host/%2f",
    "src-queue": "source_queue",
    "dest-uri": "amqp://dest_user:dest_pass@dest_host/%2f",
    "dest-queue": "dest_queue",
    "ack-mode": "on-confirm",
    "delete-after": "never"
  }
}
Output
Shovel named 'my-shovel' is created and starts moving messages from 'source_queue' on the source server to 'dest_queue' on the destination server.
🎯

When to Use

Use RabbitMQ Shovel when you need to reliably move messages between different RabbitMQ brokers or clusters. It is helpful for:

  • Connecting separate RabbitMQ servers in different data centers or cloud regions.
  • Migrating queues and messages during upgrades or server changes.
  • Distributing workload by forwarding messages to specialized processing clusters.
  • Ensuring message delivery across network boundaries where direct client connections are not possible.

Shovel is ideal when you want a hands-off, automatic way to keep messages flowing between RabbitMQ instances without writing custom code.

Key Points

  • Shovel is a RabbitMQ plugin that moves messages between queues or brokers automatically.
  • It works reliably, reconnecting if connections drop.
  • Configuration is done via JSON or the management UI.
  • Useful for cross-cluster communication and migration.
  • Runs continuously in the background without manual intervention.

Key Takeaways

RabbitMQ Shovel automatically transfers messages between queues or brokers reliably.
It reconnects and continues moving messages if network issues occur.
Shovel is configured via JSON or the management interface for easy setup.
Use Shovel to link RabbitMQ servers across networks or for migration tasks.
It runs in the background, requiring no changes to your application code.