From e3b8b26190af066bf7abc4df419504263dbcad83 Mon Sep 17 00:00:00 2001 From: gintarasm Date: Fri, 5 Apr 2024 16:58:45 +0300 Subject: [PATCH] chore: add async connector example --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 6b13f82..0477e30 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,27 @@ var bigQuerySink = BigQueryStreamSink.newBuilder() .build(); ``` +Async connector for at least once delivery + +```java +var credentials = new JsonCredentialsProvider("key"); + +var clientProvider = new AsyncClientProvider(credentials, + WriterSettings.newBuilder() + .build() +); + +var sink = AsyncBigQuerySink.builder() + .setRowSerializer(new NoOpRowSerializer<>()) + .setClientProvider(clientProvider) + .setMaxBatchSize(30) + .setMaxBufferedRequests(10) + .setMaxBatchSizeInBytes(10000) + .setMaxInFlightRequests(4) + .setMaxRecordSizeInBytes(10000) + .build(); +``` + The sink takes in a batch of records. Batching happens outside the sink by opening a window. Batched records need to implement the BigQueryRecord interface. ```java