use of org.springframework.cloud.gcp.data.firestore.util.ObservableReactiveUtil in project spring-cloud-gcp by spring-cloud.
the class ReactiveFirestoreTransactionManager method startTransaction.
private Mono<ReactiveFirestoreResourceHolder> startTransaction(TransactionDefinition definition) {
TransactionOptions.Builder txOptions = definition.isReadOnly() ? TransactionOptions.newBuilder().setReadOnly(TransactionOptions.ReadOnly.newBuilder().build()) : TransactionOptions.newBuilder().setReadWrite(TransactionOptions.ReadWrite.newBuilder().build());
BeginTransactionRequest beginTransactionRequest = BeginTransactionRequest.newBuilder().setOptions(txOptions).setDatabase(this.databasePath).build();
return ObservableReactiveUtil.<BeginTransactionResponse>unaryCall(obs -> this.firestore.beginTransaction(beginTransactionRequest, obs)).map(beginTransactionResponse -> new ReactiveFirestoreResourceHolder(beginTransactionResponse.getTransaction()));
}
Aggregations