Covers replacing Thread.sleep with await() across a void @Async method, an @EmbeddedKafka-backed @KafkaListener, and an already-running @Scheduled job; verifies Awaitility 4.3.0's real defaults (10s timeout, 100ms poll interval) and its default-uncaught-exception-handler swap directly against the jar; and documents a real pom.xml trap where Boot 4.1.1 split Kafka's autoconfiguration (spring-boot-kafka) out of spring-kafka itself, which silently leaves @KafkaListener beans with no running container.
24 lines
1.0 KiB
Plaintext
24 lines
1.0 KiB
Plaintext
== Real failure with org.springframework.kafka:spring-kafka as a direct dependency instead of org.springframework.boot:spring-boot-starter-kafka (pom.xml since fixed) ==
|
|
|
|
$ mvn -B test
|
|
[ERROR] Errors:
|
|
[ERROR] KafkaListenerAwaitTest.messageSentIsEventuallyConsumed:49 ? ConditionTimeout Assertion condition defined as a Lambda expression in com.ankurm.awaitility.KafkaListenerAwaitTest
|
|
Expecting ConcurrentLinkedQueue:
|
|
[]
|
|
to contain:
|
|
["order-42-created"]
|
|
but could not find the following element(s):
|
|
["order-42-created"]
|
|
within 5 seconds.
|
|
[INFO]
|
|
[ERROR] Tests run: 11, Failures: 0, Errors: 2, Skipped: 0
|
|
|
|
No exception at context startup, and the application context came up without a single warning.
|
|
Autowiring KafkaListenerEndpointRegistry directly in a scratch test and calling
|
|
getListenerContainers() on it confirmed the real cause: the bean did not exist. Neither did
|
|
KafkaTemplate, ConsumerFactory, or kafkaListenerContainerFactory. Grepping the full log for the
|
|
Spring Kafka logger prefix also confirmed it:
|
|
|
|
$ grep -c "o\.s\.k\." full-test-run.log
|
|
0
|