This project is a node-js client implementation for ZMQ Service Suite.
0MQ Install
You need to have 0MQ installed.
If you use MacOS just do
$ brew install zeromq
npm install zmq-service-suite-client --save
var ZSSClient = require('zmq-service-suite-client');
var config = {
// broker frontend address
broker: 'tcp://127.0.0.1:7777',
// service unique identifier
sid: 'service-identifier',
// client identity (optional), defaults to 'client'
identity: "clientX",
// client timeout in ms (optional), defaults to 1s
timeout: 1000
};
var client = new ZSSClient(config);
var verb = "service/action";
var payload = "something";
// call return a promise
client.call(verb, payload)
.then(function(response){
console.log("received payload =>", response.payload);
console.log("received headers =>", response.headers);
});
// fails the promise when service status is not 200
client.call('foo')
.fail(function(error){
console.log("fail with code: %s and user message: %s and dev message %s",
error.code, error.userMessage, error.developerMessage);
});
// it fails the promise
client.call(verb, payload, { timeout: 1000 });
- pass request headers
client.call(verb, payload, { headers: { something: "data" } });
The client library have a peer dependency to logger-facade-nodejs, the module used for logging.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
We use grunt bump package to control package versioning.
Bump Patch version
$ grunt bump
Bump Minor version
$ grunt bump:minor
Bump Major version
$ grunt bump:major
$ npm test
We aim for 100% coverage and we hope it keeps that way! :) We use pre-commit and pre-push hooks and CI to accomplish this, so don't mess with our build! :P
Check the report after running npm test.
$ open ./coverage/lcov-report/index.html