fs2-reactive-streams
will get you a stream where multiple libraries form the connecting pieces of it, which might be what you want. Another alternative is to just do an unsafeRunSync
inside of the foreach
(not my first choice but it should "work"). Personally if it were me I would defer to fs2 as much as possible as it has direct support for cats effect .
fs2-reactive-streams
. If your application is already mostly Akka Streams and you just want to run some isolated pure code in there, just running the IO
is also an option (albeit a compromise)
run
the Akka stream, since Future
s start immediately. Put the run
expression in IO.fromFuture
.
1
IO
run(args: List[String]): IO[ExitCode]
method.
IO.fromFuture(...runWith(Sink.foreach(println))).as[ExitCode.Success]
IOApp
is that it takes care of running the IO[ExitCode]
for you.
Sink.foreach
is calling println
, so you should see your output fine.
Future[Done]
, which has a thread that prints the ticks, right?