Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Listener don't work after restart jira

Manuel Chanivet Roca January 21, 2019

I have a custom listener that works fine, but when I restart Jira, this listener does not work until I reinstall my custom addon.

 

This is the Listener:

public class CodProyectoListener implements InitializingBean, DisposableBean {
private static final Logger log = LoggerFactory.getLogger(CodProyectoListener.class);

private EventPublisher eventPublisher;
private ApplicationProperties applicationProperties;
private CodProyectoUtils codProyectoUtils;

public CodProyectoListener(ApplicationProperties applicationProperties, EventPublisher eventPublisher, CodProyectoUtils codProyectoUtils) {
this.applicationProperties = applicationProperties;
this.eventPublisher = eventPublisher;
this.codProyectoUtils = codProyectoUtils;
}

@Override
public void destroy() throws Exception {
eventPublisher.unregister(this);

}

@Override
public void afterPropertiesSet() throws Exception {
eventPublisher.register(this);
}
.
.
.
}

 

And this is the atlassian-plugin.xml:

<component-import key="eventPublisher" interface="com.atlassian.event.api.EventPublisher"/>
<component key="eventListener" class="es.mutua.jira.addons.listener.CodProyectoListener">
<description>Recupera informacion sobre el CF Código Proyecto.</description>
</component>

 

Can someone help me?

1 answer

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.
January 21, 2019

It is possible that the EventPublisher is not injected properly due to Atlassian Spring Scanner version. You might want to use the latest method of using annotations.

Check https://developer.atlassian.com/server/jira/platform/writing-jira-event-listeners-with-the-atlassian-event-library/ for sample code.

Also see https://bitbucket.org/atlassian/atlassian-spring-scanner/overview

Suggest an answer

Log in or Sign up to answer