Class Event
java.lang.Object
org.pipservices3.commons.commands.Event
- All Implemented Interfaces:
- IEvent,- INotifiable
Concrete implementation of 
IEvent interface.
 It allows to send asynchronous notifications to multiple subscribed listeners.
 ### Example ###
 
 
 Event event = new Event("my_event");
 event.addListener(myListener);
 
 event.notify("123", Parameters.fromTuples(
   "param1", "ABC",
   "param2", 123
 ));
 
 - See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddListener(IEventListener listener) Adds a listener to receive notifications when this event is fired.Gets all listeners registered in this event.getName()Gets the name of the event.voidnotify(String correlationId, Parameters args) Fires this event and notifies all registered listeners.voidremoveListener(IEventListener listener) Removes a listener, so that it no longer receives notifications for this event.
- 
Constructor Details- 
EventCreates a new event and assigns its name.- Parameters:
- name- the name of the event that is to be created.
- Throws:
- NullPointerException- an Error if the name is null.
 
 
- 
- 
Method Details- 
getNameGets the name of the event.
- 
getListenersGets all listeners registered in this event.- Specified by:
- getListenersin interface- IEvent
- Returns:
- a list of listeners.
 
- 
addListenerAdds a listener to receive notifications when this event is fired.- Specified by:
- addListenerin interface- IEvent
- Parameters:
- listener- the listener reference to add.
 
- 
removeListenerRemoves a listener, so that it no longer receives notifications for this event.- Specified by:
- removeListenerin interface- IEvent
- Parameters:
- listener- the listener reference to remove.
 
- 
notifyFires this event and notifies all registered listeners.- Specified by:
- notifyin interface- INotifiable
- Parameters:
- correlationId- optional transaction id to trace calls across components.
- args- the parameters to raise this event with.
- Throws:
- ApplicationException- if the event fails to be raised.
 
 
-