It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

ishara93 I'm New Here Sep 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
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

334 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you