Get support for liip/roger-q

If you're new to LTH, please see our FAQ for more information on what it is we do.

Support Options

Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:

View Open Issues

Take a look to see if anyone else has experienced the same issue as you and if they managed to solve it.

Open an Issue

Make sure to read any relevant guidelines for opening issues on this repo before posting a new issue.

Sponsor directly

Check out the page and see if there are any options to sponsor this project or it's developers directly.

liip/roger-q

Roger-Q

Latest Version Software License Build Status

Roger-Q is a tool to handle RabbitMQ queues, and it includes commands to dump, dedupe and publish messages.

Installation

Run this to download the latest release from Github, move it into your bin folder, and make it executable:

curl -L https://github.com/liip/roger-q/releases/latest/download/roger-q.phar > /usr/local/bin/roger-q
chmod a+x /usr/local/bin/roger-q

Commands

To get the list of all commands, run roger-q.phar list

To see all options of a command, run roger-q.phar {commmand} --help.

Except for dedupe, the commands require the --host option to know where to find RabbitMQ, and --username, --password and --vhost. The default is localhost on port 5672 with vhost / and credentials guest/guest. (Hint: Pull request to support a configuration file for these parameters would be welcome.)

Dump (dump)

Dumps the messages from the given queue to the standard output. The command uses the RabbitMQ management API, rather than the regular protocol, to read and write messages, which is much faster for queues with many messages. This means that you need to install the Management Plugin in your RabbitMQ. If you do not use the default port 15672, you need to specify the --port parameter.

The messages are dumped as JSON as in the following example (the example has been pretty-formatted):

[
  {
     "payload_bytes": 129,
     "redelivered": false,
     "exchange": "my-exchange-name",
     "routing_key": "routing-key",
     "message_count": 3891,
     "properties": {
       // Message headers here
     },
     "payload": "The message payload",
     "payload_encoding": "string"
   },
   // Next messages here...
]

Example usage:

# roger-q.phar dump queue-name

Dedupe (dedupe)

In the following example the messages from messages.txt file will be de-duplicated by checking the uniqueness of the given field. The resulting messages are outputted to the standard output.

# cat messages.txt | roger-q.phar dedupe id-field

Publish (publish)

Reads messages from the standard input and publishes them to the specified queue. Usually, you would send messages to an exchange rather than a queue directly, but the use-case of this tool is to clean up queues. If you specify an exchange instead of a queue, the messages will be reported as published but not arrive anywhere.

The following example will publish the messages from the messages.txt file into the queue-name queue. The queue is additionally purged before starting the publishing operation.

# cat messages.txt | roger-q.phar publish queue-name --purge

PHAR building

Box is used to build a precompiled PHAR file of the application.

Run make dist to:

  • download the box library in tools/ (if not present)
  • create the PHAR executable in dist/roger-q.phar

Development

To run the PHP coding-styles checks (php-cs-fixer and phpstan) run the make phpcs command to:

  • download the php-cs-fixer tool in tools/ (if not present)
  • download the phpstan tool in tools/ (if not present)
  • Run php-cs-fixer on the source code
  • Run phpstan on the source code
Our Mission

We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.

Interesting Articles

Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated

p-e622a1a2