Service - Notification Manager: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(8 intermediate revisions by one other user not shown) | |||
Line 7: | Line 7: | ||
= Repository = | = Repository = | ||
https://bitbucket.org/ | https://bitbucket.org/izara-core-shared/izara-core-shared-notification-manager | ||
= DynamoDB tables = | = DynamoDB tables = | ||
Line 13: | Line 13: | ||
== PendingConsolidation Table == | == PendingConsolidation Table == | ||
; partition key | ; notificationGroupId (partition key) | ||
: type: string | : type: string | ||
: comes from: random UUID | : comes from: random UUID | ||
; sort key | ; time (sort key) | ||
: 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 30: | Line 31: | ||
=== notificationGroup === | === notificationGroup === | ||
* Groups many | * Groups many notifications together | ||
* 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 | ||
Line 37: | Line 38: | ||
{ | { | ||
objectType: "notificationGroup", | objectType: "notificationGroup", | ||
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'] | |||
}, | |||
overwriteGeneratedMainFunction: ["get", "delete"], | |||
addOnDataStructure: [ | addOnDataStructure: [ | ||
{ | { | ||
Line 48: | Line 54: | ||
fieldName: "notificationGroupName", | fieldName: "notificationGroupName", | ||
type: "string", | type: "string", | ||
optionalOnCreate: true, // default = false | optionalOnCreate: true, // default = false | ||
canUpdate: true, // default = true | canUpdate: true, // default = true | ||
Line 58: | Line 63: | ||
fieldName: "consolidated", | fieldName: "consolidated", | ||
type: "boolean", | type: "boolean", | ||
optionalOnCreate: true, | |||
optionalOnCreate: true, | |||
canUpdate: true, | canUpdate: true, | ||
validation: { | validation: { | ||
Line 68: | Line 72: | ||
fieldName: "consolidatedType", | fieldName: "consolidatedType", | ||
type: "string", | type: "string", | ||
optionalOnCreate: true, | |||
optionalOnCreate: true, | |||
canUpdate: true, | canUpdate: true, | ||
validation: { | validation: { | ||
Line 78: | Line 81: | ||
fieldName: "consolidatedFrequency", | fieldName: "consolidatedFrequency", | ||
type: "string", | type: "string", | ||
optionalOnCreate: true, | |||
optionalOnCreate: true, | canUpdate: true, | ||
validation: { | |||
pattern: pattern | |||
} | |||
}, | |||
{ | |||
fieldName: "consolidatedNextSendDue", | |||
type: "number", | |||
optionalOnCreate: true, | |||
canUpdate: true, | canUpdate: true, | ||
validation: { | validation: { | ||
Line 88: | Line 99: | ||
fieldName: "consolidatedSendIfEmpty", | fieldName: "consolidatedSendIfEmpty", | ||
type: "boolean", | type: "boolean", | ||
optionalOnCreate: true, | |||
optionalOnCreate: true, | |||
canUpdate: true, | canUpdate: true, | ||
validation: { | validation: { | ||
Line 98: | Line 108: | ||
} | } | ||
], | ], | ||
storageResources: { | storageResources: { | ||
myGraph: { | myGraph: { | ||
Line 108: | Line 117: | ||
notificationGroupId: { | notificationGroupId: { | ||
type: "string", | type: "string", | ||
randomOnCreate: true, | |||
canUpdate: false, | canUpdate: false, | ||
validation: { | validation: { | ||
Line 151: | Line 140: | ||
; notificationGroupName | ; notificationGroupName | ||
: string name set by reciever service, optional | : string name set by reciever service, optional | ||
; consolidated | ; consolidated | ||
: true|false | : true|false | ||
; consolidatedType | ; consolidatedType | ||
: overview|detailed | : overview|detailed | ||
Line 169: | Line 151: | ||
; consolidatedSendIfEmpty | ; consolidatedSendIfEmpty | ||
: true|false | : true|false | ||
=== notification === | === notification === | ||
Line 176: | Line 157: | ||
{ | { | ||
objectType: "notification", | objectType: "notification", | ||
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'] | |||
}, | |||
overwriteGeneratedMainFunction: ["get", "delete"], | |||
addOnDataStructure: [ | addOnDataStructure: [ | ||
{ | { | ||
Line 187: | Line 173: | ||
fieldName: "notificationName", | fieldName: "notificationName", | ||
type: "string", | type: "string", | ||
optionalOnCreate: true, // default = false | optionalOnCreate: true, // default = false | ||
canUpdate: true, // default = true | canUpdate: true, // default = true | ||
Line 197: | Line 182: | ||
} | } | ||
], | ], | ||
// overwriteGeneratedMainFunction: ["update"], | |||
storageResources: { | storageResources: { | ||
myGraph: { | myGraph: { | ||
Line 207: | Line 192: | ||
notificationId: { | notificationId: { | ||
type: "string", | type: "string", | ||
randomOnCreate: true, | |||
canUpdate: false, | canUpdate: false, | ||
validation: { | validation: { | ||
Line 213: | Line 198: | ||
}, | }, | ||
storageResourceTags: ['myGraph'] | storageResourceTags: ['myGraph'] | ||
} | } | ||
}, | }, | ||
identifiers: [ | identifiers: [ | ||
Line 230: | Line 215: | ||
; notificationName | ; notificationName | ||
: string name set by reciever service, optional | : string name set by reciever service, optional | ||
=== notificationTrigger === | === notificationTrigger === | ||
Line 239: | Line 223: | ||
canDelete: false, | canDelete: false, | ||
complexFilterServiceTag: "complexFilter", | complexFilterServiceTag: "complexFilter", | ||
overwriteGeneratedMainFunction: [" | 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: ["update", "get", "delete"], | |||
storageResources: { | storageResources: { | ||
myGraph: { | myGraph: { | ||
Line 249: | Line 239: | ||
notificationTriggerId: { | notificationTriggerId: { | ||
type: "string", | type: "string", | ||
randomOnCreate: true, | |||
canUpdate: false, | canUpdate: false, | ||
validation: { | validation: { | ||
Line 255: | Line 245: | ||
}, | }, | ||
storageResourceTags: ['myGraph'] | storageResourceTags: ['myGraph'] | ||
}, | }, | ||
propertyName: { | propertyName: { | ||
type: "string", | type: "string", | ||
optionalOnCreate: true, | optionalOnCreate: true, | ||
canUpdate: false, | canUpdate: false, | ||
Line 270: | Line 258: | ||
type: "string", | type: "string", | ||
requiredOnCreate: true, | requiredOnCreate: true, | ||
canUpdate: false, | |||
validation: { | |||
pattern: pattern | |||
}, | |||
storageResourceTags: ['myGraph'] | |||
}, | |||
valueString: { | |||
type: "string", | |||
optionalOnCreate: true, | optionalOnCreate: true, | ||
canUpdate: false, | canUpdate: false, | ||
Line 275: | Line 271: | ||
pattern: pattern | pattern: pattern | ||
}, | }, | ||
storageResourceTags: ['myGraph'] | storageResourceTags: ['myGraph'] | ||
}, | }, | ||
valueNumber: { | |||
type: " | type: "number", | ||
optionalOnCreate: true, | optionalOnCreate: true, | ||
canUpdate: false, | canUpdate: false, | ||
Line 314: | Line 310: | ||
; valueType | ; valueType | ||
: property|attribute|serviceName|topicName | : property|attribute|serviceName|topicName | ||
; | ; valueString | ||
: | : type: string | ||
; valueNumber | |||
: type: number | |||
; values | ; values | ||
: | : type: arrayMixed | ||
=== consolidated === | === consolidated === | ||
Line 327: | Line 324: | ||
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: [], // default: ['hdrApi', 'hdrSqs'] | |||
update: [], // default: ['hdrApi', 'hdrSqs'] | |||
get: [], // default: ['hdrApi', 'hdrInv'] | |||
delete: [], // default: ['hdrApi', 'hdrSqs'] | |||
}, | |||
storageResources: { | storageResources: { | ||
dynamoDB: { | dynamoDB: { | ||
storageType: "dynamoDB", | storageType: "dynamoDB", | ||
tableName: "PendingConsolidation" | |||
} | } | ||
}, | }, | ||
Line 336: | Line 339: | ||
notificationGroupId: { | notificationGroupId: { | ||
type: "string", | type: "string", | ||
canUpdate: false, | canUpdate: false, | ||
storageResourceTags: ['dynamoDB'], | |||
fromServiceNameTag: "NotificationManager" , | |||
fromObjectType: "notificationGroup" | |||
}, | }, | ||
time: { | time: { | ||
type: " | type: "string", | ||
requiredOnCreate: true, | requiredOnCreate: true, | ||
canUpdate: false, | canUpdate: false, | ||
validation: { | validation: { | ||
Line 357: | Line 356: | ||
type: "object", | type: "object", | ||
requiredOnCreate: true, | requiredOnCreate: true, | ||
canUpdate: false, | canUpdate: false, | ||
validation: { | validation: { | ||
Line 391: | Line 389: | ||
== Object Relationships == | == Object Relationships == | ||
=== | === hasNotificationGroup === | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
" | "hasNotificationGroup": { | ||
fieldNames: { | |||
originTimestamp: {...} | "originTimestamp": { | ||
type: "number", // "string" | "number" ... | |||
requiredOnCreate: true, // default = false | |||
canUpdate: true, // default = true | |||
validation: {} // ajv syntax | |||
} | |||
}, | }, | ||
storageResources: { | storageResources: { | ||
Line 409: | Line 412: | ||
from: { | from: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "UserContactManager", | ||
objectType: " | objectType: "userContact" | ||
}, | }, | ||
linkType: "one", | linkType: "one", | ||
Line 416: | Line 419: | ||
to: { | to: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "NotificationManager", | ||
objectType: "notificationGroup" | |||
}, | }, | ||
requiredOnCreate: true, | requiredOnCreate: true, | ||
Line 428: | Line 431: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
: links | : links userContact to notificationGroup | ||
=== | === disabledNotificationGroup === | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
" | "disabledNotificationGroup": { | ||
fieldNames: { | |||
originTimestamp: {...} | "originTimestamp": { | ||
type: "number", // "string" | "number" ... | |||
requiredOnCreate: true, // default = false | |||
canUpdate: true, // default = true | |||
validation: {} // ajv syntax | |||
} | |||
}, | }, | ||
storageResources: { | storageResources: { | ||
Line 448: | Line 456: | ||
from: { | from: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "UserContactManager", | ||
objectType: " | objectType: "userContact" | ||
}, | }, | ||
linkType: "one" | linkType: "one" | ||
Line 455: | Line 463: | ||
to: { | to: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "NotificationManager", | ||
objectType: "notificationGroup" | |||
}, | }, | ||
linkType: "many", | linkType: "many", | ||
Line 468: | Line 476: | ||
=== | === hasNotification === | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
" | "hasNotification": { | ||
fieldNames: { | |||
originTimestamp: {...} | "originTimestamp": { | ||
type: "number", // "string" | "number" ... | |||
requiredOnCreate: true, // default = false | |||
canUpdate: true, // default = true | |||
validation: {} // ajv syntax | |||
} | |||
}, | }, | ||
storageResources: { | storageResources: { | ||
Line 486: | Line 499: | ||
from: { | from: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "NotificationManager", | ||
objectType: "notificationGroup" | objectType: "notificationGroup" | ||
}, | }, | ||
Line 494: | Line 507: | ||
to: { | to: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "NotificationManager", | ||
objectType: "notification" | |||
}, | }, | ||
requiredOnCreate: true, | requiredOnCreate: true, | ||
Line 508: | Line 521: | ||
=== | === disabledNotification === | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
" | "disabledNotification": { | ||
fieldNames: { | |||
originTimestamp: {...} | "originTimestamp": { | ||
type: "number", // "string" | "number" ... | |||
requiredOnCreate: true, // default = false | |||
canUpdate: true, // default = true | |||
validation: {} // ajv syntax | |||
} | |||
}, | }, | ||
storageResources: { | storageResources: { | ||
Line 526: | Line 544: | ||
from: { | from: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "NotificationManager", | ||
objectType: "notificationGroup" | objectType: "notificationGroup" | ||
}, | }, | ||
Line 534: | Line 552: | ||
to: { | to: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "NotificationManager", | ||
objectType: "notification" | |||
}, | }, | ||
linkType: "many", | linkType: "many", | ||
Line 547: | Line 565: | ||
=== | === hasNotificationTrigger === | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
" | "hasNotificationTrigger": { | ||
fieldNames: { | |||
originTimestamp: {...} | "originTimestamp": { | ||
type: "number", // "string" | "number" ... | |||
requiredOnCreate: true, // default = false | |||
canUpdate: true, // default = true | |||
validation: {} // ajv syntax | |||
} | |||
}, | }, | ||
storageResources: { | storageResources: { | ||
Line 565: | Line 588: | ||
from: { | from: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "NotificationManager", | ||
objectType: "notification" | objectType: "notification" | ||
}, | }, | ||
Line 573: | Line 596: | ||
to: { | to: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "NotificationManager", | ||
objectType: "notificationTrigger" | |||
}, | }, | ||
requiredOnCreate: true, | requiredOnCreate: true, | ||
Line 587: | Line 610: | ||
=== | === disabledNotificationTrigger === | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
" | "disabledNotificationTrigger": { | ||
fieldNames: { | |||
originTimestamp: {...} | "originTimestamp": { | ||
type: "number", // "string" | "number" ... | |||
requiredOnCreate: true, // default = false | |||
canUpdate: true, // default = true | |||
validation: {} // ajv syntax | |||
} | |||
}, | }, | ||
storageResources: { | storageResources: { | ||
Line 605: | Line 633: | ||
from: { | from: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "NotificationManager", | ||
objectType: "notification" | objectType: "notification" | ||
}, | }, | ||
Line 613: | Line 641: | ||
to: { | to: { | ||
objType: { | objType: { | ||
serviceTag: " | serviceTag: "NotificationManager", | ||
objectType: "notificationTrigger" | |||
}, | }, | ||
linkType: "many", | linkType: "many", | ||
Line 625: | Line 653: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
= 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 00:52, 9 March 2025
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/izara-core-shared/izara-core-shared-notification-manager
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 notifications together
- Simplifies management of similar notifications
- Allows for consolidation of notifications at notification group level
{
objectType: "notificationGroup",
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']
},
overwriteGeneratedMainFunction: ["get", "delete"],
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
}
}
]
}
],
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
fieldNames: { // see Per Service Schemas
notificationGroupId: {
type: "string",
randomOnCreate: 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
- 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
notification
{
objectType: "notification",
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']
},
overwriteGeneratedMainFunction: ["get", "delete"],
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",
randomOnCreate: 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
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: ["update", "get", "delete"],
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
fieldNames: {
notificationTriggerId: {
type: "string",
randomOnCreate: 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']
}
},
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
consolidated
{
objectType: "consolidated",
canDelete: false,
complexFilterServiceTag: "complexFilter",
overWriteHandlers: { // optional, if not set will create default handlers, if empty will not create handler and main function
create: [], // default: ['hdrApi', 'hdrSqs']
update: [], // default: ['hdrApi', 'hdrSqs']
get: [], // default: ['hdrApi', 'hdrInv']
delete: [], // default: ['hdrApi', 'hdrSqs']
},
storageResources: {
dynamoDB: {
storageType: "dynamoDB",
tableName: "PendingConsolidation"
}
},
fieldNames: {
notificationGroupId: {
type: "string",
canUpdate: false,
storageResourceTags: ['dynamoDB'],
fromServiceNameTag: "NotificationManager" ,
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
hasNotificationGroup
{
"hasNotificationGroup": {
fieldNames: {
"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
disabledNotificationGroup
{
"disabledNotificationGroup": {
fieldNames: {
"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
}
}
]
}
}
hasNotification
{
"hasNotification": {
fieldNames: {
"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
}
}
]
}
}
disabledNotification
{
"disabledNotification": {
fieldNames: {
"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
}
}
]
}
}
hasNotificationTrigger
{
"hasNotificationTrigger": {
fieldNames: {
"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
}
}
]
}
}
disabledNotificationTrigger
{
"disabledNotificationTrigger": {
fieldNames: {
"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