Reconciliation Support
This section explains the data reconciliation in microservice framework by generating and validating the sequence numbers.
In a distributed application, where a continuous transmission of data/event takes place from one subsystem to another, there is a possibility of data loss, due to unexpected failures during transmission.
Even though such cases are a rarity, it is the responsibility of systems involved to verify that the transmitted data is intact.
Data Reconciliation in MSF
To provide a way for reconciling transmitted event data in a microservice system, Temenos MSF makes use of the following fields, which are available in its events.
- Event source ID
- Business key
- Sequence number
Reconciliation is effectively achieved by generation and validation of sequence numbers, based on business key and event source during different stages of an event, that is, event production and consumption.
|
Field name in GenericEvent |
Field name in CloudEvent |
Description |
|---|---|---|
|
sequenceNo |
sequenceno |
Sequence number to keep track of events |
|
eventSourceId |
source |
name of originating system |
|
businessKey |
businesskey |
key to identify a business object |
Sequence Number Generation
Sequence number can be generated in the following two ways:
Sequence number can be generated by an event source system, while raising an event.
- Any system, while raising an event, can set the sequence number, business key and event source in its event data.
- The same gets forwarded to respective microservices, as it is, by ms-eventstore.
Sequence number can be generated by ms-eventstore, before forwarding the events to the respective microservices.
- To enable ms-eventstore to generate sequence number, the business key and event source id attributes should be sent as part of an event.
- Based on business key and event source id, ms-eventstore will generate a sequence number.
Sequence generation scenarios in ms-eventstore are given below:
- ms-eventstore generates sequences, if and only if, an incoming event contains business key and does not contain a sequence number.
- If an event contains both businessKey and sequenceNumber, ms-eventstore does not validate/generate/modify the sequence numbers. It forwards the request as it is.
- If an event does not contain businessKey, the sequence generation logic will not be triggered at ms-eventstore.
Sequence Number validation
From an event consumer perspective, a default method isSequenceValid() is available in Function and EventProcessor interfaces to enable MS developers in validating the sequence number in an event, based on businessKey and eventSourceId.
isSequenceValid() - method signature
default void isSequenceValid(final Context ctx) throws FunctionException
Since an empty default implementation is provided at interface level, implementing this new method is an optional requirement.
In this topic