Kafka Channel name with a 'period' in Quarkus application

1.5k views Asked by At

While I am playing with repo kafka-quickstart , I noticed that if I add a period to the channel name quarkus is failing to start. The channel name in the github repo is 'quotes' and I changed it to 'quotes.ch' all over the occurrences.

the properties file entry is changed to
mp.messaging.outgoing.quotes.ch.value.serializer=io.quarkus.kafka.client.serialization.ObjectMapperSerializer
The outgoing annotation with channel name "quotes.ch" in QuotesProcessor and the channel annotation with "quotes.ch" in QuotesResource

The processor application failed to start with below exception :: How to handle such names in quarkus?

Thread [39m [38;5;188m) [39m [38;5;151mFailed to start application (with profile dev) [39m [38;5;203m: java.lang.IllegalArgumentException: SRMSG00071: Invalid channel configuration - the connector attribute must be set for channel quotes at io.smallrye.reactive.messaging.providers.impl.ConnectorConfig.lambda$new$0(ConnectorConfig.java:50) at java.base/java.util.Optional.orElseThrow(Optional.java:403) at io.smallrye.reactive.messaging.providers.impl.ConnectorConfig.lambda$new$1(ConnectorConfig.java:50) at java.base/java.util.Optional.orElseGet(Optional.java:364) at io.smallrye.reactive.messaging.providers.impl.ConnectorConfig.(ConnectorConfig.java:49) at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.lambda$extractConfigurationFor$0(ConfiguredChannelFactory.java:85) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.extractConfigurationFor(ConfiguredChannelFactory.java:74)

UPDATE::: This problem/bug is fixed in https://github.com/quarkusio/quarkus/pull/25490

1

There are 1 answers

0
Kemot 90 On

you need update your application.properties like a this

# Configurazione incoming quotes Kafka topic for Channel
mp.messaging.incoming.quotes.connector=smallrye-kafka
mp.messaging.incoming.quotes.topic=quotes
mp.messaging.incoming.quotes.auto.offset.reset=earliest

after configuring correctly kafka you can use

@Channel("quotes")...

Official documentation: more info for your use case here https://quarkus.io/guides/kafka-reactive-getting-started and other example here https://quarkus.io/blog/getting-started-kafka/