neton-client ~master

A client library for neton.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Service Discovery

NetonOption option = {"127.0.0.1", 50051};
RegistryService service  NetonFactory.createRegistryService(option)

1.watch service

service.subscribe(SERVICE_NAME,new class Listener{
        override void onEvent(Event event)
        {
            logInfo("service listen : ",event);
        }
    });

2. registry service

service.registerInstance(SERVICE_NAME , ADDR , PORT);
service.registerInstance(SERVICE_NAME , ADDR1 , PORT1);

3. discovery service

auto list = service.getAllInstances(SERVICE_NAME);
assert(list.length == 1 && list[0].ip == ADDR  && list[0].port == PORT);

4. delete service

service.deregisterInstance(SERVICE_NAME , ADDR,PORT);

Configuration management

NetonOption option = {"127.0.0.1", 50051};
ConfigService config = NetonFactory.createConfigService(option);

1.watch config

config.addListener(CONFIG_KEY,new class Listener{
        override void onEvent(Event event)
        {
            logInfo("config listen : ",event);
        }
    });

2. publish config

config.publishConfig(CONFIG_KEY,CONFIG_VALUE);

3. get config

auto value = config.getConfig(CONFIG_KEY);
assert(value == CONFIG_VALUE);

4. remove config

config.removeConfig(CONFIG_KEY);
Dependencies:
grpc
Versions:
0.0.1 2019-Mar-18
~master 2019-Apr-26
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 20 downloads total

Score:
0.6
Short URL:
neton-client.dub.pm