Re: [akka-user] [akka streams] question on some time related use cases

2015-05-28 Thread Endre Varga
Hi Jakub, Every state that is encapsulated in the Stage is safe to being accessed from any of the Stage callbacks (onPull, onPush, etc.). In this regard it is like an Actor, where you can safely access its state from the receive block. You can look into the cookbook (

Re: [akka-user] [akka streams] question on some time related use cases

2015-05-27 Thread Jakub Liska
Hi, btw can Stage by stateful? Is R/W from/to this in a PushPullStage thread safe? var state : Map[A,Cancellable] = Map.empty Thanks, Jakub On Friday, January 23, 2015 at 2:42:11 AM UTC+1, Frank Sauer wrote: Thanks for the pointers Endre, I’ll explore those ideas. Frank On Jan 22,

Re: [akka-user] [akka streams] question on some time related use cases

2015-01-22 Thread Endre Varga
Hi Frank, On Thu, Jan 22, 2015 at 2:51 AM, Frank Sauer fsaue...@gmail.com wrote: Thanks, I came up with the following, but I have some questions: /** * Holds elements of type A for a given finite duration after a predicate p first yields true and as long as subsequent * elements

Re: [akka-user] [akka streams] question on some time related use cases

2015-01-22 Thread Endre Varga
On Thu, Jan 22, 2015 at 5:07 AM, Frank Sauer fsaue...@gmail.com wrote: Update, in a simple test scenario like so val ticks = Source(1 second, 1 second, () = Hello) val flow = ticks.transform(() = new FilterFor[String](10 seconds)(x = true)).to(Sink.foreach(println(_))) flow.run()

Re: [akka-user] [akka streams] question on some time related use cases

2015-01-22 Thread Frank Sauer
Thanks for the pointers Endre, I’ll explore those ideas. Frank On Jan 22, 2015, at 4:02 AM, Endre Varga endre.va...@typesafe.com wrote: On Thu, Jan 22, 2015 at 5:07 AM, Frank Sauer fsaue...@gmail.com mailto:fsaue...@gmail.com wrote: Update, in a simple test scenario like so val

Re: [akka-user] [akka streams] question on some time related use cases

2015-01-21 Thread Frank Sauer
Thanks, I came up with the following, but I have some questions: /** * Holds elements of type A for a given finite duration after a predicate p first yields true and as long as subsequent * elements matching that first element (e.g. are equal) still satisfy the predicate. If a matching

Re: [akka-user] [akka streams] question on some time related use cases

2015-01-21 Thread Frank Sauer
Update, in a simple test scenario like so val ticks = Source(1 second, 1 second, () = Hello) val flow = ticks.transform(() = new FilterFor[String](10 seconds)(x = true)).to(Sink.foreach(println(_))) flow.run() I'm seeing the following error, so this doesn't work at all and I'm not

[akka-user] [akka streams] question on some time related use cases

2015-01-16 Thread Frank Sauer
I have two uses cases that I'm used to from using CEP systems like Esper and I'm trying to figure out if I can implements them (easily) with Akka Streams: 1) test if in a stream of events ALL new events satisfy some predicate during some finite interval of time, which starts at the time the

Re: [akka-user] [akka streams] question on some time related use cases

2015-01-16 Thread Akka Team
Hi Frank! We do not have such operations off-the-shelf, however they are easily implementable by using custom stream processing stages: http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-M2/scala/stream-customize.html Be sure to refer to the cookbook for some inspiration on how to