I am not sure a simple listener pattern warrants a full Akka Stream to be
involved. Streams starts to shine when you need backpressure, but if you
don't need any (because events are rare, or there is no way to meaningfully
backpressure) then it might be just too heavyweight and lead to
frustrations. You can just use plain actors for the simple cases. Of course
I don't know what is the context of your problem so streams might be a good
idea, I just warn against unconditional use of them.

-Endre

On Mon, Aug 29, 2016 at 2:51 PM, Mark Hammons <[email protected]>
wrote:

> Hmm, Ok. As for backpressure, with these there should be none because only
> the latest values emitted by the listener are useful. So I guess I would
> set them to have a buffer of size 1 and to drop the oldest elements in the
> buffer for that effect right?
>
>
> On Monday, August 29, 2016 at 8:33:31 AM UTC+2, Tal Pressman wrote:
>>
>> Hi,
>>
>> You could use an ActorPublisher (Source.actorPublisher) and send it
>> messages from the listener. Just remember to handle backpressure - what do
>> you do if the listener is called but the stream isn't ready to accept
>> messages yet?
>>
>> Tal
>>
>> On Monday, August 29, 2016 at 12:26:34 AM UTC+3, Mark Hammons wrote:
>>>
>>> I am writing a scheduler for mesos, and I'd like to construct it
>>> completely from streams instead of the listener functions it currently
>>> uses. How would I create a source and emit items when the listening hooks
>>> are called?
>>>
>>>
>>>
>>> Thanks
>>> --
>>>
>>> Mark Hammons - +33 06 03 69 56 56
>>>
>>> Research Engineer @ BioEmergences <http://bioemergences.iscpif.fr>
>>>
>>> Lab Phone: 01 69 82 34 19
>>>
>> --
> >>>>>>>>>> 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 [email protected].
> To post to this group, send email to [email protected].
> 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 [email protected].
To post to this group, send email to [email protected].
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