owg

This is the one way gateway which publishes your messages via different protocols into services using the popular node js middleware framework - connect

npm install owg
2 downloads in the last day
15 downloads in the last week
33 downloads in the last month

One way Gateway

The module can publish messages in a different services using different protocols, which is set in the configuration. This package is compatible with connect and dispath projects. You should use this module with quip to set correct http statuses..

Example

var connect = require('connect'),
    quip = require('quip'),
    owg = require('owg');

var gateway = owg({
    "protocol": "amqp",
    "connection": "amqp://localhost/rabbitmq",
    "exchange": "exchange-name",
    "routingKey": "yourRoutingKey",
    "durable": true
}, console.log);

connect()
    .use(quip)
    .use(connect.bodyParser())
    .use(gateway.handle);

gateway.send('Application started');

Requests format

Apply only requests with POST methods and body with content type 'application/json'.

Supported protocols

  • rabbtimq

Http Status

  • 202 - messages sent to remote service
  • 405 - a request contain incorrect method
  • 400 - a request body has an incorrect format or a content type

Configuration

The configuration of different protocols may be different. To setup the current protocol use the parameter "protocol".

Amqp configuration

  • connection - a connection string has the following format "amqp[s]://hot[:protocol]/[name]"
  • exchange - exchange name
  • routingKey - the name of the message field, which will be used to route between queues
  • durable - the boolean flag, it is false by default. If set then the exchange will be marked as durable. Durable exchanges remain active during a server restarts.
npm loves you