I've created a listener and throw an event. The listener displays a notification. This works fine until I dispatch the event from within the new thread.
Listener:
def flag = [
type: "info", //Other possible options are "info", "success", "error"
body: "${event["params"]["issue"]}",
close: "manual",
title: "Epic Cloning in progress"
]
com.onresolve.scriptrunner.runner.util.UserMessageUtil.flag(flag)
UserMessageUtil is a wrapper for Atlassian UI (AUI) - Flag
Script to throw event:
This works:
IssueEventManager issueEventM = ComponentAccessor.getIssueEventManager()
IssueEventBundleFactory issueEventFactory = (IssueEventBundleFactory) ComponentAccessor.getComponent(IssueEventBundleFactory.class)
IssueEventBundle eventBundle = issueEventFactory.wrapInBundle(new IssueEvent(epic, ["issue": epic], user, 10001, false))
issueEventM.dispatchEvent(eventBundle)
This doesn't:
Thread.start {
JiraThreadLocalUtils.preCall();
IssueEventManager issueEventM = ComponentAccessor.getIssueEventManager()
IssueEventBundleFactory issueEventFactory = (IssueEventBundleFactory) ComponentAccessor.getComponent(IssueEventBundleFactory.class)
IssueEventBundle eventBundle = issueEventFactory.wrapInBundle(new IssueEvent(epic, ["issue": epic], user, 10001, false))
issueEventM.dispatchEvent(eventBundle)
JiraThreadLocalUtils.postCall()
}
How can I raise the event from within the thread?
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.