async-events-tutorial /

Filename Size Date modified Message
src
10.1 KB
1.5 KB
3.5 KB
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:

https://developer.atlassian.com/display/DOCS/Introduction+to+the+Atlassian+Plugin+SDK
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.