Process logic /queues

Hello all im having a process that populate the queue → process logic-> mark completed or terminated.

the issue in the process logic we have to wait other system 5 minute to do there part.

I’m trying do all the items from the queue then wait 5 minute the complete the process but the queue will be and issue to pick the next item! with no status!
since i didn’t complete the job

Is it possible to pick the queue item twice?
or should i build two queues if yes how this will work !shall i call the second part if the process in the end!
im using the REF template

Regards

@Hazem_Saleh

Instead you can use one wueue only with different references

Eg

  1. First add queue items with say reference first and in process xaml check if reference is first
  2. If first then do the steps you want to do before wait
  3. Then after that before part is done use add wueue item and now add the same item to queue but with reference as second
  4. And on else side of if do the part which is to be done after wait

So effectively what happens in when the process first time comes to process.xaml as per if it goes to then side and add a item at the end for else side to work…so second tiem as reference is different we can do the remaining last steps…

Hope this helps

Cheers

Hi

One way is to use two queues. You would have one queue for the items that need to be processed and another queue for the items that are waiting to be completed. When you process an item from the first queue, you would mark it as “in progress” and then add it to the second queue. You would then have a separate process that monitors the second queue and completes the items in the queue after 5 minutes.

Another way to handle this situation is to use a single queue and a timer. When you process an item from the queue, you would start a timer for 5 minutes. When the timer expires, you would check the status of the item in the queue. If the item is still “in progress”, you would mark it as “completed”. If the item has already been completed, you would ignore it.

Here is a pseudocode example of how to implement the two-queue approach:

// Create two queues: one for the items that need to be processed and one for the items that are waiting to be completed.
var queue1 = new Queue();
var queue2 = new Queue();

// Process an item from the first queue.
var item = queue1.Dequeue();

// Mark the item as “in progress”.
item.Status = “in progress”;

// Add the item to the second queue.
queue2.Enqueue(item);

// Start a separate process to monitor the second queue and complete the items in the queue after 5 minutes.

Hope this helps

Cheers @Hazem_Saleh

1 Like

In the UiPath REFramework (REF), it’s not possible to pick a queue item twice from the same queue, as each queue item should ideally be processed only once. However, you can work around your scenario by adjusting your workflow and possibly using two separate queues or a different approach.

Here’s a suggested approach:

  1. Two Separate Queues:

    • You can create two separate queues in Orchestrator: one for items that need to wait for 5 minutes before processing and another for items that can be processed immediately.
  2. Queue 1 - Wait for 5 Minutes:

    • Populate Queue 1 with items that need to wait for 5 minutes before processing.
    • In your Process Logic, when you encounter an item from Queue 1, use a Delay activity to wait for 5 minutes before continuing with the processing logic.
  3. Queue 2 - Immediate Processing:

    • Populate Queue 2 with items that can be processed immediately without waiting.
    • In your Process Logic, when you complete processing an item from Queue 2, you can mark it as completed.
  4. Handling Both Queues in the REF Template:

    • Modify your REF template to handle both queues. When processing an item, check which queue it belongs to and follow the appropriate logic:
      • If it’s from Queue 1 (the “Wait for 5 Minutes” queue), wait for 5 minutes and then mark it as completed.
      • If it’s from Queue 2 (the “Immediate Processing” queue), process it immediately and mark it as completed.
  5. Workflow Control:

    • Ensure that you handle the logic to pick items from both queues as part of your overall process control. You may need to adjust the Dispatcher and Performer workflows accordingly.

This approach allows you to effectively manage items that require a 5-minute wait and items that can be processed immediately without attempting to pick the same queue item twice. It also maintains a clear separation between the two types of items.

Remember to configure your queues, transaction statuses, and exception handling in Orchestrator to match this approach and ensure proper tracking of items.

Thanks

1 Like

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