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
| Edit this page 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
| Edit this page 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
| Edit this page View SourceEquals(ActorSelection)
Declaration
protected bool Equals(ActorSelection other)
Parameters
| Type | Name | Description |
|---|---|---|
| ActorSelection | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
| Edit this page View SourceGetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the current object. |
Overrides
| Edit this page 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()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | A string that represents the current object. |
Edit this page