YiCheng-tech / opensergo-java-sdk

OpenSergo Java SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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-beta1</version>
</dependency>
  1. Subscribe data from OpenSergo control plane:
// 1. Create client with remote host and port of OpenSergo control plane
OpenSergoClient client = new OpenSergoClient(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

License:Apache License 2.0


Languages

Language:Java 100.0%