public interface QldbDriverBuilder
Builder class to create the QldbDriver
.
QldbSessionClientBuilder sessionClientBuilder = QldbSessionClient.builder();
QldbDriver qldbDriver = QldbDriver
.builder()
.ledger(ledger)
.maxConcurrentTransactions(poolLimit)
.transactionRetryPolicy(TransactionRetryPolicy.builder().maxNumberOfRetries(retryLimit).build())
.sessionClientBuilder(sessionClientBuilder)
.httpClientBuilder(ApacheHttpClient.builder().maxConnections(maxConnections))
.build();
Modifier and Type | Method and Description |
---|---|
QldbDriver |
build()
Build a
QldbDriver instance using the current configuration set with the builder. |
QldbDriverBuilder |
httpClientBuilder(software.amazon.awssdk.http.SdkHttpClient.Builder httpClientBuilder)
Specify the http client builder that should be used for making http requests.
|
QldbDriverBuilder |
ionSystem(com.amazon.ion.IonSystem ionSystem)
Specify the
IonSystem that should be used to generate the hash of
the parameters and the statements. |
QldbDriverBuilder |
ledger(String ledgerName)
Specify the ledger to connect to and submit the transactions.
|
QldbDriverBuilder |
maxConcurrentTransactions(int maxConcurrentTransactions)
Specify the maximum number of concurrent transactions that can be executed at any point in time.
|
QldbDriverBuilder |
readAhead(int readAhead)
Specify the number of read-ahead buffers, determining the amount of sets of results buffered in memory,
for each open result set, created within the driver.
|
QldbDriverBuilder |
readAhead(int readAhead,
ExecutorService executorService)
Specify the number of read-ahead buffers, determining the amount of sets of results buffered in memory,
for each open result set, created within the driver.
|
QldbDriverBuilder |
sessionClientBuilder(software.amazon.awssdk.services.qldbsession.QldbSessionClientBuilder clientBuilder)
Specify the low level QLDB session builder that should be used for accessing QLDB.
|
QldbDriverBuilder |
transactionRetryPolicy(RetryPolicy retryPolicy)
Specify the retry policy that will be used to execute the transactions.
|
QldbDriver build()
QldbDriver
instance using the current configuration set with the builder.QldbDriver
.QldbDriverBuilder ledger(String ledgerName)
Specify the ledger to connect to and submit the transactions.
The ledgerName is mandatory.
ledgerName
- The name of the ledger to create a driver with.QldbDriverBuilder sessionClientBuilder(software.amazon.awssdk.services.qldbsession.QldbSessionClientBuilder clientBuilder)
Specify the low level QLDB session builder that should be used for accessing QLDB.
Note that the user agent suffix and retry count will be set on the specified session builder,
and the http client will be overwritten. To pass a customized http client to the QldbDriver
,
use httpClientBuilder(SdkHttpClient.Builder)
.
The clientBuilder is mandatory.
clientBuilder
- The builder used to create the low-level session.QldbDriverBuilder ionSystem(com.amazon.ion.IonSystem ionSystem)
Specify the IonSystem
that should be used to generate the hash of
the parameters and the statements. If no parameter is specified then a default value would be used.
The ionSystem is optional.
ionSystem
- The IonSystem
to use.QldbDriverBuilder transactionRetryPolicy(RetryPolicy retryPolicy)
Specify the retry policy that will be used to execute the transactions. If no parameter is specified then an instance
of DefaultQldbTransactionBackoffStrategy
would be used.
The retryPolicy is optional.
retryPolicy
- Contains the rules to retry the transaction.QldbDriverBuilder maxConcurrentTransactions(int maxConcurrentTransactions)
Specify the maximum number of concurrent transactions that can be executed at any point in time. If no value is specified then the value from AWS SDK default max connections would be used.
The maxConcurrentTransactions is optional.
maxConcurrentTransactions
- Specifies the maximum number of concurrent transactions that can be executed by the QldbDriver
.QldbDriverBuilder readAhead(int readAhead)
Specify the number of read-ahead buffers, determining the amount of sets of results buffered in memory, for each open result set, created within the driver. If read-ahead is desired to be enabled, this must be set to at least 2.
The higher the read-ahead buffer count, the more memory will be consumed by the driver when retrieving results.
When read-ahead is set to any number greater than 0, a background thread will be started to perform retrieval.
To supply an ExecutorService
for the threads, see readAhead(int, ExecutorService)
.
When the executor is not provided, a new Thread
is created to perform the retrieval.
The readAhead is optional.
readAhead
- The number of read-ahead buffers for each open result set, 0 for no asynchronous read-ahead.QldbDriverBuilder readAhead(int readAhead, ExecutorService executorService)
Specify the number of read-ahead buffers, determining the amount of sets of results buffered in memory, for each open result set, created within the driver.
The higher the read-ahead buffer count, the more memory will be consumed by the driver when retrieving results.
When read-ahead is set to any number greater than 0, the supplied ExecutorService
will be used to
asynchronously retrieved results. To simply start new threads, see readAhead(int)
.
The readAhead and executorService are optional.
readAhead
- The number of read-ahead buffers for each open result set, 0 for no asynchronous read-ahead.executorService
- The executor to be used by the retrieval thread.QldbDriverBuilder httpClientBuilder(software.amazon.awssdk.http.SdkHttpClient.Builder httpClientBuilder)
Specify the http client builder that should be used for making http requests.
Note that if maximum connections is set in the http client, it should be equal or greater than
maxConcurrentTransactions(int)
to avoid connection contentions and poor performance.
If no parameter is specified then a default value would be used.
The httpClientBuilder is optional.
httpClientBuilder
- The builder used to create the http client.