Writing listeners in JIRA

Listeners are very powerful features in JIRA. JIRA has a mechanism for throwing events whenever something happens on an issue, such as creating an issue, updating an issue, progressing on the workflows, and so on. Using listeners, we can capture these events and do special things based on our requirements.

Listeners are implemented using the atlassian-event library. All we have to do is to register the listener class as a component and then use the EventListener annotation to listen on the events.

Getting ready

Create a skeleton plugin using Atlassian Plugin SDK.

How to do it...

Let us write a simple listener that prints a different message to the console based on different issue events. Following are the steps required.

Get JIRA Development Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.