Enqueue

Verb: enqueue

This command is used for inserting an item at the last position of a "Queue" or "Message Queue" collection.

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

Syntax

enqueue --collection(Queue<Variant>) [--isserver(Boolean)] [--priority(Numeric)] [--correlationid(String)] --value(Variant)

Inputs

Script Designer Required AcceptedTypes Description
--collection Queue Required Queue<Any> Queue in which the item is inserted.
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.
--isserver Queue Provider Optional Boolean When enabled, the queue is fetched from a queue server.
--priority Priority Optional Number Priority for each item to be enqueued.
--correlationid Correlation Identifier Optional Text Identifier responsible for distinguishing the item from the queue.
--value Inserted Item Required Any Item that should be inserted in the collection.
The inserted item must be of the same type (Text, Numeric, Boolean, etc.) as the items in the collection from the Queue parameter.

Example

Example 1: The Enqueue command inserts the item "John" at the last position of a "Queue" type collection.

defVar --name namesCollection --type Queue --innertype String --value "[Ana,Mary,Lucas,Victor]"
enqueue --collection "${namesCollection}" --value John
logMessage --message "${namesCollection}" --type "Info"
// The obtained result in "namesCollection" is: [Ana,Mary,Lucas,Victor,John].

Example 2: After obtaining a connection to the queue provider Active MQ connection, and also the "Message Queue" type variable through the Get Queue command, the Enqueue command inserts the item "Mary" at the last position of that queue.

defVar --name connection --type QueueConnection
defVar --name obtainedQueue --type MessageQueue
connectActiveMQ --queueprovider Training --fromconfiguration  connection=value
getQueue --connection ${connection} --fromconfiguration  --queue queueA obtainedQueue=value
enqueue --collection "${obtainedQueue}" --isserver  --priority 1 --value Mary

See Also

  • Check if Collection Contains