Re: [akka-user] [Akka-Streams] Want to always receive latest element in Sink

2018-02-23 Thread saloniv
Hello Arnout, We are providing api for developers to use. So, there is a callback written by other developers which will be executed instead of Thread.sleep in example. Hence, we cannot say whether they will write CPU intensive code or some kind of IO. Hope this helps. On Wednesday,

Re: [akka-user] [Akka-Streams] Want to always receive latest element in Sink

2018-02-08 Thread Johan Andrén
You should be able to allow a faster upstream to continue, while emitting the latest value whenever downstream is read with conflate like so: Source(0 to 1000) .throttle(10, 1.second, 1, ThrottleMode.shaping) // fast upstream .conflate((in, prev) => in) // keep the latest value

Re: [akka-user] [Akka-Streams] Want to always receive latest element in Sink

2018-02-07 Thread Arnout Engelen
Hello Saloni, I think it would be helpful to have a more realistic example than doing "Thread.sleep(1000)" in the sink. Could we unpack what this sleep is intended to mimic in your 'real' application? Is it for example doing CPU-intensive data parsing or perhaps some kind of IO? Kind regards,

[akka-user] [Akka-Streams] Want to always receive latest element in Sink

2018-01-24 Thread saloniv
Hello, We are having a requirement that if a consumer is slower than producer then discard all the elements that cannot be consumed and whenever the consumer gets ready, feed the latest element from producer. We tried an approach as follows: Source.actorRef(0, OverflowStrategy.dropHead)