MQRouter

A tiny router for routing messages by topic name from message queues.

Download

npm install mqrouter

API

Create Router

var router = new Router ( ) ;

Optionally pass routes object to constructor

var routes = { " things/:thing/online " : function ( message ) { var topic = message . topic ; var params = message . params ; var payload = message . payload ; } } ; var router = new Router ( routes ) ;

Add Route

router . add ( topic , payload ) ;

Remove Route

router . remove ( topic ) ;

Execute Route

router . execute ( " things/esp-123/online " , true ) ;

Example Usage