警报通知服务用于向客户机(如 Groovy)通知事件。不过,要使客户机能够接收通知,它必须使用警报通知服务 API 进行订阅。在可靠客户机和非可靠客户机方面,发行版 6 与以前的发行版之间存在明显的差异。对于发行版 5.1.x,客户机是可靠的,这表示在确认事件传送之前无法删除事件。对于发行版 6,客户机可能是不可靠的,这表示无法保证客户机能够接收到每个事件。在发行版 6 中,设置为“可靠”的最后一个客户机将其前面的所有客户机设置为“不可靠”客户机。
警报通知服务 API
/** * request to the event management system to get an events that satisfy the * filter provided. The method will validate the call-back object for the * call-back method name and parameter (see below for more information). * This method allow the caller to register multiple time with diffrent * filtering,target and call-back parameters. * * @param filter - the filter that will be applied to the events prior to * forwarding them to this client. the valid keys for the map * are defined in {@link com.sun.caps.management.api.alerts. * AlertNotificationFilterElementType}. * For the ALERTSEVERITY type the valid value are define in * {@link com.sun.caps.management.api.alerts.AlertLevelType#}. * * @param targetNames - the server instances that is subscription will initially be * filtered on. if targetNames is/are defined it/they have * precedence over the servername element in the filter * mentioned above. * * @param CallbackObject an instance of the client object that contain the * call back method to be called when event received * from the server. * @param methodName the method name to be invoke when event received from the * server. * IMPORTANT: THE METHOD MUST HAVE ONE PARAMETER OF TYPE * {@link com.sun.caps.management.api.alerts.Alert"} ALERT. * * @param requireReliableDelivery - true mean this client request that all events * should be delivered to him reliably otherwise the client * may miss event. * IMPORTANT: THE SYSTEM ALLOW ONLY ONE RELIABLE CLIENT. THE LAST CLIENT * TO SET IT TO TRUE TAKES OVER THE RELIABLE DELIVERY. IT * WILL AFFECT ALL THE SUBSCRIPTIONS DONE BY THE CLIENT IN * THE CURRENT APPLICATION SESSION. * * @param exceptionCallBack an instance of the client object that contain the call * back method to be called when an connectivity exception * is generated by this service. * * @param exceptionMethodName the method name to be invoke when an exception is * generated by this service. * IMPORTANT: THE METHOD MUST HAVE ONE PARAMETER OF TYPE * {@link java.lang.Exception} EXCEPTION. * * NOTE: the exception call be should be the same for all subscriptions * calls otherwise the last the exception call back * defined by the last subscription will be used. * * @return Unique identification string that need to be used in the un-subscribe * operation. * * @throws ManagementRemoteException * 1. if fail to communicate with the event management system * 2. unable to invoke call back method because of invalid parameter. */ public String subscribe(Map filter,String[] targetName,Object CallbackObject,String * methodName, Boolean requireReliableDelivery,Object exceptionCallBack, String exceptionMethodName) throws ManagementRemoteException; /** * request the event management system to stop forwarding events to this client * based on the subscription the caller made using the subscribe method. * once all the caller unsubscribe all the IDs any events that are waiting * to be delivered to this client will be discarded. * * @param - subscriptionIDs A list of IDs return by the subscribe call/s that the * caller wish to unsubscribe from. * * @throws ManagementRemoteException if fail to communicate with the Domain server. */ public void unsubscribe(String[] subscriptionIDs) throws ManagementRemoteException; /** * utility method that returns the parameters the client used to subscribe for * alerts for the given subscription ID. * * @param - subscriptionIDs list return by the subscribe call/s. * * return a map keyed IDs on the provided as a parameter and values as * SubcriptionInformationinstances. * @see com.sun.caps.management.api.alerts.SubcriptionInformation * @throws ManagementRemoteException if fail to communicate with the Domain server. */ public Map getSubscriptionInformation(String[] subscriptionIDs);