Data Client NotificationApi

The NotificationApi mirrors the Notification Rest Api.

It provides ways to get some notification when catalogs or subscriptions are changed.

For the full NotificationApi specification, see NotificationApi.

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

Example

Scala
Java
val client = BaseClient()
val notificationApi = client.of[NotificationAPIV2Api]

val someHrn = "hrn:here:data::olp-here-test:whatever"
val someLayer = "whateverStreamLayer"
val result: Future[String] =
  notificationApi
    .subscribe(someHrn,
               SubscribeRequest(notificationCatalogHRN = Some(someHrn),
                                notificationStreamLayerId = Some(someLayer)))
    .executeToEntity()

result
  .andThen {
    case Success(subscriptionId) =>
      // do something with the subscription id
      println(s"${subscriptionId}")
    case Failure(ex) =>
      ex.printStackTrace()
  }
  .andThen {
    case _ =>
      client.shutdown()
  }

Await.result(result, Duration.Inf)
BaseClient client = BaseClientJava.instance();
NotificationAPIV2Api notificationApi = new NotificationAPIV2Api(client);

String someHrn = "hrn:here:data::olp-here-test:whatever";
String someLayer = "whateverStreamLayer";

String subscriptionId =
    notificationApi
        .subscribe()
        .withHrn(someHrn)
        .withSubscribeRequest(
            new JSubscribeRequest.Builder()
                .withNotificationCatalogHRN(someHrn)
                .withNotificationStreamLayerId(someLayer)
                .build())
        .build()
        .executeToEntity()
        .toCompletableFuture()
        .join();

// do something with the the subscription id
System.out.println(subscriptionId);

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

results matching ""

    No results matching ""