Data Center Event Listener - How to make sure an event is processed only once?

Hello,

I have a custom event listener plugin and I need to make it compatible with Jira Data-Center (multi nodes).

I have read the datacenter plugin developpment guidelines, and as far as I understood these, my plugin is almost ready.

I just need to know if I have to bother about multiple event handling. Here’s the context:

The plugin listens to issue events, such as Issue_updated. When such an event is fired by Jira, the plugin catches it and processes it. The basics. My concern is: if an issue is updated, is the corresponding event fired on every nodes at the same time, or is it only fired on the node where the actual update was performed? Do I need to bother about my plugin processing the same event for each node or will it behave exactly like on Server, with one node firing the event and the other nodes just displaying the change which triggered the fired event without emiting the same event?

I couldn’t find a definitive answer in data center documentation.

Thanks in advance for your answers!

I might be completely wrong here, but as far as I always understood the DC cluster architecture, there is one “main” node on which the events are processed. All the other nodes are mostly for HA and load balancing of requests.

Does this mean my plugin should be deployed only on this “main” node? Because if I have for example five nodes, with a copy of my plugin on each of them, and a listened event is fired, then each copy will capture and process the same event, causing 5 actions instead of one. How do I avoid such case?

The clustering agent of Data Center will take care of this. From the 5 nodes, the “main” node is automatically elected. If a node goes offline, another node will be elected automatically. There is no manual operation for app vendors. You do not need to deploy the app to a specific node. You can just go to the load balanced UPM of the cluster, install your app, and Jira will take care of the rest. You can safely assume that your app will only receive a single event.

However, and this is also true for Server and single node deployments: event handling in Jira is historically buggy. It is always a good practice to make sure your event handling is idempotent, and that you can also deal with the possibility that an event never gets fired.

2 Likes

Thanks a lot for these precisions!

1 Like