データクライアントのインジェスト API

イン ジェスト API は、インジェスト REST API をミラーリングします。

これらのクラスを使用すると、ストリームレイヤーにデータを送信し、オリジン間のリソース共有を管理できます。

両方の API クラスについて 、リクエストごとの設定メトリクスが適用されます。

IngestApi

任意の種類のデータをストリームレイヤーに送信できます。

IngestApiのすべての仕様について は、 IngestApi を参照してください。

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()
  }

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();

コレスピ

これにより、クロスオリジンのリソース共有( CORS )を管理できます。

CORSApi の全仕様について は、 CORSApi を参照してください。

Scala
Java
val client = BaseClient()
val corsApi = client.of[CORSApi]

val result = corsApi.ingestDataCors("whateverLayer").executeToStatusCode()

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

Await.result(result, Duration.Inf)
BaseClient client = BaseClientJava.instance();
CORSApi corsApi = new CORSApi(client);

corsApi
    .ingestDataCors()
    .withLayerId("whateverLayer")
    .build()
    .executeToEntity()
    .toCompletableFuture()
    .join();

」に一致する結果は 件です

    」に一致する結果はありません