Skip to content
/ owg Public

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..

Notifications You must be signed in to change notification settings

burlakilia/owg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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..

Install

   npm install owg

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.

About

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..

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published