. . .

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

  1. Create a new Java project

  2. Download the Interface IModuleTaskListener from here

  3. Add the file to your project (maybe you need to create a package structure)

  4. Create your own class which implements IModuleTaskListener

  5. Create the directory META-INF/services at the root of your project

  6. Add an empty file called com.apiomat.backend.management.IModuleTaskListener to that directory

  7. As content of this file, add the fully qualified name of the class which implements the interface IModuleTaskListener, then save and close it.

  8. Write your code

  9. Create a jar which contains your own classes and the META-INF folder (exclude the file IModuleTaskListener that's in the services directory)

  10. 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

  11. 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