Entered messages in akka

The Akka framework recommends using a typed actor only to interact with external code. However, the standard actors from Akka are untyped. Is there a better way to create a type of safe player? Are there any other frameworks for actors or the type of safe wrappers around akka?

+7
source share
4 answers

If you really want actors with static typing, then you could go ahead and use typed actors in all of your code. This is very discouraging for several reasons.

1.) You run the risk of turning your system into a bunch of RPCs. The method of receiving an actor makes it obvious that the whole thing is the transmission of messages, and even more so if you simply call methods on a typed actor.

2.) The actor simply has no type. While it works, the messages that the actor can process may vary depending on the state in which it is located, how this can happen with these messages. This is a great way to model multiple protocols, and Akka actors have first-class support for it using FSM.

So, if you really want to do this, you can freely use typed actors around the world and it will work, but you should really think about the problem that you are trying to solve before you do it.

+5
source

To check compilation time, see the SynapseGrid framework. It defines a SystemBuilder that creates a DataFlow topology. When building, it is guaranteed that the types being checked are checked. Then the resulting system is converted to a RuntimeSystem with nested and properly connected participants.

+1
source

Why is this problem for you? akka.actor.Actor has a receiving method of type PartialFunction , which will be called only for messages that it can handle. Why do you need compile time checks? But to answer your question: one way - for an external api - is to create a wrapper around your ActorRef , which will then send messages to the actor.

0
source

Everything is going pretty fast, I was thinking about providing an update 1. Typed members are deprecated 2. Instead, a new Akka Typed concept is revealed in momemnt

As I understand it, this should be the final decision for a typed system of actors. But since this is at least the third attempt and planned early for Akka 2.4, this requirement remains to be proved.

I personally hope that both systems will be available: existing for more dynamic use cases, new for more reliable

0
source

All Articles