Class ConnectionWorker (2.21.0)

public class ConnectionWorker implements AutoCloseable

A BigQuery Stream Writer that can be used to write data into BigQuery Table.

TODO: Support batching.

Inheritance

java.lang.Object > ConnectionWorker

Implements

AutoCloseable

Static Methods

getApiMaxRequestBytes()

public static long getApiMaxRequestBytes()

The maximum size of one request. Defined by the API.

Returns
TypeDescription
long

Constructors

ConnectionWorker(String streamName, ProtoSchema writerSchema, long maxInflightRequests, long maxInflightBytes, FlowController.LimitExceededBehavior limitExceededBehavior, String traceId, BigQueryWriteClient client, boolean ownsBigQueryWriteClient)

public ConnectionWorker(String streamName, ProtoSchema writerSchema, long maxInflightRequests, long maxInflightBytes, FlowController.LimitExceededBehavior limitExceededBehavior, String traceId, BigQueryWriteClient client, boolean ownsBigQueryWriteClient)
Parameters
NameDescription
streamNameString
writerSchemaProtoSchema
maxInflightRequestslong
maxInflightByteslong
limitExceededBehaviorLimitExceededBehavior
traceIdString
clientBigQueryWriteClient
ownsBigQueryWriteClientboolean

Methods

append(ProtoRows rows)

public ApiFuture<AppendRowsResponse> append(ProtoRows rows)

Schedules the writing of rows at the end of current stream.

Parameter
NameDescription
rowsProtoRows
Returns
TypeDescription
ApiFuture<AppendRowsResponse>

append(ProtoRows rows, long offset)

public ApiFuture<AppendRowsResponse> append(ProtoRows rows, long offset)

Schedules the writing of rows at given offset.

Parameters
NameDescription
rowsProtoRows
offsetlong
Returns
TypeDescription
ApiFuture<AppendRowsResponse>

close()

public void close()

Close the stream writer. Shut down all resources.

getInflightWaitSeconds()

public long getInflightWaitSeconds()
Returns
TypeDescription
long

getUpdatedSchema()

public synchronized TableSchema getUpdatedSchema()

Thread-safe getter of updated TableSchema

Returns
TypeDescription
TableSchema

getWriterId()

public String getWriterId()
Returns
TypeDescription
String

a unique Id for the writer.