quarkus: Quarkus Kafka Kotlin Coroutines does not work
Describe the bug
Hello to all. When trying to use Kotlin suspending functions together with Quarkus Kafka I am getting the following exception:
SRMSG00201: Error caught while processing a message: java.lang.IllegalStateException: No Vertx context found
I have simply defined the following code:
@Incoming("order-in")
suspend fun consumeOrderEvents(orderRecord: Record<String, Order>) {
After analysing the issue I found that the code is not being called on a Vertx Thread as the exception is thrown from the following snippet:
val dispatcher: CoroutineDispatcher = Vertx.currentContext()?.let(::VertxDispatcher)
?: throw IllegalStateException("No Vertx context found")
in the AbstractSubscribingCoroutineInvoker
class .
Is there anything I have to watch out for when configuring Quarkus Kafka and Kotlin ?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 20 (10 by maintainers)
As far as I’m aware, this appears to be fixed and the issue can be closed. I didn’t open this issue, though.
Looks good now with
2.8.0.CR1
. Thank you and looking forward to the final release!Yes, Quarkus 2.8 depends on reactive messaging 3.15.0 which runs message handling methods on Vert.x context.
We are now enforcing it in reactive messaging.
@ozangunalp was that merged in 2.8?
@cescoffier An identical exception is raised when using RabbitMQ connector.
This method:
Produces this stacktrace: