Skip to content

Commit

Permalink
Merge pull request quarkusio#20722 from stuartwdouglas/artemis-record…
Browse files Browse the repository at this point in the history
…er-injection

Change Artemis to use recorder injection
  • Loading branch information
gsmet authored Oct 13, 2021
2 parents e3be925 + 4e55617 commit ff609cf
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -104,15 +103,15 @@ void load(BuildProducer<FeatureBuildItem> feature, Optional<ArtemisJmsBuildItem>

@Record(ExecutionTime.RUNTIME_INIT)
@BuildStep
ArtemisCoreConfiguredBuildItem configure(ArtemisCoreRecorder recorder, ArtemisRuntimeConfig runtimeConfig,
ArtemisCoreConfiguredBuildItem configure(ArtemisCoreRecorder recorder,
BuildProducer<SyntheticBeanBuildItem> syntheticBeanProducer, Optional<ArtemisJmsBuildItem> artemisJms) {

if (artemisJms.isPresent()) {
return null;
}

SyntheticBeanBuildItem serverLocator = SyntheticBeanBuildItem.configure(ServerLocator.class)
.supplier(recorder.getServerLocatorSupplier(runtimeConfig))
.supplier(recorder.getServerLocatorSupplier())
.scope(ApplicationScoped.class)
.defaultBean()
.unremovable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
@Recorder
public class ArtemisCoreRecorder {

public Supplier<ServerLocator> getServerLocatorSupplier(ArtemisRuntimeConfig config) {
final ArtemisRuntimeConfig config;

public ArtemisCoreRecorder(ArtemisRuntimeConfig config) {
this.config = config;
}

public Supplier<ServerLocator> getServerLocatorSupplier() {
return new Supplier<ServerLocator>() {
@Override
public ServerLocator get() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -34,11 +33,11 @@ HealthBuildItem health(ArtemisBuildTimeConfig buildConfig) {

@Record(ExecutionTime.RUNTIME_INIT)
@BuildStep
ArtemisJmsConfiguredBuildItem configure(ArtemisJmsRecorder recorder, ArtemisRuntimeConfig runtimeConfig,
ArtemisJmsConfiguredBuildItem configure(ArtemisJmsRecorder recorder,
BuildProducer<SyntheticBeanBuildItem> syntheticBeanProducer) {

SyntheticBeanBuildItem connectionFactory = SyntheticBeanBuildItem.configure(ConnectionFactory.class)
.supplier(recorder.getConnectionFactorySupplier(runtimeConfig))
.supplier(recorder.getConnectionFactorySupplier())
.scope(ApplicationScoped.class)
.defaultBean()
.unremovable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
@Recorder
public class ArtemisJmsRecorder {

public Supplier<ConnectionFactory> getConnectionFactorySupplier(ArtemisRuntimeConfig config) {
final ArtemisRuntimeConfig config;

public ArtemisJmsRecorder(ArtemisRuntimeConfig config) {
this.config = config;
}

public Supplier<ConnectionFactory> getConnectionFactorySupplier() {
return new Supplier<ConnectionFactory>() {
@Override
public ConnectionFactory get() {
Expand Down

0 comments on commit ff609cf

Please sign in to comment.