use of com.google.spanner.v1.RollbackRequest in project grpc-gcp-java by GoogleCloudPlatform.
the class Rollback method rollbackCall.
public void rollbackCall() {
System.out.println("\n:: Rolling Back Transaction ::\n");
if (Main.transactionId == null) {
System.out.println("WARNING: No current transaction open, run BeginTransaction first...");
return;
} else {
System.out.println("Found Transaction ID '" + Main.transactionId.toString() + "'. Committing....");
}
FirestoreBlockingStub blockingStub = new GRPCFirebaseClientFactory().createFirebaseClient().getBlockingStub();
RollbackRequest rollbackRequest = RollbackRequest.newBuilder().setTransaction(Main.transactionId).setDatabase("projects/firestoretestclient/databases/(default)").build();
try {
blockingStub.rollback(rollbackRequest);
} catch (Exception e) {
System.out.println("Error during call: " + e.getMessage() + e.getCause());
return;
}
System.out.println("Success!");
Menu menu = new Menu();
menu.draw();
}
Aggregations