Service - Notification Manager: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 13: Line 13:
== PendingConsolidation Table ==
== PendingConsolidation Table ==


; partition key
; notificationGroupId (partition key)
* notificationGroupId
: type: string
: type: string
: {reciverTag} + "_" + {groupingId}
: comes from: random UUID
; sort key
; time (sort key)
* time
: type: number
: type: number
: {timestamp activity handled in Activity Switchboard}_{small random UUID}
: {timestamp activity handled in Activity Switchboard}_{small random UUID}
; activityMsg
: type: object
: object containing ''messageAttributes'' and ''message''


= Object Schemas =
= Object Schemas =
Line 39: Line 40:
canDelete: false,
canDelete: false,
     complexFilterServiceTag: "complexFilter",
     complexFilterServiceTag: "complexFilter",
    overWriteHandlers: { // optional, if not set will create default handlers, if empty will not create handler and main function
create: ['hdrSqs'], // default: ['hdrApi', 'hdrSqs']
update: ['hdrSqs'], // default: ['hdrApi', 'hdrSqs']
get: [], // default: ['hdrApi', 'hdrInv']
delete: [], // default: ['hdrApi', 'hdrSqs']
},
addOnDataStructure: [
addOnDataStructure: [
{
{
type: "versionedData",
type: "versionedData",
versionedDataLabel: "notificationGroupSetting",
versionedDataLabel: "notificationGroupSettings",
storageResourceTag: "myGraph",
storageResourceTag: "myGraph",
fieldNames: [
fieldNames: [
{ // fieldName in versionedData should now same in main objectSchema
{ // fieldName in versionedData should now same in main objectSchema
fieldName: "notificationGroupName"
fieldName: "notificationGroupName",
type: "string",
optionalOnCreate: true, // default = false
canUpdate: true, // default = true
validation: {
pattern: pattern
}
},
},
{  
{  
fieldName: "consolidated",
fieldName: "consolidated",
type: "boolean",
optionalOnCreate: true,
canUpdate: true,
validation: {
pattern: pattern
}
},
{
fieldName: "consolidatedType",
type: "string",
optionalOnCreate: true,
canUpdate: true,
validation: {
pattern: pattern
}
},
},
{
{
fieldName: "consolidatedType"
fieldName: "consolidatedFrequency",
type: "string",
optionalOnCreate: true,
canUpdate: true,
validation: {
pattern: pattern
}
},
},
{
{
fieldName: "consolidatedFrequency"
fieldName: "consolidatedNextSendDue",
type: "number",
optionalOnCreate: true,
canUpdate: true,
validation: {
pattern: pattern
}
},
},
{
{
fieldName: "consolidatedSendIfEmpty"
fieldName: "consolidatedSendIfEmpty",
type: "boolean",
optionalOnCreate: true,
canUpdate: true,
validation: {
pattern: pattern
}
}
}
]
]
}
}
     ],
     ],
     overwriteGeneratedMainFunction: ["create", "get", "update"],
     // overwriteGeneratedMainFunction: ["update"],
     storageResources: {
     storageResources: {
myGraph: {
myGraph: {
Line 71: Line 117:
     },
     },
     fieldNames: { // see Per Service Schemas
     fieldNames: { // see Per Service Schemas
notificationGroupId: {},
notificationGroupId: {
additionalData: {}
    type: "string",
optionalOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
receiverTag: {
type: "string",
requiredOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
userId: {
type: "string",
requiredOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
}
     },
     },
     identifiers: [
     identifiers: [
Line 86: Line 157:


; notificationGroupId (identifier)
; notificationGroupId (identifier)
: comes from: {receiverTag}_{groupingId} (Old)
: comes from: random UUID
: eg receiverTag: ContactMethodEmail
: eg groupingId: {userId}, cannot include underscores
: '''New Idea! comes from use notificationGroupUniqueId as notificationGroupId'''
: ''' eg {"ContactMethodEmail_randomIdA_randomIdB"}'''
; notificationGroupName
; notificationGroupName
: string name set by reciever service, optional
: string name set by reciever service, optional
; additionalData
; receiverTag
: set by the creating service, gets added to notifications sent to the receiver
: set by the creating service name
: eg: can include the actual userId and  used to make the groupingId
: eg ContactMethodEmail
; consolidated
; consolidated
: true|false
: true|false
: optional, if excluded (or value not true), defaults to false
; consolidatedType
; consolidatedType
: overview|detailed
: overview|detailed
Line 108: Line 174:
; consolidatedSendIfEmpty
; consolidatedSendIfEmpty
: true|false
: true|false
; userId
: for createdBy relationship




Line 117: Line 185:
canDelete: false,
canDelete: false,
complexFilterServiceTag: "complexFilter",
complexFilterServiceTag: "complexFilter",
     overwriteGeneratedMainFunction: ["create", "get", "update"],
     overWriteHandlers: { // optional, if not set will create default handlers, if empty will not create handler and main function
create: ['hdrSqs'], // default: ['hdrApi', 'hdrSqs']
update: ['hdrSqs'], // default: ['hdrApi', 'hdrSqs']
get: [], // default: ['hdrApi', 'hdrInv']
delete: [], // default: ['hdrApi', 'hdrSqs']
},
addOnDataStructure: [
{
type: "versionedData",
versionedDataLabel: "notificationSettings",
storageResourceTag: "myGraph",
fieldNames: [
{ // fieldName in versionedData should now same in main objectSchema
fieldName: "notificationName",
type: "string",
optionalOnCreate: true, // default = false
canUpdate: true, // default = true
validation: {
pattern: pattern
}
}
]
}
    ],
  // overwriteGeneratedMainFunction: ["update"],
     storageResources: {
     storageResources: {
myGraph: {
myGraph: {
Line 125: Line 217:
     },
     },
     fieldNames: {
     fieldNames: {
notificationId: {},
notificationId: {
notificationName: {}
    type: "string",
optionalOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
userId: {
type: "string",
requiredOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
}
     },
     },
     identifiers: [
     identifiers: [
Line 140: Line 248:


; notificationId (identifier)
; notificationId (identifier)
: hash of object containing {notificationName, triggers}
: comes from: random UUID
; notificationName
; notificationName
: string name set by reciever service, optional
: string name set by reciever service, optional
; userId
: for createdBy relationship




=== notificationTrigger ===
=== notificationTrigger ===
array/list of triggers that must match for this notification to happen, see [[#Triggers structure]]


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
Line 154: Line 262:
canDelete: false,
canDelete: false,
     complexFilterServiceTag: "complexFilter",
     complexFilterServiceTag: "complexFilter",
     overwriteGeneratedMainFunction: ["create", "get"],
     overWriteHandlers: { // optional, if not set will create default handlers, if empty will not create handler and main function
create: ['hdrSqs'], // default: ['hdrApi', 'hdrSqs']
update: [], // default: ['hdrApi', 'hdrSqs']
get: [], // default: ['hdrApi', 'hdrInv']
delete: [], // default: ['hdrApi', 'hdrSqs']
},
    // overwriteGeneratedMainFunction: ["create"],
     storageResources: {
     storageResources: {
myGraph: {
myGraph: {
Line 162: Line 276:
     },
     },
     fieldNames: {
     fieldNames: {
notificationTriggerId: {},
notificationTriggerId: {
propertyName: {},
type: "string",
valueType: {},
optionalOnCreate: true,
value: {},
canUpdate: false,
values: {}
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
propertyName: {
type: "string",
optionalOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
valueType: {
type: "string",
requiredOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
valueString: {
type: "string",
optionalOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
valueNumber: {
type: "number",
optionalOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
values: {
type: "arrayMixed",
optionalOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
userId: {
type: "string",
requiredOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
}
     },
     },
     identifiers: [
     identifiers: [
Line 180: Line 352:


; notificationTriggerId (identifier)
; notificationTriggerId (identifier)
: '''New Idea; comes from: {notificationId}_{small random UUID}'''
: comes from: random UUID
; propertyName
; propertyName
: can be a nested property, use dot notation
: can be a nested property, use dot notation
Line 186: Line 358:
; valueType
; valueType
: property|attribute|serviceName|topicName
: property|attribute|serviceName|topicName
; value
; valueString
: {string or number}
: type: string
; valueNumber
: type: number
; values
; values
: {array/list of value}
: type: arrayMixed
; userId
: for createdBy relationship




Line 202: Line 378:
dynamoDB: {
dynamoDB: {
storageType: "dynamoDB",
storageType: "dynamoDB",
graphServerTag: "PendingConsolidation"
tableName: "PendingConsolidation"
}
}
     },
     },
     fieldNames: {
     fieldNames: {
notificationGroupId: {},
notificationGroupId: {
time: {},
type: "string",
activityMsg: {}
requiredOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['dynamoDB'],
fromServiceNameTag: "NotificationMgr" ,
fromObjectType: "notificationGroup"
},
time: {
type: "string",
requiredOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['dynamoDB']
},
activityMsg: {
type: "object",
requiredOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['dynamoDB']
}
     },
     },
     identifiers: [
     identifiers: [
Line 226: Line 428:


; notificationGroupId (partition key)
; notificationGroupId (partition key)
: '''comes from use notificationGroupUniqueId as notificationGroupId (by Pong 2/7/2024)'''
: comes from: random UUID
: '''eg {"ContactMethodEmail_randomIdA_randomIdB"}'''
; time (sort key)
; time (sort key)
: comes from {timestamp activity handled in Activity Switchboard}_{small random UUID}
: comes from {timestamp activity handled in Activity Switchboard}_{small random UUID}
Line 242: Line 443:
"has_notificationGroup": {
"has_notificationGroup": {
properties: {
properties: {
originTimestamp: {...}
"originTimestamp": {
    type: "number",            // "string" | "number" ...
requiredOnCreate: true,  // default=false
canUpdate: true,          // default = true
validation: {}            // ajv syntax
}
},
},
storageResources: {
storageResources: {
Line 255: Line 461:
from: {
from: {
objType: {
objType: {
serviceTag: "ContactMethodEmail",
serviceTag: "UserContactManager",
objectType: "email"
objectType: "userContact"
},
},
linkType: "one",
linkType: "one",
Line 262: Line 468:
to: {
to: {
objType: {
objType: {
serviceTag: "NotificationMgr",
serviceTag: "NotificationManager",
objType: "notificationGroup"
objectType: "notificationGroup"
},
},
requiredOnCreate: true,
requiredOnCreate: true,
Line 274: Line 480:
}
}
</syntaxhighlight>
</syntaxhighlight>
 
: links userContact to notificationGroup


=== disabled_notificationGroup ===
=== disabled_notificationGroup ===
Line 281: Line 487:
"disabled_notificationGroup": {
"disabled_notificationGroup": {
properties: {
properties: {
originTimestamp: {...}
"originTimestamp": {
    type: "number",            // "string" | "number" ...
requiredOnCreate: true,  // default=false
canUpdate: true,          // default = true
validation: {}            // ajv syntax
}
},
},
storageResources: {
storageResources: {
Line 294: Line 505:
from: {
from: {
objType: {
objType: {
serviceTag: "ContactMethodEmail",
serviceTag: "UserContactManager",
objectType: "email"
objectType: "userContact"
},
},
linkType: "one"
linkType: "one"
Line 301: Line 512:
to: {
to: {
objType: {
objType: {
serviceTag: "NotificationMgr",
serviceTag: "NotificationManager",
objType: "notificationGroup"
objectType: "notificationGroup"
},
},
linkType: "many",
linkType: "many",
Line 319: Line 530:
"has_notification": {
"has_notification": {
properties: {
properties: {
originTimestamp: {...}
"originTimestamp": {
    type: "number",            // "string" | "number" ...
requiredOnCreate: true,  // default=false
canUpdate: true,          // default = true
validation: {}            // ajv syntax
}
},
},
storageResources: {
storageResources: {
Line 332: Line 548:
from: {
from: {
objType: {
objType: {
serviceTag: "NotificationMgr",
serviceTag: "NotificationManager",
objectType: "notificationGroup"
objectType: "notificationGroup"
},
},
Line 340: Line 556:
to: {
to: {
objType: {
objType: {
serviceTag: "NotificationMgr",
serviceTag: "NotificationManager",
objType: "notification"
objectType: "notification"
},
},
requiredOnCreate: true,
requiredOnCreate: true,
Line 359: Line 575:
"disabled_notification": {
"disabled_notification": {
properties: {
properties: {
originTimestamp: {...}
"originTimestamp": {
    type: "number",            // "string" | "number" ...
requiredOnCreate: true,  // default=false
canUpdate: true,          // default = true
validation: {}            // ajv syntax
}
},
},
storageResources: {
storageResources: {
Line 372: Line 593:
from: {
from: {
objType: {
objType: {
serviceTag: "NotificationMgr",
serviceTag: "NotificationManager",
objectType: "notificationGroup"
objectType: "notificationGroup"
},
},
Line 380: Line 601:
to: {
to: {
objType: {
objType: {
serviceTag: "NotificationMgr",
serviceTag: "NotificationManager",
objType: "notification"
objectType: "notification"
},
},
linkType: "many",
linkType: "many",
Line 398: Line 619:
"has_notificationTrigger": {
"has_notificationTrigger": {
properties: {
properties: {
originTimestamp: {...}
"originTimestamp": {
    type: "number",            // "string" | "number" ...
requiredOnCreate: true,  // default=false
canUpdate: true,          // default = true
validation: {}            // ajv syntax
}
},
},
storageResources: {
storageResources: {
Line 411: Line 637:
from: {
from: {
objType: {
objType: {
serviceTag: "NotificationMgr",
serviceTag: "NotificationManager",
objectType: "notification"
objectType: "notification"
},
},
Line 419: Line 645:
to: {
to: {
objType: {
objType: {
serviceTag: "NotificationMgr",
serviceTag: "NotificationManager",
objType: "notificationTrigger"
objectType: "notificationTrigger"
},
},
requiredOnCreate: true,
requiredOnCreate: true,
Line 433: Line 659:




= Triggers structure =
=== disabled_notificationTrigger ===
 
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
[
{
{
"disabled_notificationTrigger": {
"propertyName": {can be a nested property, use dot notation}
properties: {
"valueType": property|attribute|serviceName|topicName
"originTimestamp": {
"value": {string or number}
    type: "number",            // "string" | "number" ...
"values": {array/list of values}
requiredOnCreate: true,  // default=false
},
canUpdate: true,         // default = true
..
validation: {}            // ajv syntax
]
}
},
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "graphHandler"
}
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "NotificationManager",
objectType: "notification"
},
linkType: "one",
handler: true
},
to: {
objType: {
serviceTag: "NotificationManager",
objectType: "notificationTrigger"
},
linkType: "many",
handler: true
}
}
]
}
}
</syntaxhighlight>
</syntaxhighlight>


== value or values array ==
= value or values array =


* Either 'value' or 'values' should be set, not both, if 'values' is used it means any of the elements in the 'values' array can match.
* Either 'value' or 'values' should be set, not both, if 'values' is used it means any of the elements in the 'values' array can match.

Latest revision as of 02:18, 8 August 2024

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

PendingConsolidation Table

notificationGroupId (partition key)
type: string
comes from: random UUID
time (sort key)
type: number
{timestamp activity handled in Activity Switchboard}_{small random UUID}
activityMsg
type: object
object containing messageAttributes and message

Object Schemas

Additional Information
Per Service Schemas

objType

notificationGroup

  • Groups many notificatons together
  • Simplifies management of similar notifications
  • Allows for consolidation of notifications at notification group level
{
	objectType: "notificationGroup",
	canDelete: false,
    complexFilterServiceTag: "complexFilter",
    overWriteHandlers: { // optional, if not set will create default handlers, if empty will not create handler and main function
		create: ['hdrSqs'], 	// default: ['hdrApi', 'hdrSqs']
		update: ['hdrSqs'], 	// default: ['hdrApi', 'hdrSqs']
		get: [], 				// default: ['hdrApi', 'hdrInv']
		delete: [], 			// default: ['hdrApi', 'hdrSqs']
	},
	addOnDataStructure: [
		{
			type: "versionedData",
			versionedDataLabel: "notificationGroupSettings",
			storageResourceTag: "myGraph",
			fieldNames: [
				{ // fieldName in versionedData should now same in main objectSchema
			 		fieldName: "notificationGroupName",
			 		type: "string",
					optionalOnCreate: true, 				// default = false
					canUpdate: true, 						// default = true
					validation: {
						pattern: pattern
					}
				},
				{ 
					fieldName: "consolidated",
			 		type: "boolean",
					optionalOnCreate: true, 								
					canUpdate: true, 						
					validation: {
						pattern: pattern
					}
				},
				{
					fieldName: "consolidatedType",
			 		type: "string",
					optionalOnCreate: true, 								
					canUpdate: true, 						
					validation: {
						pattern: pattern
					}
				},
				{
					fieldName: "consolidatedFrequency",
			 		type: "string",
					optionalOnCreate: true, 								
					canUpdate: true, 						
					validation: {
						pattern: pattern
					}
				},
				{
					fieldName: "consolidatedNextSendDue",
			 		type: "number",
					optionalOnCreate: true, 								
					canUpdate: true, 						
					validation: {
						pattern: pattern
					}
				},
				{
					fieldName: "consolidatedSendIfEmpty",
			 		type: "boolean",
					optionalOnCreate: true, 				 				
					canUpdate: true, 						
					validation: {
						pattern: pattern
					}
				}
			]
		}
    ],
    // overwriteGeneratedMainFunction: ["update"],
    storageResources: {
		myGraph: {
			storageType: "graph",
			graphServerTag: "GraphHandler"
		}
    },
    fieldNames: { // see Per Service Schemas
		notificationGroupId: {
		    type: "string",
			optionalOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']
		},
		receiverTag: {
			type: "string",
			requiredOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']
		},
		userId: {
			type: "string",
			requiredOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']
		}
    },
    identifiers: [
		{
			type: "identifier",
			fieldName: "notificationGroupId"
		}
    ]
}

fieldNames

notificationGroupId (identifier)
comes from: random UUID
notificationGroupName
string name set by reciever service, optional
receiverTag
set by the creating service name
eg ContactMethodEmail
consolidated
true|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
userId
for createdBy relationship


notification

{
	objectType: "notification",
	canDelete: false,
	complexFilterServiceTag: "complexFilter",
    overWriteHandlers: { // optional, if not set will create default handlers, if empty will not create handler and main function
		create: ['hdrSqs'], 	// default: ['hdrApi', 'hdrSqs']
		update: ['hdrSqs'], 	// default: ['hdrApi', 'hdrSqs']
		get: [], 				// default: ['hdrApi', 'hdrInv']
		delete: [], 			// default: ['hdrApi', 'hdrSqs']
	},
	addOnDataStructure: [
		{
			type: "versionedData",
			versionedDataLabel: "notificationSettings",
			storageResourceTag: "myGraph",
			fieldNames: [
				{ // fieldName in versionedData should now same in main objectSchema
			 		fieldName: "notificationName",
			 		type: "string",
					optionalOnCreate: true, 				// default = false
					canUpdate: true, 						// default = true
					validation: {
						pattern: pattern
					}
				}
			]
		}
    ],
   // overwriteGeneratedMainFunction: ["update"],
    storageResources: {
		myGraph: {
			storageType: "graph",
			graphServerTag: "GraphHandler"
		}
    },
    fieldNames: {
		notificationId: {
		    type: "string",
			optionalOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']
		},
		userId: {
			type: "string",
			requiredOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']
		}
    },
    identifiers: [
		{
			type: "identifier",
			fieldName: "notificationId"
		}
    ]
}

fieldNames

notificationId (identifier)
comes from: random UUID
notificationName
string name set by reciever service, optional
userId
for createdBy relationship


notificationTrigger

{
	objectType: "notificationTrigger",
	canDelete: false,
    complexFilterServiceTag: "complexFilter",
    overWriteHandlers: { // optional, if not set will create default handlers, if empty will not create handler and main function
		create: ['hdrSqs'], 	// default: ['hdrApi', 'hdrSqs']
		update: [], 			// default: ['hdrApi', 'hdrSqs']
		get: [], 				// default: ['hdrApi', 'hdrInv']
		delete: [], 			// default: ['hdrApi', 'hdrSqs']
	},
    // overwriteGeneratedMainFunction: ["create"],
    storageResources: {
		myGraph: {
			storageType: "graph",
			graphServerTag: "GraphHandler"
		}
    },
    fieldNames: {
		notificationTriggerId: {
			type: "string",
			optionalOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']
		},
		propertyName: {
			type: "string",
			optionalOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']
		},
		valueType: {
			type: "string",
			requiredOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']
		},
		valueString: {
			type: "string",
			optionalOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']		
		},
		valueNumber: {
			type: "number",
			optionalOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']		
		},
		values: {
			type: "arrayMixed",
			optionalOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']		
		},
		userId: {
			type: "string",
			requiredOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['myGraph']
		}
    },
    identifiers: [
		{
			type: "identifier",
			fieldName: "notificationTriggerId"
		}
    ]
}

fieldNames

notificationTriggerId (identifier)
comes from: random UUID
propertyName
can be a nested property, use dot notation
"serviceName" and "topicName" valueTypes do not have propertyName
valueType
property|attribute|serviceName|topicName
valueString
type: string
valueNumber
type: number
values
type: arrayMixed
userId
for createdBy relationship


consolidated

{
	objectType: "consolidated",
	canDelete: false,
    complexFilterServiceTag: "complexFilter",
    storageResources: {
		dynamoDB: {
			storageType: "dynamoDB",
			tableName: "PendingConsolidation"
		}
    },
    fieldNames: {
		notificationGroupId: {
			type: "string",
			requiredOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['dynamoDB'],
			fromServiceNameTag: "NotificationMgr" ,
			fromObjectType: "notificationGroup"
		},
		time: {
			type: "string",
			requiredOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['dynamoDB']		
		},
		activityMsg: {
			type: "object",
			requiredOnCreate: true,
			canUpdate: false,
			validation: {
				pattern: pattern
			},
			storageResourceTags: ['dynamoDB']		
		}
    },
    identifiers: [
		{
			type: "partitionKey",
			fieldName: "notificationGroupId"
		},
		{
			type: "sortKey",
			fieldName: "time"
		}
    ]
}

fieldNames

notificationGroupId (partition key)
comes from: random UUID
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


Object Relationships

has_notificationGroup

{
	"has_notificationGroup": {
		properties: {
			"originTimestamp": {
			    type: "number",            	// "string" | "number" ...
				requiredOnCreate: true,  	// default=false
				canUpdate: true,          	// default = true
				validation: {}            	// ajv syntax
			}
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "graphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "UserContactManager",					
						objectType: "userContact"
					},
					linkType: "one",
				},
				to: {
					objType: {
						serviceTag: "NotificationManager",				
						objectType: "notificationGroup"					
					},
					requiredOnCreate: true,					
					linkType: "many",
					handler: true
				}
			}
		]
	}
}
links userContact to notificationGroup

disabled_notificationGroup

{
	"disabled_notificationGroup": {
		properties: {
			"originTimestamp": {
			    type: "number",            	// "string" | "number" ...
				requiredOnCreate: true,  	// default=false
				canUpdate: true,          	// default = true
				validation: {}            	// ajv syntax
			}
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "UserContactManager",					
						objectType: "userContact"
					},
					linkType: "one"
				},
				to: {
					objType: {
						serviceTag: "NotificationManager",				
						objectType: "notificationGroup"					
					},			
					linkType: "many",
					handler: true
				}
			}
		]
	}
}


has_notification

{
	"has_notification": {
		properties: {
			"originTimestamp": {
			    type: "number",            	// "string" | "number" ...
				requiredOnCreate: true,  	// default=false
				canUpdate: true,          	// default = true
				validation: {}            	// ajv syntax
			}
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "NotificationManager",					
						objectType: "notificationGroup"
					},
					linkType: "one",
					handler: true					
				},
				to: {
					objType: {
						serviceTag: "NotificationManager",				
						objectType: "notification"					
					},
					requiredOnCreate: true,					
					linkType: "many",
					handler: true
				}
			}
		]
	}
}


disabled_notification

{
	"disabled_notification": {
		properties: {
			"originTimestamp": {
			    type: "number",            	// "string" | "number" ...
				requiredOnCreate: true,  	// default=false
				canUpdate: true,          	// default = true
				validation: {}            	// ajv syntax
			}
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "graphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "NotificationManager",					
						objectType: "notificationGroup"
					},
					linkType: "one",
					handler: true
				},
				to: {
					objType: {
						serviceTag: "NotificationManager",				
						objectType: "notification"					
					},
					linkType: "many",
					handler: true
				}
			}
		]
	}
}


has_notificationTrigger

{
	"has_notificationTrigger": {
		properties: {
			"originTimestamp": {
			    type: "number",            	// "string" | "number" ...
				requiredOnCreate: true,  	// default=false
				canUpdate: true,          	// default = true
				validation: {}            	// ajv syntax
			}
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "graphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "NotificationManager",					
						objectType: "notification"
					},
					linkType: "one",
					handler: true
				},
				to: {
					objType: {
						serviceTag: "NotificationManager",				
						objectType: "notificationTrigger"					
					},
					requiredOnCreate: true,	
					linkType: "many",
					handler: true
				}
			}
		]
	}
}


disabled_notificationTrigger

{
	"disabled_notificationTrigger": {
		properties: {
			"originTimestamp": {
			    type: "number",            	// "string" | "number" ...
				requiredOnCreate: true,  	// default=false
				canUpdate: true,          	// default = true
				validation: {}            	// ajv syntax
			}
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "graphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "NotificationManager",					
						objectType: "notification"
					},
					linkType: "one",
					handler: true
				},
				to: {
					objType: {
						serviceTag: "NotificationManager",				
						objectType: "notificationTrigger"					
					},
					linkType: "many",
					handler: true
				}
			}
		]
	}
}

value or values array

  • Either 'value' or 'values' should be set, not both, if 'values' is used it means any of the elements in the 'values' array can match.
  • To achieve this on Activity Switchboard a new trigger group is created for each element, each activity group has the full list of other triggers, and one option from this trigger's values array. If a notification has multiple values type triggers than a new trigger group on Activity Switchboard is created for each combination.
  • "serviceName" and "topicName" valueTypes do not have propertyName

serviceName and topicName triggers

  • Notifications do not have to set their serviceName and/or topicName, if not set then any message that matches the properties will pass
  • Can set only the serviceName, then any message that passess the properties and is from that serviceName passes
  • Can set serviceName+topicName, then only messages in that topic will pass
  • serviceName and topicName can both be submitted as "values" array, creating multiple trigger groups for each combination

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