Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Because most services and collectors deployed on DCAE platform relies on similar microservices a commmon Software Development Kit has been created. It contains utilities and clients which may be used when getting configuration from CBS, consuming messages from DMaaP, interacting with AAI, etc. SDK is written in Java.

NOTE For now only Config Binding Service client has reached a stable API level. More are expected to be done in Dublin.

NOTE This page is a work in progress.

Table of Contents

Artifacts

Current version

Code Block
languagexml
<properties>
  <sdk.version>1.1.2-SNAPSHOT</sdk.version>
</properties>

Maven dependencies

Choose one or more depending on what you need.

Code Block
languagexml
<dependencies>
  <dependency>
    <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
    <artifactId>cbs-client</artifactId>
    <version>${sdk.version}</version>
  </dependency>

  <!-- more to go -->

</dependencies>

Available APIs

cbs-client - a Config Binding Service client

You can use CbsClientFactory to lookup for CBS in your application. Returned CbsClient can then be used to get a configuration, poll for configuration or poll for configuration changes.

Sample usage:

Code Block
languagejava
// Generate RequestID and InvocationID which will be used when logging and in HTTP requests
RequestDiagnosticContext diagnosticContext = RequestDiagnosticContext.create();

// Read necessary properties from the environment
final EnvProperties env = EnvProperties.fromEnvironment();

// Create the client and use it to get the configuration
CbsClientFactory.createCbsClient(env)
        .flatMap(cbsClient -> cbsClient.get(diagnosticContext))
        .subscribe(jsonObject -> {
            // do a stuff with your JSON configuration using GSON API
 final int port = Integer.parseInt(jsonObject.get("collector.listen_port").getAsString());
 // ...
 });

Notes about reactive programming

TODOClick here to see SDK architecture description.

Artifacts

Click here to see artifacts description.


Available APIs

Click here to see available APIs description.