diff --git a/extensions/core/deployment/src/main/java/io/quarkiverse/cxf/quarkus/vertx/http/client/deployment/VertxWebClientProcessor.java b/extensions/core/deployment/src/main/java/io/quarkiverse/cxf/quarkus/vertx/http/client/deployment/VertxWebClientProcessor.java index f3c1f944c..fa9d7545c 100644 --- a/extensions/core/deployment/src/main/java/io/quarkiverse/cxf/quarkus/vertx/http/client/deployment/VertxWebClientProcessor.java +++ b/extensions/core/deployment/src/main/java/io/quarkiverse/cxf/quarkus/vertx/http/client/deployment/VertxWebClientProcessor.java @@ -1,13 +1,9 @@ package io.quarkiverse.cxf.quarkus.vertx.http.client.deployment; -import io.quarkiverse.cxf.deployment.RuntimeBusCustomizerBuildItem; -import io.quarkiverse.cxf.quarkus.vertx.http.client.VertxWebClientRecorder; import io.quarkiverse.cxf.vertx.http.client.HttpClientPool; import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.ExecutionTime; -import io.quarkus.deployment.annotations.Record; public class VertxWebClientProcessor { @@ -16,12 +12,4 @@ void additionalBeans(BuildProducer additionalBeans) { additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(HttpClientPool.class)); } - @BuildStep - @Record(ExecutionTime.STATIC_INIT) - void customizers( - VertxWebClientRecorder recorder, - BuildProducer customizers) { - customizers.produce(new RuntimeBusCustomizerBuildItem(recorder.customizeBus())); - } - } diff --git a/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/CxfClientProducer.java b/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/CxfClientProducer.java index f4d80e01f..611939700 100644 --- a/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/CxfClientProducer.java +++ b/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/CxfClientProducer.java @@ -189,7 +189,8 @@ private Object produceCxfClient(CXFClientInfo cxfClientInfo) { cxfClientInfo, origConduitImpl, authorizationPolicy, - vertx); + vertx, + httpClientPool); props.put(HTTPConduitFactory.class.getName(), conduitFactory); Object result; final HTTPConduitFactory origConduitFactory = bus.getExtension(HTTPConduitFactory.class); diff --git a/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/HTTPConduitImpl.java b/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/HTTPConduitImpl.java index a0ab87e42..dfcf995f2 100644 --- a/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/HTTPConduitImpl.java +++ b/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/HTTPConduitImpl.java @@ -1,13 +1,11 @@ package io.quarkiverse.cxf; import java.io.IOException; -import java.util.Objects; import org.apache.cxf.Bus; import org.apache.cxf.configuration.jsse.TLSClientParameters; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.http.HTTPConduit; -import org.apache.cxf.transport.http.HTTPTransportFactory; import org.apache.cxf.transport.http.HttpClientHTTPConduit; import org.apache.cxf.transport.http.URLConnectionHTTPConduit; import org.apache.cxf.ws.addressing.EndpointReferenceType; @@ -50,10 +48,8 @@ public HTTPConduitImpl resolveDefault() { @ConfigDocEnumValue("VertxHttpClientHTTPConduitFactory") VertxHttpClientHTTPConduitFactory { @Override - public HTTPConduit createConduit(HTTPTransportFactory f, Bus b, EndpointInfo localInfo, + public HTTPConduit createConduit(HttpClientPool httpClientPool, Bus b, EndpointInfo localInfo, EndpointReferenceType target) throws IOException { - final HttpClientPool httpClientPool = Objects.requireNonNull(b.getExtension(HttpClientPool.class), - "HttpClientPool in org.apache.cxf.Bus"); return new VertxHttpClientHTTPConduit(b, localInfo, target, httpClientPool); } @@ -75,7 +71,7 @@ public TLSClientParameters createTLSClientParameters(CXFClientInfo cxfClientInfo @ConfigDocEnumValue("HttpClientHTTPConduitFactory") HttpClientHTTPConduitFactory { @Override - public HTTPConduit createConduit(HTTPTransportFactory f, Bus b, EndpointInfo localInfo, + public HTTPConduit createConduit(HttpClientPool httpClientPool, Bus b, EndpointInfo localInfo, EndpointReferenceType target) throws IOException { return new HttpClientHTTPConduit(b, localInfo, target); } @@ -83,7 +79,7 @@ public HTTPConduit createConduit(HTTPTransportFactory f, Bus b, EndpointInfo loc @ConfigDocEnumValue("URLConnectionHTTPConduitFactory") URLConnectionHTTPConduitFactory { @Override - public HTTPConduit createConduit(HTTPTransportFactory f, Bus b, EndpointInfo localInfo, + public HTTPConduit createConduit(HttpClientPool httpClientPool, Bus b, EndpointInfo localInfo, EndpointReferenceType target) throws IOException { return new URLConnectionHTTPConduit(b, localInfo, target); } @@ -100,7 +96,7 @@ public static HTTPConduitImpl findDefaultHTTPConduitImpl() { } @Override - public HTTPConduit createConduit(HTTPTransportFactory f, Bus b, EndpointInfo localInfo, EndpointReferenceType target) + public HTTPConduit createConduit(HttpClientPool httpClientPool, Bus b, EndpointInfo localInfo, EndpointReferenceType target) throws IOException { throw new IllegalStateException( "Call " + HTTPConduitImpl.class.getName() + ".resolveDefault() before calling createConduit()"); diff --git a/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/HTTPConduitSpec.java b/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/HTTPConduitSpec.java index ca87f21b3..3230b6aea 100644 --- a/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/HTTPConduitSpec.java +++ b/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/HTTPConduitSpec.java @@ -11,10 +11,10 @@ import org.apache.cxf.configuration.jsse.TLSClientParameters; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.http.HTTPConduit; -import org.apache.cxf.transport.http.HTTPTransportFactory; import org.apache.cxf.ws.addressing.EndpointReferenceType; import io.quarkiverse.cxf.CxfClientConfig.WellKnownHostnameVerifier; +import io.quarkiverse.cxf.vertx.http.client.HttpClientPool; import io.quarkus.tls.TlsConfiguration; import io.quarkus.tls.runtime.VertxCertificateHolder; import io.quarkus.tls.runtime.config.TlsBucketConfig; @@ -27,7 +27,7 @@ default HTTPConduitSpec resolveDefault() { return this; } - HTTPConduit createConduit(HTTPTransportFactory f, Bus b, EndpointInfo localInfo, EndpointReferenceType target) + HTTPConduit createConduit(HttpClientPool httpClientPool, Bus b, EndpointInfo localInfo, EndpointReferenceType target) throws IOException; default Optional tlsClientParameters(CXFClientInfo cxfClientInfo, Vertx vertx) { @@ -115,4 +115,4 @@ default TLSClientParameters createTLSClientParameters(CXFClientInfo cxfClientInf String getConduitDescription(); -} \ No newline at end of file +} diff --git a/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/QuarkusHTTPConduitFactory.java b/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/QuarkusHTTPConduitFactory.java index 313cec731..cf0b96194 100644 --- a/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/QuarkusHTTPConduitFactory.java +++ b/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/QuarkusHTTPConduitFactory.java @@ -13,6 +13,7 @@ import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.jboss.logging.Logger; +import io.quarkiverse.cxf.vertx.http.client.HttpClientPool; import io.vertx.core.Vertx; /** @@ -34,19 +35,22 @@ public class QuarkusHTTPConduitFactory implements HTTPConduitFactory { private final HTTPConduitSpec busHTTPConduitImpl; private final AuthorizationPolicy authorizationPolicy; private final Vertx vertx; + private final HttpClientPool httpClientPool; public QuarkusHTTPConduitFactory( CxfFixedConfig cxFixedConfig, CXFClientInfo cxfClientInfo, HTTPConduitSpec busHTTPConduitImpl, AuthorizationPolicy authorizationPolicy, - Vertx vertx) { + Vertx vertx, + HttpClientPool httpClientPool) { super(); this.cxFixedConfig = cxFixedConfig; this.cxfClientInfo = cxfClientInfo; this.busHTTPConduitImpl = busHTTPConduitImpl; this.authorizationPolicy = authorizationPolicy; this.vertx = vertx; + this.httpClientPool = httpClientPool; } @Override @@ -59,19 +63,19 @@ public HTTPConduit createConduit(HTTPTransportFactory f, Bus b, EndpointInfo loc if (httpConduitImpl == null && (CXFRecorder.isHc5Present()) && busHTTPConduitImpl != null) { - return configure(f, busHTTPConduitImpl.resolveDefault(), cxfClientInfo, b, localInfo, target); + return configure(busHTTPConduitImpl.resolveDefault(), cxfClientInfo, b, localInfo, target); } if (httpConduitImpl == null) { httpConduitImpl = HTTPConduitImpl.QuarkusCXFDefault; } - return configure(f, httpConduitImpl.resolveDefault(), cxfClientInfo, b, localInfo, target); + return configure(httpConduitImpl.resolveDefault(), cxfClientInfo, b, localInfo, target); } - private HTTPConduit configure(HTTPTransportFactory f, HTTPConduitSpec httpConduitImpl, CXFClientInfo cxfClientInfo, Bus b, + private HTTPConduit configure(HTTPConduitSpec httpConduitImpl, CXFClientInfo cxfClientInfo, Bus b, EndpointInfo localInfo, EndpointReferenceType target) throws IOException { - final HTTPConduit httpConduit = httpConduitImpl.createConduit(f, b, localInfo, target); + final HTTPConduit httpConduit = httpConduitImpl.createConduit(httpClientPool, b, localInfo, target); httpConduitImpl.tlsClientParameters(cxfClientInfo, vertx).ifPresent(httpConduit::setTlsClientParameters); final HTTPClientPolicy policy = new HTTPClientPolicy(); httpConduit.setClient(policy); diff --git a/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/quarkus/vertx/http/client/VertxWebClientRecorder.java b/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/quarkus/vertx/http/client/VertxWebClientRecorder.java deleted file mode 100644 index 2c7294f19..000000000 --- a/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/quarkus/vertx/http/client/VertxWebClientRecorder.java +++ /dev/null @@ -1,27 +0,0 @@ -package io.quarkiverse.cxf.quarkus.vertx.http.client; - -import java.util.function.Consumer; - -import org.apache.cxf.Bus; - -import io.quarkiverse.cxf.vertx.http.client.HttpClientPool; -import io.quarkus.arc.Arc; -import io.quarkus.arc.InstanceHandle; -import io.quarkus.runtime.RuntimeValue; -import io.quarkus.runtime.annotations.Recorder; - -@Recorder -public class VertxWebClientRecorder { - - public RuntimeValue> customizeBus() { - - return new RuntimeValue<>(bus -> { - InstanceHandle httpClientPool = Arc.container().instance(HttpClientPool.class); - if (httpClientPool.isAvailable()) { - bus.setExtension(httpClientPool.get(), HttpClientPool.class); - } else { - throw new IllegalStateException(HttpClientPool.class.getName() + " not available in Arc"); - } - }); - } -} diff --git a/extensions/transports-http-hc5/runtime/src/main/java/io/quarkiverse/cxf/transport/http/hc5/Hc5Recorder.java b/extensions/transports-http-hc5/runtime/src/main/java/io/quarkiverse/cxf/transport/http/hc5/Hc5Recorder.java index 65c3a08de..ee45fef94 100644 --- a/extensions/transports-http-hc5/runtime/src/main/java/io/quarkiverse/cxf/transport/http/hc5/Hc5Recorder.java +++ b/extensions/transports-http-hc5/runtime/src/main/java/io/quarkiverse/cxf/transport/http/hc5/Hc5Recorder.java @@ -7,7 +7,6 @@ import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.http.HTTPConduit; import org.apache.cxf.transport.http.HTTPConduitFactory; -import org.apache.cxf.transport.http.HTTPTransportFactory; import org.apache.cxf.transport.http.asyncclient.hc5.AsyncHTTPConduitFactory; import org.apache.cxf.transport.http.asyncclient.hc5.AsyncHttpResponseWrapperFactory; import org.apache.cxf.workqueue.WorkQueueManager; @@ -15,6 +14,7 @@ import org.eclipse.microprofile.context.ManagedExecutor; import io.quarkiverse.cxf.HTTPConduitSpec; +import io.quarkiverse.cxf.vertx.http.client.HttpClientPool; import io.quarkus.arc.Arc; import io.quarkus.arc.InstanceHandle; import io.quarkus.runtime.RuntimeValue; @@ -48,13 +48,14 @@ public static class Hc5HTTPConduitImpl implements HTTPConduitSpec { private AsyncHTTPConduitFactory asyncHTTPConduitFactory; @Override - public HTTPConduit createConduit(HTTPTransportFactory f, Bus b, EndpointInfo localInfo, EndpointReferenceType target) + public HTTPConduit createConduit(HttpClientPool httpClientPool, Bus b, EndpointInfo localInfo, + EndpointReferenceType target) throws IOException { AsyncHTTPConduitFactory factory; if ((factory = asyncHTTPConduitFactory) == null) { factory = asyncHTTPConduitFactory = new AsyncHTTPConduitFactory(b); } - return factory.createConduit(f, b, localInfo, target); + return factory.createConduit(b, localInfo, target); } @Override