Routers
Routers help send the same type of message to a set of actors to be processed in parallel depending upon the type of the router used. Routers should be used with caution because they can hinder performance. When the router receives a message to broadcast, every routee is checked whether alive or not. When a routee is not alive the router removes it from its set of routees. When the last routee stops the router itself stops.
GoAkt comes shipped with the following routing strategies:
Fan-Out
: This strategy broadcasts the given message to all its available routees in parallel.Random
: This strategy randomly picks a routee in its set of routees and send the message to it.Round-Robin
: This strategy sends messages to its routee in a round-robin way. For n messages sent through the router, each actor is forwarded one message.
A router a just like any other actor that can be spawned. To spawn router just call the ActorSystem SpawnRouter
method. Router as well as their routees are not passivated.
Last updated