Implement own Module registration notifier
This article describes step-by-step how you implement your own notifier for Module (un)registration in ApiOmat.
You can use this e.g. for notifying a load balancer or mailing lists about native module deployments on yambas instances.
Step-by-step guide
How to write Notifier JAR
-
Create a new Java project
-
Download the Interface IModuleTaskListener from here
-
Add the file to your project (maybe you need to create a package structure)
-
Create your own class which implements IModuleTaskListener
-
Create the directory META-INF/services at the root of your project
-
Add an empty file called com.apiomat.backend.management.IModuleTaskListener to that directory
-
As content of this file, add the fully qualified name of the class which implements the interface IModuleTaskListener, then save and close it.
-
Write your code
-
Create a jar which contains your own classes and the META-INF folder (exclude the file IModuleTaskListener that's in the services directory)
-
Upload this jar to all yambas instances and move it to ${catalina.base}/shared/lib/ (or ${catalina.home}/shared/lib/); If the directory shared/lib doesn't exist, create it
-
Restart tomcat and get notified about module registration/un-registration/re-registration/rollback
As yambas admin you have to create the folder shared/lib in catalina.base or catalina.home and add the jar to all instances that should send notifications
Checkout the sample project to get an idea
Check that in Loadbalancer "Connection Draining" is deactivated