Postpone queue items after X times

I want to postpone a queue item that is caught through a BRE for 5 times, if after 5 times of postponing still throwing BRE, then the status will change to Failed. I am using REFramework. How can I do this?

You need to keep track of how many times you have postponed the item. One way is by adding a count to the transaction item itself using the Set Transaction Progress activity:

  • Get the transaction’s current progress by CInt(transactionItem.Progress). If you get an empty or null string, consider it as 0.
  • Check if the progress is over your threshold.
    a) True → set status to failed
    b) False → Postpone.
  • Before the Postpone transaction activity, use the Set Transaction Progress to increment the progress value by 1.

1.In your ReFramework, add a counter variable, let’s call it BRECounter , to keep track of how many times the BRE occurs for a specific queue item. Initialize this counter to 0
BRECounter = 0

2.inside the Process state) to include the logic to catch and handle the BRE:

a. After catching the BRE, increment the BRECounter by 1.

b. Check if BRECounter is less than or equal to 5. If it is, postpone the queue item and continue processing the next queue item. Use the “Set Transaction Status” activity to postpone the item. You can set the RetryNumber field to BRECounter to indicate how many times the item has been postponed.

c. If BRECounter is greater than 5, set the TransactionStatus to “Failed” and log an error. Use the “Set Transaction Status” activity to change the status to “Failed.”

condition like this :

If BRECounter <= 5
Postpone the queue item
Set TransactionStatus to “Failed”
End If


It’s good to note that this solution only works if the postpone time is small enough for the item to be reprocessed in the same process run. Also to me it seems that the counter would not be specific to a certain queue item.

if counter is not specific to a particular queue item, you’ll need to make some adjustments:

  1. Create a dictionary or a collection to store individual counters for each queue item that encounters a BRE. The dictionary should use the queue item’s unique identifier as the key.
    2.Within your Process.xaml in the ReFramework, when a BRE occurs for a specific queue item, retrieve the corresponding counter from the dictionary, increment it, and check if it’s reached the limit (e.g., 5).
  2. If the counter for the specific queue item is less than the limit, postpone the item and update the counter for that item in the dictionary. This ensures that the count is specific to the queue item.
    4.If the counter for a specific queue item reaches the limit, you can set the transaction status to “Failed” for that item, log the failure, and handle it accordingly.

you can try this it will work if the count is not specific


Thank you for replying, do give me some time to test your suggestion! :grinning:

Thank you for replying, i will try both of your suggestion and do give me some time to test your suggestion! :grinning:

let me know its working


thank you! this is the easiest thing to play around with. Ive made some adjustments, if the specific BRE is caught, then it would increment the TransactionItem.Progress, normal BRE would flow normally without increment the TransactionItem.Progress.

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