simple-rpc-client

1.3.0 • Public • Published

simple-rpc-client

Simple RPC client module based on AMQP/RabbitMQ.

Example

var simplerpc = require('./lib/simple-rpc');
 
var RABBITMQ_URL = 'amqp://guest:guest@localhost:5672';
 
simplerpc.connect(RABBITMQ_URL, function connected(err) {
    var remoteMethod = 'sum';
    var args = {
        a: 2,
        b: 3
    };
 
    simplerpc.call(remoteMethod, args, function callback(err, message) {
        logger.debug('got response', message);
    });
});

Timeouts

There is a 60-second timeout by default. You can pass any timeout you want to call. Once the timeout is reached, the callback will be called with an error.

    ...
    var TIMEOUT = 5000; // 5-second timeout
    simplerpc.call(slowRemoteMethod, args, TIMEOUT, function callback(err, message) {
        if (err) {
            // possible timeout
        } else {
            logger.debug('got response', message);
        }
    });

Development documentation

Coding guidelines

Uses provided .jshintrc and .gjslintrc flag files. To check source code style, type

grunt lint

Testing

To run tests, type

grunt test

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.3.0
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.3.0
    2
  • 1.2.12
    2
  • 1.2.10
    1

Package Sidebar

Install

npm i simple-rpc-client

Weekly Downloads

5

Version

1.3.0

License

none

Last publish

Collaborators

  • palmerabollo