Listen to offline message events
This document explains how to hook up customer logic when a message is stored offline or bounced (i.e. not stored offline and the target entity was not available).
-
Create your own plugin where you will place your custom code.
-
Create a new implementation of the OfflineMessageListener interface.
-
Register the new interface implementation so that it will be alerted of new events. Use OfflineMessageStrategy#addListener(OfflineMessageListener) to register the new listener.
-
When your pluing is unloaded you will need to unregister your listener so that no references to the plugin are kept. Use OfflineMessageStrategy#removeListener(OfflineMessageListener) to unregister the listener.
There is only one instance of OfflineMessageStrategy in the system. Use XMPPServer.getInstance().getOfflineMessageStrategy() to get the unique instance and add or remove your listeners.