0.1.1 • Published 10 years ago

thrift-client-factory v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

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);
0.1.1

10 years ago

0.1.0

10 years ago