Class ActorSelection
This class represents a logical view of a section of an ActorSystem's tree of actors that allows for broadcasting of messages to that section.
Implements
Inherited Members
Namespace: Akka.Actor
Assembly: Akka.dll
Syntax
public class ActorSelection : ICanTell
Constructors
| Improve this Doc View SourceActorSelection()
Initializes a new instance of the ActorSelection class.
Declaration
public ActorSelection()
ActorSelection(IActorRef, SelectionPathElement[])
Initializes a new instance of the ActorSelection class.
Declaration
public ActorSelection(IActorRef anchor, SelectionPathElement[] path)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | anchor | The anchor. |
SelectionPathElement[] | path | The path. |
ActorSelection(IActorRef, IEnumerable<String>)
Initializes a new instance of the ActorSelection class.
Declaration
public ActorSelection(IActorRef anchor, IEnumerable<string> elements)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | anchor | The anchor. |
IEnumerable<String> | elements | The elements. |
ActorSelection(IActorRef, String)
Initializes a new instance of the ActorSelection class.
Declaration
public ActorSelection(IActorRef anchor, string path)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | anchor | The anchor. |
String | path | The path. |
Properties
| Improve this Doc View SourceAnchor
Gets the anchor.
Declaration
public IActorRef Anchor { get; }
Property Value
Type | Description |
---|---|
IActorRef |
Path
Gets the elements.
Declaration
public SelectionPathElement[] Path { get; }
Property Value
Type | Description |
---|---|
SelectionPathElement[] |
PathString
A string representation of all of the elements in the ActorSelection path, starting with "/" and separated with "/".
Declaration
public string PathString { get; }
Property Value
Type | Description |
---|---|
String |
Methods
| Improve this Doc View SourceEquals(ActorSelection)
Declaration
protected bool Equals(ActorSelection other)
Parameters
Type | Name | Description |
---|---|---|
ActorSelection | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceGetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceResolveOne(TimeSpan)
Resolves the IActorRef matching this selection.
The result is returned as a Task that is completed with the IActorRef
if such an actor exists. It is completed with failure ActorNotFoundException if
no such actor exists or the identification didn't complete within the supplied timeout
.
Under the hood it talks to the actor to verify its existence and acquire its IActorRef
Declaration
public Task<IActorRef> ResolveOne(TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | The amount of time to wait while resolving the selection before terminating the operation and generating an error. |
Returns
Type | Description |
---|---|
Task<IActorRef> | A Task that will be completed with the IActorRef, if the actor was found. Otherwise it will be failed with an ActorNotFoundException. |
Exceptions
Type | Condition |
---|---|
ActorNotFoundException | This exception is thrown if no such actor exists or the identification didn't complete within the supplied |
ResolveOne(TimeSpan, CancellationToken)
Resolves the IActorRef matching this selection.
The result is returned as a Task that is completed with the IActorRef
if such an actor exists. It is completed with failure ActorNotFoundException if
no such actor exists or the identification didn't complete within the supplied timeout
.
Under the hood it talks to the actor to verify its existence and acquire its IActorRef
Declaration
public Task<IActorRef> ResolveOne(TimeSpan timeout, CancellationToken ct)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | The amount of time to wait while resolving the selection before terminating the operation and generating an error. |
CancellationToken | ct | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Task<IActorRef> | A Task that will be completed with the IActorRef, if the actor was found. Otherwise it will be failed with an ActorNotFoundException. |
Exceptions
Type | Condition |
---|---|
ActorNotFoundException | This exception is thrown if no such actor exists or the identification didn't complete within the supplied |
Tell(Object, IActorRef)
Sends a message to this ActorSelection.
Declaration
public void Tell(object message, IActorRef sender = null)
Parameters
Type | Name | Description |
---|---|---|
Object | message | The message to send |
IActorRef | sender | The actor that sent the message |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |