Atlassian connect uninstall event spring boot

I am developing jira application using spring boot,
I want to delete my database records on atlassian connect uninstall event spring boot
How would I do it

Hi @DhavalZala

I am not able to help you directly but do these threads help?

Thank You @Taylan but I have tried already it is not working

@DhavalZala were you able to find out how to implement the ‘/uninstall’ hook for the spring boot application?

@DhavalZala @VanshMittal the README touches on this briefly:

Reacting to add-on lifecycle events

Upon successful completion of add-on installation or uninstallation, a Spring application event will be fired: AddonInstalledEvent or AddonUninstalledEvent . These events are fired asynchronously and cannot affect the HTTP response returned to the Atlassian host.

What is not mentioned there, and may not be self-evident, is that for each event to be fired, the corresponding lifecycle hook must be declared in the app descriptor.

2 Likes

@epehrson
I am unable to import the event AddonUninstalledEvent

I am trying this way
import org.springframework.boot.context.event.AddonUninstalledEvent;

But it is resulting into compilation error, any help on how to import this particular event or how to access that event?

@VanshMittal check the API documentation.

1 Like

Thank you so much @epehrson for the help

RE: The easiest approach is to delete when the customer uninstalls the…

Sadly, whether you implement an event listener whatever for uninstall, you will find that this helps with maybe 20% of the customers who actually get round to uninstalling the app. Due to the awful 2 phase nature of app removals in cloud, customers have to (a) unlicense, then (b) uninstall, guess what, most only get to (a).

How to deal with unlicensed customers:
You may decide to go further, to wipe data after a customer has been unlicensed for 30d, seems reasonable. It works. But:

Consequences of cloud app 2phase uninstall:
After some time passes, Atlassian will reboot the customer instance for some reason, this action fires an App install event, being a good vendor, you have absolutely no memory of this customer, so you’ll go ahead and create a new AC_HOST record, for which the customer is unlikely to ever install a license, or even notice. After another 30d cycle of being unlicensed, your app could burn the AC_HOST record again, aaaaand around we go.

We have zombie hosts still doing this after many years. I used to log support requests with Atlassian to get these instance app entries uninstalled, I’ve given up with that after my ever longer lists of hosts simply got ignored.

If you want a solution to the whole thing, Atlassian needs to do something useful like prompt the user to uninstall when they unlicense, something I did suggested YEARS ago, to no avail.