Keeping count of postpone activity?

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.

Capture

1 Like

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.

1 Like

Hey @HsDev,

To track the count of postpone actions on a queue item, You can use the progress property of Queue Tx Item.

So Please follow the below steps,

  1. You can see a new item in my queue & the item details with no progress param info.

  1. While postponing the queue item, Set the Tx Item progress with a flag or postpone count no(Im using postponecount no in this demostration). PFB

  1. Now you can also able to see the same update in orchestrator

So based on this you can track and avoid infinite loop.

Attaching xaml for ref - Qtest.zip (2.4 KB)

Hope this helps.

Feel free to get in touch for any queries.

Cheers :slight_smile:

4 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.