The server startup observer is an extension point that can be used to execute any custom code during server startup. This allows a developer to perform any work before and/or after server startup (i.e. starting all the transports), as required. The ServerStartupObserver interface needs to be implemented in order to use this extension and it includes two methods to be overridden. The completingServerStartup() method could contain the implementation of any task that needs to be performed before starting all the transports. The completedServerStartup() method could contain the implementation of any task that needs to be performed after all the transports are completely started.
A sample implementation of the org.wso2.carbon.core.ServerStartupObserver interface is as follows:
The following Maven dependency will be needed for the above implementation:
After implementing the ServerStartupObserver interface, the implementation class needs to be registered as an OSGI service for the server to recognize it. Following is a sample bundle activator inside which the service is registered.
Your custom ServerStartupObserver should be packaged in an OSGi bundle and added to the