That emits at a given rate. Example used increasing delays. The concat
version is nice if you want to encode a scenario where there is a
"timetable".

On Mon, Jan 11, 2016 at 1:10 PM, Roland Kuhn <goo...@rkuhn.info> wrote:

> Wouldn’t it be easier to use a tick source and zip it with a iterator
> source?
>
> 11 jan 2016 kl. 12:40 skrev Endre Varga <endre.va...@typesafe.com>:
>
> You can concatenate singleton sources with .delayInitial():
>
>
> Source.single(1).delayInitial(1.second).concat(Source.single(2).delayInitial(...)).concat(...)
>
> Of course you can do this in a for loop to make it simpler.
>
> On Mon, Jan 11, 2016 at 12:22 PM, Bruno Bieth <bie...@gmail.com> wrote:
>
>> Yeah :) but I couldn't figure a quicker way to test groupedWithin.
>>
>> On Monday, January 11, 2016 at 12:06:53 PM UTC+1, √ wrote:
>>>
>>> And of course "Thread.sleep()" is evil™ also always applies.
>>>
>>> On Mon, Jan 11, 2016 at 11:47 AM, Bruno Bieth <bie...@gmail.com> wrote:
>>>
>>>> Thanks,
>>>>
>>>> @drewhk <https://github.com/drewhk> told me this as well and it works!
>>>> I forgot that akka-stream 2.0 introduced fusing...
>>>>
>>>> Regards,
>>>> Bruno
>>>>
>>>>
>>>> On Monday, January 11, 2016 at 10:36:28 AM UTC+1, rkuhn wrote:
>>>>>
>>>>> Hi Bruno,
>>>>>
>>>>> it works with fuzzing because the interpreter will only process one
>>>>> step before looking into its Actor mailbox—but what actually breaks things
>>>>> is your usage of Thread.sleep. If you want to block, you’ll typically want
>>>>> to do so behind an Attributes.asyncBoundary.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Roland
>>>>>
>>>>> 11 jan 2016 kl. 10:26 skrev Bruno Bieth <bie...@gmail.com>:
>>>>>
>>>>> Turns out it works with fuzzing (explaining why it passes the test
>>>>> suite).
>>>>> I've submitted an issue: https://github.com/akka/akka/issues/19394
>>>>>
>>>>> On Monday, January 11, 2016 at 8:45:19 AM UTC+1, Bruno Bieth wrote:
>>>>>>
>>>>>> I can't tell if I'm doing something wrong in this code:
>>>>>>
>>>>>> implicit val as = ActorSystem()
>>>>>> implicit val mat = ActorMaterializer()
>>>>>>
>>>>>> val future = Source.fromIterator(() => new Iterator[Int] {
>>>>>>   var i = 0
>>>>>>   override def hasNext: Boolean = true
>>>>>>   override def next(): Int = {
>>>>>>     println(s"Waiting $i seconds")
>>>>>>
>>>>>>     scala.concurrent.blocking {
>>>>>>
>>>>>> Thread.sleep(i * 1000)
>>>>>>
>>>>>>     }
>>>>>>     i = i + 1
>>>>>>     i
>>>>>>   }
>>>>>> }).groupedWithin(20, 2.seconds).runForeach(println)
>>>>>>
>>>>>> Await.ready(future, 10.seconds)
>>>>>>
>>>>>>
>>>>>> It seems to me that at least something should be printed. But the
>>>>>> output invariably is:
>>>>>>
>>>>>> Waiting 0 seconds
>>>>>> Waiting 1 seconds
>>>>>> Waiting 2 seconds
>>>>>> Waiting 3 seconds
>>>>>> Waiting 4 seconds
>>>>>> Waiting 5 seconds
>>>>>>
>>>>>> java.util.concurrent.TimeoutException: Futures timed out after [10000
>>>>>> milliseconds]
>>>>>>
>>>>>> I tried to follow the code of GroupedWithin and it seems that the
>>>>>> timer works as expected but then when the AsyncCall gets called nothing
>>>>>> happens (from `GraphStage`):
>>>>>>
>>>>>> interpreter.onAsyncInput(GraphStageLogic.this, event, 
>>>>>> handler.asInstanceOf[Any ⇒ Unit])
>>>>>>
>>>>>>
>>>>>> Bruno
>>>>>>
>>>>>
>>>>> --
>>>>> >>>>>>>>>> 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 akka-user+...@googlegroups.com.
>>>>> To post to this group, send email to akka...@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/group/akka-user.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *Dr. Roland Kuhn*
>>>>> *Akka Tech Lead*
>>>>> Typesafe <http://typesafe.com/> – Reactive apps on the JVM.
>>>>> twitter: @rolandkuhn
>>>>> <http://twitter.com/#!/rolandkuhn>
>>>>>
>>>>>
>>>> --
>>>> >>>>>>>>>> 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 akka-user+...@googlegroups.com.
>>>> To post to this group, send email to akka...@googlegroups.com.
>>>> Visit this group at https://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 akka-user+unsubscr...@googlegroups.com.
>> To post to this group, send email to akka-user@googlegroups.com.
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> *Dr. Roland Kuhn*
> *Akka Tech Lead*
> Typesafe <http://typesafe.com/> – Reactive apps on the JVM.
> twitter: @rolandkuhn
> <http://twitter.com/#!/rolandkuhn>
>
> --
> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to