Feature description
Problem:
A KafkaConsumer instance can be safely shared between threads when all access is mutually exclusive. Improper access results in a ConcurrentModificationException being raised - as per the documentation.
Micronaut's current implementation does not ensure that access to a KafkaConsumer is mutually exclusive, and as a consequence, downstream code is unable to perform operations with the KafkaConsumer instance outside of the poll loop thread. This is prohibitive as it prevents multi-threaded code from utilising all of the niceties of Micronaut's Kafka implementation and life-cycle management.
Feature Request:
To ensure that Micronaut's use of KafkaConsumers is mutually exclusive, achieved by performing Kafka operations within a synchronized block.
Implementation:
- Synchronise access to
KafkaConsumer instances within the KafkaConsumerProcessor when performing Kafka operations.
- Update documentation in
ConsumerRegistry#getConsumer.
Feature description
Problem:
A
KafkaConsumerinstance can be safely shared between threads when all access ismutually exclusive. Improper access results in aConcurrentModificationExceptionbeing raised - as per the documentation.Micronaut's current implementation does not ensure that access to a
KafkaConsumeris mutually exclusive, and as a consequence, downstream code is unable to perform operations with theKafkaConsumerinstance outside of thepoll loopthread. This is prohibitive as it prevents multi-threaded code from utilising all of the niceties of Micronaut's Kafka implementation and life-cycle management.Feature Request:
To ensure that Micronaut's use of
KafkaConsumers is mutually exclusive, achieved by performing Kafka operations within asynchronizedblock.Implementation:
KafkaConsumerinstances within theKafkaConsumerProcessorwhen performing Kafka operations.ConsumerRegistry#getConsumer.