Search in sources :

Example 1 with CancelQueryRequest

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);
    }
}
Also used : QueryResult(com.amazonaws.services.timestreamquery.model.QueryResult) QueryRequest(com.amazonaws.services.timestreamquery.model.QueryRequest) CancelQueryRequest(com.amazonaws.services.timestreamquery.model.CancelQueryRequest) CancelQueryRequest(com.amazonaws.services.timestreamquery.model.CancelQueryRequest)

Aggregations

CancelQueryRequest (com.amazonaws.services.timestreamquery.model.CancelQueryRequest)1 QueryRequest (com.amazonaws.services.timestreamquery.model.QueryRequest)1 QueryResult (com.amazonaws.services.timestreamquery.model.QueryResult)1