-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
UnsupportedOperationException in TlsConfigUtils when setting ALPN false #46652
Comments
/cc @radcortez (config) |
Hi @radcortez package org.acme.amqp.runtime.client;
// ...
@ApplicationScoped
@Priority(1)
public class AmqpClientConfigFixAlpnCustomizer implements ClientCustomizer<AmqpClientOptions> {
private static final Logger log = Logger.getLogger(AmqpClientConfigFixAlpnCustomizer.class);
@Inject
TlsConfigurationRegistry tlsRegistry;
@Override
public AmqpClientOptions customize(String channel, Config channelConfig, AmqpClientOptions options) {
Optional<String> tlsConfigName = channelConfig.getOptionalValue("tls-configuration-name", String.class);
if (tlsConfigName.isPresent()) {
String tlsConfig = tlsConfigName.get();
Optional<TlsConfiguration> maybeTlsConfig = tlsRegistry.get(tlsConfig);
if (maybeTlsConfig.isPresent()) {
//Use the custom TlsConfigUtils
TlsConfigUtils.configure(options, maybeTlsConfig.get()); // Use your custom class
log.debugf("Configured RabbitMQOptions for channel %s with TLS configuration %s", channel, tlsConfig);
}
}
return options;
}
} package org.acme.amqp.tls.runtime.config;
// ...
public class TlsConfigUtils {
public static void configure(TCPSSLOptions options, TlsConfiguration configuration) {
options.setSsl(true);
if (configuration.getTrustStoreOptions() != null) {
options.setTrustOptions(configuration.getTrustStoreOptions());
}
// ...
options.setEnabledSecureTransportProtocols(sslOptions.getEnabledSecureTransportProtocols());
// Avoid call setUseAlpn
if (sslOptions.isUseAlpn()) {
options.setUseAlpn(true);
}
}
}
} With this change to my example project, I managed to avoid the blocking exception but I get yet another error which I report below.
Is it possible that the AMQP/TLS connection part was not tested correctly? Thanks. |
//cc @ozangunalp |
Description
The application is using the smallrye-amqp connector configured to use SSL/TLS connection through the TLS Registry configuration, as also reported in the Quarkus documentation.
I encountered a java.lang.UnsupportedOperationException when using the TlsConfigUtils class to configure TLS options in my Quarkus project. The error occurs because the setUseAlpn method is called unconditionally, even when ALPN is disabled in the configuration.
I am currently blocked due to this incorrect behavior and cannot find a way to avoid this situation from the documentation.
Steps to Reproduce
Expected Behavior
The application should not call setUseAlpn when ALPN is disabled in the configuration, avoiding the UnsupportedOperationException.
Actual Behavior
The application throws a java.lang.UnsupportedOperationException because setUseAlpn is called unconditionally.
Environment:
Quarkus version: 3.19.1
Java version: OpenJDK Runtime Environment Corretto-23.0.2.7.1 (build 23.0.2+7-FR)
Operating System: macOS 15.3.1 (24D70) (24.3.0 Darwin Kernel Version 24.3.0)
Additional Context
The issue occurs in the TlsConfigUtils class, which is part of the core of Quarkus. Here is the relevant code snippet:
Here you can be found the example code https://github.com/amusarra/quarkus-quickstarts/tree/main/amqp-quickstart/amqp-quickstart-producer
Thank you for your assistance
The text was updated successfully, but these errors were encountered: