1 package com.atlassian.event.api;
2
3 /**
4 * Interface to publish events. It allows the decoupling of listeners which handle events and
5 * publishers which dispatch events.
6 *
7 * @see EventListener annotation which can be used to indicate event listener methods
8 * @since 2.0
9 */
10 public interface EventPublisher extends EventListenerRegistrar {
11 /**
12 * Publish an event that will be consumed by all listeners which have registered to receive it.
13 * Implementations must dispatch events to listeners which have a public method annotated with
14 * {@link EventListener} and one argument which is assignable from the event type (i.e. a superclass
15 * or interface implemented by the event object). Implementations may also dispatch events
16 * to legacy {@link com.atlassian.event.EventListener} implementations based on the types returned
17 * from {@link com.atlassian.event.EventListener#getHandledEventClasses()}.
18 *
19 * This method should process all event listeners, despite any errors or exceptions that are generated
20 * as a result of dispatching the event.
21 *
22 * @param event the event to publish
23 * @throws NullPointerException if the event is {@code null}
24 */
25 void publish(Object event);
26 }