Hi Francesco, You could emulate what you want using this:
scala> val (q, f) = Source.queue[Option[Int]](10, OverflowStrategy.backpressure).takeWhile(_.isDefined).map(_.get).toMat(Sink.foreach(println))(Keep.both).run() q: akka.stream.SourceQueue[Option[Int]] = akka.stream.impl.AcknowledgeSource$$anon$1@7288034b f: scala.concurrent.Future[Unit] = scala.concurrent.impl.Promise$DefaultPromise@66b57506 scala> q.offer(Some(10)) res17: scala.concurrent.Future[Boolean] = scala.concurrent.impl.Promise$DefaultPromise@37880069 scala> 10 scala> q.offer(Some(11)) res18: scala.concurrent.Future[Boolean] = scala.concurrent.impl.Promise$DefaultPromise@27b0289c scala> 11 scala> q.offer(None) res19: scala.concurrent.Future[Boolean] = scala.concurrent.impl.Promise$DefaultPromise@6480cd5b scala> f.value res20: Option[scala.util.Try[Unit]] = Some(Success(())) //Exercise left to the reader as how to also incorporate an error signal On Sat, Nov 7, 2015 at 10:55 AM, Francesco Di Muccio < [email protected]> wrote: > Hi, > > the new Source.queue in Akka Stream 2.0-M1 offers an interesting way to > imperatively push elements into the stream without loosing backpressure > information, but how could the complete signal be sent to the source? > > In case of Source.actorRef it is possible by sending a PoisonPill or a > Success/Failure message to the materialized actor ref, but when > materializing a SourceQueue the only method that is exposed is offer() to > push elements into the stream, adding a complete() and/or fail() method > could solve the issue, or maybe there is some other way that is not yet > documented (or I missed it). > > Regards, > Francesco > > -- > >>>>>>>>>> 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- Cheers, √ -- >>>>>>>>>> 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
