Skip to content

A message service that parses & re-distributes them to various other endpoints

License

Notifications You must be signed in to change notification settings

drewblas/consignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Consignment

A web service that takes incoming messages and passes them through a multi-step workflow to dispatch them to other endpoints. Typically the message submitter is cURL or other simple in-app HTTP POSTer. Then consignment takes care of the difficult stuff like using complex APIs, distributing to multiple recipients, etc.

You can do things like:

  • Send confirmation messages from cron (using CURL) and have them routed to e-mail
  • Report an error and distribute it to campfire, e-mail, & pagerduty all at once
  • Send periodic notifications to campfire as a background job progresses
  • Recieve simple internal notifications, reformat them appropriately, and then re-POST them to an external endpoint
  • Easily re-route requests from one endpoint to another and then change it back without modifying your app

In short: Make consignment responsible for knowing how to talk to all your third-party APIs and encapsulate the logic for which messages should go where.

Usage

Ping

Request:  POST /ping
Response: {"message": "pong"}

Create message

Request:  POST /messages
Response: {"matches": ["Log & store all"], "id": "51eea636bc64a5aee5000001"}

Retrieve message info

Request:  GET /messages/:id
Response: 
{
  "headers": {
    "user-agent": "curl",
    "host": "localhost:5000",
    "accept": "*/*"
  },
  "body": {},
  "query": {},
  "params": [],
  "ip": "127.0.0.1",
  "ts": "2013-07-23T15:50:13.907Z",
  "_id": "51eea636bc64a5aee5000001"
}

Setup

To customize consignment for your workflow, you'll want to:

  1. Install dependencies:
npm install
  1. Copy the examples: These are the important two files to look at to customize to your needs
cp dispatch/workflow.example.coffee dispatch/workflow.coffee
cp config/services.example.coffee config/services.coffee
  1. Add your own modules to dispatch/filters and dispatch/recipients (see https://github.com/drewblas/consignment-modules for community modules)

  2. Run the server:

foreman start
OR
node server.js

Deploy on Heroku

The store_mongo recipient will utilize MONGOHQ ENV vars for setup. The e-mail recipient will utilize Mandrill env vars. These can be changed with config/services.coffee

Attributions

App structure generated by Skeleton

About

A message service that parses & re-distributes them to various other endpoints

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published