Giter VIP home page Giter VIP logo

rabbitmq-move's Introduction

rabbitmq-move

πŸ₯„⛏️ Bash CLI utility for moving RabbitMQ messages using the Shovel interface. No admin UI neededΒ§

Description

Circumvents the admin UI for moving messages between queues (or different instances) in RabbitMQ. Intended to be a script used for creating terminal shortcuts (aliases) for repeated tasks (ie re-running dead letter queue messages manually).

Getting Started

Dependencies

  • curl
  • getopts
  • RabbitMQ server with the shovel api plugin enabled.

Installing

Clone this project git clone https://github.com/kdouda/rabbitmq-move, or simply download the rabbit_move.sh script into your preferred directory and give it execution permissions (chmod +x rabbitmq_move.sh).

Executing program

For example, if we are running the API on localhost:15672 and we want to move messages from queue queue-from to queue-to on the RabbitMQ server running on localhost, we run the script with the following parameters:

./rabbit_move.sh -h http://guest:guest@localhost:15672 -f queue-from -t queue-to -s amqp://guest:guest@localhost/%2f

Parameters

  • -h Hostname of the RabbitMQ API, including the protocol (http(s)) and the port, username and password and the vhost. Required. VHost must be percent encoded.
  • -v VHost, defaults to / (%2f), optional. Must be percent encoded. ❗ Used for the management API only.
  • -s Source AMQP server (amqp://), including the vhost, required.
  • -d Destination AMQP server (amqp://), optional. If not provided, defaults to the source server parameter -s.
  • -f Name of the source queue (where the messages are taken from), required.
  • -t Name of the destination queue (where the messages are sent to), required. Must not be the same as -f.
  • -n Name of the shovel, optional. Defaults to move-shell-script.

Providing an invalid parameter (or no parameters) will result in an error message being shown.

Alias

For example, if we want to create a shell alias for the previously provided script, we could do something akin to the following:

alias empty_queue="PATH_TO/rabbit_move.sh -h http://guest:guest@localhost:15672 -f queue-from -t queue-to -s amqp://guest:guest@localhost/%2f"

If you have multiple aliases using this script, it may be wise to use environment variables to replace the shared parts of the alias command.

Version History

  • 0.1
    • Initial Release

Contributing

This is an extremely single-purpose bash script, but if you have any ideas for improving it, or if some use case does not work for you, please open an issue!

Future

Something I am considering doing is creating a CLI interface (using something like Gum) for this that would report the progress, show queue states and so on. Another script I have ready is for saving RabbitMQ messages to disk, which will be released in another repository.

License

This project is licensed under the MIT license. But if you for any reason use this, please do let me know, I'd love to know!

Acknowledgments

rabbitmq-move's People

Contributors

kdouda avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.