Skip to main content

One post tagged with "How to add data to the queue?"

View All Tags

How to add data to the queue?

· 4 min read
Selin Gizem Özkan
RPA Developer

A queue is a container that enables you to hold an unlimited number of items. Queue items can store multiple types of data. A queue is usually considered a list of pending jobs executed by priority or other criteria related to the underlying order in which several jobs are executed.

In this case, we will explore how to use the 'queue' package and its nodes in the flow.

How to Setup?

To begin, Login to your Robomotion workspace. If you haven't registered yet, you can create your workspace from the provided link.

About Queue Package

The Queue package consists of six node options that enable you to easily manage your files within your workflow.

Nodes

How can a new queue be created by accessing queues through the Admin Console?

  1. To begin, login in to your Robomotion workspace.
  2. Click on "Queues" in the Admin Console.
  3. Click on "Create Queue."
  4. Enter the Name and description for the queue you are creating.

Create Queue

  1. Click "OK." The queue has been created.

The queue

  1. Let's create a stream to add data to the queue we've created.

What is the 'Add Item' node?

You can add items to the queues you've created using the 'Add Item' node. Enter the data you want to add in the input field of the node. You can choose the priority for the items. The options for priority in the node are Low, Normal, and High.

To use this node, credentials must be selected. To set up credentials, follow the steps below:

  1. Click on 'Vaults'.
  2. Click on 'Create Vault'.
  3. Enter the name and description for the vault.
  4. Click on 'Create'.
  5. Copy the generated secret key.
  6. Click on 'Create Item'.
  7. Select 'RSA Key Pair'.
  8. Click 'Save' and then 'Close'.
  9. Inject the created vault into the robot.

Now, you can add items to the queues with the 'Add Item' node, and the credentials are set up for node usage.

Flow Steps

  1. The "Inject" node is used to initialize the flow.
  2. Add a function node to define the objects you want to add to the queue.

Function Node Named “Set Items”:

msg.item1 = {
'name': 'item1'
}
msg.item2 = {
'name': 'item2'
}
msg.item3 = {
'name': 'item3'
}

return msg;
  1. We use the 'Add Item' node to add the objects item1, item2, and item3 defined within the function to the queue with different priority levels.
  2. Input the items you want to add from the function into the 'Add Item' node.
  3. Enter the queue name information in the Options field.
  4. Select the priority for the item to be added
  5. Credentials are selected.

Add Item Node

  1. Sequentially, item1, item2, and item3 are added using the 'Add Item' node with priority levels of Normal, High, and Low, respectively.

  2. Stop the flow with the "Stop" node.

Add Item Queue Flow

  1. You can view the added objects in the 'New' section of the queues in the Admin Console.

Admin Console

  1. Let's examine how the objects added to the queue are processed within the flow.

Flow Steps

  1. Inject node is used to initialize the flow.
  2. Retrieve the added objects using the 'Get Next Item' node.
  3. In the 'Options' field of the 'Get Next Item' node, enter the queue name and credential information.

Get Next Item Node

  1. You can see which object is being processed using the Debug node.
  2. You can observe that the object with a high priority level is processed first. In this example, item2 is present in the output of the Debug node.
  3. When you check the queues in the Admin Console, you can see that there is a value of 1 under In Progress.

Admin Console Progress

Get Next Item Queue Flow

Here you can access the complete flow by clicking on the following link:

https://casestudies.robomotion.io/designer/shared/NR94m16G4DYewvFPEPCYqv

https://casestudies.robomotion.io/designer/shared/TYiDnGwWU17asUasyySTTg