How to send Email Notifications only on the Last Retry Attempt in SAP CI/IS when using AEM

Estimated read time 5 min read

Introduction: 

In SAP Cloud Platform Integration (CPI) or Integration Suite, handling retries effectively is crucial for ensuring smooth and reliable message processing. One common requirement in integration scenarios is sending email notifications only when a certain condition is met- such as after the last retry attempt. This helps in reducing notification overload while ensuring that stakeholders are only alerted when necessary.

When using the Advanced Event Mesh (AEM) Sender, you can leverage event driven communication to handle retries in a more controlled manner. In this blog, we will explore how to configure SAP CPI to send email notifications only after the final retry attempt, using the AEM Sender adapter. This solution not only streamlines the notification process but also ensures that notifications are sent only when the retry attempts have been exhausted, making the system more efficient and less intrusive.

Use Case Overview:

In this use case, we will demonstrate how to configure an integration flow using the Advanced Event Mesh (AEM) Sender to consume messages from a queue. The primary goal is to handle retry logic in such a way that an email alert is sent only after the final retry attempt is reached, ensuring notifications are triggered only when necessary.

Integration Flow:

Below is a sample Integration Flow created to route email alert only on the last retry attempt.

 

Important note: Make sure to use * in the Allowed headers as shown, to ensure that the full set of headers is received from the AEM sender.

 

 

 

 

 

Now, let’s discuss the basic configuration.

For guidance on configuring the AEM sender channel, refer to SAP help or other relevant blogs. In this example, we have set the Maximum Message Processing Attempts to 3, and our goal is to send an alert only on the third (final) retry attempt.

This is achieved by using the “LocalProcessingAttempt” header, which is dynamically set during runtime based on the number of attempts. Initially, the AEM sender sets this header to 1 as shown below, and it increments with each subsequent retry.

In the local sub-process, we use a router to define the routing condition as ${header.LocalProcessingAttempt} > ‘2’. This means that once the attempt exceeds 2, the flow will follow the path where the email receiver is configured.

Note: To make the retry attempt dynamic, you can substitute the value 2 with a property that we can set in a content modifier before router.

Conclusion:

 With the use of the “LocalProcessingAttempt” header and routing conditions, you can tailor the retry logic to suit specific business needs and enhance the overall efficiency of your integration processes.By configuring the integration flow to send email alerts only on the final retry attempt, you can significantly reduce unnecessary notifications and focus attention on the most critical events. This method provides better control over communication in your SAP CPI environment, ensuring that stakeholders are only alerted when all retry options have been exhausted.

 

 

 

​ Introduction: In SAP Cloud Platform Integration (CPI) or Integration Suite, handling retries effectively is crucial for ensuring smooth and reliable message processing. One common requirement in integration scenarios is sending email notifications only when a certain condition is met- such as after the last retry attempt. This helps in reducing notification overload while ensuring that stakeholders are only alerted when necessary.When using the Advanced Event Mesh (AEM) Sender, you can leverage event driven communication to handle retries in a more controlled manner. In this blog, we will explore how to configure SAP CPI to send email notifications only after the final retry attempt, using the AEM Sender adapter. This solution not only streamlines the notification process but also ensures that notifications are sent only when the retry attempts have been exhausted, making the system more efficient and less intrusive.Use Case Overview:In this use case, we will demonstrate how to configure an integration flow using the Advanced Event Mesh (AEM) Sender to consume messages from a queue. The primary goal is to handle retry logic in such a way that an email alert is sent only after the final retry attempt is reached, ensuring notifications are triggered only when necessary.Integration Flow:Below is a sample Integration Flow created to route email alert only on the last retry attempt. Important note: Make sure to use * in the Allowed headers as shown, to ensure that the full set of headers is received from the AEM sender.     Now, let’s discuss the basic configuration.For guidance on configuring the AEM sender channel, refer to SAP help or other relevant blogs. In this example, we have set the Maximum Message Processing Attempts to 3, and our goal is to send an alert only on the third (final) retry attempt.This is achieved by using the “LocalProcessingAttempt” header, which is dynamically set during runtime based on the number of attempts. Initially, the AEM sender sets this header to 1 as shown below, and it increments with each subsequent retry.In the local sub-process, we use a router to define the routing condition as ${header.LocalProcessingAttempt} > ‘2’. This means that once the attempt exceeds 2, the flow will follow the path where the email receiver is configured.Note: To make the retry attempt dynamic, you can substitute the value 2 with a property that we can set in a content modifier before router.Conclusion: With the use of the “LocalProcessingAttempt” header and routing conditions, you can tailor the retry logic to suit specific business needs and enhance the overall efficiency of your integration processes.By configuring the integration flow to send email alerts only on the final retry attempt, you can significantly reduce unnecessary notifications and focus attention on the most critical events. This method provides better control over communication in your SAP CPI environment, ensuring that stakeholders are only alerted when all retry options have been exhausted.     Read More Technology Blogs by Members articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author