Skip to main content

Install events-into-rabbitmq plugin into headless wallet

Goal​

This article will guide you to install the events-into-rabbitmq plugin into Hathor headless wallet.

The events-into-rabbitmq plugin is part of the external notification feature: it forwards wallet events — such as new transactions and balance updates for the wallets the headless instance manages — to a RabbitMQ queue, where your own services can consume them. For more on this feature and the full event payload, see Hathor external notifications.

Requirements​

Plugin configuration parameters​

Source code flagDocker Compose env varRequiredExample
--plugin_rabbitmq_queueHEADLESS_PLUGIN_RABBITMQ_QUEUEYeshathor-events
--plugin_rabbitmq_urlHEADLESS_PLUGIN_RABBITMQ_URLYesamqp://user:password@localhost:5672

Step-by-step​

  1. Install dependency.
  2. Configure and enable the plugin.

Step 1: install dependency​

  1. Open the command line from the directory where you installed Hathor headless wallet.
  2. Run the command to install the dependencies:
npm install amqplib@^0.10.3

Step 2: configure and enable the plugin​

:::warning Protect your seed phrase

The examples below show --seed_default / HEADLESS_SEED_DEFAULT inline for clarity. A seed phrase passed as a CLI argument or a plain environment variable can be exposed in shell history, docker inspect output, and process listings. For production, inject the seed at runtime via a secrets manager (Docker secrets or an environment file with restricted permissions) rather than hardcoding it.

:::

If you installed Hathor headless wallet from source code, you must modify both the src/config.js file and the command to start the application, to respectively enable and configure the plugin:

  1. Open the command line from the directory where you installed Hathor headless wallet.
  2. Open the src/config.js file.
  3. Add 'rabbitmq' to the array of values of the enabled_plugins property to enable the plugin.

If you are enabling multiple plugins, value shall be an array of plugin ids: enabled_plugins: ['PluginId1', 'PluginId2', ...].

At the end of this substep, the config.js file will be as follows:

hathor-wallet-headless/src/config.js
module.exports = {

...

enabled_plugins: ['rabbitmq'],

plugin_config: {},

...

};
  1. Append the --plugin_rabbitmq_queue <queue_name> parameter into the command to start the wallet application, replacing the <queue_name> placeholder with the RabbitMQ queue name.

  2. Append the --plugin_rabbitmq_url <queue_url> parameter into the command to start the wallet application, replacing the <queue_url> placeholder with the RabbitMQ queue URL.

At the end of this substep, the command to start the wallet application will be as follows:

npm start -- --plugin_rabbitmq_queue <queue_name> --plugin_rabbitmq_url <queue_url>

Verify the plugin is active​

After starting the wallet with the plugin enabled:

  1. Check the startup logs. The wallet logs that the rabbitmq plugin was loaded during initialization. A connection error logged here usually means the AMQP URL is wrong or RabbitMQ is unreachable.
  2. Trigger an event. Send a transaction to one of the wallets the headless instance manages (see Send a transfer).
  3. Confirm delivery. In the RabbitMQ management UI (or via rabbitmqadmin), open your queue and confirm the message count increased.

Troubleshooting​

  • ECONNREFUSED / connection refused at startup. RabbitMQ is not reachable at the URL provided. Confirm the instance is running and the host, port, and credentials in --plugin_rabbitmq_url are correct.
  • Plugin not loaded. Confirm rabbitmq is present in enabled_plugins (source code) or HEADLESS_ENABLED_PLUGINS (Docker), and that you started the wallet from the image you rebuilt with amqplib installed — not the stock Docker Hub image.
  • Wallet starts but no messages arrive. Verify the queue name matches exactly, and that events are actually occurring on a managed wallet (send a test transaction to confirm).

Task completed​

You have installed the events-into-rabbitmq plugin in your instance of Hathor headless wallet.

The events-into-rabbitmq plugin is part of the external notification feature. For how to use this plugin or install other plugins of this feature, see Hathor external notifications.

Was this page helpful?