Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
15c9513
Added initial notifications documentation readme and asset placeholders
mdebarros Dec 10, 2020
d1560e3
updated notification-engine requirements & added example
mdebarros Dec 11, 2020
9dce0a6
Notification-engine updates
mdebarros Dec 11, 2020
f3db573
updates to notification engine
mdebarros Dec 15, 2020
a5297ae
fixed sequencing on notification design
mdebarros Dec 15, 2020
9535332
updated notify design svg, and added a gitignore for VSCode Plantuml …
mdebarros Dec 16, 2020
bed56c5
updated notification design
mdebarros Dec 16, 2020
f88dcb3
updated notification design
mdebarros Dec 16, 2020
5fa895e
updated notification design
mdebarros Dec 16, 2020
9bd9287
updated notification design
mdebarros Dec 16, 2020
e5efef6
updates to notification design docs
mdebarros Jan 6, 2021
729e264
updates to notification design docs
mdebarros Jan 6, 2021
696ee1a
updates to notification design docs
mdebarros Jan 6, 2021
a372cb7
updates to notification design docs
mdebarros Jan 6, 2021
f0012a3
updates to notification design docs
mdebarros Jan 6, 2021
a0ffd8c
Update mojaloop-technical-overview/notifications/assets/sequence/seq-…
mdebarros Jan 6, 2021
14606b4
Update mojaloop-technical-overview/notifications/README.md
mdebarros Jan 6, 2021
34366ef
Merge branch 'master' into feature/#1869Designforreliablenotification…
mdebarros Jan 27, 2021
ec679fd
Merge branch 'master' of github.com:mojaloop/documentation into featu…
mdebarros Feb 23, 2021
45b90fb
Updated to notification reliable design
mdebarros Mar 8, 2021
2a9c365
Updates to package-lock and bug fix to plantuml_diff script
mdebarros Mar 8, 2021
7b6881d
Updates to SD for notification
mdebarros Mar 8, 2021
bc9c8fc
Updated notification sd flow for alt path
mdebarros Mar 8, 2021
16b6bec
Added example for multiple transports
mdebarros Mar 9, 2021
2bced12
Updated description for notification cmd handler
mdebarros Mar 9, 2021
fbe27aa
Fixes for circleci
mdebarros Mar 9, 2021
1220fbd
fixes for circleci config
mdebarros Mar 9, 2021
e6155bd
Merge branch 'master' into feature/#1869Designforreliablenotification…
mdebarros Mar 9, 2021
7674636
Updates to notif rel end2end arch diagrams
mdebarros Mar 26, 2021
1ce400f
Merge remote-tracking branch 'origin/master' into feature/#1869Design…
mdebarros Mar 26, 2021
6ccd3ca
Merge branch 'feature/#1869Designforreliablenotificationsonfinalizati…
mdebarros Mar 26, 2021
08f004c
Removed unused folder
mdebarros Mar 26, 2021
6860051
Updates to notification v2 e2e arch diagram
mdebarros Mar 26, 2021
91b6d40
Updated notification v2 e2e arch diagram
mdebarros Mar 26, 2021
175edb9
updated notify design v2
mdebarros Mar 29, 2021
c757ab9
updated notify design v2
mdebarros Mar 29, 2021
c0ea05c
updates to notification design v2 - included more detail on re-try lo…
mdebarros Mar 30, 2021
61c9ea3
updates to notification design v2 - included more detail on re-try lo…
mdebarros Mar 30, 2021
a1b4260
updates to notification design v2 - included more detail on re-try lo…
mdebarros Mar 30, 2021
a471c42
updates to notification design v2 - included more detail on re-try lo…
mdebarros Mar 31, 2021
40daafa
updates to notification design v2 - included more detail on re-try lo…
mdebarros Mar 31, 2021
60d1a19
updates to notification design v2 - included more detail on re-try lo…
mdebarros Mar 31, 2021
af3a6f6
spelling fixes
mdebarros Mar 31, 2021
42e2c80
Updated mojaloop-simulator to fix subid issue - https://github.com/mo…
mdebarros Apr 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ _book
*.log

*.jar

# Ignore VSCode Plantuml Image exporter
out/**/*.*
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,18 @@ group Send notification to Participants
activate TOPIC_NOTIFICATIONS
deactivate TOPIC_NOTIFICATIONS

group Persist Event Information
NOTIFY_HANDLER -> CSAPI: Request to persist event information - POST - /events
activate CSAPI
CSAPI -> TOPIC_EVENTS: Publish event information
activate TOPIC_EVENTS
|||
ref over TOPIC_EVENTS : Event Handler Consume\n
|||
TOPIC_EVENTS --> CSAPI: Return success
deactivate TOPIC_EVENTS
CSAPI --> NOTIFY_HANDLER: Return success
deactivate CSAPI
end
note right of NOTIFY_HANDLER #lightgray
The endpoint details are cached, when the cache
expires, the details are fetched again
note right of OPERATOR #yellow
Message:
{
payload: {
endpoint: {
type: <typeValue>,
value: <endpointValue>
}
}
}
end note

NOTIFY_HANDLER -> CSAPI: Request Endpoint details for Participant - GET - /participants/{{fsp}}/endpoints\n<color #FF0000><b>Error code:</b> 2003</color>

activate CSAPI
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
220 changes: 220 additions & 0 deletions mojaloop-technical-overview/notifications/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# Notifications

This document will discuss the architecture and design of Mojaloop's Notification-engine.

## 1. Requirements

```
1.1. Notification-engine must be stateless
a. Notification messages consumed by the Notification-engine contains everything needed to send notifications

1.2. Notification messages must support
a. Config included to indicate that the message must be reliably delivered
b. Notification transport (i.e. HTTP, gRPC, Email, etc)
c. End-point details to deliver the notification

1.3. Reliability
a. Notification-engine must support retries based on a configuration
b. HTTP keep-alive must be configured for HTTP transports
c. A delivery-report must be published to a kafka event topic indicating the result of the notification:
i. success / error
ii. meta-data: request-timestamp, delivery-timestamp, request-latency
d. Delivery-reports events must be persisted into a data-store (Central-Ledger?)

1.4. Notification-engine must be support the following ingress:
a. Consuming event messages from a Kafka topic
i. Notification message JSON schema
b. An API for sending notifications
ii. OpenAPI v3 YAML specification document
```


## 2. Design

### 2.1 Overview

This design proposes the seperation of the current Notification capabilities (transport vs mojaloop-contextual processing) into the following components:

| Components | Description | Notes |
| --- | --- | --- |
| Notification Evt Handler | Consumes existing Notification events, then interprates (in context of Mojaloop use-cases) those events into an appropriate NotifyCmd message to some explicit receipient. This component is stateful, and will store information of the notification events and delivery reports as required. | This component is a "Central-Service" |
| Notification Cmd Handler | This is responsible for the "notification-engine" capabilities. This will consume and process Notification Command message produced by the NotificationEvt Handler. This component is stateless, and has no dependency on any persistence or caching stores. This allows for multiple pluggable Cmd Handlers to exist to handle different transports as required. | This component is a "Supporting-Service" |


...
![example](assets/diagrams/Transfers-Arch-End-to-End-with-Notify-Engine-v1.0.svg)
<!--
![example](assets/diagrams/architecture/example.svg)
-->

### 2.2. Sequence Diagram

![example](assets/sequence/seq-notify-v2-1.0.0.svg)

### 2.3 Types of Notifications

| Event | Description | Notes |
| --- | --- | --- |
| Notification | Existing Notification event currently produced by Central-Service components which is the result of some Mojaloop use-case. | . |
| NotifyCmd | Notification Command message produced by the Notification Evt Handler, which is consumed and processed by the Notification Cmd Handler. This message is generic, and can be used for any notification purposes. It is not context aware, nor does it have any knowledge of a Mojaloop use-case. It contains only the transport specific information requires to delivery the notification. | . |
| NotifyDelivered | Domain event message to broadcast Delivery reports to Central-Services. This event can be consumed by the Central-Services (currently the Notification Evt Handler) to persist this information to a store. | . |

## 3. Models

### 3.1. Schema

..

### 3.2. Examples

#### 3.2.1. Events

#### 3.2.1.a. Notification event produced by Central-Services

```JSON
{
"from": "payerfsp",
"to": "payeefsp",
"id": "aa398930-f210-4dcd-8af0-7c769cea1660",
"content": {
"headers": {
"content-type": "application/vnd.interoperability.transfers+json;version=1.0",
"date": "2019-05-28T16:34:41.000Z",
"fspiop-source": "payerfsp",
"fspiop-destination": "payeefsp"
},
"payload": "data:application/vnd.interoperability.transfers+json;version=1.0;base64,ewogICJmdWxmaWxtZW50IjogIlVObEo5OGhaVFlfZHN3MGNBcXc0aV9VTjN2NHV0dDdDWkZCNHlmTGJWRkEiLAogICJjb21wbGV0ZWRUaW1lc3RhbXAiOiAiMjAxOS0wNS0yOVQyMzoxODozMi44NTZaIiwKICAidHJhbnNmZXJTdGF0ZSI6ICJDT01NSVRURUQiCn0"
},
"type": "application/json",
"metadata": {
"event": {
"id": "3920382d-f78c-4023-adf9-0d7a4a2a3a2f",
"type": "transfer",
"action": "prepare",
"createdAt": "2019-05-29T23:18:32.935Z",
"state": {
"status": "success",
"code": 0,
"description": "action successful"
},
"responseTo": "1a396c07-47ab-4d68-a7a0-7a1ea36f0012"
},
"trace": {
"service": "central-ledger-prepare-handler",
"traceId": "bbd7b2c7-3978-408e-ae2e-a13012c47739",
"parentSpanId": "4e3ce424-d611-417b-a7b3-44ba9bbc5840",
"spanId": "efeb5c22-689b-4d04-ac5a-2aa9cd0a7e87",
"startTimestamp": "2015-08-29T11:22:09.815479Z",
"finishTimestamp": "2015-08-29T11:22:09.815479Z",
"tags": {
"transctionId": "659ee338-c8f8-4c06-8aff-944e6c5cd694",
"transctionType": "transfer",
"parentEventType": "bulk-prepare",
"parentEventAction": "prepare"
}
}
}
}
```

#### 3.2.1.b. Notification Command produced by Notificant Evt Handler

```JSON
{
"msgId": "18efb9ea-d29a-42b9-9b30-59e1e7cfe216", // Generated by the NotificationEvtHandler
"msgKey": "861b86e6-c3da-48b3-ba17-896710287d1f", // Mapped from the aggregateId, used by Kafka for Key-partitioning
"msgName": "NotifyCmd",
"msgType": 2, // DomainEvents
"msgTopic": "NotificationCommands", // Topic that the message will be published too
"msgPartition": null, // Optional partition used for publishing the message to the msgTopic
"msgTimestamp": 1607677081837, // Time of message creation
"aggregateName": "Notifications",
"aggregateId": "861b86e6-c3da-48b3-ba17-896710287d1f", // Generated by the NotificationEvtHandler
"notifyId": "3920382d-f78c-4023-adf9-0d7a4a2a3a2f", // Mapped from the metadata.event.id by the NotificationEvtHandler, used to correlate multiple NotifyCmd.
"transport": { // Transport information required by the notification-engine
"type": "HTTP", // Transport type
"method": "GET", // Optional method for the associated transport
"recipient": {
"endpoint": "http://fsp.com/parties/{{partyIdType}}/{{partyId}}}?key={{value}}", // Templated endpoint. It can be a hardcoded string with all parameters pre-rendered into the string.
"params": { // Optional template parameters
"partyIdType": "MSISDN",
"partyId": "12345",
"value": "ABCD"
}
},
"options": { // Run-time config options for the notification-engine
"deliveryReport": true, // Enable delivery-reporting
"retry": { //Retry config
"count": 3,
"type": "noDelay|exponentialDelay",
"condition": "isNetworkError|isSafeRequestError|isIdempotentRequestError|isNetworkOrIdempotentRequestError"
}
}
},
"payload": {
// Headers to be send in request. Note trace-headers (traceParent, traceState) will also included when sending out the request when provided in traceInfo section.
"headers": {
"content-type": "application/vnd.interoperability.transfers+json;version=1.0",
"date": "2019-05-28T16:34:41.000Z",
"fspiop-source": "payerfsp",
"fspiop-destination": "payerfsp"
},
// Body is optional and may be ignored depending on the transport.method
"body": "data:application/vnd.interoperability.transfers+json;version=1.0;base64,ewogICJmdWxmaWxtZW50IjogIlVObEo5OGhaVFlfZHN3MGNBcXc0aV9VTjN2NHV0dDdDWkZCNHlmTGJWRkEiLAogICJjb21wbGV0ZWRUaW1lc3RhbXAiOiAiMjAxOS0wNS0yOVQyMzoxODozMi44NTZaIiwKICAidHJhbnNmZXJTdGF0ZSI6ICJDT01NSVRURUQiCn0",
},
"traceInfo": { // Optional. Populate if trace-headers are to be be included in request headers.
"traceParent": "00-8e540e87060d56a2d2e0be5d732791e7-d96a5971b7c5cac6-21",
"traceState": "acmevendor=eyJzcGFuSWQiOiJkOTZhNTk3MWI3YzVjYWM2IiwidGltZUFwaVByZXBhcmUiOiIxNjA3Njc3MDgxNzAwIiwidGltZUFwaUZ1bGZpbCI6IjE2MDc2NzcwODE4MTkifQ==",
"service": "notification-evt-handler",
"startTimestamp": 1607677081837,
"finishTimestamp": 2007677081838
}
}
```

#### 3.2.1.c. Delivery-report Event produced by Notification Cmd Handler


```JSON
{
"msgId": "18efb9ea-d29a-42b9-9b30-59e1e7cfe216", // Generated by the NotificationEvtHandler
"msgKey": "861b86e6-c3da-48b3-ba17-896710287d1f", // Mapped from the aggregateId, used by Kafka for Key-partitioning
"msgName": "NotifyDelivered",
"msgType": 2, // DomainEvents
"msgTopic": "NotificationCommands", // Topic that the message will be published too
"msgPartition": null, // Optional partition used for publishing the message to the msgTopic
"msgTimestamp": 2007677081820, // UTC Time of message creation
"aggregateName": "Notifications",
"aggregateId": "861b86e6-c3da-48b3-ba17-896710287d1f", // Generated by the NotificationEvtHandler
"notifyId": "3920382d-f78c-4023-adf9-0d7a4a2a3a2f", // Mapped from the metadata.event.id by the NotificationEvtHandler, used to correlate multiple NotifyCmd.
"report": { // Transport information required by the notification-engine
"deliveryTimestamp": 1607677081840, // UTC Timestamp of delivery
"retryAttempts": 1, // Number of retries that were necessary to delivery the message
"response": {
"statusCode": "202", // error code from transport
"statusDescription": "Accepted", // templated endpoint
"headers": {
"content-type": "application/vnd.interoperability.transfers+json;version=1.0",
"date": "2019-05-28T16:34:41.000Z"
},
"body": "{}",
},
"accepted": true,
"errorInformation": { // Only applicable if "accepted"=false, and expected to occur if we are not able to deliver the notification due to a transport issues: connectivity, timeout or certificate.
"errorCode": "408", // Internal error code - may be the same as statusCode
"errorDescription": "ECONNABORTED\ntimeout of 2ms exceeded\nError: timeout of 2ms exceeded\n at createError (/node_modules/axios/lib/core/createError.js:16:15)\n at Timeout.handleRequestTimeout (/node_modules/axios/lib/adapters/http.js:252:16)\n at listOnTimeout (timers.js:324:15)\n at processTimers (timers.js:268:5)" // Can include a stringified stack trace.
}
},
"traceInfo": {
"traceParent": "00-8e540e87060d56a2d2e0be5d732791e7-d96a5971b7c5cac6-21",
"traceState": "acmevendor=eyJzcGFuSWQiOiJkOTZhNTk3MWI3YzVjYWM2IiwidGltZUFwaVByZXBhcmUiOiIxNjA3Njc3MDgxNzAwIiwidGltZUFwaUZ1bGZpbCI6IjE2MDc2NzcwODE4MTkifQ==",
"service": "notification-Cmd-handler",
"startTimestamp": 1607677081837,
"finishTimestamp": 2007677081838
}
}
```

## 4. References

...
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading