Skip to content

Harmoniser CLI

Jose Lloret edited this page Sep 17, 2024 · 3 revisions

Harmoniser CLI is a command line tool that runs a Ruby process through bundle exec harmoniser. This utility accepts the following options:

bundle exec bin/harmoniser -h

harmoniser [options]
-c, --concurrency INT            Set the number of threads to use
-e, --environment ENV            Set the application environment (defaults to inferred environment or 'production')
-r, --require [PATH|DIR]         Specify a file to require or the location of the Rails application
-v, --[no-]verbose               Run verbosely (set log severity to 'debug' for detailed RabbitMQ interactions)
-V, --version                    Print version and exit
-h, --help                       Show help

The concurrency option is used to control the number of threads dedicated to the subscriber setup. If this option is ignored, each subscriber will have its own dedicated thread to process messages. A high number of threads can pose risks for highly concurrent applications. For instance, applications using a database pool may experience timeouts when attempting to obtain a connection from the pool if too many threads are used.

The environment is automatically inferred from the environment variables RAILS_ENV or RACK_ENV, otherwise it falls back to production. However you can specify your preferred value, for instance development or test.

The require option defaults to . (current directory), which means that under a Rails application, this option might be ignored. Since Ruby is not limited to Rails, you can explicitly specify the path to your Ruby file. This file will be used to load classes, including Harmoniser::Subscriber. On the other hand, if a path to a directory is passed, Harmoniser assumes that ./config/environment.rb resides within the specified folder.

When the verbose option is passed, it sets the severity of Harmoniser logs to debug, allowing you to see fine-grained details of events such as RabbitMQ interactions. By default, verbosity is disabled to prevent your environment from being flooded with unnecessary logs.

Clone this wiki locally