Listener and event

gil November 15, 2011

I have a question about developing a custom JIRA listener. So the below is a tutorial on how to create a listener. How do I tie it to a custom event?

https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Writing+event+listeners+with+the+atlassian-event+library

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
shilpa garg February 6, 2014

not able to fire the event.jobin could u please help me.i m using 6.1.7 version.i have created the listener.but dont know hoe to dispatch the event

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 15, 2011

You will have to check for the id of the custom event you created in the onIssueEvent method.

if (eventTypeId.equals(new Long("your_event_id"))) {
// do your stuff
}
your_long_id is the id of th custom event which you can find on the URL if you edit the event or from the database!
gil November 15, 2011

but how do I fire it within the listener plugin?

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 15, 2011

What do you mean? The above code is in the listener plugin. Are you instead looking to fire a custom event from here? If so, use IssueEventDispatcher : http://docs.atlassian.com/jira/latest/com/atlassian/jira/event/issue/IssueEventDispatcher.html

gil November 17, 2011

thank you. I'll try it out.

gil November 18, 2011

Hi Jobin, could you provde some sample code for IssueEventDispatcher? Again, my application is like this:

I have a custom event called SendEmail. I create a custom plugin triger to detect an update condition. When it is met, the plugin will fire this SendEmail event, which is tired to a notification scheme to send out some notificaiton.

Thanks for your help!

gil November 20, 2011

Look like I can do like this:

IssueEventDispatcher.dispatchEvent(eventID, issue, user)

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 20, 2011

yup, thats how you do it.

TAGS
AUG Leaders

Atlassian Community Events