Service - Notification Manager: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
Line 22: Line 22:
* Simplifies management of similar notifications
* Simplifies management of similar notifications
* Allows for consolidation of notifications at notification group level
* Allows for consolidation of notifications at notification group level
* no sort key


=== Fields ===
=== Fields ===
Line 28: Line 27:
; notificationGroupId
; notificationGroupId
: (partition key)
: (partition key)
: comes from: {receiverTag}_{grouping id given be receiver service}_{uuid}
: comes from: {receiverTag}_{hash of groupingId given be receiver service}
: eg receiverTag: userContactMgr
: eg receiverTag: userContactMgr
: eg grouping id: userId or userId+methodTag hash
: eg groupingId: userId or {userId}_{methodTag} hash
: uuid is added to the end when creating the notification group to uniquely identify this group, could come from receiver service, or generate randomly
: uuid is added to the end when creating the notification group to uniquely identify this group, could come from receiver service, or generate randomly
; uniqueId
: (sort key)
: given by the receiver service, expected to be unique per notification group
: eg a UUID generated by [[Service - User Contact Manager]]
; notificationGroupName
; notificationGroupName
: string name set by reciever service, optional
: string name set by reciever service, optional

Revision as of 11:44, 28 November 2020

Overview

Consolidates and sends notifications to any number of receiver services. Will be used for user notifications but can have other types of receiver services added. Activities are received from Activity Switchboard service.

Notification groups set whether activities are considated (eg per day/per month/per x number of activities), if considated activities are stored here until sending is triggered, according to the considation rules. If not consolidated they are sent on immediately.

Repository

https://bitbucket.org/stb_working/notification-manager/src/master/

DynamoDB tables

Standard Config Table Per Service

Configuration tags

  • ...

NotificationGroups

  • Groups many notificatons together
  • Simplifies management of similar notifications
  • Allows for consolidation of notifications at notification group level

Fields

notificationGroupId
(partition key)
comes from: {receiverTag}_{hash of groupingId given be receiver service}
eg receiverTag: userContactMgr
eg groupingId: userId or {userId}_{methodTag} hash
uuid is added to the end when creating the notification group to uniquely identify this group, could come from receiver service, or generate randomly
uniqueId
(sort key)
given by the receiver service, expected to be unique per notification group
eg a UUID generated by Service - User Contact Manager
notificationGroupName
string name set by reciever service, optional
consolidated
true|false
optional, if excluded (or value not true), defaults to false
consolidatedType
overview|detailed
overview sends a count of each type of notification, detailed lists each activity message
consolidatedFrequency
not sure, maybe use some sort of standard like cron
consolidatedNextSendDue
timestamp for next due time to send notification
consolidatedSendIfEmpty
true|false

Notifications

  • no sort key

Fields

notificationId
(partition key)
random UUID
notificationGroupId
serviceName
msgTag
notificationName
string name set by reciever service, optional
triggers
array/list of triggers that must match for this notification to happen, see #Triggers structure

PendingConsolidation

Fields

notificationGroupId
(partition key)
time
(sort key)
comes from {timestamp activity handled in Activity Switchboard}_{small random UUID}
adding the UUID to ensure no clashing records with the same timestamp and notificationGroupId
activityMsg
copy of the message delivered from Activity Switchboard

Triggers structure

Record of the triggers for a notification, saved in Notifications table

[
	{
		"property": {can be a nested property, use dot notation}
		"value": {string or number}
		"values": {array/list of values}
		"meta": true|false // default false, if true will search message attributes or other special cases like msgTag
	},
	..
]
  • either value or values is set, not both

Consolidated notifications

How to trigger processing for time based consolidations

  • ....
  • maybe can use some sort of queue to store a list of NotificationGroup’s that are due to be sent (either because consolidatedSendIfEmpty == true or there are some activities waiting to be processed)

Formating the notification body

  • Initially the format will be hardwired and simple, but in the future we could create templates for formating the notification body
  • The notificationBody is currently sent to receiver as a JSON stringified object containing all activityMsgs

Ideas

  • overview notifications currently count per notification, but could be extended to do aggregates on a per notification, per field level
  • If set to overview maybe can store just aggregate/s needed for the consolidated notification, at the moment store entire messages, create the overview once when sending notification

Working documents

Working documents - Notification Manager