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(mojaloop/#3488): enable batch processing #415

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8cf54d3
feat: added seq diagrams for binning fulfil and prepare
vijayg10 Sep 1, 2023
b5a0d2e
feat: added seq diagram for abort with partial changes
vijayg10 Sep 1, 2023
c9ca8a5
chore: render diagrams for ease of view
kleyow Sep 1, 2023
3abb86f
fix: refactored abort action messages
vijayg10 Sep 4, 2023
315f68f
feat: updated binning sequence diagram
vijayg10 Sep 4, 2023
6f05888
feat: added rev2 of binning diagram
vijayg10 Sep 4, 2023
dd6d24f
feat: changes in binning seq
vijayg10 Sep 5, 2023
acd4ec7
feat: update seq diagrams
vijayg10 Sep 5, 2023
4c4ada0
feat: restructured the files
vijayg10 Sep 5, 2023
d962592
chore: some file name changes
vijayg10 Sep 6, 2023
4a8bfc1
feat: added overview
vijayg10 Sep 6, 2023
c1e1ea9
feat: updated seq diagrams
vijayg10 Sep 6, 2023
cc84ec8
chore: re-organised filenames and diagram numbers
vijayg10 Sep 7, 2023
971e84d
feat: refined seq diagrams
vijayg10 Sep 7, 2023
1b38ec0
Update docs/technical/central-ledger/assets/diagrams/sequence/seq-pos…
vijayg10 Sep 11, 2023
9af8f4f
Update docs/technical/central-ledger/assets/diagrams/sequence/seq-pos…
vijayg10 Sep 11, 2023
4318852
fix: addressed PR comments
vijayg10 Sep 11, 2023
1bf4195
fix: build issues
vijayg10 Sep 11, 2023
cd2d40a
fixes for legacy-build issues
mdebarros Sep 12, 2023
b63f436
fix: fixed design diagram for batching
vijayg10 Sep 27, 2023
cb7ab69
Merge branch 'feat/3488-enable-batch-processing' of https://github.co…
vijayg10 Sep 27, 2023
a44c197
fix: updated design diagram for batching
vijayg10 Oct 4, 2023
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
4 changes: 4 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,10 @@ module.exports = {
}
]
},
{
title: "Position Handler Bin Support",
path: "central-ledger/transfers/1.3.4-position-handler-consume-binning"
},
]
},
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/'*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>

* Vijay Kumar Guthi <vijaya.guthi@infitx.com>

--------------
******'/

@startuml
' declate title
title 1.3.4.1. Position Messages Binning

autonumber

' Actor Keys:
' boundary - APIs/Interfaces, etc
' collections - Kafka Topics
' control - Kafka Consumers
' entity - Database Access Objects
' database - Database Persistence Store

' declare actors
control "Position Handler" as POS_HANDLER

entity "Domain Bin Processor" as BIN_PROCESSOR
entity "Prepare Domain" as DOMAIN_PREPARE
entity "Fulfil Domain" as DOMAIN_FULFIL
entity "Abort Domain" as DOMAIN_ABORT
entity "Timeout Domain" as DOMAIN_TIMEOUT
entity "Transfer Facade" as FACADE_TRANSFER
entity "Account Facade" as FACADE_ACCOUNT
collections "Notification-Topic" as TOPIC_NOTIFICATIONS
' database "Central Store" as DB

box "Central Service" #LightYellow
participant POS_HANDLER
participant BIN_PROCESSOR
participant DOMAIN_FULFIL
participant DOMAIN_ABORT
participant DOMAIN_TIMEOUT
participant DOMAIN_PREPARE
participant FACADE_TRANSFER
participant FACADE_ACCOUNT
' participant DB
participant TOPIC_NOTIFICATIONS
end box

' start flow
activate POS_HANDLER
group Position Handler Consume
POS_HANDLER -> POS_HANDLER: Consumes messages from the Position topic \nand stores them in memory
loop for each message in the list
POS_HANDLER -> POS_HANDLER: Assign message to account-bin by accountID and child action-bin by event-action\n (References to the messagses to be stored in bins, no duplication of messages)
POS_HANDLER -> POS_HANDLER: Audit message
end
group <color #blue>DB TRANSACTION</color>
POS_HANDLER -> BIN_PROCESSOR: Call Bin Processor with the list of account-bins

BIN_PROCESSOR -> FACADE_TRANSFER: Pre Bulk fetch all transferStateChanges for all the transferIds in the account-bin
BIN_PROCESSOR -> FACADE_ACCOUNT: Pre Bulk fetch all position and settlement account balances for the account-bin\nAcquire lock on position

loop for each account-bin in the list
note right of BIN_PROCESSOR #lightblue
**Note**: Order of processing for various actions
1. Fulfil - Work in progress is first priority
2. Abort & Timeout - Freeing funds for future transfers is priority before tackling new requests
3. Prepare - Processing new requests is last priority
end note

BIN_PROCESSOR -> DOMAIN_FULFIL: Process Fulfil Bin
note right of BIN_PROCESSOR
Input: Bin, Pre-fetched account balances and transferStateChanges
Output: Accumulated changes in position and transferStateChanges
end note
activate DOMAIN_FULFIL
DOMAIN_FULFIL --> BIN_PROCESSOR: Result
deactivate DOMAIN_FULFIL

BIN_PROCESSOR -> DOMAIN_ABORT: Process Abort Bin
note right of BIN_PROCESSOR
Input: Bin, previously accumulated account balances and transferStateChanges
Output: Accumulated changes in position and transferStateChanges
end note
activate DOMAIN_ABORT
DOMAIN_ABORT --> BIN_PROCESSOR: Result
deactivate DOMAIN_ABORT

BIN_PROCESSOR -> DOMAIN_TIMEOUT: Process Timeout Bin
note right of BIN_PROCESSOR
Input: Bin, previously accumulated account balances and transferStateChanges
Output: Accumulated changes in position and transferStateChanges
end note
activate DOMAIN_TIMEOUT
DOMAIN_TIMEOUT --> BIN_PROCESSOR: Result
deactivate DOMAIN_TIMEOUT

BIN_PROCESSOR -> DOMAIN_PREPARE: Process Prepare Batch
note right of BIN_PROCESSOR
Input: Bin, previously accumulated account balances and transferStateChanges
Output: Accumulated changes in position and transferStateChanges
end note
activate DOMAIN_PREPARE
DOMAIN_PREPARE --> BIN_PROCESSOR: Result
deactivate DOMAIN_PREPARE
BIN_PROCESSOR -> FACADE_TRANSFER: Bulk insert accumulated transferStateChanges
BIN_PROCESSOR -> FACADE_TRANSFER: Bulk get the transferStateChangeIds for transferids using select whereIn
BIN_PROCESSOR -> BIN_PROCESSOR: Mutate accumulated positionChanges with transferStateChangeIds
BIN_PROCESSOR -> FACADE_ACCOUNT: Bulk insert accumulated positionChanges
end

BIN_PROCESSOR --> POS_HANDLER: Return bins with results
alt return is true
POS_HANDLER -> POS_HANDLER: Commit Kafka Offset
POS_HANDLER -> POS_HANDLER: Commit DB Transaction
loop for each result in the account-bin
POS_HANDLER -> POS_HANDLER: Produce notification message
POS_HANDLER -> POS_HANDLER: Audit notification
end
else return is false or unhandled exception
POS_HANDLER -> POS_HANDLER: Rollback DB Transaction
POS_HANDLER -> POS_HANDLER: Audit error
end
end
end
deactivate POS_HANDLER
@enduml
Loading