Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration via env variables not working correctly anymore since Quarkus 3.11 #2659

Closed
panphg opened this issue Jun 18, 2024 · 4 comments
Closed

Comments

@panphg
Copy link

panphg commented Jun 18, 2024

After upgrading from Quarkus 3.10.2 to 3.11.0 our application that uses channels with a hyphen, e.g. abc-def, cannot be configured using environment variables anymore.

Description

When configuring a channel with a hyphen in the name in application.properties, e.g.

mp.messaging.incoming.abc-def.enabled=false
mp.messaging.incoming.abc-def.connector=smallrye-in-memory

and enabling the channel using the environment variable MP_MESSAGING_INCOMING_ABC_DEF_ENABLED=true,
then the application throws the following exception on startup:

java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
        at io.quarkus.runtime.Application.start(Application.java:101)
        at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
        at io.quarkus.runner.GeneratedMain.main(Unknown Source)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:113)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: jakarta.enterprise.inject.spi.DeploymentException: java.lang.IllegalArgumentException: SRMSG00071: Invalid channel configuration -  the `connector` attribute must be set for channel `abc`
        at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:58)
        at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_qTrMuLFyQ1IvGfeSxRVitl6CCBQ.notify(Unknown Source)
        at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:351)
        at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:333)
        at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:80)
        at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:155)
        at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:106)
        at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
        at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
        ... 11 more
Caused by: java.lang.IllegalArgumentException: SRMSG00071: Invalid channel configuration -  the `connector` attribute must be set for channel `abc`
        at io.smallrye.reactive.messaging.providers.impl.ConnectorConfig.lambda$getConnectorAttribute$0(ConnectorConfig.java:65)
        at java.base/java.util.Optional.orElseThrow(Optional.java:403)
        at io.smallrye.reactive.messaging.providers.impl.ConnectorConfig.lambda$getConnectorAttribute$1(ConnectorConfig.java:65)
        at java.base/java.util.Optional.orElseGet(Optional.java:364)
        at io.smallrye.reactive.messaging.providers.impl.ConnectorConfig.getConnectorAttribute(ConnectorConfig.java:64)
        at io.smallrye.reactive.messaging.providers.impl.ConnectorConfig.<init>(ConnectorConfig.java:59)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.lambda$extractConfigurationFor$0(ConfiguredChannelFactory.java:91)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.extractConfigurationFor(ConfiguredChannelFactory.java:78)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.initialize(ConfiguredChannelFactory.java:107)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory_ClientProxy.initialize(Unknown Source)
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
        at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
        at io.smallrye.reactive.messaging.providers.extension.MediatorManager.start(MediatorManager.java:250)
        at io.smallrye.reactive.messaging.providers.extension.MediatorManager_ClientProxy.start(Unknown Source)
        at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:53)
        ... 19 more

The problem seems to be that smallrye-reactive-messaging thinks the name of the channel is abc instead of abc-def when using the environment variable MP_MESSAGING_INCOMING_ABC_DEF_ENABLED.

This setup used to work up to Quarkus 3.10.2, but does not work anymore since Quarkus 3.11.0.

Steps to reproduce the issue

I created a minimal Quarkus project that reproduces the issue: panphg/smallrye-messaging-config.

  1. Clone the repository panphg/smallrye-messaging-config
  2. Run ./gradlew quarkusDev

If you change value of quarkusPluginVersion and quarkusPlatformVersion in gradle.properties to 3.10.2 and run the application again, everything works as expected.

I'm not sure if this issue is caused by smallrye-reactive-messaging or smallrye-config (or a combination of both), but I'm happy to raise this issue in smallrye-config again, if you think the problem should be solved there.

@ozangunalp
Copy link
Collaborator

Hi, thanks for the detailed description.

In reactive messaging we've tests against regressions on this.
Also both Quarkus 3.10.2 and 3.11. depend on Reactive messaging 4.21.0

We'd need to check what has changed on Quarkus.

@panphg
Copy link
Author

panphg commented Jun 19, 2024

Should I open the issue in smallrye-config? Quarkus 3.11 is using a different version (3.7.1 vs 3.8.1) and I found a change in 3.8.0 that might have something to do with this problem: smallrye/smallrye-config#1146.

@ozangunalp
Copy link
Collaborator

I think there could be something with the Quarkus integration, let's see what @radcortez finds out in quarkusio/quarkus#41296

@ozangunalp
Copy link
Collaborator

Closing this as @radcortez came up with a fix in smallrye/smallrye-config#1180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants