use of com.amazonaws.services.timestreamquery.model.CancelQueryRequest in project amazon-timestream-tools by awslabs.
the class QueryExample method cancelQuery.
public void cancelQuery() {
System.out.println("Starting query: " + SELECT_ALL_QUERY);
QueryRequest queryRequest = new QueryRequest();
queryRequest.setQueryString(SELECT_ALL_QUERY);
QueryResult queryResult = queryClient.query(queryRequest);
System.out.println("Cancelling the query: " + SELECT_ALL_QUERY);
final CancelQueryRequest cancelQueryRequest = new CancelQueryRequest();
cancelQueryRequest.setQueryId(queryResult.getQueryId());
try {
queryClient.cancelQuery(cancelQueryRequest);
System.out.println("Query has been successfully cancelled");
} catch (Exception e) {
System.out.println("Could not cancel the query: " + SELECT_ALL_QUERY + " = " + e);
}
}
Aggregations