observers and actors

12 views
Skip to first unread message

Julien Ammous

unread,
Oct 16, 2014, 4:01:33 AM10/16/14
to concurr...@googlegroups.com
Hi,
I was looking at a distance at this library waiting for it to stabilize and it looks like it is now ready but while trying to wrap my minds around the new constructs I came to a stupid qestion:

How would you use actors with observers ?
My idea was to have abunch of actors notified using an observer but the observe will call an update method on the object given which is a proxy in this case.

Here is my test file: https://gist.github.com/schmurfy/d3ba8cdbc4c1f943cdb2

I ended up using a block passed to add_observer but it feels wrong...
Now that the internals seems to have stabilized (as far as I can tell) it would be nice to have some examples, the examples folders is not that helpful currently.

Petr Chalupa

unread,
Oct 20, 2014, 4:14:24 AM10/20/14
to Julien Ammous, concurr...@googlegroups.com
Hello,

I've read the example and I would the the same using observers. Another way would be to use https://github.com/ruby-concurrency/concurrent-ruby/blob/master/lib/concurrent/actor/utils/broadcast.rb.

I have to apologies about the lacking documentation, I hope I have time to fix it soon. 
In the meanwhile please feel free to bombard me with questions it'll help me with mapping what is missing the most in the documentation.

Petr

--
You received this message because you are subscribed to the Google Groups "Concurrent Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email to concurrent-ru...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Schmurfy

unread,
Oct 20, 2014, 5:08:21 AM10/20/14
to Petr Chalupa, concurr...@googlegroups.com
Thanks for both for your answers (jdantonio replied directly to me saying documentation will be the next focus once he gets back from holidays).

I had a like at the broadcast example but when I copy/paste the example whether on 0.7.0 or master it does not do much except writing:
[EXPERIMENTAL] A full release of `Actor`, is expected in the 0.7.0 release.

There is also something puzzling, for me it looks like the Observable module should define the behavior and this simple Broadcast Actor should use it to define a broadcasting actor but instead they both start from scratch.

I will continue to ask questions if I have but currently I don't even know where I am going to get something out of the ground xD

If you could correct/update my simple test case it would help greatly :)

Petr Chalupa

unread,
Oct 21, 2014, 2:59:55 PM10/21/14
to Schmurfy, concurr...@googlegroups.com
Hi,

I se it as two different concepts. Observers are called directly and synchronously, broadcast actor is asynchronous and is just to be able to easily deliver messages to more actors. It the example you've provided it seemed like a good fit. Is https://gist.github.com/schmurfy/d3ba8cdbc4c1f943cdb2#comment-1322412 helpful?

Petr

Schmurfy

unread,
Oct 22, 2014, 5:18:46 AM10/22/14
to Petr Chalupa, concurr...@googlegroups.com
Thanks, it works :)

Reply all
Reply to author
Forward
0 new messages