Class AssociationRegistry
Shared state among TestTransport instances. Coordinates the transports and the means of communication between them.
Inherited Members
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
| Improve this Doc View SourceClear()
Wipes out all of the AssociationRegistry instances retained by this process.
Declaration
public static void Clear()
ClearLog()
Clears the current contents of the log
Declaration
public void ClearLog()
DeregisterAssociation((Address, Address))
Removes an association.
Declaration
public Option<(IHandleEventListener, IHandleEventListener)> DeregisterAssociation((Address, Address) key)
Parameters
Type | Name | Description |
---|---|---|
System.ValueTuple<Address, Address> | key | Ordered pair of addresses representing an association. First element must be the address of the initiator. |
Returns
Type | Description |
---|---|
Option<System.ValueTuple<IHandleEventListener, IHandleEventListener>> | The original entries, or Option.None if the key wasn't found in the table. |
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 |
---|---|
Boolean | True if there is an association for the given address. |
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. |
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. |
LogActivity(Activity)
Logs a transport activity
Declaration
public void LogActivity(Activity activity)
Parameters
Type | Name | Description |
---|---|---|
Activity | activity | The activity to be logged |
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) |
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 |
---|---|---|
System.ValueTuple<Address, Address> | key | Ordered pair of addresses representing an association. First element must be the address of the initiator. |
System.ValueTuple<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 |
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. |
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 |
System.ValueTuple<IHandleEventListener, IHandleEventListener> | listenerPair | pair of listeners in initiator, receiver order |
Returns
Type | Description |
---|---|
IHandleEventListener | TBD |
Reset()
Clears the state of the entire registry.
Declaration
public void Reset()
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<System.ValueTuple<TestTransport, Task<IAssociationEventListener>>> | The transport, if it exists. |
TransportsReady(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 |
---|---|
Boolean | True if all transports are successfully registered. |