toki-method-rabbit
v1.0.4
Published
Plugin
Downloads
12
Maintainers
Readme
toki-method-rabbit
RabbitMQ plugin used in Toki core.
This plugin interfaces Toki core with the BunnyBus RabbitMQ driver.
Lead Maintainer: Wes Tyler
How to integrate with Toki
Getting started with RabbitMQ and Toki is a simple 2-step process!
npm install --save toki-method-rabbit
- Add your
toki-method-rabbit
action configuration to your Toki rules-engine configuration.
That's it! The Toki rules engine handles all of the code require
ing and context setup behind the scenes, freeing you to focus on more important things.
toki-method-rabbit Action Configuration Schema
toki-method-rabbit
is meant to be used as an action step in a Toki rules-engine configuration definition.
This method is intended for publishing messages to a RabbitMQ message bus in the course of a Toki process lifecycle.
Like other toki-method-*
modules, toki-method-rabbit
is implemented through the Toki rule configuration.
There are 4 required configuration properties for this method:
"name"
{{string}}
The name of the action step. Eg. `"rabbit"`
"type"
{{string}}
The type of action to be taken by the Toki rules engine. In this case the value should always be `"toki-method-rabbit"`
"rabbitConfiguration"
{{object}}
The connection configurations for the RabbitMQ bus being used.
See the [BunnyBus configurations](https://github.com/xogroup/bunnybus/blob/master/API.md#config) for more information.
"inputConfiguration"
{{object}}
The mapping schema used to create the Rabbit message being published to the exchange. toki-method-rabbit leverages [toki-templater](https://github.com/xogroup/toki-templater) to support dynamic templating in your inputConfiguration mappings.
Examples can be found in the sample Toki config.
Contributing
We love community and contributions! Please check out our guidelines before making any PRs.
Setting up for development
Getting yourself setup and bootstrapped is easy. Use the following commands after you clone down.
npm install && npm test
Please note that the tests make use of Docker and require the rabbitmq:3-management
Docker image. Once you have Docker installed, if tests fail then follow these steps:
- Ensure that you have the rabbitmq host mappings in your
/env/hosts
file:127.0.0.1 rabbitmq
- If your tests are able to connect to the Docker image, but you have a
Socket closed abruptly during opening handshake
error, your Docker image may be initializing too slowly. Try increasing thesleep
delay in the wait-on-resources file.