1.0.5 • Published 9 years ago

microservice-crutch v1.0.5

Weekly downloads
49
License
-
Repository
github
Last release
9 years ago

microservice-crutch

Provides a jump-start on implementing a micro-service compatible with micro-services using AMQP and the medseek-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
1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.1

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago