From e3af735e4679902431a49f9f26b2474c93e531dd Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 21 Feb 2024 16:19:54 +0200 Subject: [PATCH] Use supplier in order to properly have mutiny retry --- .../runtime/exporter/otlp/VertxGrpcExporter.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/VertxGrpcExporter.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/VertxGrpcExporter.java index 270bb82c6fcff..551efb3e0afc8 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/VertxGrpcExporter.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/exporter/otlp/VertxGrpcExporter.java @@ -6,6 +6,7 @@ import java.time.Duration; import java.util.Collection; import java.util.Map; +import java.util.concurrent.CompletionStage; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; import java.util.function.Supplier; @@ -22,7 +23,6 @@ import io.opentelemetry.sdk.trace.export.SpanExporter; import io.quarkus.vertx.core.runtime.BufferOutputStream; import io.smallrye.mutiny.Uni; -import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; @@ -109,8 +109,14 @@ private static void initiateSend(GrpcClient client, SocketAddress server, int numberOfAttempts, Handler> onSuccessHandler, Consumer onFailureCallback) { - Future> reqFuture = client.request(server); - Uni.createFrom().completionStage(reqFuture.toCompletionStage()).onFailure().retry().withBackOff(Duration.ofMillis(100)) + Uni.createFrom().completionStage(new Supplier>>() { + + @Override + public CompletionStage> get() { + return client.request(server).toCompletionStage(); + } + }).onFailure().retry() + .withBackOff(Duration.ofMillis(100)) .atMost(numberOfAttempts).subscribe().with( new Consumer<>() { @Override