Press "Enter" to skip to content

How To ensure exclusive message transfers with SAP Cloud Integration

0

Situation: You want to make sure that only one instance of an integration flow is active at the same time (exclusivity). Any additional (incoming) message shall be refused (be it triggered by a sender or by a timer event)

Solution: Use the Datastore to make sure your iflow is executed only once at the same time:

Use a Local Integration Process to only catch errors of writing if entry already exists
Make sure “Overwrite Existing Message” is unchecked
Return the error to sender in case of error
Return the error to sender in case of error
Set a custom status because the main status is set to COMPLETED
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;

def Message processData(Message message) {
	def messageLog = messageLogFactory.getMessageLog(message);
	def error = message.getHeaders().get("Error");       
        if(messageLog != null){
                messageLog.addCustomHeaderProperty("Error", error);   
        }
        return message;
}
Delete the entry from the Datastore after processing, e.g. by using a Sequential Multicast
Delete from Datastore Step

Monitoring

Datastore Monitoring
Error Message in Postman
Message Monitor in SAP Cloud Integration with Custom Status & Error Message as Custom Header
Print Friendly, PDF & Email