npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-pigeon-client

v0.0.10

Published

A pure Javascript Pigeon client for Node.js.

Downloads

22

Readme

node-pigeon-client

This module is designed to resemble the Pigeon Java client API but with tweaks to follow the convention of Node.js modules. Develops that are familiar with the Pigeon Java client would be able to pick it up quickly.

This module has been tested to work with Pigeon version 2.3.10.

Getting Started

  1. Install node.
  2. Install node-pigeon-client using npm:
$ npm install node-pigeon-client --save
  1. An environment configuration file /data/webapps/appenv should be provided in the given format
deployenv = qa             # Environment.
zkserver  = 127.0.0.1:2181 # Zookeeper host and port.

Example

Remote service "EchoService":

public class EchoService {
  public int hello(int a) {
    return a;
  }
}

Call the remote service "EchoService":

var pigeon = require('node-pigeon-client');
var java   = require('node-pigeon-client').java;

var url = 'EchoService'; // Remote service url.
pigeon.getService(url, function(err, service) {
  if (err) {
    return console.log('Get remote service error: %s.', err);
  }

  service.hello(java.int(123456), function(err, result) {
    if (err) {
      return console.log('Call remote service method error: %s.', err);
    }

    // Output 123456 to the console.
    console.log('Remote service method result: %d.', result);
  });
});

Documentation

getService(url, [options], callback)

Retrieve the service of the given url.

Arguments

  • url String - The service url.

  • options Object - An object to set the service retrive options. Currently available options are:

    • zkserver: Comma seperated host:port pairs, each represents a Zookeeper server. e.g.
    '127.0.0.1:2181, 127.0.0.1:2182, 127.0.0.1:2183'
    • timeout Remote service method call timeout in milliseconds.
    • protocol Protocol of remote service method call.
    • serialize Serailization of network transmission.
    • timeoutRetry Whether to retry when timeout.
    • retries The number of retry attempts for timeout.
    • loadBalance Type of remote service server load balance.

    Default options:

    {
      zkserver    : '127.0.0.1:2181' // Can also set in '/data/webapps/appenv'.
      timeout     : 1000,
      protocol    : 'http'           // http.
      serialize   : 'hessian'        // hessian.
      timeoutRetry: true             // true/false
      retries     : 1
      loadBalance : 'autoaware'      // autoaware/roundRobin/random
    }
  • callback(err, service) Function - The callback function. The service can be regarded as an object containing all the service methods that can be called.

Java Types Supported

  • null
  • int
  • long
  • double
  • boolean
  • java.lang.Integer
  • java.lang.Long
  • java.lang.Double
  • java.lang.Boolean
  • java.lang.String
  • java.lang.Object
  • java.util.List
  • java.util.Set
  • java.util.Date
  • array
  • user-defined

java.null()

Example

Object a = null;
var a = java.null()

java.int(jsNumber)

Example

int a = 123;
var a = java.int(123);

java.long(jsNumber)

Example

long a = 123;
var a = java.long(123);

java.double(jsNumber)

Example

double a = 1.23;
var a = java.double(1.23);

java.boolean(jsBoolean)

Example

boolean a = true;
var a = java.boolean(true);

java.Integer(jsNumber)

Example

java.lang.Integer a = new java.lang.Integer(123);
var a = java.Integer(123);

java.Long(jsNumber)

Example

java.lang.Long a = new java.lang.Long(123);
var a = java.Long(123);

java.Double(jsNumber)

Example

java.lang.Double a = new java.lang.Double(1.23);
var a = java.Double(1.23);

java.Boolean(jsBoolean)

Example

java.lang.Boolean a = new java.lang.Boolean(true);
var a = java.Boolean(true);

java.String(jsString)

Example

java.lang.String a = new java.lang.String('123');
var a = java.String('123');

java.Object(jsObject)

Example

public Class Car {
  private String name;
  private int money;
  private ArrayList<Integer> wheelSize = new ArrayList<Integer>();

  public Car(name, money, wheelSize) {
    this.name = name;
    this.money = money;
    this.wheelSize = wheelSize;
  }
}

java.lang.Object a = new Car("Benz", 123, new ArrayList([1, 2, 3, 4]));
var a = java.Object({
  name     : java.String('Benz'),
  money    : java.int(123),
  wheelSize: java.List.Integer([1, 2, 3, 4])
});

java.List.Generics(jsArray)

Generics represents the following types:

  • int
  • long
  • double
  • boolean
  • java.lang.Integer
  • java.lang.Long
  • java.lang.Double
  • java.lang.Boolean
  • java.lang.String
  • java.lang.Object
  • java.util.Date
  • user-defined

Example

List<String> a = new ArrayList(["a", "b", "c"]);
var a = java.List.String(['a', 'b', 'c']);

java.Set.Generics(jsArray)

See java.List.Generics(jsArray).

java.array.Generics(jsArray)

See java.List.Generics(jsArray).

java.Date(jsDate)

Example

java.util.Date a = new java.util.Date();
var a = java.Date(new Date());

java.Class(classname, jsObject)

Example

package packagename;
public Class Car {
  private String name;
  private int money;
  private ArrayList<Integer> wheelSize = new ArrayList<Integer>();

  public Car(name, money, wheelSize) {
    this.name = name;
    this.money = money;
    this.wheelSize = wheelSize;
  }
}

packagename.Car a = new packagename.Car("Benz", 123, new ArrayList([1, 2, 3, 4]));
var a = java.Class('packagename.Car', {
  name     : java.String('Benz'),
  money    : java.int(123),
  wheelSize: java.List.Integer([1, 2, 3, 4])
})