I am interested in the "easy to roll your own", though… I played with it for about 20 or 30 minutes and found the initialization of the composed beast to be a real pain in the ass. The 'receive' method is very difficult to compose initially. I can't find the right order / hook / whatever to get it to build properly - i.e. it's got nothing in it. The only way I could get it to work was to "become" the initial composition after construction (i.e. preStart()).
I wouldn't be surprised at all if I were missing something - I'm no scala god - but might it be a tad more difficult to roll your own these days than it was back in the 1.x days?
> --
> You received this message because you are subscribed to the Google Groups "Akka User List" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/GUUQLTEnOmMJ.
> 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 see what you mean: the receive() method is called from the constructor of the Actor trait, i.e. before the constructor of the subclass has run. I need to think a little about it, but it looks like extracting receive() before someone is allowed to call become() is a necessary evil, which means that using become() is mandatory in these scenarios.
Regards,
Roland
Hiho,
I experienced the same - I tried to have a dynamic receive() which acts on different "subreceives" based on the sender of the message (because I had the necessity to process the same message differently based on the sender of the message).
But I got stuck because of initialization order issues which I could not resolve.
So it was indeed the "become" call which came to the rescue. I think this is a point worth mentioning in the cookbook or docu because it's a terrible wast of time when you get caught by this for the first time.
But all in all akka (2.0 M4) rocks! I enjoy it very much.
Keep up the good work.
Greetings
Bernd
Hiho,
I experienced the same - I tried to have a dynamic receive() which acts on different "subreceives" based on the sender of the message (because I had the necessity to process the same message differently based on the sender of the message).
But I got stuck because of initialization order issues which I could not resolve.
So it was indeed the "become" call which came to the rescue. I think this is a point worth mentioning in the cookbook or docu because it's a terrible wast of time when you get caught by this for the first time.
But all in all akka (2.0 M4) rocks! I enjoy it very much.
Keep up the good work.