thrift-client-factory

0.1.1 • Public • Published

Thrift Client Factory Build Status

A factory for creating ready-made client using the default configuration thrift clients for nodejs.

Getting Started

In order to run tests for this package, some external dependencies need to be installed.

$ npm install -g grunt-cli
  • Install thrift. Most package managers (brew, chocolately, etc.) have a package for thrift.
  • Install npm modules
cd {repository-directory}
$ npm install

Running tests

$ grunt test

Usage

Create a Client

// Required node modules
var factory = require("thrift-client-factory");
 
// Required files
var MyService = require("./gen/MyService");
 
var hostname = "localhost"; // Arbitrary host
var hostport = 9160;        // Arbitrary port
 
function onError(error) {
  console.log(error);
}
 
var MyClient = factory.create(MyService, hostname, hostport, onError);

Destroy a Client

In a persistent process, if the client/connection is not persisted, then use:

// Thrift creates a reference between the connection object and the client.
// When finished with the client and connection, use:
factory.destroy(MyClient);

Dependents (0)

Package Sidebar

Install

npm i thrift-client-factory

Weekly Downloads

4

Version

0.1.1

License

MIT

Last publish

Collaborators

  • jlmorgan