diff --git a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java index 0c7517a29139f..20687b076e977 100644 --- a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java +++ b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java @@ -59,6 +59,7 @@ public void handle(Throwable event) { future.onSuccess(new Handler() { @Override public void handle(HttpClientRequest httpClientRequest) { + requestContext.setHttpClientRequest(httpClientRequest); Future sent; if (requestContext.isMultipart()) { Promise requestPromise = Promise.promise(); diff --git a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/RestClientRequestContext.java b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/RestClientRequestContext.java index 66e71264aed4e..9d18d786c36bf 100644 --- a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/RestClientRequestContext.java +++ b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/RestClientRequestContext.java @@ -6,6 +6,8 @@ import io.vertx.core.http.HttpClient; import io.vertx.core.http.HttpClientRequest; import io.vertx.core.http.HttpClientResponse; +import io.vertx.core.impl.ContextInternal; +import io.vertx.core.net.impl.ConnectionBase; import io.vertx.ext.web.multipart.MultipartForm; import java.io.IOException; import java.io.InputStream; @@ -154,6 +156,17 @@ public ClientResponseContextImpl getOrCreateClientResponseContext() { return clientResponseContext; } + @Override + protected Executor getContextExecutor() { + if (httpClientRequest != null) { + return ((ConnectionBase) httpClientRequest.connection()).getContext().nettyEventLoop(); + } + if (Context.isOnEventLoopThread()) { + return ((ContextInternal) restClient.getVertx().getOrCreateContext()).nettyEventLoop(); + } + return null; + } + public ClientRequestContextImpl getOrCreateClientRequestContext() { if (clientRequestContext == null) { clientRequestContext = new ClientRequestContextImpl(this, this.getRestClient(), this.getConfiguration());