ih-microservice
Makes it easy to write a micro-service with ih-util-microservices+AMQP.
Last updated 2 years ago by dmartines .
UNLICENSED · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ih-microservice 
SYNC missed versions from official npm registry.

microservice-crutch

Provides a jump-start on implementing a micro-service compatible with micro-services using AMQP and the ih-util-microservices module.

This is a fork of the open-source project by the same name that I started while at Influence Health. You can check out the original at https://github.com/medseek-engineering/microservice-crutch.

Prerequisites

You must have RabbitMQ installed and working. You can pass the location of the RabbitMQ server on the command line when starting your process like this:

node myapp.js --broker=amqp://username:password@host:port/vhost

If you do not specify the location of RabbitMQ, the default of amqp://guest:guest@localhost:5672/ is used instead.

Usage

Quick Start

npm install microservice-crutch
var crutch = require('microservice-crutch');
crutch({ /*default options*/ }, function(app, microservices, options, Promise) {
    return microservices.bind('topic://exchangeName/routingKey/queueName', function(mc) {
        return Promise.try(function() {
            return { receivedBody: mc.deserialize() };
        }).catch(function(error) {
            return { error: error };
        });
    });
});

Examples

See the examples for a ping sender and listener that illustrates the most common usage.

First, clone the Github repository for microservice-crutch, and npm install.

Start the ping listener first, then the ping sender.

git clone https://github.com/fwestrom/microservice-crutch.git
cd microservice-crutch
npm install
node examples/ping-listener.js
node examples/ping-sender.js

Current Tags

  • 0.8.0                                ...           latest (2 years ago)

11 Versions

  • 0.8.0                                ...           2 years ago
  • 0.7.0                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.9                                ...           4 years ago
  • 0.0.8                                ...           4 years ago
  • 0.0.7                                ...           4 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 2
Last Month 0
Dependencies (7)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |