micromessaging
Easy-to-use interface for Rabbit MQ
Last updated 3 months ago by youri .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install micromessaging 
SYNC missed versions from official npm registry.

Micromessaging

Build Status

This module has been written for Swanest back-end. It eases the use of messaging between services. We use RabbitMQ as the underlying broker service. This library is using amqplib (0.5.3) as a core dependency but we do use some parameters that are only RabbitMQ related so it might not work with other AMQP 0.9.1 brokers.

Supported version of NodeJS 8+


Installation

yarn add micromessaging npm install micromessaging --save

API

Full API documentation is at: swanest.github.io/micromessaging

Special thanks to TypeDoc that enabled it.

Dependencies

  • RabbitMQ > 3.3.0

Usage

import { Messaging } from 'micromessaging';

// Server
const server = new Messaging('server');
await server.handle('request-name', (message) => {
    // message.body = {how: {are: 'you?'}}
    message.reply({im: 'fine'});
});
await server.connect(); // Connect can be before or after the handlers it doesnt matter.


// Client
const client = new Messaging('client');
await client.connect(); // Connection needs to be established before...
const response = await client.request('server', 'request-name', {how: {are: 'you?'}});
// response = {im: 'fine'}

Notes

v3.0 includes breaking changes and CAN'T be used with another module using an earlier micromessaging version.

About what it does:

  • RPC model (.request / .handle)
  • Event subscription (PUB/SUB) (.emit / .listen)
  • Worker queue tasks (.task / .handle)
  • Election of a master between services that do have the same serviceName (in new Messaging(serviceName[, serviceOptions]))
  • Manage the process quality of service (Qos.ts)
    • The QoS is managed through usage of HeavyEL for event-loop management and the MemoryPressure module to know about memory usage and pressure.
    • What it basically does is to try to keep the process under a certain usage and will stop accepting messages when it reaches a certain threshold to avoid crashes. The reason is that this enables parallelism and it should be properly managed as NodeJS is single threaded.
  • Has knowledge about the status of it's peers (through PeerStatus.ts)

TODO

  • [ ] Change the API to expose the strict minimum

Current Tags

  • 3.0.0                                ...           beta (2 years ago)
  • 3.2.9                                ...           latest (3 months ago)

94 Versions

  • 3.2.9                                ...           3 months ago
  • 3.2.8                                ...           3 months ago
  • 3.2.7                                ...           7 months ago
  • 3.2.6                                ...           7 months ago
  • 3.2.5                                ...           7 months ago
  • 3.2.4                                ...           9 months ago
  • 3.2.3                                ...           9 months ago
  • 3.2.2                                ...           9 months ago
  • 3.2.1                                ...           a year ago
  • 3.2.0                                ...           a year ago
  • 3.1.1                                ...           a year ago
  • 3.1.0                                ...           a year ago
  • 3.0.30                                ...           a year ago
  • 3.0.29                                ...           a year ago
  • 3.0.28                                ...           a year ago
  • 3.0.27                                ...           a year ago
  • 3.0.26                                ...           a year ago
  • 3.0.25                                ...           2 years ago
  • 3.0.24                                ...           2 years ago
  • 3.0.23                                ...           2 years ago
  • 3.0.22                                ...           2 years ago
  • 3.0.21                                ...           2 years ago
  • 3.0.20                                ...           2 years ago
  • 3.0.19                                ...           2 years ago
  • 3.0.18                                ...           2 years ago
  • 3.0.17                                ...           2 years ago
  • 3.0.16                                ...           2 years ago
  • 3.0.14                                ...           2 years ago
  • 3.0.13                                ...           2 years ago
  • 3.0.12                                ...           2 years ago
  • 3.0.11                                ...           2 years ago
  • 3.0.10                                ...           2 years ago
  • 3.0.9                                ...           2 years ago
  • 3.0.8                                ...           2 years ago
  • 3.0.7                                ...           2 years ago
  • 3.0.6                                ...           2 years ago
  • 3.0.5                                ...           2 years ago
  • 3.0.4                                ...           2 years ago
  • 3.0.3                                ...           2 years ago
  • 3.0.2                                ...           2 years ago
  • 3.0.1                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.2.7                                ...           2 years ago
  • 2.2.6                                ...           2 years ago
  • 2.2.5                                ...           2 years ago
  • 2.2.4                                ...           2 years ago
  • 2.2.3                                ...           2 years ago
  • 2.2.2                                ...           2 years ago
  • 2.2.1                                ...           2 years ago
  • 2.2.0                                ...           2 years ago
  • 2.1.27                                ...           2 years ago
  • 2.1.26                                ...           2 years ago
  • 2.1.25                                ...           2 years ago
  • 2.1.24                                ...           2 years ago
  • 2.1.23                                ...           2 years ago
  • 2.1.22                                ...           2 years ago
  • 2.1.21                                ...           2 years ago
  • 2.1.20                                ...           2 years ago
  • 2.1.19                                ...           2 years ago
  • 2.1.18                                ...           2 years ago
  • 2.1.17                                ...           2 years ago
  • 2.1.16                                ...           2 years ago
  • 2.1.15                                ...           2 years ago
  • 2.1.14                                ...           3 years ago
  • 2.1.13                                ...           3 years ago
  • 2.1.12                                ...           3 years ago
  • 2.1.11                                ...           3 years ago
  • 2.1.10                                ...           3 years ago
  • 2.1.9                                ...           3 years ago
  • 2.1.8                                ...           3 years ago
  • 2.1.7                                ...           3 years ago
  • 2.1.6                                ...           3 years ago
  • 2.1.5                                ...           3 years ago
  • 2.1.4                                ...           3 years ago
  • 2.1.3                                ...           3 years ago
  • 2.1.2                                ...           3 years ago
  • 2.1.1                                ...           3 years ago
  • 2.1.0                                ...           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.1.3                                ...           3 years ago
  • 1.1.2                                ...           3 years ago
  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 94
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (13)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |