Class EventListener<TContract>
Represents a communication listener for receiving events.
Inheritance
Namespace: Copper.Eventing.Service
Assembly: Copper.Eventing.Service.dll
Syntax
public class EventListener<TContract> : ICommunicationListener where TContract : class
Type Parameters
Name | Description |
---|---|
TContract |
Constructors
View SourceEventListener(IEventReceiver, TContract)
Initializes a new instance of the EventListener<TContract> class.
Declaration
public EventListener(IEventReceiver eventReceiver, TContract serviceImplementation)
Parameters
Type | Name | Description |
---|---|---|
IEventReceiver | eventReceiver | The event receiver. |
TContract | serviceImplementation | The service implementation. |
Methods
View SourceAbort()
This method causes the communication listener to close. Close is a terminal state and this method causes the transition to close ungracefully. Any outstanding operations (including close) should be canceled when this method is called.
Declaration
public void Abort()
CloseAsync(CancellationToken)
This method causes the communication listener to close. Close is a terminal state and this method allows the communication listener to transition to this state in a graceful manner.
Declaration
public Task CloseAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents outstanding operation. |
OpenAsync(CancellationToken)
This method causes the communication listener to be opened. Once the Open completes, the communication listener becomes usable - accepts and sends messages.
Declaration
public Task<string> OpenAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | A System.Threading.Tasks.Task that represents outstanding operation. The result of the Task is the endpoint string. |