Pip-Services-Commons-Dotnet
|
Concrete implementation of IEvent interface. It allows to send asynchronous notifications to multiple subscribed listeners. More...
Public Member Functions | |
Event (string name) | |
Creates a new event and assigns its name. More... | |
void | AddListener (IEventListener listener) |
Adds a listener to receive notifications when this event is fired. More... | |
void | RemoveListener (IEventListener listener) |
Removes a listener, so that it no longer receives notifications for this event. More... | |
async Task | NotifyAsync (string correlationId, Parameters args) |
Fires this event and notifies all registered listeners. More... | |
Properties | |
string | Name [get] |
Gets the name of the event. More... | |
List< IEventListener > | Listeners [get] |
Gets all listeners registered in this event. More... | |
Properties inherited from PipServices3.Commons.Commands.IEvent | |
string | Name [get] |
Gets the event name. More... | |
List< IEventListener > | Listeners [get] |
Gets the listeners that receive notifications for this event. More... | |
Concrete implementation of IEvent interface. It allows to send asynchronous notifications to multiple subscribed listeners.
See IEvent, IEventListener
PipServices3.Commons.Commands.Event.Event | ( | string | name | ) |
Creates a new event and assigns its name.
name | The name of the event. |
ArgumentNullException | an Error if the name is null. |
void PipServices3.Commons.Commands.Event.AddListener | ( | IEventListener | listener | ) |
Adds a listener to receive notifications when this event is fired.
listener | Tthe listener reference to add. |
Implements PipServices3.Commons.Commands.IEvent.
async Task PipServices3.Commons.Commands.Event.NotifyAsync | ( | string | correlationId, |
Parameters | args | ||
) |
Fires this event and notifies all registered listeners.
correlationId | Unique correlation/transaction id. |
args | The event arguments/value. |
InvocationException | if the event fails to be raised. |
Implements PipServices3.Commons.Run.INotifiable.
void PipServices3.Commons.Commands.Event.RemoveListener | ( | IEventListener | listener | ) |
Removes a listener, so that it no longer receives notifications for this event.
listener | the listener reference to remove. |
Implements PipServices3.Commons.Commands.IEvent.
|
get |
Gets all listeners registered in this event.
|
get |
Gets the name of the event.