Re: [akka-user] [akka-stream] How to provide flow with 'last seen element' backup?

2017-08-10 Thread Akka Team
I misread it as wanting the last value to pass through the stream before completion, but I guess it was, read the last value that passed by in a stream. There's no stage that does that out of the box, so providing your own safe concurrent field of some kind, or firing of the elements to an actor

Re: [akka-user] [akka-stream] How to provide flow with 'last seen element' backup?

2017-08-07 Thread Alexey Shuksto
Hi, Johan, Thanks for your reply, but would not `Sink.last` complete it's Future only after Source fully completed? I need to check for last passed value in-between: ``` val bh = Source.unfold(0)(v => Some((v+1, v))).delay(1.minute).runWith(BroadcastHub.sink) bh.runWith(Sink.ignore) ``` So,

Re: [akka-user] [akka-stream] How to provide flow with 'last seen element' backup?

2017-08-07 Thread Akka Team
You can achieve this by using Sink.last which will materialize into a Future[T] that completes with the last element emitted. It does however not complete the promise with the last element on failures, this can be remedied by prepending it with a .recoverWithRetries(0, { case _ => Source.empty

[akka-user] [akka-stream] How to provide flow with 'last seen element' backup?

2017-07-29 Thread Alexey Shuksto
Hello hAkkers, In our project we use some number of flows that follow same building logic: ``` val input: Source[T, NotUsed] = ??? val output = input.runWith(BroadcastHub.sink) output.runWith(Sink.ignore) ``` Sink.ignore here used to prevent BroadcastHub inner buffer overflow and, also, to