Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion sending messages to an actor inside a future
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
John Stanford  
View profile  
 More options Mar 20 2012, 2:31 pm
From: John Stanford <jxstanf...@gmail.com>
Date: Tue, 20 Mar 2012 11:31:30 -0700
Local: Tues, Mar 20 2012 2:31 pm
Subject: Re: [akka-user] sending messages to an actor inside a future
Hi Roland and Derek,

Thanks for the ideas.  I did simplify the case quite a bit for the example, and do need to replace the otherActor if it is recreated because it's parent restarted.  This is probably a good case for an FSM and as Viktor was kind enough to point out in another conversation, Stash.  Here we go!

Thanks,
John

On Mar 20, 2012, at 10:20 AM, Roland Kuhn wrote:

> Hi John,

> On Mar 20, 2012, at 17:19 , John Stanford wrote:

>> Hi,

>> Just want to make sure I understand this properly.  Let's say I have this actor:

>> class MyActor extends Actor {

>> val otherActor = context.parent ? MyOtherActorRequest mapTo manifest[ActorRef]

>> def receive = {

>>   case m: Message => otherActor map (_ forward m)

>>   case _              => ()
>> }

>> And let's say there are two messages in MyActor's mailbox.  Will the otherActor future need to be completed before the second message it taken from the mailbox for processing?  Is there a more appropriate way to deal with this other actor to avoid the map operation on every incoming message?  Clearly I could Await it, but that would violate the goal of non-blocking.  

> As you are getting that ActorRef from the parent, why not simply pass it in as constructor argument? If it is a cyclic dependency thing, I’d model this actor as a state machine which starts out “queueing” and will turn into “forwarding” upon reception of that ActorRef (thereby draining the queue). This is the only way to retain the order of messages; if that is not needed, your solution should work just fine (although I would use foreach instead of map).

> Regards,

> Roland Kuhn
> Typesafe – The software stack for applications that scale.
> twitter: @rolandkuhn

> --
> 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-user@googlegroups.com.
> To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.