tchannel-promise

promisify tchannel

Usage no npm install needed!

<script type="module">
  import tchannelPromise from 'https://cdn.skypack.dev/tchannel-promise';
</script>

README

tchannel-promise NPM version Dependency Status Coverage Status

tchannel promises

tchannel-promise wraps tchannel send() to return a bluebird promise.

Installation

$ npm install tchannel-promise --save

Usage

var TchannelPromise = require('tchannel-promise');

var tchannel = new TChannelPromise(options);

var testChannel = tchannel
      .makeSubChannel({serviceName: 'test'});

var bluebirdPromise = testChannel
    .request()
    .send('echo', 'arg1', 'arg2');
    
bluebirdPromise    
    .then(function onSuccess(result){
      // handle successful result    
      // result.response
      // result.arg2
      // result.arg3
    }, function onFailure(err){
      // handle error err
    })
    .catch(function onException(ex){
      // handle exception ex
    });

License

© Rajesh Segu