How to create Listener for component created event ?

Naveen Kumar D P April 18, 2017

Create Listener for component created plugin

1 answer

0 votes
Acroo April 18, 2017

 Listener

import com.atlassian.event.api.EventListener;
import com.atlassian.event.api.EventPublisher;
import com.atlassian.jira.event.issue.IssueEvent;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class Listener implements InitializingBean, DisposableBean { private final EventPublisher eventPublisher; public Listener(EventPublisher eventPublisher) { this.eventPublisher = eventPublisher; } @Override public void afterPropertiesSet() throws Exception { eventPublisher.register(this); } @Override public void destroy() throws Exception { eventPublisher.unregister(this); } @EventListener public void onIssueEvent(IssueEvent issueEvent) { if (Objects.equals(issueEvent.getEventTypeId(), EventType.ISSUE_CREATED_ID)) { // some code } } }

 

and to atlassian-plugin.xml

<atlassian-plugin>

........ 

<component key="eventListener" class="Listener">
        <description>Class that processes the incoming JIRA issue events.</description>
    </component>

........

</atlassian-plugin>
Naveen Kumar D P April 20, 2017

Hello All,

  How can I have a event for component created in specific project? I only find issue_created, issue_updated etc i.e with the issues.

 How about for components and versions which are project specific.

 

Thanks

Naveen

Suggest an answer

Log in or Sign up to answer