All Projects → dubek → Rabbitmq Dump Queue

dubek / Rabbitmq Dump Queue

Licence: mit
Dump messages from a RabbitMQ queue to files, without affecting the queue.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Rabbitmq Dump Queue

Rabbitmq Server
Open source RabbitMQ: core server and tier 1 (built-in) plugins
Stars: ✭ 9,064 (+6420.86%)
Mutual labels:  rabbitmq, amqp
Amqpstorm
Thread-safe Python RabbitMQ Client & Management library
Stars: ✭ 130 (-6.47%)
Mutual labels:  rabbitmq, amqp
Humusamqp
PHP 7 AMQP library
Stars: ✭ 70 (-49.64%)
Mutual labels:  rabbitmq, amqp
Tackle
💯 percent reliable microservice communication
Stars: ✭ 44 (-68.35%)
Mutual labels:  rabbitmq, amqp
Aiormq
Pure python AMQP 0.9.1 asynchronous client library
Stars: ✭ 112 (-19.42%)
Mutual labels:  rabbitmq, amqp
Yii2 Rabbitmq
RabbitMQ Extension for Yii2
Stars: ✭ 52 (-62.59%)
Mutual labels:  rabbitmq, amqp
Rabbitroutine
Lightweight library that handles RabbitMQ auto-reconnect and publishing retry routine for you.
Stars: ✭ 77 (-44.6%)
Mutual labels:  rabbitmq, amqp
Spring Boot Rabbitmq
Spring Boot集成rabbitMQ实现消息推送
Stars: ✭ 24 (-82.73%)
Mutual labels:  rabbitmq, amqp
Amiquip
Pure Rust RabbitMQ client
Stars: ✭ 88 (-36.69%)
Mutual labels:  rabbitmq, amqp
Rabbus
A tiny wrapper over amqp exchanges and queues 🚌 ✨
Stars: ✭ 86 (-38.13%)
Mutual labels:  rabbitmq, amqp
Yii Queue
Queue extension for Yii 3.0
Stars: ✭ 38 (-72.66%)
Mutual labels:  rabbitmq, amqp
Amqproxy
An intelligent AMQP proxy, with connection and channel pooling/reusing
Stars: ✭ 115 (-17.27%)
Mutual labels:  rabbitmq, amqp
Yii2 Queue
Yii2 Queue Extension. Supports DB, Redis, RabbitMQ, Beanstalk and Gearman
Stars: ✭ 977 (+602.88%)
Mutual labels:  rabbitmq, amqp
Rabbitmqbundle
RabbitMQ Bundle for the Symfony2 web framework
Stars: ✭ 1,125 (+709.35%)
Mutual labels:  rabbitmq, amqp
Remit
RabbitMQ-backed microservices supporting RPC, pubsub, automatic service discovery and scaling with no code changes.
Stars: ✭ 24 (-82.73%)
Mutual labels:  rabbitmq, amqp
Laravel Queue Rabbitmq
RabbitMQ driver for Laravel Queue. Supports Laravel Horizon.
Stars: ✭ 1,175 (+745.32%)
Mutual labels:  rabbitmq, amqp
Aio Pika
AMQP 0.9 client designed for asyncio and humans.
Stars: ✭ 611 (+339.57%)
Mutual labels:  rabbitmq, amqp
Node Celery
Celery client for Node.js
Stars: ✭ 648 (+366.19%)
Mutual labels:  rabbitmq, amqp
Bunny
Bunny is a popular, easy to use, mature Ruby client for RabbitMQ
Stars: ✭ 1,224 (+780.58%)
Mutual labels:  rabbitmq, amqp
Rabbitmq Mock
Mock for RabbitMQ Java amqp-client
Stars: ✭ 114 (-17.99%)
Mutual labels:  rabbitmq, amqp

rabbitmq-dump-queue

Dump messages from a RabbitMQ queue to files, without affecting the queue.

Build Status

Installation

Download a release

Precompiled binary packages can be found on the releases page.

Compile from source

If you have Go installed, you can install rabbitmq-dump-queue from source by running:

go get github.com/dubek/rabbitmq-dump-queue

The rabbitmq-dump-queue executable will be created in the $GOPATH/bin directory.

Usage

To dump the first 50 messages of queue incoming_1 to /tmp:

rabbitmq-dump-queue -uri="amqp://user:[email protected]:5672/" -queue=incoming_1 -max-messages=50 -output-dir=/tmp

This will create the files /tmp/msg-0000, /tmp/msg-0001, and so on.

The output filenames are printed one per line to the standard output; this allows piping the output of rabbitmq-dump-queue to xargs or similar utilities in order to perform further processing on each message (e.g. decompressing, decoding, etc.).

To include the AMQP headers and properties in the output, add the -full option to the command-line. This will create the following files:

/tmp/msg-0000
/tmp/msg-0000-headers+properties.json
/tmp/msg-0001
/tmp/msg-0001-headers+properties.json
...

The JSON files have the following structure:

{
  "headers": {
    "x-my-private-header": "my-value"
  },
  "properties": {
    "correlation_id": "XYZ-9876",
    "delivery_mode": 0,
    "priority": 5
  }
}

By default, it will not acknowledge messages, so they will be requeued. Acknowledging messages using the -ack=true switch will remove them from the queue, allowing the user to process new messages (see implementation details).

rabbitmq-dump-queue -uri="amqp://user:[email protected]:5672/" -queue=incoming_1 -max-messages=50 -output-dir=/tmp -ack=true

Running rabbitmq-dump-queue -help will list the available command-line options.

Message requeuing implementation details

In order to fetch messages from the queue and later return them in the original order, rabbitmq-dump-queue uses a standard AMQP basic.get API call without automatic acknowledgements, and it doesn't manually acknowledge the received messages. Thus, when the AMQP connection is closed (after all the messages were received and written to files), RabbitMQ returns all the un-acked messages (all the messages) back to the queue in their original order.

This means that during the time rabbitmq-dump-queue receives and saves the messages, the messages are not visible to other consumers of the queue. This duration is usually very short (unless you're downloading a lot of messages), but make sure your system can handle such a situation (or shut down other consumers of the queue during the time you use this tool).

Note that the same approach is used by RabbitMQ's management HTTP API (the /api/queues/{vhost}/{queue}/get endpoint with requeue=true).

Testing

To run the automated tests, have a RabbitMQ server listen on 127.0.0.1:5672 with user guest and password guest. This can be easily achieved with Docker:

docker run --name test-rabbitmq -d -p 5672:5672 rabbitmq:3-management

Then run:

go build .
go test -v .

To stop the RabbitMQ server container, run:

docker stop test-rabbitmq
docker rm test-rabbitmq

Contributing

Github pull requests and issues are welcome.

License

rabbitmq-dump-queue is under the MIT License. See the LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].