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.
- 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.
Request: POST /ping
Response: {"message": "pong"}
Request: POST /messages
Response: {"matches": ["Log & store all"], "id": "51eea636bc64a5aee5000001"}
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"
}
To customize consignment for your workflow, you'll want to:
- Install dependencies:
npm install
- 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
-
Add your own modules to
dispatch/filters
anddispatch/recipients
(see https://github.com/drewblas/consignment-modules for community modules) -
Run the server:
foreman start
OR
node server.js
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
App structure generated by Skeleton