Interface NotificationHandler


public interface NotificationHandler
This Java interface must be implemented by your classes that must manage incoming notifications sent by the connected SAP CC system.

Implementation in Your Client Application

You develop an handler depending on your business requirements.

Customizing Sequence

Design and develop the handleNotification(..) method:
  • Implement the identification of a received notification by its unique class ID
  • Implement the business functions in your handler

Example

This notification handler prints information relating to each received notification:

    public void handleNotification(String systemId, InstanceId systemInstanceId, long timestamp, int descUid, String... args) {
       NotificationDescription description = NotifBook.searchNotificationDescription(descUid);
       if (description == null) {
           // Should never occur
           System.out.println("Unknown notification");
           return;
       }
       System.out.println("notification received @"+timestamp);
       System.out.println("    > SID: "+systemId);
       System.out.println("    > Instance ID: "+systemInstanceId);
       System.out.println("    > uid: "+descUid);
       System.out.println("    > name: "+description.getName());
       System.out.println("    > technical name: "+description.getPrettyName());
       System.out.println("    > level: "+description.getSeverityLevel());
       if (description.getAdditionalInfoKeys().length != 0) {
           System.out.println("    >>>> additional info >>>>");
           for (int i = 0; i < description.getAdditionalInfoKeys().length; i++) {
               System.out.println("    > "+description.getAdditionalInfoKeys()[i]+": "+args[i]);
           }
       }
       System.out.println();

       ...

 

Notes on SAP CC Implementation

You release the thread calling this method as soon as possible since it may be the thread responsible for reading the notifications from the network.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handleNotification(String systemName, InstanceId instanceID, long timestamp, int uid, String... args)
    Invoked each time a notification must be managed by the client application.
  • Method Details

    • handleNotification

      void handleNotification(String systemName, InstanceId instanceID, long timestamp, int uid, String... args)
      Invoked each time a notification must be managed by the client application.

      The notification description is available thanks to the NotifBook invoking its searchNotificationDescription(..) method with uid as argument.

      Recommendation

      SAP strongly recommends to release the thread calling this method as soon as possible since it may be the thread responsible for reading the notifications from the network.

      Parameters:
      systemName - The unique SAP Identifier (SID) of the SAP CC system that threw the notification
      instanceID - The identifier of the system instance (e.g. rater#1) that threw the notification
      timestamp - The date when the notification has been thrown
      uid - The unique identifier of the notification class; Use this ID to determine the class and the related description of the received notification.
      args - The arguments of the notification