Deleting failed queue items if successful on retry

Hello,

Does anyone know if there is a way to delete failed queue items if the same queue item is retried and is successful? If I have a queue item that failed and then the same queue item (same queue item reference) is added again and is now successful - can I delete the failed item?

When I report on failed and successful queue items I want to avoid having the same item (failed & successful) on the report and just have the queue items that were successful with the failed items that weren’t re-tried or re-uploaded and then became successful on the second try

1 Like

Hi @cbot ,
You can use the “Get Queue Items” activity and in the “QueueItemStates” property select “Failed”, so you will get the items from the queue that have a failed status.
Adds a variable of type “IEnumerable[QueueItem]” in the “QueueItems” output property.

Now just use the “Delete Queue Items” activity to delete the items from the queue.

Thanks - I have that part down but I guess what I am struggling with is identifying queue items that have the same reference. If they do and one is failed and one is successful then delete the failed item.

Then you will need to do a search on successful items and then check if your failed item exists within your successful items list.
If it exists, add this item inside an auxiliary variable (IEnumarable[QueueItem]) and then use this variable to delete the items from the queue.

I don’t see any other way to do it, since you want to make sure that the reference had a successful execution.

Hope this helps.

Hi @cbot,

Could you tell us what do you use to report? Excel?, Insights? Kibana? Splunk? I am asking this because instead of parsing through the queue items again, you could use these other tools to quickly filter through your logs, if you have used your reference in the logs as well.

Algorithm

Get values of reference in successful items, 
Get values of reference in failed items, 

Inner join items on reference (finding intersection points)

Sort by processed time descending

Keep first occurrence, delete the rest.

We use something similar in our reporting and our log messages ensure that we capture all possible cases for a queue item and use “dedup reference” in splunk, which returns the last reported log for that reference. If it was successful, automatically the failed/retry logs are ignored.


The alternative way is as suggested by @tainan.ramos. The last time I checked there are ton of other options/methods when you handle queue items. Do check the methods you have available in addition to the one mentioned above. "QueueItem." the dot should show you all the methods.

1 Like

I am using excel to report on successful and failed items. I am not sure what you mean with Inner Join as I am basically getting all queue items and sorting them on their status.

My reporting build looks like this –
Main.xaml (53.6 KB)