Fetch and update retry count from queue during run

Hi Team,

I have a transaction item in queue and if it fails i need to mark it as failed status and then pick it up in the next run (run happens every 5 mins). I need it to retry only 3 times (in different runs, not retry 3 times in the same run) and after that it should not be picked up again. For this purpose, want to understand if there is a way to fetch the current retry count from queue and update the current count back to orchestrator?

@Ajith209

in the config make the max retry number pass the value as 3

Is there a reason why it can’t be retried in current run? What you want is possible, but it would way easier to let the retries happen automatically by queue retry mechanism. If you still want to go for it, I think it could be handled by a combination of Postpone transaction item & Set transaction progress:

  • Before adding a transaction to queue, check with Get Queue Items if the item has been added earlier or not (filter with reference field), or enforce unique references in the queue.
  • When a transaction item is failed:
    • Check current retry number from Progress field. If all retries are used, set the transaction status to failed.
    • Else postpone it by a sufficient amount, so it won’t be picked up in the current run.
    • Update the current retry number to the progress field with Set progress activity.

Thanks for the reply. Yes there is a reason why i cannot retry immediately as there are other dependencies that might make it success after some time. If we are using set transaction progress will we be able to see from orchestrator how many times it retried. As we need a report at the end of the day how many times which transaction retried.

This will not work as i don’t want to retry immediately.

Yes, it’s displayed like this:

Iam able to use set transaction in progress activity once. In the second run it is throwing " Set Transaction Progress: Object reference not set to an instance of an object."when i want to add the second retry coun t.

You need to set the progress while the transaction’s status is InProgress ie. before setting it to Success/Fail or postponing it.

I am trying like that only

Check if you have many variables/arguments with the same name. The error you get means that you have a null object.

Just set the queue itself to 3 retries.

And there’s the possibility that the expression you set is null. Can you show us what you are setting as the progress?

The retries shouldn’t happen on the same run, hence there’s a need for some extra logic.

@Ajith209

instead of progress and all simply when the item fails add a new item with same data but increment the retry number which will be a item in your specific content and give a postponed time so that it is not picked in same run and also next time you can check the retrynumber count again from specific content and either add item again or end as max retry reached

hope this helps

cheers

Good suggestion, end result will be the same as in updating the Progress. Downside in this is that there will be extra items in queue.

1 Like

@efelantti

But in progress the number cannot be incremented only the status can be changed…so given this approach

Cheers

The progress can be updated as many times as needed. And to get the current progress, we can use trItem.Progress. So for incrementing it, assuming we just store the retry number in the Progress:

(CInt(trItem.Progress)+1).ToString
1 Like