async-events-tutorial /

Filename Size Date modified Message
10.3 KB
Better log messages and Spring lifecycle management
1.5 KB
more explanation
3.6 KB
Better log messages and Spring lifecycle management
A tutorial on Asynchronous Events in Atlassian Plugins.

It demonstrates how you can use both Synchronous and Asynchronous events in a plugin.

For example imagine you want to perform a really long operation (> 100ms)
when an issue goes into a certain state.

If you do this during the standard synchronous issue event then you will
block the HTTP thread until you code finishes.

This code demonstrates how you can re-raise an asynchronous event
and hence allow the main HTTP thread to complete as fast as possible.

You long processing can then take place off in another thread of execution.

BEWARE : Multi-threaded applications are kinda tricky.  A bunch of
ThreadLocal based services such as user AuthenticationContext services are not
available or correct on non HTTP threads of execution.

You must be aware of the services you use on this non HTTP thread of execution so you
don't get any surprises or make assumptions about what is available on that thread.

Here are the SDK commands you'll use immediately:

* atlas-run   -- installs this plugin into the product and starts it on localhost
* atlas-debug -- same as atlas-run, but allows a debugger to attach at port 5005
* atlas-cli   -- after atlas-run or atlas-debug, opens a Maven command line window:
                 - 'pi' reinstalls the plugin into the running product instance
* atlas-help  -- prints description for all commands in the SDK

Full documentation is always available at: