Class BigQueryReadClients
Two factory methods rather than one, because only the reading side has anything to configure:
the ReadRows retry budget is inert on a client that only creates sessions, and a caller
that had to pass it would be inventing a value. Naming them after the call each serves is what
keeps the wrong one from being picked.
public because those two live in sibling packages and Java has no
package-tree-internal access — the same reason the connector's metric-name inventory is public.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.cloud.bigquery.storage.v1.BigQueryReadClientcreateForReads(String serviceAccountKeyFile, EmulatorEndpoint emulatorEndpoint, int retryMaxAttempts, Runnable onRetry) Creates the client a reader opens its assigned streams with.static com.google.cloud.bigquery.storage.v1.BigQueryReadClientcreateForSessions(String serviceAccountKeyFile, EmulatorEndpoint emulatorEndpoint) Creates the client the enumerator creates its read session with.
-
Method Details
-
createForSessions
public static com.google.cloud.bigquery.storage.v1.BigQueryReadClient createForSessions(@Nullable String serviceAccountKeyFile, @Nullable EmulatorEndpoint emulatorEndpoint) throws IOException Creates the client the enumerator creates its read session with.CreateReadSession's own retry settings are left as the SDK ships them — a ten-minute budget overDEADLINE_EXCEEDEDandUNAVAILABLE. That call happens once per job, on the coordinator thread, before anything has been read, and a failure there is reported immediately rather than sitting inside a fetch.- Parameters:
serviceAccountKeyFile- the service-account key-file path, ornullfor ADCemulatorEndpoint- the emulator's gRPC endpoint, ornullfor BigQuery itself- Returns:
- the client; the caller owns it and must close it
- Throws:
IOException- if the client cannot be created
-
createForReads
public static com.google.cloud.bigquery.storage.v1.BigQueryReadClient createForReads(@Nullable String serviceAccountKeyFile, @Nullable EmulatorEndpoint emulatorEndpoint, int retryMaxAttempts, @Nullable Runnable onRetry) throws IOException Creates the client a reader opens its assigned streams with.- Parameters:
serviceAccountKeyFile- the service-account key-file path, ornullfor ADCemulatorEndpoint- the emulator's gRPC endpoint, ornullfor BigQuery itselfretryMaxAttempts- the bound put on the client's ownReadRowsretryonRetry- run once per retried attempt, ornullto observe none- Returns:
- the client; the caller owns it and must close it
- Throws:
IOException- if the client cannot be created
-