Skip to content

Commit

Permalink
chore: add async connector example
Browse files Browse the repository at this point in the history
  • Loading branch information
gintarasm committed Apr 5, 2024
1 parent 9905530 commit e3b8b26
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@ var bigQuerySink = BigQueryStreamSink.<String>newBuilder()
.build();
```

Async connector for at least once delivery

```java
var credentials = new JsonCredentialsProvider("key");

var clientProvider = new AsyncClientProvider<String>(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
Expand Down

0 comments on commit e3b8b26

Please sign in to comment.