1.3.0 • Published 6 years ago

simple-rpc-client v1.3.0

Weekly downloads
17
License
-
Repository
github
Last release
6 years ago

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
1.3.0

6 years ago

1.2.12

7 years ago

1.2.11

7 years ago

1.2.10

8 years ago

1.1.7

8 years ago