Skip to content

Commit c5d08d0

Browse files
committed
Kafka MessageDrivenAdapterTests: batch race condition
The `ConsumerConfig.FETCH_MIN_BYTES_CONFIG` is `1` byte by default. Therefore, the batch consumer expectations might be fulfilled too early just for one record. Adjust such a config to `12` bytes to be sure that both published records are received in a single batch: exactly what we expect in the test logic. **Auto-cherry-pick to `6.4.x`**
1 parent 90b0555 commit c5d08d0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageDrivenAdapterTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ protected boolean doSend(Message<?> message, long timeout) {
398398
void testInboundBatch() throws Exception {
399399
Map<String, Object> props = KafkaTestUtils.consumerProps(EMBEDDED_BROKERS, "test2", "true");
400400
props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
401+
props.put(ConsumerConfig.FETCH_MIN_BYTES_CONFIG, 12);
402+
401403
DefaultKafkaConsumerFactory<Integer, String> cf = new DefaultKafkaConsumerFactory<>(props);
402404
ContainerProperties containerProps = new ContainerProperties(topic2);
403405
containerProps.setIdleEventInterval(100L);

0 commit comments

Comments
 (0)