sofa-registry-node

0.0.1 • Public • Published

sofa-registry-node

[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][codecov-image]][codecov-url] [![David deps][david-image]][david-url] Known Vulnerabilities

Node.js SDK for SOFARegistry

Usage

const httpclient = require('urllib');
const { RegistryType, RegistryClient } = require('sofa-registry-node');
const client = new RegistryClient({
  config: {
    endpoint: '127.0.0.1',
    port: 9603,
    env: 'sit',
    zone: 'DEFAULT_ZONE',
    dataCenter: 'test',
    appname: 'foo',
    instanceId: 'bar',
    recheckInterval: 500,
  },
  logger: console,
  httpclient,
});
 
// publish data
client.register({
  dataId,
  group: 'DEFAULT',
  appname: 'chair-test',
}, 'test_val', 'test_val2');
 
// subscribe data
client.subscribe({
  dataId,
  group: 'DEFAULT',
  appname: 'chair-test',
  scope: 'zone',
}, data => {
  subData = data;
});
 
// subscribe config data
client.subscribeConfig({
  dataId,
  group: 'DEFAULT',
  appname: 'chair-test',
}, data => {
  confData = data;
});
 

Readme

Keywords

Package Sidebar

Install

npm i sofa-registry-node

Weekly Downloads

4

Version

0.0.1

License

none

Unpacked Size

59.6 kB

Total Files

37

Last publish

Collaborators

  • gxcsoccer
  • killagu