I am updating an issue (Issue B) from the update event handler of another issue (Issue A). I am also going to be handling the resulting update event of Issue B in another event handler.
Below is the code to do the update on Issue A:
issueManager.updateIssue(user, targetIssue, EventDispatchOption.ISSUE_UPDATED, false);
How can I add params to the resulting event so I can get those param values from IssueEvent object while handling the update event on Issue B.
I do not think you can add something to an event. Why you can not do everything you need in the listener for Issue A?
The question I asked explains the requirement in an oversimplified fashion. To give a little more detail I can say that Issue A will update not only Issue B but potentially update a number of issues and each issue might respond with the update of a number of other issues as well. The event mechanism is the perfect fit for propogating the updates.
And also, firing an event ensures that any other plugin in the system listening to updates on issues respond to the update too.
The IssueEvent object (which is a parameter we get in an event handler) has a "params" map<String, Object> attached to it. The map feels like it is intended to carry arbitrary data with the event so I am searching for a way to insert data into that params map.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe it could work like this
Issue updatedIssue = issueManager.updateIssue(user, issue, UpdateIssueRequest.builder()
.eventDispatchOption(EventDispatchOption.ISSUE_UPDATED)
.sendMail(false)
.issueProperties(new HashMap<>())
.build());
But I did not try it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With a little bir of tweaking I got it to work. I can successfully dispatch an event and catch it in the other end.
HashMap<String, JsonNode> params = new HashMap<>();
params.put("myKey", new TextNode("myValue"));
Issue updatedIssue = issueManager.updateIssue(updater, targetIssue, UpdateIssueRequest.builder()
.eventDispatchOption(EventDispatchOption.ISSUE_UPDATED)
.sendMail(false)
.issueProperties(params)
.build());
Unfortunately params do not contain the values I provide. It just looks like a regular IssueEvent object.
I guess I will need to find a way to do manual recursion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.