Skip to content

jnan806/opensergo-java-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenSergo Logo

OpenSergo Java SDK

OpenSergo Java SDK CI Maven Central License

Introduction

Documentation

See the OpenSergo Website for the official website of OpenSergo.

See the 中文文档 for document in Chinese.

Quick Start

  1. Add dependency in Maven pom.xml:
<!-- replace here with the latest version -->
<dependency>
    <groupId>io.opensergo</groupId>
    <artifactId>opensergo-java-sdk</artifactId>
    <version>0.1.0</version>
</dependency>
  1. Subscribe data from OpenSergo control plane:
// 1. Create client with remote host and port of OpenSergo control plane
OpenSergoClient client = OpenSergoClientManager.get().getOrCreateClient(host, port);
// 2. Start the OpenSergo client.
client.start();

// 3. Subscribe the config of the target (namespace, appName, kind)
client.subscribeConfig(new SubscribeKey("default", "my-service", configKind),
    new OpenSergoConfigSubscriber() {
        @Override
        public boolean onConfigUpdate(SubscribeKey subscribeKey, Object dataList) {
            // Handle received config here
            System.out.println("key: " + subscribeKey + ", data: " + dataList);
            return true;
        }
    });

About

OpenSergo Java SDK

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%