I have a simple stream declared like following:
Source.tick(Duration.ofSeconds(1), Duration.ofSeconds(30), Files.list(rootDir).collect(Collectors.toList()))
.mapConcat(files -> files)
.log("scanning logs")
.via(logsFlow.create())
.via(kafkaFlow.create())
// .via(archiveFlow.create())
.runWith(Sink.ignore(), materializer)
.whenComplete((a, b) -> {
log.info("done");
});
With archiveFlow commented out everything works like expected. But when I'm adding additional flow no matter if it is archive flow or some simple flow like this:
.via(Flow.of(Path.class).map(path -> {
log.info("foo");
return path;
}))
stream is completed after first tick. Why is that?
2019-03-20 21:35:09.292 DEBUG 50089 --- [lt-dispatcher-2] a.kafka.internal.DefaultProducerStage : Stage completed
2019-03-20 21:35:09.294 DEBUG 50089 --- [lt-dispatcher-4] akka.stream.Materializer : [scanning logs] Downstream finished.
2019-03-20 21:35:09.296 INFO 50089 --- [onPool-worker-3] com.example.MyStream : done