Data Client StreamApi

The StreamApi mirrors the Stream Rest Api.

It provides a way to get information (metadata) about layers and partitions stored in a catalog.

For the full StreamApi specification, see StreamApi.

The following pages describe the per-request configuration and metrics.

Example

Scala
Java
val client = BaseClient()
val streamApi = client.of[StreamApi]

val someHrn = "hrn:here:data::olp-here-test:whatever"
val someLayer = "whateverLayer"
val someSubscriptionId = "subscription-xyz-123"
val result: Future[ConsumerSubscribeResponse] =
  streamApi
    .subscribe(
      hrn = someHrn,
      layerId = someLayer,
      subscriptionId = Some(someSubscriptionId)
    )
    .executeToEntity()

result
  .andThen {
    case Success(response) =>
      // do something with the subscription response
      println(
        s"node base url for subscription ${response.subscriptionId.get} is ${response.nodeBaseURL.get}")
    case Failure(ex) =>
      ex.printStackTrace()
  }
  .andThen {
    case _ =>
      client.shutdown()
  }

Await.result(result, Duration.Inf)
BaseClient client = BaseClientJava.instance();
StreamApi streamApi = new StreamApi(client);

String someHrn = "hrn:here:data::olp-here-test:whatever";
String someLayer = "whateverLayer";
String someSubscriptionId = "subscription-xyz-123";

ConsumerSubscribeResponse result =
    streamApi
        .subscribe()
        .withHrn(someHrn)
        .withLayerId(someLayer)
        .withSubscriptionId(Optional.of(someSubscriptionId))
        .build()
        .executeToEntity()
        .toCompletableFuture()
        .join();

// do something with the subscription response
System.out.printf(
    "node base url for subscription %s is %s\n",
    result.getSubscriptionId().get(), result.getNodeBaseURL().get());

client.shutdown().toCompletableFuture().join();

results matching ""

    No results matching ""