Skip to end of metadata
Go to start of metadata

This is a brief tutorial which teaches you how to write a trivial event listener plugin.The FishEye Twitter Integration Plugin Tutorial contains an event listener plugin module as part of a more complex plugin.

Plugin Source

We encourage you to work through this tutorial. If you want to skip ahead or check your work when you are done, you can find the plugin source code on Atlassian Bitbucket. Bitbucket serves a public Git repository containing the tutorial's code. To clone the repository, issue the following command:

$ git clone https://atlassian_tutorial@bitbucket.org/atlassian_tutorial/fecru-review-creator.git

Alternatively, you can download the source using the Downloads page here: https://bitbucket.org/atlassian_tutorial/fecru-review-creator

Work through the Tutorial

An Event Listener must implement com.atlassian.event.EventListener.

Your implementation is added to atlassian-plugin.xml:

Your implementation's getHandledEventClasses method must return an array of the event classes you wish to be notified of, in our example, comment creation and update events. (here are other event types)

When a commit occurs our handleEvent method will be called:

1 Comment

  1. Using 2.1.4 I see that the EventListener interface mentioned above is deprecated and linked to an EventListener annotation.  This document should be updated with the new use method.  At the very least, if this is still the intended usage you should mention the deprecation.  Otherwise, developers will see the deprecation and be troubles (and rightly so).