Unable to cast message to KafkaRecordBatch
Whenever i try to use the KafkaRecordBatch<K, V> object as Incoming item i get the following error:
ERROR [io.sma.rea.mes.provider] (vert.x-eventloop-thread-0) SRMSG00200: The method nl.devolksbank.capability.transactioninsights.transaction.BatchTransactionLoader#processBoekingBatch has thrown an exception: java.lang.ClassCastException: class org.eclipse.microprofile.reactive.messaging.Message$5 cannot be cast to class io.smallrye.reactive.messaging.kafka.KafkaRecordBatch (org.eclipse.microprofile.reactive.messaging.Message$5 and io.smallrye.reactive.messaging.kafka.KafkaRecordBatch are in unnamed module of loader io.quarkus.bootstrap.runner.RunnerClassLoader @4534b60d)
The channel in question is set to batch mode, and im using a void uni return signature. Message < List > and ConsumerRecords<K, V> are working as expected.
Quarkus 3.7.3 quarkus-smallrye-reactive-messaging-kafka
In the long run, it is no longer recommended to continue using custom message types such as KafkaRecordBatch, KafkaRecord etc. to consume messages. I am preparing a documentation change to signal this.
The reason is using custom types makes it impossible to apply any elaborate message interception, such as message observation.
The Micrometer message observation in Quarkus is shipped in 3.7 and was activated by default when Micrometer extension is used. I think this is the issue you are having, unless you are defining a custom incoming message interceptor.
That being said we thought that without announcing this, it would cause issues like this, so we've disabled by default the message observation in 3.7.4, so that is no longer a breaking change.
This has been addressed in https://smallrye.io/smallrye-reactive-messaging/latest/concepts/model/#messages-vs-payloads