Skip to content

xogroup/toki-method-rabbit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

toki-method-rabbit

RabbitMQ plugin used in Toki core.

This plugin interfaces Toki core with the BunnyBus RabbitMQ driver.

Lead Maintainer: Wes Tyler

npm version Build Status Known Vulnerabilities NSP Status

How to integrate with Toki

Getting started with RabbitMQ and Toki is a simple 2-step process!

  1. npm install --save toki-method-rabbit
  2. 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 requireing 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:

  1. "name"
{{string}}

The name of the action step. Eg. `"rabbit"`
  1. "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"`
  1. "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.
  1. "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:

  1. Ensure that you have the rabbitmq host mappings in your /env/hosts file: 127.0.0.1 rabbitmq
  2. 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 the sleep delay in the wait-on-resources file.