Forums

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

Is there an automated loop detection for onIssueEvent

Emre Toptancı _OBSS_
Atlassian Partner
February 7, 2018 edited

I want to ask about something that is working to my benefit but I am not sure that I understand why it happens that way.

I am using onIssueEvent method for handling issue events, including "issue updated" event. In my event handler I call IssueManager.updateIssue() for another issue and the update event is intentionally dispatched for the target issue:

@EventListener
public void onIssueEvent(IssueEvent issueEvent){
 log.debug("handling update for " + issueEvent.getIssue().getKey());
/* some event handling code */
issueManager.updateIssue(user,
targetIssue,
EventDispatchOption.ISSUE_UPDATED,
false
);
/* some more event handling code */
log.debug("handled update for " + issueEvent.getIssue().getKey());
}

In an example based on the data on my system:

  1. Issue A is updated by the user
  2. The update event handler for issue A dispatches an update event for issue B
  3. The update event handler for issue B dispatches an update event for issue C
  4. Finally the update event handler for issue C dispatches back an update event for issue A
  5. And so on ... (at least it was expected to be)

Somehow the log output I get is something like below:

handling update for A
handling update for B
handling update for C
handled update for C
handled update for B
handled update for A

First, I was expecting IssueManager.updateIssue() method to fire an event that would be handled AFTER the current event handler finishes but somehow it acts like a method call. My event handler for Issue A resumes after B and C are finished handling their events.

Second, I was expecting to face an infinite loop and was prepared to search for a way to break it but the event handler on issue C does not dispatch an update event back to issue A, even tough it is instructed to do so.

So, all of these are against my expectations. Can someone shed a light on why it is happening this way?

(Jira 7.5.0)

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events