Run custom java code as early as possible during app startup
I want to call Core.registerLogSubscriber() to send logged error messages to Sentry. Preferably, I want to call it before the first message is logged that is “Initializing runtime...”. The only option I know is an “After startup” microflow, but I think it starts too late. I also tried a javax.servlet.ServletContextListener implementation annotated with @javax.servlet.annotation.WebListener, but the class didn’t load (I put it in the same Eclipse project where my custom actions are). What about custom OSGI components? How hard is it to add one?
We do something similar and have the setup as the first action in our After Startup microflow. I believe this is the earliest place you perform an action like this. It will be interesting to see if anyone else has a better solution.