I have a work queue where i am adding my invoice details and one of the field in queue item is invoice processed date time. Since the dispatcher is controlled by a different team, we don’t have any control on that. I need to sort items based on processed date time value so that item having least value is processed first instead of normal FIFO method. Any solution / ideas ?
Please note that including deadline / priority while adding records to dispatcher is not an option. Solution should be on the processor side
Since the solution should be on the performer side, you could get all the items on the queue with “Get Queue Items” activity that will return a IEnumerable. From that, you could make a filter based on queueitems fields.
If using the orchestrator API is an option, you could use the “GetQueueItems” method to return a JSON containing all the queue items on a spefic queue (You’ll have to find the queue definition id before, but you can do that using the queue definition methods). There are a lot of things that you can play with when using the API.
For exemple, each item has a property called “CreationTime” that you could use to make your FIFO processing. To retrieve the specific item you could make use of the reference property, so after you sorted your JSON, just get the references of the items and then use the “Get Transaction Item” passing the reference as parameter of the activity.
To find more about the API, use swagger. OrchestratorURL/orchestrator_/swagger
Hope it helps.
You can use Get Queue Items and Transaction Activities together and target specific Transactions.
I’m using this approach because I have a use case where my Queue Items don’t fit any kind of SLA.
The Robot must simply process all the New items added to Queue a couple of times a day and that’s it. It really does not matter what the order is. This is how I’ve done it:
Get QueueItems into a Collection using the Get Queue Items Activity
I apply the
QueueItemStates = New filter to get only the New Items recently added to the Queue
The number of items to be retrieved is set to the Maximum allowable of 100 in the
From the output QueueItem collection, you will know the “exact” number of Transactions you have to process which will then be used to initialize a Counter for iterating through the transaction. This is because the number of QueueItems may not be always equal to the Maximum limit of 100.
Assign counter = ListQueueItems.Count()
The Next step would be to process each of the QueueItems in the collection as a Transaction.
aQueueItem = ListQueueItems(counter-1)
Use Get QueueItem Activity and apply a Reference filter on it like so:
You can see that I the aQueuItem.Reference string property with the Equals FilterStrategy has been used to target the exact Transaction
Process the QueueItem as per your requirements and then set its status to Success or Failure based on your process logic.