Hey Everyone. I'm currently building a module that subscribes to tags. I'm doing this through the TagManager subsribeAsync method. Everything is working great but when I uninstall the module, the subscription is still going. I could probably get around this by doing a unsubscribeAsync during the shutdown hook. Am I thinking about this correctly? Is this the right way to do that. I'm also really needing a solution when the license changes (like when a trial is over) or when a setting is changed. Just looking for general guidance to make sure I'm on the right path. Thanks everyone in advance!
You absolutely need to unsubscribe all you listeners before you let the shutdown hook finish. So, not just calling the async unsubscribe, but doing the .get()
method on the future it gives you.
As for license changes, your hook is notified. You just need to implement the appropriate methods and hang onto the last license state you are given. Have critical points in the rest of your code interrogate the gateway hook for that saved information.
(I usually use a private static field and a public static .isAllowed()
method right in the hook.)
Awesome! Sounds like I was on the right path. Thanks for the info!