Skip to content

Commit 9a97bcc

Browse files
graemerochercodex
andcommitted
Fix consumer interception state test regressions
Restore the multi-method ConsumerInfo constructor used by the new routing specs and stub pass-through interception in the state tests so they exercise the real dispatch path. Co-Authored-By: Codex with GPT-5 <codex@openai.com>
1 parent f1759bf commit 9a97bcc

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

kafka/src/main/java/io/micronaut/configuration/kafka/processor/ConsumerInfo.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,17 @@ final class ConsumerInfo {
121121
);
122122
}
123123

124+
ConsumerInfo(
125+
String clientId,
126+
String groupId,
127+
OffsetStrategy offsetStrategy,
128+
AnnotationValue<KafkaListener> kafkaListener,
129+
Properties properties,
130+
List<ExecutableMethod<?, ?>> methods
131+
) {
132+
this(clientId, groupId, offsetStrategy, kafkaListener, properties, methods, Map.of());
133+
}
134+
124135
@SuppressWarnings("unchecked")
125136
ConsumerInfo(
126137
String clientId,

kafka/src/test/groovy/io/micronaut/configuration/kafka/processor/ConsumerCreationStrategyStateSpec.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class ConsumerCreationStrategyStateSpec extends Specification {
3030
def listener = new TestPerClassMultiTopicListener()
3131
def processor = Stub(KafkaConsumerProcessor) {
3232
getBinderRegistry() >> binderRegistry
33+
interceptRecord(_, _ as ConsumerRecord) >> { ConsumerInfo ignored, ConsumerRecord<?, ?> record -> record }
3334
}
3435
def kafkaConsumer = Stub(Consumer) {
3536
subscription() >> ([] as Set)
@@ -54,6 +55,7 @@ class ConsumerCreationStrategyStateSpec extends Specification {
5455
def listener = new TestPerClassMultiTopicBatchListener()
5556
def processor = Stub(KafkaConsumerProcessor) {
5657
getBatchBinderRegistry() >> batchBinderRegistry
58+
interceptRecords(_, _ as ConsumerRecords) >> { ConsumerInfo ignored, ConsumerRecords<?, ?> records -> records }
5759
}
5860
def kafkaConsumer = Stub(Consumer) {
5961
subscription() >> ([] as Set)
@@ -78,6 +80,7 @@ class ConsumerCreationStrategyStateSpec extends Specification {
7880
def listener = new TestBatchMultiTopicListener()
7981
def processor = Stub(KafkaConsumerProcessor) {
8082
getBatchBinderRegistry() >> batchBinderRegistry
83+
interceptRecords(_, _ as ConsumerRecords) >> { ConsumerInfo ignored, ConsumerRecords<?, ?> records -> records }
8184
}
8285
def kafkaConsumer = Stub(Consumer) {
8386
subscription() >> ([] as Set)

0 commit comments

Comments
 (0)