package com.atlassian.bitbucket.mesh.event;

import javax.annotation.Nonnull;

/**
 * Interface to publish events. It allows the decoupling of listeners which handle events and
 * publishers which dispatch events.
 */
public interface EventPublisher {

    /**
     * Publish an event that will be consumed by all listeners which have registered to receive it.
     * Implementations must dispatch events to listeners which have a public method annotated with
     * {@code org.springframework.context.event.EventListener} and one argument which is assignable
     * from the event type (i.e. a superclass or interface implemented by the event object).
     *
     * @param event the event to publish
     */
    void publish(@Nonnull Object event);
}
