When you say database could it be you mean an SQL database? Because for those Slick 3 (also known as Reactive Slick) exposes queries as reactive streams so you can directly consume them using Akka Streams (Source.fromPublisher(myquery...))
-- Konrad `ktoso` Malawski Akka <http://akka.io> @ Lightbend <http://lightbend.com> On 30 May 2016 at 19:19:50, Akka Team (akka.offic...@gmail.com) wrote: Hi Devin, It might even be possible to do that using the flow api combinators, something like this: implicit val system = ActorSystem() implicit val mat = ActorMaterializer() def fetchFromDatabase(position: Int): Vector[Int] = (position to (position + 99)).toVector val periodicFetch: Source[Int, Cancellable] = Source.tick(0.seconds, 3.seconds, NotUsed) .statefulMapConcat[Int] { () => var lastJob = 0 { (notUsed) => // remember to run stage on separate dispatcher if call is blocking val rows = fetchFromDatabase(lastJob) lastJob += 100 rows } } periodicFetch.runWith(Sink.foreach(println)) If you still need more control I'd recommend you to do this using a GraphStage instead, I think that API is much easier to understand and get right than the ActorPublisher API, you can find docs and samples here: http://doc.akka.io/docs/akka/2.4.6/scala/stream/stream-customize.html -- Johan Akka Team Typesafe - Reactive apps on the JVM Blog: letitcrash.com Twitter: @akkateam -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout. -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.