Event Listener Module Type

An event listener plugin module is an object which is notified when certain internal Crucible or FishEye events occur.

To include an event listener module add a listener element to your atlassian-plugins.xml file:

    <listener key="example-listener" class="com.atlassian.crucible.example.plugin.spring.ExampleListener"/>

and create a class which implements com.atlassian.event.EventListener. See the FishEye event and Crucible event javadoc for specific event types. See the javadoc for EventListener to understand the general details regarding events.

For example, if we want to listen for all events, and print a message to standard output we would write:

public class ExampleListener implements EventListener {
    public void handleEvent(Event event) {
        System.out.println("Got event: " + event);
    }

    public Class[] getHandledEventClasses() {
        return new Class[0];
    }
}

Event listeners may implement StateAware if they need to be notified when the module is enabled or disabled.

Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport