Skip to content

Commit 77a7529

Browse files
committed
Improve Kafka Exception Message
- when we can't determine reply topic
1 parent 88e259c commit 77a7529

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

spring-integration-kafka/src/main/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandler.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,8 @@ else if (replyHeader != null) {
626626
replyTopic = getSingleReplyTopic();
627627
}
628628
else {
629-
throw new IllegalStateException("No reply topic header and no default reply topic can be determined");
629+
throw new IllegalStateException("No reply topic header and no default reply topic can be determined; "
630+
+ "container's assigned partitions: " + this.replyTopicsAndPartitions);
630631
}
631632
}
632633
else {

spring-integration-kafka/src/test/java/org/springframework/integration/kafka/dsl/KafkaDslTests.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,9 @@ public void onPartitionsRevoked(Collection<TopicPartition> partitions) {
459459

460460
@Override
461461
public void onPartitionsAssigned(Collection<TopicPartition> partitions) {
462-
ContextConfiguration.this.replyContainerLatch.countDown();
462+
if (!partitions.isEmpty()) {
463+
ContextConfiguration.this.replyContainerLatch.countDown();
464+
}
463465
}
464466

465467
});

spring-integration-kafka/src/test/kotlin/org/springframework/integration/kafka/dsl/kotlin/KafkaDslKotlinTests.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,9 @@ class KafkaDslKotlinTests {
345345
}
346346

347347
override fun onPartitionsAssigned(partitions: Collection<TopicPartition>) {
348-
this@ContextConfiguration.replyContainerLatch.countDown()
348+
if (!partitions.isEmpty()) {
349+
this@ContextConfiguration.replyContainerLatch.countDown()
350+
}
349351
}
350352

351353
})

0 commit comments

Comments
 (0)