Notification API Developer User Guide

Notification API has been designed for the developers of the community to integrate notifications with their developed functionality.

Consider a case where, when a client is generated you want to notify some users of the organization that a client was created. Follow the below given steps to add the code just before the return statement of the method which creates a client or at the end of a method if return statement does not exist.

Steps to add Notification in a functionality

  1. Create a notification queue 
    Queue queue = new ActiveMQQueue(nameOfTheQueue);
    Note :- Use the name of the queue to be "NotificationQueue" because this is the name of a queue at which the listener listens for incoming messages.

  2. Create a NotificationData object.
    NotificationData notificationData = new NewNotificationBuilder()

    For E.g :- If we want to send the notification to user1 with id 1 that "A new client with name ABC was created". Consider object id to be 72, a user which creates it to be "mifos" and with "default" as a tenant identifier and id of the office for which the notification is generated to be 1.
    NotificationData notificationData = new NewNotificationBuilder()
    .withNotificationContent( "A new with name ABC client was created")

    To know more about the attributes of notification like what an object in a generated notification means then navigate to this link.

    Name Of ArguementType
    idOfTheUserToBeNotifiedLong || List<Long>(There can be more than one users to be notified)
  3. Broadcast the notification

    • Autowire NotificationEvent class.
    • For E.g
      NotificationEvent notificationEvent;
    • Broadcast the event
      notificationEvent.broadcastNotification(nameOfTheQueue, notificationData);