Dequeue

Verb: dequeue

Removes the first item from a "Queue" or "Message Queue" collection.

Collections are enumerable data structures that can be accessed using indexes and keys.

Syntax

dequeue --collection(IQueue<Variant>) [--handleerror(Boolean)] (Boolean)=success (Variant)=value

Inputs

Script Designer Required AcceptedTypes Description
--collection Queue Required IQueue<Any> Queue with the item that should be removed.
In this parameter, in addition to the “Queue” type collection, the “Message Queue” type, which originates from the connection to a queue provider, is also accepted. To manipulate a “Message Queue” variable, it must be obtained from the Queue Obtained parameter of the Get Queue command.
--handleerror Handle Error Optional Boolean When enabled, if an error occurs during the command execution, the current script will not fail and information regarding that error are returned on the Output. If it is not enabled, the script will failed when an error occurs.

Outputs

Script Designer AcceptedTypes Description
success Success Boolean Returns "True" if the item was successfully removed from the queue, or "False" otherwise.
value Removed Item Any Returns the item removed from the queue.

Example

Example 1: The Dequeue command removes the first item from a queue and stores the value in the variable "removedValue".

defVar --name namesCollection --type Queue --innertype String --value "[Ana,Maria,Lucas,Victor]"
defVar --name removedValue --type String
dequeue --collection "${namesCollection}" removedValue=value
logMessage --message "Removed Value: ${removedValue}" --type "Info"
// Removed Value: Ana.

Example 2: After the Active MQ connection command obtains a connection to the queue provider and the "Message Queue", the Dequeue command will remove the first item from that " Message Queue ".

defVar --name connection --type QueueConnection
defVar --name obtainedQueue --type MessageQueue
defVar --name removedValue --type String
connectActiveMQ --queueprovider Training --fromconfiguration  connection=value
getQueue --connection ${connection} --fromconfiguration  --queue queueA obtainedQueue=value
dequeue --collection "${obtainedQueue}" removedValue=value

See Also

  • Count Items
  • Get Item from Stack or Queue
  • Get List Item
  • Pop
  • Remove Items from Collection