linker-node-client

0.1.2 • Public • Published

linker-node-client

Description

Linker is a RPC Library based on http protocol for node to java and node to node.

Install

npm install linker-node-client --save

Before

you need run a linker-service.
linker-java-service: https://github.com/LinkerRPC/linker-java-service/

Usage

var url = 'http://localhost:8080/linker',
    accessKey = '12345678',
    serviceName = 'com.example.test.TestClass';
var Linker = require('linker-node-client').client(url, accessKey);
 
Linker.init(function(){
    var store = require('linker-node-client').store(serviceName);
    store.testMethod('zfeng217', function (err, result) {
        if(err) return console.log(err);
 
        console.log(result); //{ code: 200, message: 'success', result: "zfeng217", type: '' }
    })
});
or
var url = 'http://localhost:8080/linker',
    accessKey = '12345678',
    serviceName = 'com.example.test.TestClass',
    methodName = 'testMethod';
var Linker = require('linker-node-client').client(url, accessKey);
 
Linker.invoke(serviceName, methodName, ['zfeng217'], function (err, result) {
    if(err) return console.log(err);
        
    console.log(result); //{ code: 200, message: 'success', result: "zfeng217", type: '' }
});

Readme

Keywords

none

Package Sidebar

Install

npm i linker-node-client

Weekly Downloads

0

Version

0.1.2

License

ISC

Last publish

Collaborators

  • zfeng