use of com.couchbase.client.core.cnc.events.request.IndividualReplicaGetFailedEvent in project couchbase-jvm-clients by couchbase.
the class ReplicaHelper method getAllReplicasReactive.
/**
* @param clientContext (nullable)
* @param parentSpan (nullable)
*/
public static Flux<GetReplicaResponse> getAllReplicasReactive(final Core core, final CollectionIdentifier collectionIdentifier, final String documentId, final Duration timeout, final RetryStrategy retryStrategy, Map<String, Object> clientContext, RequestSpan parentSpan) {
notNullOrEmpty(documentId, "Id", () -> ReducedKeyValueErrorContext.create(documentId, collectionIdentifier));
CoreEnvironment env = core.context().environment();
RequestSpan getAllSpan = env.requestTracer().requestSpan(TracingIdentifiers.SPAN_GET_ALL_REPLICAS, parentSpan);
getAllSpan.attribute(TracingIdentifiers.ATTR_SYSTEM, TracingIdentifiers.ATTR_SYSTEM_COUCHBASE);
return Reactor.toMono(() -> getAllReplicasRequests(core, collectionIdentifier, documentId, clientContext, retryStrategy, timeout, getAllSpan)).flux().flatMap(Flux::fromStream).flatMap(request -> Reactor.wrap(request, get(core, request), true).onErrorResume(t -> {
env.eventBus().publish(new IndividualReplicaGetFailedEvent(request.context()));
// Swallow any errors from individual replicas
return Mono.empty();
}).map(response -> new GetReplicaResponse(response, request instanceof ReplicaGetRequest))).doFinally(signalType -> getAllSpan.end());
}
Aggregations