From 4e556179e7a1e7807219c6f4bcc88122fef1f54f Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Wed, 13 Oct 2021 15:43:02 +1100 Subject: [PATCH] Change Artemis to use recorder injection --- .../artemis/core/deployment/ArtemisCoreProcessor.java | 5 ++--- .../quarkus/artemis/core/runtime/ArtemisCoreRecorder.java | 8 +++++++- .../artemis/jms/deployment/ArtemisJmsProcessor.java | 5 ++--- .../quarkus/artemis/jms/runtime/ArtemisJmsRecorder.java | 8 +++++++- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/extensions/artemis-core/deployment/src/main/java/io/quarkus/artemis/core/deployment/ArtemisCoreProcessor.java b/extensions/artemis-core/deployment/src/main/java/io/quarkus/artemis/core/deployment/ArtemisCoreProcessor.java index 4e027ee66bc03..8e2312487ea05 100644 --- a/extensions/artemis-core/deployment/src/main/java/io/quarkus/artemis/core/deployment/ArtemisCoreProcessor.java +++ b/extensions/artemis-core/deployment/src/main/java/io/quarkus/artemis/core/deployment/ArtemisCoreProcessor.java @@ -19,7 +19,6 @@ import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.artemis.core.runtime.ArtemisCoreRecorder; -import io.quarkus.artemis.core.runtime.ArtemisRuntimeConfig; import io.quarkus.deployment.Feature; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; @@ -104,7 +103,7 @@ void load(BuildProducer feature, Optional @Record(ExecutionTime.RUNTIME_INIT) @BuildStep - ArtemisCoreConfiguredBuildItem configure(ArtemisCoreRecorder recorder, ArtemisRuntimeConfig runtimeConfig, + ArtemisCoreConfiguredBuildItem configure(ArtemisCoreRecorder recorder, BuildProducer syntheticBeanProducer, Optional artemisJms) { if (artemisJms.isPresent()) { @@ -112,7 +111,7 @@ ArtemisCoreConfiguredBuildItem configure(ArtemisCoreRecorder recorder, ArtemisRu } SyntheticBeanBuildItem serverLocator = SyntheticBeanBuildItem.configure(ServerLocator.class) - .supplier(recorder.getServerLocatorSupplier(runtimeConfig)) + .supplier(recorder.getServerLocatorSupplier()) .scope(ApplicationScoped.class) .defaultBean() .unremovable() diff --git a/extensions/artemis-core/runtime/src/main/java/io/quarkus/artemis/core/runtime/ArtemisCoreRecorder.java b/extensions/artemis-core/runtime/src/main/java/io/quarkus/artemis/core/runtime/ArtemisCoreRecorder.java index 1c752cf508da2..07bb1150f8e31 100644 --- a/extensions/artemis-core/runtime/src/main/java/io/quarkus/artemis/core/runtime/ArtemisCoreRecorder.java +++ b/extensions/artemis-core/runtime/src/main/java/io/quarkus/artemis/core/runtime/ArtemisCoreRecorder.java @@ -10,7 +10,13 @@ @Recorder public class ArtemisCoreRecorder { - public Supplier getServerLocatorSupplier(ArtemisRuntimeConfig config) { + final ArtemisRuntimeConfig config; + + public ArtemisCoreRecorder(ArtemisRuntimeConfig config) { + this.config = config; + } + + public Supplier getServerLocatorSupplier() { return new Supplier() { @Override public ServerLocator get() { diff --git a/extensions/artemis-jms/deployment/src/main/java/io/quarkus/artemis/jms/deployment/ArtemisJmsProcessor.java b/extensions/artemis-jms/deployment/src/main/java/io/quarkus/artemis/jms/deployment/ArtemisJmsProcessor.java index f8621d8fd8faa..10aefcac5048e 100644 --- a/extensions/artemis-jms/deployment/src/main/java/io/quarkus/artemis/jms/deployment/ArtemisJmsProcessor.java +++ b/extensions/artemis-jms/deployment/src/main/java/io/quarkus/artemis/jms/deployment/ArtemisJmsProcessor.java @@ -6,7 +6,6 @@ import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.artemis.core.deployment.ArtemisBuildTimeConfig; import io.quarkus.artemis.core.deployment.ArtemisJmsBuildItem; -import io.quarkus.artemis.core.runtime.ArtemisRuntimeConfig; import io.quarkus.artemis.jms.runtime.ArtemisJmsRecorder; import io.quarkus.deployment.Feature; import io.quarkus.deployment.annotations.BuildProducer; @@ -34,11 +33,11 @@ HealthBuildItem health(ArtemisBuildTimeConfig buildConfig) { @Record(ExecutionTime.RUNTIME_INIT) @BuildStep - ArtemisJmsConfiguredBuildItem configure(ArtemisJmsRecorder recorder, ArtemisRuntimeConfig runtimeConfig, + ArtemisJmsConfiguredBuildItem configure(ArtemisJmsRecorder recorder, BuildProducer syntheticBeanProducer) { SyntheticBeanBuildItem connectionFactory = SyntheticBeanBuildItem.configure(ConnectionFactory.class) - .supplier(recorder.getConnectionFactorySupplier(runtimeConfig)) + .supplier(recorder.getConnectionFactorySupplier()) .scope(ApplicationScoped.class) .defaultBean() .unremovable() diff --git a/extensions/artemis-jms/runtime/src/main/java/io/quarkus/artemis/jms/runtime/ArtemisJmsRecorder.java b/extensions/artemis-jms/runtime/src/main/java/io/quarkus/artemis/jms/runtime/ArtemisJmsRecorder.java index 8069ced0bba59..3d5e38c0cf219 100644 --- a/extensions/artemis-jms/runtime/src/main/java/io/quarkus/artemis/jms/runtime/ArtemisJmsRecorder.java +++ b/extensions/artemis-jms/runtime/src/main/java/io/quarkus/artemis/jms/runtime/ArtemisJmsRecorder.java @@ -12,7 +12,13 @@ @Recorder public class ArtemisJmsRecorder { - public Supplier getConnectionFactorySupplier(ArtemisRuntimeConfig config) { + final ArtemisRuntimeConfig config; + + public ArtemisJmsRecorder(ArtemisRuntimeConfig config) { + this.config = config; + } + + public Supplier getConnectionFactorySupplier() { return new Supplier() { @Override public ConnectionFactory get() {