Autoreceive messages not triggered when using traits that override actor receive method?

51 views
Skip to first unread message

Magnus Andersson

unread,
Dec 30, 2013, 8:48:03 PM12/30/13
to akka...@googlegroups.com
Hi 

I'm trying to setup publish-subscribe type of relationship between two types of actors. To do that I send in an actorSelection into the subscriber that in turn sends an Identify message to the publisher to get the actorRef. So that I can init death watch and subscribe to events.

The issue I run into is that I have two traits for these types of actors, but when I use those the Identify causes a match error. I had a look in the Akka source and in the documentation. To me it seems as if I should never have to worry about handling AutoReceiveMessages in the first place?

I get the following log line:

mimer-idp [DEBUG] [12/31/2013 01:11:03.778] [MimerSystem-akka.actor.default-dispatcher-16] [akka://MimerSystem/user/session_repo/publisher] unhandled message from Actor[akka://MimerSystem/user/session_client/subscriber#1714660639]: Identify

I included some pseudo code below to describe the publisher where this occurs. I'm suspecting that it has to do with my trait and inheritance/stacking. Tried a bunch of different variations but no luck so far.

I'm using akka 2.3-M1.

Happy new year! :)
/Magnus

trait Publisher {
 self: Actor with ActorLogging =>

 def events: Actor.Receive

override def receive = {
 ... control messages ...
 case other => events( other ) // delegates to events in implementing class
 }
}

class MyPublisher extends Actor with ActorLogging with Publisher {
 def events: Actor.Receive = {
   case mpsm:MyPublisherSpecificMessage => ...
   case other => unhandled( other )
 }
}

Patrik Nordwall

unread,
Dec 31, 2013, 9:31:47 AM12/31/13
to akka...@googlegroups.com
Are you sending Identify companion object?

/Patrik

> 31 dec 2013 kl. 02:48 skrev Magnus Andersson <mag...@magnusart.com>:
>
> Identify

Akka Team

unread,
Jan 1, 2014, 8:31:47 AM1/1/14
to akka...@googlegroups.com
On Tue, Dec 31, 2013 at 3:31 PM, Patrik Nordwall <patrik....@gmail.com> wrote:
Are you sending Identify companion object?

Yes, very likely, otherwise the log would contain Identify(someid) instead of simply Identify.

-Endre
 

/Patrik

> 31 dec 2013 kl. 02:48 skrev Magnus Andersson <mag...@magnusart.com>:
>
> Identify

--
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: http://akka.io/faq/
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.



--
Akka Team
Typesafe - The software stack for applications that scale
Blog: letitcrash.com
Twitter: @akkateam

Magnus Andersson

unread,
Jan 2, 2014, 6:55:07 AM1/2/14
to akka...@googlegroups.com
Hi

Yes this was indeed the problem, I figured it out but my message was in quarantine before being posted so I couldn't reply. 

The remoting documentation only mentions the Identify message without any example code. There might be some docu I have missed, otherwise an example would be nice.

Thanks for the help
/Magnus

Patrik Nordwall

unread,
Jan 2, 2014, 11:09:46 AM1/2/14
to akka...@googlegroups.com
Hi Magnus,

It would be great if the compiler could  find this mistake, but I am afraid that is not possible.

Magnus Andersson

unread,
Jan 3, 2014, 4:41:59 AM1/3/14
to akka...@googlegroups.com
Hi

Ah, I missed that documentation example. I did remember seeing an example before though.

I did a search for "akka actorSelection Identify" and I got the Akka Remoting page showing up at the top. :)

/Magnus


2014/1/2 Patrik Nordwall <patrik....@gmail.com>
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/U-qskD0p44g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.



--
Magnus Andersson
Infogad bild 1
ma.png
Reply all
Reply to author
Forward
0 new messages