Knows Not Much
Knows Not Much

Reputation: 31546

Convert Slick 3.0 Query results into a Akka Streams GraphStage

Is there any example available where somone queries mysql using slick3.0 and the results of the query are converted into a AkkaStream GraphStage?

I don't want to write a custom GraphStage of my own (unless absolutely necessary).

I am pretty sure that there should be some way of converting the query results into GraphStage

Upvotes: 1

Views: 172

Answers (1)

Stefano Bonetti
Stefano Bonetti

Reputation: 9023

Slick supports streaming of query results, and that is done by adhering to the Reactive Streams API.

You can call .stream on a Slick database, and get back a org.reactivestreams.Publisher.

This can be wrapped into an Akka streams Source by calling Source.fromPublisher(dbPublisher).

You can find more info in the docs, and a complete example in this repo.

Upvotes: 2

Related Questions