Fix KafkaDslTests for splitter race condition

It looks like `Stream.generate()` might producer items not in the expected order.
So, use `Stream.toList()` to be sure in the sequence size, and then `resequence()`
to be sure that items are emitted downstream in the proper sequence order.
This commit is contained in:
Artem Bilan
2024-10-03 12:17:25 -04:00
parent 8d7eb7c2ed
commit 0998a9502e

View File

@@ -349,7 +349,8 @@ public class KafkaDslTests {
public IntegrationFlow sendToKafkaFlow(
KafkaProducerMessageHandlerSpec<Integer, String, ?> kafkaMessageHandlerTopic2) {
return f -> f
.splitWith(s -> s.function(p -> Stream.generate(() -> p).limit(101).iterator()))
.splitWith(s -> s.function(p -> Stream.generate(() -> p).limit(101).toList()))
.resequence()
.enrichHeaders(h -> h.header(KafkaIntegrationHeaders.FUTURE_TOKEN, "foo"))
.publishSubscribeChannel(c -> c
.subscribe(sf -> sf.handle(