Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #1869 Design for reliable notifications on finalization of a transfer #288

Open
wants to merge 44 commits into
base: master
Choose a base branch
from

Conversation

Copy link
Contributor

@lewisdaly lewisdaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @mdebarros (and team).

A couple thoughts in addition to my inline comments:

  1. I would like to see examples and schemas of the NotifyCMD for other transports
  2. Related to the above, requiring the notification command handler is a noble goal, and to do this properly, we need to make sure we have a good understanding of the requirements so we can design the messages from the Notification Evt Handler with the appropriate level of detail.

@mdebarros
Copy link
Member Author

Thanks @lewisdaly for the feedback!

See my inline comments below:

This looks great @mdebarros (and team).

A couple thoughts in addition to my inline comments:

  1. I would like to see examples and schemas of the NotifyCMD for other transports
    I would prefer to create the schema once the overall architecture approach has been given the DA node. Let me know if you feel that the definition for this schema is vital to achieving said nod.
  1. Related to the above, requiring the notification command handler is a noble goal, and to do this properly, we need to make sure we have a good understanding of the requirements so we can design the messages from the Notification Evt Handler with the appropriate level of detail.
    Agreed. That is exactly the kind of feedback I hope to receive from the DA. Validating the documented requirements, and also identifying any that I may have missed.

…re/#1869Designforreliablenotificationsonfinalizationofatransfer
1. Added schemas for both types of Domain and Command events
2. Updated SD to show validation of transport-types and content-types
3. Fixed typos
@mdebarros mdebarros closed this Mar 9, 2021
@mdebarros mdebarros reopened this Mar 9, 2021
…forreliablenotificationsonfinalizationofatransfer
…onofatransfer' of github.com:mojaloop/documentation into feature/#1869Designforreliablenotificationsonfinalizationofatransfer
Copy link
Contributor

@lewisdaly lewisdaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few other thoughts and questions for your consideration @mdebarros


| State | Description | Notes |
| --- | --- | --- |
| received | Indicates that the NotifyCmd event has been received by the Notification Cmd Handler. | |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better word than received here? At first glance through the diagrams I assumed received meant "received by the intended recipient", as opposed to "received by the Notification Cmd Handler"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about pending?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's better, although pending and in-progress have similar meanings then. Maybe we could change received to pending and in-progress to processing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I will make this change.

"NotificationCommands"
]
},
"msgPartition": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required? If so, should it have a different type than null?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. It's optionally, so I can remove it from the example. It allows one to override the Kafka partition.

It allows the partitioning to be managed at the application level if required. It was a pretty useful attribute in the Perf PoC. It can be removed.

"endpoint"
],
"properties": {
"endpoint": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The endpoints + params templating looks like it adds a lot of complexity. Does it need to be a part of this? Or could it be handled by a different component? Why can't the ml-api-adapter just spit out an already resolved endpoint?

Copy link
Member Author

@mdebarros mdebarros Mar 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can. Both are supported.

The original idea was to pass additional attributes into the Notification Engine, and also reduce duplicate fields/data by using a templated URI. Using a template in the URI is optional.

It's also possible to still pass parameters even without a template URI as they will be ignored, and thus pass additional attributes to the Notification Cmd Handler which may be useful for future customization.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Yeah I'm not too fussed about this, but templating looks like it adds more complexity, and muddies the water a little bit about which component is responsible for generating valid URLs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. It's worth pointing out that it is not difficult to add or remove this functionality.

However, I still believe it's better to not duplicate data....so I am still a fan of the template approach :D

},
"additionalProperties": false
},
"traceInfo": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should trace info also be duplicated in the headers? Or will the Notification Event Handler take care of this for us?

Copy link
Member Author

@mdebarros mdebarros Mar 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be handled by the Cmd Handler. It would re-generate the tracing headers with the most recent trace meta-state before sending out the notification.

There is also an argument for it to be handled by the Callback Handler instead. I am leaning towards the first as it will increase the breadth of the trace (i.e. more components that are included in the trace).

Copy link
Contributor

@lewisdaly lewisdaly Apr 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think I understand. I'm a little wary of messages containing redundant parameters (ie. both in the payload.headers and traceInfo fields). Could there be a case where we could have misaligned trace metdata between those 2 fields?

Copy link
Member Author

@mdebarros mdebarros Apr 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think I understand. I'm a little wary of messages containing redundant parameters (ie. both in the payload.headers and traceInfo fields). Could there be a case where we could have misaligned trace metdata between those 2 fields?

The headers you see in the example are originally from what was received by the Hub, as such they do NOT reflect the current trace state that is stored within the trace meta-data portion of the message. The propagation of incoming request headers is managed by the API Adapter, so it would be responsible for including or deleting them...the idea being that the incoming request would be "persisted" as-is without any modifications. The outgoing headers are generally mapped from the incoming headers, but certain headers will be deleted or replaced...in this case, the trace headers will be replaced before sending the notification, so I do not see this as an issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for clearing that up.


| Components | Description | APIs | Notes |
| --- | --- | --- | --- |
| ML-Adapter Callback Handler | This component understands the context and semantics of the FSPIOP Specification. Consumes existing Notification (internal) events, then interprets (in context of Mojaloop use-cases) those events into an appropriate event message to some explicit recipient. Also handles feedback loop and compensating actions (defined by configurable rules) from Delivery Reports. It must also resolve any notification details required (i.e. URLs, transport type, etc) by querying the Central-Service's Admin API. This component is pluggable, and the design supports the possibility of several Callback Handlers existing for several specific transports or alternatively to support different context languages like ISO 20022. | N/A | This component is part of the "ML-API-Adapter" |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could there be a need to de-duplicate notification events from central services before they get put on the ml-adapter's notification event que?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not aware of such a requirement, but this is possible. It is also possible to use Kafka to handle this with its "compaction" feature. Perhaps something to be raised in the next DA or Ref Arch meeting?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not a requirement, then lets not make more work for ourselves ;). I guess maybe we need to be clear (or maybe we are clear in some documentation somewhere that I'm not aware of) that there is never a case where the central-ledger could create 2 duplicate notification events.

@mdebarros mdebarros marked this pull request as ready for review April 7, 2021 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants