How to Implement Retry Mechanism using throwExceptionForRetry service in trigger and trigger service

Hi All,

Please any one reply me with steps how to Retry Mechanism using throwExceptionForRetry service in trigger and trigger service.

Please explain me briefly development steps and property values for trigger and trigger services.

Thanks and Regards,
Anil Kumar Ellendula

Hi Anil
If you want the service to retry only for a specified number of times, you need to set the number of retries in the trigger properties and the duration after which each retry should happen. In this case you need to set one of the properties as retry until max attempts reached.
In your trigger subscribing service u need to take a variable(retry) and set it as ‘false’ as the first step in your try block. In your catch block you need to retrieve the current retryCount and maxRetries from trigger properties by using wm public service pub.flow.getRetryCount. Also, you need to write a logic to set this variable(retry) as true when the retryCount is less then maxRetryCount in your catch block. When retryCount = maxRetryCount , invoke/implement your error handler.
In the finally block you need to invoke throwException for retry only when variable(retry) is = ‘true’. if you are doing clearPipeline do remember to preserve the same.

Regards
Anuj

1 Like