-
Bug
-
Resolution: Done
-
Major
-
None
-
False
-
-
False
-
---
-
-
The method io.quarkus.smallrye.reactivemessaging.kafka.deployment.SmallRyeReactiveMessagingKafkaProcessor#getChannelPropertyKey is adding quotes to the channel name if the name contains a ., but the channel parameter may already be quoted, causing double quotes.
The channel name coming from annotations is unquoted:
quarkus/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java
Lines 251 to 255
in
5c9d5e8
for (AnnotationInstance annotation : discovery.findRepeatableAnnotationsOnMethods(DotNames.OUTGOING)) {
String channelName = annotation.value().asString();
if (!discovery.isKafkaConnector(channelsManagedByConnectors, false, channelName))
{ continue; }
And the channel name coming from ChannelBuildItem is quoted:
quarkus/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/WiringHelper.java
Lines 199 to 212
in
1b3b935
/**
- Normalize the name of a given channel.
- Concatenate the channel name with double quotes when it contains dots.
- <p>
- Otherwise, the SmallRye Reactive Messaging only considers the
- text up to the first occurrence of a dot as the channel name.
- @param name the channel name.
- @return normalized channel name.
*/
private static String normalizeChannelName(String name)
{ return name != null && !name.startsWith("\"") && name.contains(".") ? "\"" + name + "\"" : name; }
quarkus/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/WiringHelper.java
Lines 63 to 74
in
1b3b935
static void produceOutgoingChannel(BuildProducer<ChannelBuildItem> producer, String name) {
String channelName = normalizeChannelName(name);
Optional<String> managingConnector = getManagingConnector(ChannelDirection.OUTGOING, channelName);
if (managingConnector.isPresent()) {
if (isChannelEnabled(ChannelDirection.OUTGOING, channelName))
{ producer.produce(ChannelBuildItem.outgoing(channelName, managingConnector.get())); }
} else
{ producer.produce(ChannelBuildItem.outgoing(channelName, null)); }
}
As a quick fix, I've changed io.quarkus.smallrye.reactivemessaging.kafka.deployment.SmallRyeReactiveMessagingKafkaProcessor#getChannelPropertyKey to handle both styles, but I think we should consider making the name style consistent, which requires some extra work.
Fixes #50751
Caused by #49861