postmaster-general
A simple library for making microservice message calls over a variety of transports.
Last updated 2 years ago by darklordzw .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install postmaster-general 
SYNC missed versions from official npm registry.

# postmaster-general MIT License Build Status Coverage Status

Simple, promise-based Node.js library for microservice communication over a variety of transport protocols.

Transport Plugins

postmaster-general functions using a variety of transport plugins that should be installed as peer-dependencies.

Install

npm install --save postmaster-general

Usage

The following snippet showcases basic usage.

const PostmasterGeneral = require('postmaster-general');
const HTTPTransport = require('postmaster-general-http-transport');

const transport = new HTTPTransport();
const postmaster = new PostmasterGeneral({
	requestTransport: transport,
	publishTransport: transport
});

const printGreeting = (message) => {
	console.log('[action:get_greeting] received');
	return Promise.resolve({ greeting: 'Hello, ' + message.name });
};

// Start the Postmaster instance.
postmaster.connect()
	.then(() => postmaster.addRequestListener('action:get_greeting', printGreeting))
	.then(() => postmaster.listen())
	.then(() => postmaster.request('action:get_greeting', { name: 'Steve' }))
	.then((res) => {
		// Handle the response.
		console.log(res.greeting);
	})
	.then(() => postmaster.disconnect())
	.catch((err) => {
		console.log(err.message);
	});

Options

See the "docs" folder for documentation.

License

Licensed under the MIT license.

Current Tags

  • 5.1.7                                ...           latest (2 years ago)

85 Versions

  • 5.1.7                                ...           2 years ago
  • 5.1.6                                ...           3 years ago
  • 5.1.5                                ...           3 years ago
  • 5.1.4                                ...           3 years ago
  • 5.1.3                                ...           3 years ago
  • 5.1.2                                ...           3 years ago
  • 5.1.0                                ...           3 years ago
  • 5.0.2                                ...           3 years ago
  • 5.0.1                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
  • 3.1.6                                ...           3 years ago
  • 3.1.5                                ...           3 years ago
  • 3.1.4                                ...           3 years ago
  • 3.1.3                                ...           3 years ago
  • 3.1.2                                ...           3 years ago
  • 3.1.1                                ...           3 years ago
  • 3.1.0                                ...           3 years ago
  • 3.0.2                                ...           3 years ago
  • 3.0.1                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.0.26                                ...           3 years ago
  • 2.0.25                                ...           3 years ago
  • 2.0.24                                ...           3 years ago
  • 2.0.23                                ...           3 years ago
  • 2.0.22                                ...           3 years ago
  • 2.0.21                                ...           3 years ago
  • 2.0.20                                ...           3 years ago
  • 2.0.19                                ...           3 years ago
  • 2.0.18                                ...           3 years ago
  • 2.0.17                                ...           3 years ago
  • 2.0.16                                ...           3 years ago
  • 2.0.15                                ...           3 years ago
  • 2.0.14                                ...           3 years ago
  • 2.0.13                                ...           3 years ago
  • 2.0.12                                ...           3 years ago
  • 2.0.11                                ...           3 years ago
  • 2.0.10                                ...           3 years ago
  • 2.0.9                                ...           3 years ago
  • 2.0.8                                ...           3 years ago
  • 2.0.7                                ...           3 years ago
  • 2.0.6                                ...           3 years ago
  • 2.0.5                                ...           3 years ago
  • 2.0.4                                ...           3 years ago
  • 2.0.3                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.3.2                                ...           3 years ago
  • 1.3.1                                ...           3 years ago
  • 1.3.0                                ...           3 years ago
  • 1.2.20                                ...           3 years ago
  • 1.2.19                                ...           3 years ago
  • 1.2.18                                ...           3 years ago
  • 1.2.17                                ...           3 years ago
  • 1.2.15                                ...           3 years ago
  • 1.2.14                                ...           3 years ago
  • 1.2.13                                ...           3 years ago
  • 1.2.12                                ...           3 years ago
  • 1.2.11                                ...           3 years ago
  • 1.2.10                                ...           3 years ago
  • 1.2.9                                ...           3 years ago
  • 1.2.8                                ...           3 years ago
  • 1.2.7                                ...           4 years ago
  • 1.2.6                                ...           4 years ago
  • 1.2.5                                ...           4 years ago
  • 1.2.4                                ...           4 years ago
  • 1.2.3                                ...           4 years ago
  • 1.2.2                                ...           4 years ago
  • 1.2.1                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.3                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.5                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.5                                ...           4 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.4                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 3
Dependencies (3)
Dev Dependencies (10)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |