Is there any way to keep count of the postpone activity?
I’m also having trouble with the deadline getting reset through every run.
I have a switch statement in my script that catches only certain business rule exceptions.
If it catches any of the exceptions that can be postponed, and depending on the exception type, it sets the number of days this transaction should be postponed.
An example would be if the account wasn’t created yet, I would want to retry in 2 days, but for an account that is on vacation I would want to retry in one week.
So the amount of time it needs to be postponed is variable.
The switch statement, sets up this amount of time, and the deadlines to which they should then stop trying.
So if the business exception keeps occuring there is no way for it to stop.
It just keeps retrying the script and resetting the deadline further and further out every time it runs.
I need a way to make it only try up to 3 times, so I can then throw the final received exception. I was thinking the best way to do this would be to somehow get the transactionItem.RetryNo But that never gets set and it’s null when I try to call it. I’m not sure how to set it though.
If you want to catch a particular type of BusinessRule Exception, you can try with the below logic, by catching this particular exception you can further work on postpone logic in the catch block…
While throwing :
try{
new BusinessRuleException(“Throwing with customized message”)
}catch{
if ( exception.ToString.Equals(“Throwing with customized message”)
{
// perform your logics
}
}
So even if I’m to do that, and I catch the exception then handle it, What I would do to handle it would be to change the amount of time it’s postponed. What I’m wondering is, after it has postponed, how am I going to stop it from running over and over again.