Integration Flow Design Guidelines for Exactly Once Scenarios
You like to ensure that a message is delivered and processed at the receiver system exactly once. Exactly Once is actually a combination of Guaranteed Delivery and Idempotent Receiver. With Guaranteed Delivery, we ensure that the message is delivered at least once, whereas an idempotent receiver ensures that duplicates are discarded.
Depending on your actual scenario and the boundary conditions, you need to apply different means to ensure quality of service Exactly Once. For instance, if your sender does not support automatic retry, you can use a JMS queue to be able to retry your messages and hence guarantee delivery of your messages. A unique ID is required to identify duplicates. This can be a message ID if the protocol used supports it, otherwise you may rely on an ID within your payload such as an order ID or a combination of an order ID and an item number.
Another capability that helps to implement scenarios with exactly once processing of your messages and which we have recently shipped in SAP Cloud Integration is the so called ID Mapper, see Define ID Mapping. The ID Mapper maps a source message ID and a context to a target message ID whereas the ID mapping is temporarily stored in the tenant database. This ensures that the already known combination of source message ID and context generates the same target message ID. A scenario that requires the ID mapper is for instance a splitter for which you need to generate a unique ID for each split item.
The splitter scenario and further scenarios have been now described in the integration flow design guidelines at Quality of Service Exactly Once. So far, we have covered the following scenarios:
- Scenario where the sender supports retry and the receiver is idempotent
- Scenario where the message protocol does not support a unique ID
- Scenario where the sender does not support a retry
- Split scenario using ID mapping
The corresponding package Integration Flow Design Guidelines – Enterprise Integration Patterns can be accessed on the SAP API Business Hub. It also comes with a Postman collection which helps you to easily run the scenarios on your own.
More scenarios will be added soon like an ID mapping scenario where sender and receiver have different ID formats, or a scenario with an XI sender adapter.
As an outlook, we plan to ship a so called idempotent process within SAP Cloud Integration that allows you to implement exactly once scenarios where the receiver is not idempotent. See this roadmap item.