Data Client IngestApi

The IngestApi mirrors the Ingest Rest Api.

It provides a way to send any kind of data to stream layers.

For the full IngestApi specification, see IngestApi.

The following pages describe per-request configuration and metrics.

Example

Scala
Java
val client = BaseClient()
val ingestApi = client.of[IngestionApi]

val someHrn = "hrn:here:data::olp-here-test:whatever"
val someLayer = "whateverLayer"
val someData = Array.fill(1000)((scala.util.Random.nextInt(256) - 128).toByte)
val result =
  ingestApi.ingestData(someHrn, someLayer, someData).executeToStatusCode()

result
  .andThen {
    case Success(responseCode) =>
      // check response code
      if (responseCode == 200) {
        // ingestion was successful
        println("ingestion was successful")
      } else {
        // should not happen as in case of error below Failure will match
      }
    case Failure(ex) =>
      ex.printStackTrace()
  }
  .andThen {
    case _ =>
      client.shutdown()
  }

Await.result(result, Duration.Inf)
BaseClient client = BaseClientJava.instance();
IngestionApi ingestApi = new IngestionApi(client);

String someHrn = "hrn:here:data::olp-here-test:whatever";
String someLayer = "whateverLayer";
byte[] someData = new byte[1000];
new java.util.Random().nextBytes(someData);

ingestApi
    .ingestData()
    .withHrn(someHrn)
    .withLayerId(someLayer)
    .withByteArray(someData)
    .build()
    .executeToEntity()
    .toCompletableFuture()
    .join();

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

results matching ""

    No results matching ""