Search code examples
javaapache-kafkaquarkusapplication.propertiessmallrye-reactive-messaging

quarkus.uuid as an expression not working in application.properties


Wrote a program where the kafka topic is read using smallrye-kafka-messaging. Now I need the group.id property to be random when ever the service is run/restarted, so i used this property in the quarkus project

mp.messaging.incoming.incoming_topic_name.group.id=${quarkus.uuid}

${quarkus.uuid} is mentioned in quarkus guides for generating random uuid in application.properties

but when when this property is used in the application, this exception shows up

Failed to start application (with profile dev): java.util.NoSuchElementException: SRCFG00011: Could not expand value quarkus.uuid in property mp.messaging.incoming.incoming.incoming_topic_name.group.id
        at io.smallrye.config.ExpressionConfigSourceInterceptor.lambda$getValue$0(ExpressionConfigSourceInterceptor.java:44)
        at io.smallrye.common.expression.ExpressionNode.emit(ExpressionNode.java:22)
        at io.smallrye.common.expression.Expression.evaluateException(Expression.java:56)
        at io.smallrye.common.expression.Expression.evaluate(Expression.java:70)
        at io.smallrye.config.ExpressionConfigSourceInterceptor.getValue(ExpressionConfigSourceInterceptor.java:37)
        at io.smallrye.config.ExpressionConfigSourceInterceptor.getValue(ExpressionConfigSourceInterceptor.java:18)

Tried also this - removed the group.id property so then kafka is using the quarkus.application.name as the consumer group id, so even after removing application name property then quarkus is using the service name as consumer group id.

Is there is any other way to set group.id of kafka listener to be random ?


Solution

  • As @geoand has mentioned in the comments, after updating the Quarkus version to 2.2.3 it is finally working fine now. The issue was due to using an old version of Quarkus, after updating version the issue is resolved.