Why and when to perform this task
java:comp/websphere/ApplicationNotificationService
Components within the same application can fire asynchronous events and register event listeners using this application notification service. Startup beans can be used to register these event listeners at application startup or they can be registered dynamically at run time.
InitialContext ic = new InitialContext(); EventSource appES = (EventSource) ic.lookup("java:comp/websphere/ApplicationNotificationService"); // now, the application can add a listener using the EventSource.addListener method. // MyEventType is an interface. MyEventType myListener = ...; AppES.addListener(myListener); // later another component can fire events as follows InitialContext ic = new InitialContext(); EventSource appES = (EventSource) ic.lookup("java:comp/websphere/ApplicationNotificationService"); // This highlights a constant string on the EventSource interface which // specifies the 'java:comp/websphere/ApplicationNotificationService' string. ic.lookup(appES.APPLICATION_NOTIFICATION_EVENT_SOURCE) // now, the application can add a listener using the EventSource.addListener method. MyEventType proxy = appES.getEventTrigger(MyEventType.class, false); proxy.someEvent(someArguments);
Related tasks
Developing event listeners