Search Results for

    Show / Hide Table of Contents

    Class AssociationRegistry

    Shared state among TestTransport instances. Coordinates the transports and the means of communication between them.

    Inheritance
    object
    AssociationRegistry
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Remote.Transport
    Assembly: Akka.Remote.dll
    Syntax
    public class AssociationRegistry
    Remarks

    NOTE: This is a global shared state between different actor systems. The purpose of this class is to allow dynamically loaded TestTransports to set up a shared AssociationRegistry.Extensions could not be used for this purpose, as the injection of the shared instance must happen during the startup time of the actor system. Association registries are looked up via a string key. Until we find a better way to inject an AssociationRegistry to multiple actor systems it is strongly recommended to use long, randomly generated strings to key the registry to avoid interference between tests.

    Methods

    | Edit this page View Source

    Clear()

    Wipes out all of the AssociationRegistry instances retained by this process.

    Declaration
    public static void Clear()
    | Edit this page View Source

    ClearLog()

    Clears the current contents of the log

    Declaration
    public void ClearLog()
    | Edit this page View Source

    DeregisterAssociation((Address, Address))

    Removes an association.

    Declaration
    public Option<(IHandleEventListener, IHandleEventListener)> DeregisterAssociation((Address, Address) key)
    Parameters
    Type Name Description
    (Address, Address) key

    Ordered pair of addresses representing an association. First element must be the address of the initiator.

    Returns
    Type Description
    Option<(IHandleEventListener, IHandleEventListener)>

    The original entries, or Option.None if the key wasn't found in the table.

    | Edit this page View Source

    ExistsAssociation(Address, Address)

    Tests if an association was registered.

    Declaration
    public bool ExistsAssociation(Address initiatorAddress, Address remoteAddress)
    Parameters
    Type Name Description
    Address initiatorAddress

    The initiator of the association.

    Address remoteAddress

    The other address of the association.

    Returns
    Type Description
    bool

    True if there is an association for the given address.

    | Edit this page View Source

    Get(string)

    Retrieves the specified AssociationRegistry associated with the key.

    Declaration
    public static AssociationRegistry Get(string key)
    Parameters
    Type Name Description
    string key

    The registry key - see the HOCON example for details.

    Returns
    Type Description
    AssociationRegistry

    An existing or new AssociationRegistry instance.

    | Edit this page View Source

    GetRemoteReadHandlerFor(TestAssociationHandle)

    Returns the event handler corresponding to the remote endpoint of the given local handle. In other words it returns the listener that will receive InboundPayload events when Write(ByteString) is called.

    Declaration
    public IHandleEventListener GetRemoteReadHandlerFor(TestAssociationHandle localHandle)
    Parameters
    Type Name Description
    TestAssociationHandle localHandle

    The handle

    Returns
    Type Description
    IHandleEventListener

    The option that contains the listener if it exists.

    | Edit this page View Source

    LogActivity(Activity)

    Logs a transport activity

    Declaration
    public void LogActivity(Activity activity)
    Parameters
    Type Name Description
    Activity activity

    The activity to be logged

    | Edit this page View Source

    LogSnapshot()

    Gets a snapshot of the current transport activity log

    Declaration
    public IList<Activity> LogSnapshot()
    Returns
    Type Description
    IList<Activity>

    A IList of activities ordered left-to-right in chronological order (element[0] is the oldest)

    | Edit this page View Source

    RegisterListenerPair((Address, Address), (IHandleEventListener, IHandleEventListener))

    Registers two event listeners corresponding to the two endpoints of an association.

    Declaration
    public void RegisterListenerPair((Address, Address) key, (IHandleEventListener, IHandleEventListener) listeners)
    Parameters
    Type Name Description
    (Address, Address) key

    Ordered pair of addresses representing an association. First element must be the address of the initiator.

    (IHandleEventListener, IHandleEventListener) listeners

    A pair of listeners that will be responsible for handling the events of the two endpoints of the association. Elements in the Tuple must be in the same order as the addresses in key.

    | Edit this page View Source

    RegisterTransport(TestTransport, Task<IAssociationEventListener>)

    Records a mapping between an address and the corresponding (transport, associationEventListener) pair.

    Declaration
    public void RegisterTransport(TestTransport transport, Task<IAssociationEventListener> associationEventListenerTask)
    Parameters
    Type Name Description
    TestTransport transport

    The transport that is to be registered. The address of this transport will be used as a key.

    Task<IAssociationEventListener> associationEventListenerTask

    The Task that will be completed with the listener that will handle the events for the given transport.

    | Edit this page View Source

    RemoteListenerRelativeTo(TestAssociationHandle, (IHandleEventListener, IHandleEventListener))

    Returns the remote endpoint for a pair of endpoints relative to the owner of the supplied TestAssociationHandle.

    Declaration
    public IHandleEventListener RemoteListenerRelativeTo(TestAssociationHandle handle, (IHandleEventListener, IHandleEventListener) listenerPair)
    Parameters
    Type Name Description
    TestAssociationHandle handle

    The reference handle to determine the remote endpoint relative to

    (IHandleEventListener, IHandleEventListener) listenerPair

    pair of listeners in initiator, receiver order

    Returns
    Type Description
    IHandleEventListener

    TBD

    | Edit this page View Source

    Reset()

    Clears the state of the entire registry. This method is not atomic and does not use a critical section when clearing transports, listeners, and logs.

    Declaration
    public void Reset()
    | Edit this page View Source

    TransportFor(Address)

    Returns the transport bound to the given address.

    Declaration
    public Option<(TestTransport, Task<IAssociationEventListener>)> TransportFor(Address address)
    Parameters
    Type Name Description
    Address address

    The address bound to the transport.

    Returns
    Type Description
    Option<(TestTransport, Task<IAssociationEventListener>)>

    The transport, if it exists.

    | Edit this page View Source

    TransportsReady(params Address[])

    Indicates if all given transports were successfully registered. No associations can be established between transports that are not yet registered.

    Declaration
    public bool TransportsReady(params Address[] addresses)
    Parameters
    Type Name Description
    Address[] addresses

    The listen addresses of transports that participate in the test case.

    Returns
    Type Description
    bool

    True if all transports are successfully registered.

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET