ActorGroup<M, A> class

An ActorGroup groups a number of Actors using the same type of Handler to handle messages.

Notice that each Actor will have its own instance of the Handler, and because of that the Handlers cannot share any state.

When a message is sent to an ActorGroup it may be handled by any of the Actors in the group, or by many depending on the chosen GroupStrategy.

Each Actor runs, as usual, in its own Isolate.

Mixed in types

Constructors

ActorGroup(Handler<M, A> handler, {int size = 6, GroupStrategy<M, A>? strategy})
Creates an ActorGroup with the given size that handles messages using the given Handler.
ActorGroup.create(Handler<M, A> createHandler(), {int size = 6, GroupStrategy<M, A>? strategy})
Creates an ActorGroup with the given size that handles messages using the given Handler.
ActorGroup.of(HandlerFunction<M, A> handlerFunction, {int size = 6, GroupStrategy<M, A>? strategy})
Creates an ActorGroup with the given size, based on a handler function.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size int
final

Methods

close() FutureOr<void>
Close this Messenger.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(M message) FutureOr<A>
Send a message and get a Future to receive the answer at some later point in time, asynchronously.
override
sendToAll(M message) Stream<A>
Send a message to all members of this group.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited