Hello
I’m not working with Reframework and i want to determinate max retry number for exceptions
Is it possible? and if it is how can i do it ?
Thank you
Hey @Dhouha_Cherif
Of course yes.
You need to just use a variable or a config file or some way of saving the max retry number & call it in the workflow to check whenever there is an exception for a retry.
Note: You need to use two variables - one for MaxRetry
and the other is for CurrentRetry
Hope this helps.
Thanks
#nK
In the main workflow include a counter and increment it whenever a exception occurs and before new transaction check if the count is reached…if reached terminate else continue
Cheers
Hi @Dhouha_Cherif ,
It is possible but it needs to be fit in to the Framework or Solution Design that you are using.
What is the Design that you have implemented. Also Check the below Activity :
The above activity along with the Try Catch Should be able to implement the required mechanism for retrying and capturing the retry count.
Let us know in some more details if the provided suggestions are not in sync with your expectations.
Hi @Dhouha_Cherif,
Transaction Items obtained from Get Transaction Item activity contains within it the retry number the item has been through from previous runs. If it has not run before then the retry number is 0.
For example, assume your transaction item is the variable TransactionItem
and you want to check the number of retries/ exception it has had, then you could use:
TransactionItem.RetryNo
So now using this you can create your own logic to check if the the particular item has been through exceptions from before and depending on your design choose a cut-off number where the item should not be retried anymore and the transaction status is set to failed.
Try this-
- Use a Try-Catch activity to handle the exception that you want to retry. P
- In the Catch block, add a Sequence activity to handle the exception. Within this Sequence, add a Counter variable to keep track of the number of retries. Initialize the variable to 0 at the beginning of the workflow.
- In the Sequence, add a While activity that checks if the Counter variable is less than the maximum retry number that you want to set. If it is, then execute the code that may throw the exception again, and increment the Counter variable by 1. If the Counter variable reaches the maximum retry number, then throw the exception again to exit the While activity.
- Add a Throw activity outside the While activity to throw the exception if it still occurs after the maximum retry number.
Thanks!