General API design and validation for java notification system

I am trying to create a universal notification service to send various notifications (Email, SMS or Mobile Push) to clients every time an event occurs. This service, in turn, will call a publisher / subscriber-based system, somewhat similar to this: https://sites.google.com/site/jeffhartkopf/notifier . Whenever an event occurs, it is published in SQS, from where the subscriber reads it and sends a notification.

Publisher API:

  • The class of the sender of the notification must have:

    sendNotification (object payload, Map attributeMap)

Here the payload contains parameters that are variables in the text of the email / SMS / push notification template. For example: if the email address has "Hello $ name", the payload object will have a name as a field and a value set as the name of the client to whom you want to send a notification:

@EventType("name"= "Recommendations")

class PayloadObject {
   @Getter @Setter
   String name;
}

Here, the type of event is a custom annotation to find out the type of event for which a notification should be sent, which clients should use when sending their useful objects.

  1. : , , JSON XML-, . , Object JSON XML- . , , Json xml. .

, , , , . , , , . (Velocity XSLT format) , . , , , ? API, , API.

+4

Source: https://habr.com/ru/post/1682445/


All Articles