how to publish events that will trigger same listener in two Jira plugin

ishara93 September 11, 2019

1. i have created two jira plugin. 

ex: plugin-one, plugin-two

2. created a Event which extend Jira AbstractEvent class in both plugins

ex : MyVeryOwnEvent extends AbstractEvent

3. created two listeners in two plugin which listen for MyVeryOwnEvent and registered with publisher

ex : 

@EventListener

    public void receiveMyEvent(MyVeryOwnEvent event){

       

       System.err.println("Got from plugin one "+event.getName());

    }

@Override

    public void afterPropertiesSet() throws Exception {

        // register ourselves with the EventPublisher

    System.err.println("register from plugin one ");

        eventPublisher.register(this);

    }

4. created servlet in plugin one and inside that that will create MyVeryOwnEvent and publish it.

@JiraImport

    private EventPublisher eventPublisher;

@Override

    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {

        String name = req.getParameter("name");

        

        MyVeryOwnEvent evt = new MyVeryOwnEvent(name);

        

        this.eventPublisher.publish( evt);

        

    }

 

Problem

when i called the servlet only plugin one listener is getting triggered. i want to trigger both listeners in plugin one and two. could you please help me to resolve this. is there any way to publish event globally ?  thanks

 

 

0 answers

Suggest an answer

Log in or Sign up to answer