quarkussmallrye-reactive-messaging

Does Quarkus create multiple consumer instances on muti partiton topics when consumer is anotated as @Blocking?


Runing on Quarkus 2.9.0.Final

@Incoming("in-topic")
@Blocking("in-pool")
public void process(MyRequest request) {
    // Do something "longish" here...
    logger.info("Done!"); <------ This keeps logging in-pool-0 Though I have configured 8 and the topic is 8 partitions.
}

Pool config just in case: smallrye.messaging.worker.in-pool.max-concurrency=8

Also the records are keyed. So I would assume different worker threads would be doing work. But we are experiencing a slow down.


Solution

  • If you want to process messages concurrently, you need to disable ordered processing using @Blocking(ordered = false). The fact that records are keyed doesn't make any difference, so the in-partition order won't be preserved.

    In more recent versions of Quarkus, there are more advanced features such as KeyedMulti and incoming concurrency to better handle these scenarios.