two days ago I've prototyped some simple web presence solution using
Akka's actors and that gave me to the thoughts, I want to discuss
about Akka. But first, let me explain how my presence actors might
work in... Erlang.
Consider Erlang function, which I will spawn in separate process each
time user goes online (one process per user):
presence_tracker() ->
receive i_am_here -> presence_tracker() % just reset timeout on receive
after 30000 -> stop % process exit and so user goes offline after 30
seconds of inactivity.
At another end, on client machine, some js code sends server Ajax
request, which will trigger 'i_am_here' message to be send to
corresponding process and that's how it works.
Now, using Akka, I can't do the same, simply because Akka has only
timeout for initial message receive by actor. Of course, I've done it
by using separate ScheduledFuture, which I handle explicitly in
actor's receive code. While it's also appropriate solution, I think,
Erlang version feels more natural and I've implement the same thing
for Akka at http://github.com/andreypopp/akka along with specs. But, I
still think this code is just proof of concept.
By introducing idleTimeout code below:
val presennceActor = actorOf(new Actor {
self.idleTimeout = Some(30000L)
protected def receive = {
case PresenceContinues =>
() // reset timeout
case ReceiveTimeout =>
handleUserOffline // user goes offline
}
}).start
will work the same as Erlang version.
The other use cases of this feature — well, any logic, that require
handling of idle state.
Also, receiveTimeout name for variable that just means *initial*
receive timeout seems confusing to me — why not introduce
initialReceiveTimeout for that purpose and mark receiveTimeout as
deprecated.
--
Andrey Popp
phone: +7 911 740 24 91
e-mail: 8ma...@gmail.com
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
I, personally, don't see any reason to have both idle and initial
timeouts, but if you care about backward compatibility you should keep
the last one, although 1.0 is a good reason to break bwc. :-)
About marking ReceiveTimeout object with the reason it was received — I'm +1.
On Mon, Sep 27, 2010 at 11:57 AM, Irmo Manie <irmo....@gmail.com> wrote:
> Hi Andrey,
> Thanks for notifying.
> If we make it an idleTimeout as you suggest, would there then still be a
> need for an initial timeout?
> We could also flag the ReceiveTimeout object itself marking it initial or
> not.
> I've created a ticket for this so we'll pick it up for the next milestone.
> http://www.assembla.com/spaces/akka/tickets/446-make-receivetimeout-work-as-in-erlang
--
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
it's all ok, looking forward 1.0 release. Thanks!
"Viktor Klang" <viktor...@gmail.com> wrote:
>> akka-user+...@googlegroups.com<akka-user%2Bunsu...@googlegroups.com>
Open a ticket, I'll fix it tomorrow.
Thanks!
Cheers,
Viktor Klang
Code Connoisseur
www.akkasource.com
> To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
"Garrick Evans" <buk...@gmail.com> wrote:
>To unsubscribe from this group, send email to akka-user+...@googlegroups.com.