diff --git a/runtime/src/main/java/org/amqphub/quarkus/qpid/jms/runtime/QpidJmsProducer.java b/runtime/src/main/java/org/amqphub/quarkus/qpid/jms/runtime/QpidJmsProducer.java index 51ee694..f00f3da 100644 --- a/runtime/src/main/java/org/amqphub/quarkus/qpid/jms/runtime/QpidJmsProducer.java +++ b/runtime/src/main/java/org/amqphub/quarkus/qpid/jms/runtime/QpidJmsProducer.java @@ -35,10 +35,10 @@ public class QpidJmsProducer { @ApplicationScoped @DefaultBean public ConnectionFactory connectionFactory() { - ConnectionFactory connectionFactory = new JmsConnectionFactory(config.username.orElse(null), config.password.orElse(null), config.url); + ConnectionFactory connectionFactory = new JmsConnectionFactory(config.username().orElse(null), config.password().orElse(null), config.url()); ConnectionFactoryWrapper wrapper = Arc.container().instance(ConnectionFactoryWrapper.class).get(); - if (config.wrap && wrapper != null) { + if (config.wrap() && wrapper != null) { return wrapper.wrap(connectionFactory); } else { return connectionFactory; diff --git a/runtime/src/main/java/org/amqphub/quarkus/qpid/jms/runtime/QpidJmsRuntimeConfig.java b/runtime/src/main/java/org/amqphub/quarkus/qpid/jms/runtime/QpidJmsRuntimeConfig.java index 0dc5cc7..3c59fd1 100644 --- a/runtime/src/main/java/org/amqphub/quarkus/qpid/jms/runtime/QpidJmsRuntimeConfig.java +++ b/runtime/src/main/java/org/amqphub/quarkus/qpid/jms/runtime/QpidJmsRuntimeConfig.java @@ -17,37 +17,37 @@ import java.util.Optional; -import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; -@ConfigRoot(name = "qpid-jms", phase = ConfigPhase.RUN_TIME) -public class QpidJmsRuntimeConfig { +@ConfigMapping(prefix = "quarkus.qpid-jms") +@ConfigRoot(phase = ConfigPhase.RUN_TIME) +public interface QpidJmsRuntimeConfig { - public static final String DEFAULT_URL = "amqp://localhost:5672"; + String DEFAULT_URL = "amqp://localhost:5672"; /** * Connection URL for the factory */ - @ConfigItem(defaultValue = DEFAULT_URL) - public String url; + @WithDefault(DEFAULT_URL) + String url(); /** * Username to optionally be set on the factory */ - @ConfigItem - public Optional username; + Optional username(); /** * Password to optionally be set on the factory */ - @ConfigItem - public Optional password; + Optional password(); /** * Whether to wrap a ConnectionFactory by ConnectionFactoryWrapper which could be introduced by other extensions, * such as quarkus-pooled-jms to provide pooling capability */ - @ConfigItem(defaultValue = "false") - public boolean wrap; + @WithDefault("false") + boolean wrap(); }