Listen to offline message events

来源:互联网 发布:淘宝系统确认收货时间 编辑:程序博客网 时间:2024/05/17 06:09
Currently Being Moderated

Listen to offline message events

VERSION 1 
Created on: 04-Sep-2007 10:46 by Gaston Dombiak - Last Modified:  04-Sep-2007 10:47 byGaston Dombiak

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

  1. Create your own plugin where you will place your custom code.

  2. Create a new implementation of the OfflineMessageListener interface.

  3. Register the new interface implementation so that it will be alerted of new events. Use OfflineMessageStrategy#addListener(OfflineMessageListener) to register the new listener.

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

0 0