Re: [akka-user] Re: Akka stream - implements Pause/Resume

2016-10-14 Thread Viktor Klang
Hi Regis, unfortunately you're still doing unsafe things (you have a race-condition in your accesses to bufferedElement) On Fri, Oct 14, 2016 at 3:56 PM, regis leray wrote: > Thanks a lot i succeed, to make it work... > > val switch = new ValveSwitch { > val callback = getAsyncCallback[A](pus

Re: [akka-user] Re: Akka stream - implements Pause/Resume

2016-10-14 Thread regis leray
Thanks a lot i succeed, to make it work... val switch = new ValveSwitch { val callback = getAsyncCallback[A](push(out, _)) override def open: Unit = { mode = ValveMode.Open bufferedElement.foreach(callback.invoke) bufferedElement = Option.empty } override def close: Unit = {

Re: [akka-user] Re: Akka stream - implements Pause/Resume

2016-10-14 Thread Konrad Malawski
Have you read the blog post? In the async callback you can push(), that's what I meant. -- Konrad `ktoso` Malawski Akka @ Lightbend On 14 October 2016 at 10:11:09, Konrad 'ktoso' Malawski (ktos...@gmail.com) wrote: Please read this: - http://blog.akka.io/

[akka-user] Re: Akka stream - implements Pause/Resume

2016-10-14 Thread Konrad 'ktoso' Malawski
Please read this: - http://blog.akka.io/integrations/2016/08/29/connecting-existing-apis - and this: http://doc.akka.io/docs/akka/2.4/scala/stream/stream -customize.html Specifically, your trigger should be implemented as async-callback, as it comes from the outside but should "wake up" the stag