Package org.pipservices4.rpc.commands
Interface IEventListener
public interface IEventListener
An interface for listener objects that receive notifications on fired events.
### Example ###
public class MyListener implements IEventListener {
private void onEvent(IContext context, IEvent event,Parameters args) {
System.out.println("Fired event " + event.getName());
}
}
Event event = new Event("myevent");
event.addListener(new MyListener());
event.notify("123", Parameters.fromTuples("param1", "ABC"));
// Console output: Fired event myevent
- See Also:
-
Method Summary
-
Method Details
-
onEvent
void onEvent(org.pipservices4.components.context.IContext context, IEvent event, org.pipservices4.components.exec.Parameters args) A method called when events this listener is subscrubed to are fired.- Parameters:
context- (optional) a context to trace execution through call chain.event- a fired eventargs- event arguments.
-