public interface AsyncClientInterface
Future<CreateTableResponse> createTable(CreateTableRequest createTableRequest, TableStoreCallback<CreateTableRequest,CreateTableResponse> callback)
After the table is created, it cannot be read from or written to immediately; you need to wait for a few seconds.
createTableRequest - Parameters required to execute the CreateTable operationcallback - The callback function to invoke after the request is completed; can be null, which means no callback function needs to be executedTableStoreException - Exception returned by the TableStore serviceClientException - Invalid response from the request, or network exceptions encounteredFuture<UpdateTableResponse> updateTable(UpdateTableRequest updateTableRequest, TableStoreCallback<UpdateTableRequest,UpdateTableResponse> callback)
For example, a user may want to adjust the table's TTL, MaxVersions configurations, or if the user finds that the current reserved throughput is too low and needs to increase the reserved throughput.
The UpdateTable operation cannot be used to modify the table's TableMeta. The adjustable configurations are:
ReservedThroughput):
The reserved throughput of the table can be dynamically changed, and both read and write throughputs can be modified separately. The minimum time interval for adjusting the read/write throughput of each table is 1 minute.
If the current UpdateTable operation occurs less than 1 minute after the previous UpdateTable or CreateTable operation, the request will be rejected.
TableOptions):
Only some configuration items of the table can be dynamically changed, such as TTL, MaxVersions, etc.
updateTableRequest - Parameters required to execute UpdateTablecallback - The callback function to be invoked upon completion of the request, which can be null if no callback function is neededTableStoreException - Exception returned by the TableStore serviceClientException - Invalid response from the request or network exceptions encounteredFuture<DescribeTableResponse> describeTable(DescribeTableRequest describeTableRequest, TableStoreCallback<DescribeTableRequest,DescribeTableResponse> callback)
Get the detailed information of a table, which includes:
TableMeta)ReservedThroughputDetails)TableOptions)describeTableRequest - Parameters required to execute DescribeTablecallback - The callback function to be invoked upon request completion, can be null if no callback is neededTableStoreException - Exception returned by the TableStore serviceClientException - Invalid response from the request or network exception encounteredFuture<ListTableResponse> listTable(TableStoreCallback<ListTableRequest,ListTableResponse> callback)
callback - The callback function to be called after the request is completed, can be null, which means no callback function is neededTableStoreException - Exception returned by the TableStore serviceClientException - Invalid response from the request or network exception encounteredFuture<DeleteTableResponse> deleteTable(DeleteTableRequest deleteTableRequest, TableStoreCallback<DeleteTableRequest,DeleteTableResponse> callback)
Caution: After the table is successfully deleted, all data under the table will be cleared and cannot be recovered. Please operate with caution!
deleteTableRequest - Parameters required to execute DeleteTablecallback - The callback function to be invoked after the request is completed. It can be null, which means no callback function is needed.TableStoreException - Exception returned by the TableStore serviceClientException - Invalid response from the request or network exception encounteredFuture<CreateIndexResponse> createIndex(CreateIndexRequest createIndexRequest, TableStoreCallback<CreateIndexRequest,CreateIndexResponse> callback)
createIndexRequest - Parameters required to execute CreateIndexcallback - The callback function to be invoked upon completion of the request, can be null which means no callback function is neededTableStoreException - Exception returned by the TableStore serviceClientException - The result returned from the request is invalid, or a network exception was encounteredFuture<DeleteIndexResponse> deleteIndex(DeleteIndexRequest deleteIndexRequest, TableStoreCallback<DeleteIndexRequest,DeleteIndexResponse> callback)
deleteIndexRequest - Parameters required to execute the deleteIndex operation.callback - The callback function to be invoked upon completion of the request, can be null if no callback is needed.TableStoreException - Exception returned by the TableStore service.ClientException - Request resulted in invalid response or encountered network issues.Future<AddDefinedColumnResponse> addDefinedColumn(AddDefinedColumnRequest addDefinedColumnRequest, TableStoreCallback<AddDefinedColumnRequest,AddDefinedColumnResponse> callback)
addDefinedColumnRequest - Parameters required for executing addDefinedColumncallback - The callback function to be called upon request completion, can be null which means no callback function is neededTableStoreException - Exception returned by the TableStore serviceClientException - The result of the request is invalid, or a network exception was encounteredFuture<DeleteDefinedColumnResponse> deleteDefinedColumn(DeleteDefinedColumnRequest deleteDefinedColumnRequest, TableStoreCallback<DeleteDefinedColumnRequest,DeleteDefinedColumnResponse> callback)
deleteDefinedColumnRequest - Parameters required to execute deleteDefinedColumn.callback - The callback function to be called upon request completion; can be null, which means no callback function is needed.TableStoreException - Exception returned by the TableStore service.ClientException - Invalid results returned from the request, or network exceptions encountered.Future<GetRowResponse> getRow(GetRowRequest getRowRequest, TableStoreCallback<GetRowRequest,GetRowResponse> callback)
getRowRequest - The parameters required to perform the GetRow operation.callback - The callback function to be invoked upon request completion, can be null which means no callback function is needed.TableStoreException - Exception returned by the TableStore service.ClientException - Invalid response from the request or network exception encountered.Future<PutRowResponse> putRow(PutRowRequest putRowRequest, TableStoreCallback<PutRowRequest,PutRowResponse> callback)
If the row to be written already exists, the old row will be deleted and the new row will be written.
If the row to be written does not exist, the new row will be written directly.
putRowRequest - Parameters required for the PutRow operation.callback - The callback function to be invoked after the request is completed. It can be null, indicating that no callback function needs to be executed.TableStoreException - Exception returned by the TableStore serviceClientException - Invalid return result of the request or network exception encounteredFuture<UpdateRowResponse> updateRow(UpdateRowRequest updateRowRequest, TableStoreCallback<UpdateRowRequest,UpdateRowResponse> callback)
If the row to be updated does not exist, a new row of data will be written.
The update operation can include writing a new attribute column or deleting one or more versions of an attribute column.
updateRowRequest - Parameters required for performing the UpdateRow operation.callback - The callback function to be invoked upon request completion, can be null which means no callback is needed.TableStoreException - Exception returned by the TableStore service.ClientException - Invalid response from the request or network exceptions encountered.Future<DeleteRowResponse> deleteRow(DeleteRowRequest deleteRowRequest, TableStoreCallback<DeleteRowRequest,DeleteRowResponse> callback)
If the row exists, it will be deleted.
If the row does not exist, this operation will have no effect.
deleteRowRequest - Parameters required for performing the DeleteRow operation.callback - The callback function to invoke upon request completion, can be null which means no callback is needed.TableStoreException - Exception returned by the TableStore service.ClientException - Invalid response or network exception encountered during the request.Future<BatchGetRowResponse> batchGetRow(BatchGetRowRequest batchGetRowRequest, TableStoreCallback<BatchGetRowRequest,BatchGetRowResponse> callback)
The BatchGetRow operation can be considered as a collection of multiple GetRow operations. Each operation is executed independently, returns results independently, and calculates the service capability unit independently.
Compared to executing a large number of GetRow operations, using the BatchGetRow operation can effectively reduce the response time of requests and improve the data read rate.
However, it should be noted that BatchGetRow only supports setting query conditions at the table level. After the operation is completed, you need to check the status of each sub-request individually and choose to retry for failed rows.
batchGetRowRequest - Parameters required to perform the BatchGetRow operation.callback - The callback function to invoke after the request is completed, can be null, which means no callback function needs to be executedFuture<BatchWriteRowResponse> batchWriteRow(BatchWriteRowRequest batchWriteRowRequest, TableStoreCallback<BatchWriteRowRequest,BatchWriteRowResponse> callback)
The BatchWriteRow operation can be considered as a collection of multiple PutRow, UpdateRow, and DeleteRow operations. Each operation is executed independently, returns results independently, and calculates the capacity unit independently.
After executing the BatchWriteRow operation, you need to check the status of each sub-request one by one to determine the write result and choose to retry for failed rows.
batchWriteRowRequest - Parameters required for executing the BatchWriteRow operation.callback - The callback function to be invoked upon request completion, can be null if no callback function is needed.Future<BulkImportResponse> bulkImport(BulkImportRequest bulkImportRequest, TableStoreCallback<BulkImportRequest,BulkImportResponse> callback)
The BulkImport operation can be regarded as a collection of multiple PutRow, UpdateRow, and DeleteRow operations. Each operation is executed independently, returns results independently, and calculates consumed capacity units independently.
After executing the BulkImport operation, you need to check the status of each sub-request individually to determine the write result and choose whether to retry for failed rows.
bulkImportRequest - Parameters required to execute the BatchWriteRow operation.callback - The callback function to invoke upon request completion, which can be null if no callback function needs to be executed.Future<GetRangeResponse> getRange(GetRangeRequest getRangeRequest, TableStoreCallback<GetRangeRequest,GetRangeResponse> callback)
getRangeRequest - The parameters required to perform the GetRange operation.callback - The callback function to be invoked upon request completion, can be null if no callback function is needed.Future<BulkExportResponse> bulkExport(BulkExportRequest bulkExportRequest, TableStoreCallback<BulkExportRequest,BulkExportResponse> callback)
bulkExportRequest - Parameters required for performing the GetRange operation.callback - The callback function to be called upon request completion, can be null which means no callback function is needed.Future<ComputeSplitsBySizeResponse> computeSplitsBySize(ComputeSplitsBySizeRequest computeSplitsBySizeRequest, TableStoreCallback<ComputeSplitsBySizeRequest,ComputeSplitsBySizeResponse> callback)
computeSplitsBySizeRequest - Parameters required to execute the ComputeSplitsBySize operation.callback - The callback function to be called upon completion of the request, can be null which means no callback function needs to be executed.Future<ListStreamResponse> listStream(ListStreamRequest listStreamRequest, TableStoreCallback<ListStreamRequest,ListStreamResponse> callback)
listStreamRequest - Parameters required for executing the ListStream operation.callback - The callback function to be called upon completion of the request, can be null which means no callback function is neededFuture<DescribeStreamResponse> describeStream(DescribeStreamRequest describeStreamRequest, TableStoreCallback<DescribeStreamRequest,DescribeStreamResponse> callback)
describeStreamRequest - The parameters required for the DescribeStream operation.callback - The callback function to be called upon completion of the request, can be null, which means no callback function is needed.Future<GetShardIteratorResponse> getShardIterator(GetShardIteratorRequest getShardIteratorRequest, TableStoreCallback<GetShardIteratorRequest,GetShardIteratorResponse> callback)
getShardIteratorRequest - Parameters required for the GetShardIterator operation.callback - The callback function to be invoked upon completion of the request, can be null if no callback is needed.Future<GetStreamRecordResponse> getStreamRecord(GetStreamRecordRequest getStreamRecordRequest, TableStoreCallback<GetStreamRecordRequest,GetStreamRecordResponse> callback)
getStreamRecordRequest - The parameters required to execute the GetStreamRecord operation.callback - The callback function to be invoked upon completion of the request, can be null if no callback is needed.Future<StartLocalTransactionResponse> startLocalTransaction(StartLocalTransactionRequest request, TableStoreCallback<StartLocalTransactionRequest,StartLocalTransactionResponse> callback)
request - Parameters required for initiating a local transaction operationTableStoreException - Exception returned by the TableStore serviceClientException - Invalid request response or network exception encounteredFuture<CommitTransactionResponse> commitTransaction(CommitTransactionRequest request, TableStoreCallback<CommitTransactionRequest,CommitTransactionResponse> callback)
request - Parameters required for the commit transaction operationTableStoreException - Exception returned by the TableStore serviceClientException - Invalid request response or network exception encounteredFuture<AbortTransactionResponse> abortTransaction(AbortTransactionRequest request, TableStoreCallback<AbortTransactionRequest,AbortTransactionResponse> callback)
request - Parameters required for the cancel transaction operationTableStoreException - Exception returned by the TableStore serviceClientException - Invalid request response or network exception encounteredFuture<CreateSearchIndexResponse> createSearchIndex(CreateSearchIndexRequest request, TableStoreCallback<CreateSearchIndexRequest,CreateSearchIndexResponse> callback)
request - Parameters required for creating a SearchIndex, see CreateSearchIndexRequestcallback - The callback function to be called upon completion of the request, can be null which means no callback function is neededTableStoreException - Exception returned by the TableStore serviceClientException - Invalid response from the request or network exception encounteredFuture<UpdateSearchIndexResponse> updateSearchIndex(UpdateSearchIndexRequest request, TableStoreCallback<UpdateSearchIndexRequest,UpdateSearchIndexResponse> callback)
request - Parameters required to update the SearchIndexcallback - The callback function to be called upon completion of the request, can be null which means no callback function needs to be executedTableStoreException - Exception returned by the TableStore serviceClientException - Invalid response from the request or network exception encounteredFuture<ListSearchIndexResponse> listSearchIndex(ListSearchIndexRequest request, TableStoreCallback<ListSearchIndexRequest,ListSearchIndexResponse> callback)
There can be multiple SearchIndex tables under a single table. Through this function, you can retrieve all SearchIndex information for a specific table.
request - Parameters required to get the SearchIndex list.callback - The callback function to call upon completion of the request, can be null if no callback is needed.TableStoreException - Exception returned by the TableStore service.ClientException - Invalid response from the request or network exception encountered.Future<DeleteSearchIndexResponse> deleteSearchIndex(DeleteSearchIndexRequest request, TableStoreCallback<DeleteSearchIndexRequest,DeleteSearchIndexResponse> callback)
Specify the tableName and indexName to delete an index.
Note: It is not allowed to delete a table until all indexes under the table have been deleted.
request - Parameters required for deleting SearchIndexcallback - The callback function to be called upon completion of the request, can be null which means no callback function needs to be executedTableStoreException - Exception returned by the TableStore serviceClientException - Invalid response from the request or network exception encounteredFuture<DescribeSearchIndexResponse> describeSearchIndex(DescribeSearchIndexRequest request, TableStoreCallback<DescribeSearchIndexRequest,DescribeSearchIndexResponse> callback)
request - Parameters required to get the SearchIndex (tableName and indexName).callback - The callback function to be called upon completion of the request, can be null which means no callback function is needed.TableStoreException - Exception returned by the TableStore service.ClientException - Invalid response from the request or network exception encountered.Future<ComputeSplitsResponse> computeSplits(ComputeSplitsRequest request, TableStoreCallback<ComputeSplitsRequest,ComputeSplitsResponse> callback)
request - Parameters required to perform the computeSplits operation.callback - The callback function invoked after the request is completed. It can be null, which means that no callback function is required.TableStoreException - Exception returned by Tablestore service.ClientException - The return result of the request is invalid or a network exception was encountered.Future<ParallelScanResponse> parallelScan(ParallelScanRequest request, TableStoreCallback<ParallelScanRequest,ParallelScanResponse> callback)
request - Parameters required to perform the parallelScan operation.callback - The callback function invoked after the request is completed. It can be null, which means that no callback function is required.TableStoreException - Exception returned by Tablestore service.ClientException - The return result of the request is invalid or a network exception was encountered.Future<CreateDeliveryTaskResponse> createDeliveryTask(CreateDeliveryTaskRequest request, TableStoreCallback<CreateDeliveryTaskRequest,CreateDeliveryTaskResponse> callback)
request - Parameters required to create a delivery taskcallback - The callback function to be called upon completion of the request, can be null which means no callback function is neededFuture<DeleteDeliveryTaskResponse> deleteDeliveryTask(DeleteDeliveryTaskRequest request, TableStoreCallback<DeleteDeliveryTaskRequest,DeleteDeliveryTaskResponse> callback)
request - The parameters required to delete the delivery taskTableStoreException - Exception returned by the Tablestore serviceClientException - Invalid return result of the request, or network exception encounteredFuture<DescribeDeliveryTaskResponse> describeDeliveryTask(DescribeDeliveryTaskRequest request, TableStoreCallback<DescribeDeliveryTaskRequest,DescribeDeliveryTaskResponse> callback)
request - Parameters required to describe the delivery taskcallback - The callback function to be called upon completion of the request, can be null which means no callback function is neededFuture<ListDeliveryTaskResponse> listDeliveryTask(ListDeliveryTaskRequest request, TableStoreCallback<ListDeliveryTaskRequest,ListDeliveryTaskResponse> callback)
request - Parameters required to list the delivery task listcallback - The callback function to be called upon completion of the request, can be null which means no callback function is neededFuture<SearchResponse> search(SearchRequest request, TableStoreCallback<SearchRequest,SearchResponse> callback)
Build your own SearchRequest, then get the SearchResponse
Example:
SearchQuery searchQuery = new SearchQuery();
TermQuery termQuery = new TermQuery();
termQuery.setFieldName("user_name");
termQuery.setTerm("jay");
searchQuery.setQuery(termQuery);
SearchRequest searchRequest = new SearchRequest(tableName, indexName, searchQuery);
SearchResponse resp = ots.search(searchRequest);
request - Parameters required for performing the search, see SearchRequest for more detailscallback - The callback function to be called upon completion of the request, can be null which means no callback function is neededSearchResponse for more detailsTableStoreException - Exception returned by the TableStore serviceClientException - Invalid response from the request or network exception encounteredSyncClientInterface asSyncClient()
void shutdown()
Make sure to release resources after all requests have been executed. After releasing resources, no further requests can be sent, and ongoing requests may not return results.
void switchCredentialsProvider(CredentialsProvider newCrdsProvider)
newCrdsProvider - new CredentialsProvider, see CredentialsProviderFactory.Future<SQLQueryResponse> sqlQuery(SQLQueryRequest request, TableStoreCallback<SQLQueryRequest,SQLQueryResponse> callback)
Copyright © 2025. All Rights Reserved.