• Home
  • Using a queue in a Blue Prism process

Basic steps for using a queue in a Blue Prism queue, including how to add and get data to a queue, as well as handling exceptions

Using a queue in a Blue Prism process

You first need to create a queue. Refer to the article “Setting up a Queue in Blue Prism” to see how to do this.

1. Basic steps

The process would generally be set up as per the diagram below.

Basic Queues Steps

It is common practice to store the name of the queue to be used in a Data Item.

Work Queues

2. Add data to queue

This action will take the items from a collection and add them to the queue specified. All items added are automatically assigned a unique ItemID by Blue Prism.

Work Queues

The compulsory inputs to the action are –

  • Queue Name – use the Data Item that has the name of the queue.
  • Data – the collection that has the individual items that need to be processed.
    The other inputs are optional but will have a default value if you do not provide a value
  • Defer Until – use this if you want to put items on the queue but not process them immediately. The items will be ignored until that date and time arrives.
  • Priority – by default all items will have a 0 priority which is the highest. You can allocate a lower priority using this input. The higher the number the lower the priority.
  • Tags and Status – you can use these to add any informational text to the items. That information can be used to determine the path item being processed must follow.\
    More information about Tags and Status will follow in another article.
  • Batch Size – the number of items to be placed on the queue in one batch. Use 0 if you want to process all items in one batch. The default batch size is 1000.

If you look at the queue in the Control Room after running this action you will see all the items from the collection. The only part of the actual data that you will see is the Item Key. This is the key field you provided when setting up the queue. The rest of the data from the collection does not show but has been stored in the Blue Prism database.

Work Queues

3.Get an item from the queue

This action is used to take one item from the queue. Blue Prism automatically takes the oldest item with the highest priority. It will also lock that item so that it cannot be processed by any other robot.

Work Queues

The only input you must provide is the name of the queue.

Key Filter and Tag Filter – use this to be more selective as to which item can be taken from the queue. The key field is the field you provided when setting up the queue.

More information on this will follow in another article.

This action has important outputs for which you need to provide a Data Item or Collection to store the output.

Work Queues

The outputs you must store are –

  • ItemID – as previously mentioned this is the unique ID assigned by Blue Prism. It will be used in later actions such as Mark as Complete.
  • Data – this will be the one row of the data put onto the queue in the previous step. You do not need to set up the field names for this collection since they will be automatically created by Blue Prism while the process is running. This is known as an undefined collection.

The other 2 outputs, Status and Attempts, only need to be stored if the path an item must follow depends on these values.

4. Check if you got an item

Blue Prism may not get an item from the queue in the following situation –

  1. There are no more pending items left on the queue
  2. All pending items have been deferred until a future date
  3. The queue has been paused

To know whether an item has been retrieved from the queue you need to use a decision with the expression as shown below.

Work Queues

5. Process the item

The steps to process the item are normally built on one or more sub-pages. When you need to refer to the data of that item you will use the collection you put as an output in the Get Next Item action e.g. Queue Item.

For example, if you need to check whether a piece of data is there you would set up a decision like the one below.

Work Queues

Since the Queue Item is an undefined collection you will not see the fields when you look at the list on the right. You can simply type the field name in the expression. Make sure it matches the name as per the original collection.

6. Mark as complete

If the robot gets through all the steps to process an item successfully then you need to mark that item as complete. If you do not put in this step Blue Prism will automatically mark the items you processed as exceptions when the process finishes.

Work Queues

The only input you must provide is the Data Item that stored the Item ID.

When you look at the queue in the Control Room you will see each item that is complete shows a tick on the left. You can also see the time it took to work each item.

7. Mark as an exception

It may happen that processing an item fails for some reason. To pick up these issues you need to have a Recover and Resume on the Main page. Between the 2 you need to store the Exception Details. Make sure all the steps, which deal with processing the item, are in a block with the Recover.

Work Queues

After the Resume you will have a Mark as Exception.

Work Queues

You must provide the following inputs –

  • Item ID – use the appropriate Data Item.
  • Exception Reason – use the Data Item in which you are storing the Exception Details.

It is possible to retry an item that failed. More details on how that works in a future article.