Store-and-Forward Queues
When an {{glossary.originating system}} wants to finalise or reverse a transaction it does this by sending an advice message in the form of a confirmation message or a reversal message, respectively.
Advice messages are important because they ensure that all entities have the same view of the final state of the transaction. It is therefore essential that they reach their intended destination.
Electrum uses store-and-forward (SAF) queues to guarantee that an advice message will reach the {{glossary.upstream}} system, ensuring that no messages are lost when, for example, an upstream system is offline and temporarily unable to receive messages.
The SAF queue allows for the sending of messages after the consumer has left the store – the consumer does not have to wait around for a finalisation step that might take some time.
SAF Process
The SAF queue works as follows (see diagram below for an illustration).
- The originating system generates an advice message to confirm or reverse a transaction.
- The advice message is stored in a SAF message repository.
- There is usually at least one SAF queue per upstream provider, per service. Messages join the queue in the order of the time they were generated. Confirmations and reversals can exist in the same queue.
- The SAF queue delivers the messages to the destination in the order in which they were added.
- The oldest messages are in the processing window at the head of the queue. The system delivers these messages first, while later messages remain lower down in the queue.
- If the system receives an acknowledgement for a given advice message, then that message set is considered complete. The message moves out of the processing window and out of the SAF queue. This frees up space for later messages to move up the queue and eventually into the processing window for delivery.
- If a sent message does not receive acknowledgment for whatever reason, the system will resend the message at regular intervals, until the acknowledgement is received. The unacknowledged message stays in the processing window during this time. Electrum will only stop resending the message when the acknowledgement is received. The message will then move out of the SAF queue and the next message in the queue will move up into the processing window.
The originating system itself may or may not use a SAF queue to send messages to Electrum.
As long as at least some messages are moving out of the processing window, then the message queue can keep moving along and the system can continue delivering new advice messages.
SAF Queue Error Handling
If there are no incoming responses to the messages in the processing window, this may mean one of the following:
- There are network problems that prevent messages being sent.
- The service provider has a fault that prevents them from responding.
- There is a fault that prevents the reattempted messages or their responses from being processed.
This leads to the messages in the processing window being stuck there (as they cannot leave until they receive an acknowledgement). This leaves no space for other messages in the queue to enter the processing window, so the queue builds up and doesn't move.
If our customers are using the Electrum-provided monitoring tools, they may notice the queue build-up. In that case, they should contact the Electrum support team. However in most cases Electrum receives automated alerts to proactively investigate issues, which could be handled in the following ways:
- If we see that the service provider isn’t responding we will contact them and troubleshoot connectivity.
- If there are no connectivity issues, we will investigate further.
- If the problem is still not resolved, Electrum will manually abort the message, which frees up space for other messages to move up into the processing window. We will inform our integration partners of this action and share the message identifiers so that any discrepancies can be resolved during reconciliation.
Recommended SAF Queue Setup
When implementing a SAF queue to deliver advices upstream to Electrum, the following parameters should be considered:
- Over what period of time should the SAF queue operate?
The longer the maximum operational period, the higher the likelihood of the advice being successfully received by an entity upstream.
- How many times should the SAF queue attempt to deliver an advice before aborting in the instance that no response is ever provided.
The greater the frequency of messages sent, the higher the likelihood of the advice being successfully received by an entity upstream.
- What should the time period between each SAF queue message be set to?
It is important to set a period between repeated advice messages delivered by the queue that is long enough for a response to be delivered from upstream, but short enough to ensure a timeous response.
Electrum recommends the following ranges for each of the above parameters:
- Maximum operation length: 4 -> 8 hours
- Period between sent advices: 15 seconds minimum -> 60 seconds maximum
- Maximum number of delivered messages: A function of the maximum operation length and period between sent advices.