Contact Us 1-800-596-4880

MUnit Queue Event Processors

logo acb active Anypoint Code Builder

logo studio active Anypoint Studio

MUnit Queue event processors manage temporary in-memory queues during MUnit test runs, letting you enqueue and dequeue values to test asynchronous flows. All queues are cleared automatically when each test ends.

Queue

Adds the value to the queue. If not specified, the value is taken from the payload.

<munit-tools:queue>
    <munit-tools:value>#[1]</munit-tools:value>
</munit-tools:queue>

You can specify the queue’s name to which the value should be added. If not specified, the default queue will be used.

<munit-tools:queue queueName="CUSTOM_QUEUE_1">
    <munit-tools:value>#[1]</munit-tools:value>
</munit-tools:queue>

Dequeue

Removes the last element of the queue, if the queue is empty, it waits until an element is queued.

<munit-tools:dequeue/>

You can specify a timeout when waiting for an element to be queued:

<munit-tools:dequeue timeout="1000" timeoutUnit="SECONDS"/>

Like the queue operation, you can specify the queue’s name from which to dequeue. If not specified, the default queue will be used.

<munit-tools:dequeue queueName="CUSTOM_QUEUE_1"/>

Queue Size

Function that obtains the queue size.

<munit-tools:assert-that expression="#[MunitTools::queueSize()]" is="#[MunitTools::equalTo(2)]" />

Like the other operations, you can specify the queue from which to the get the size. If not specified, the default queue will be used.

<munit-tools:assert-that expression="#[MunitTools::queueSize('CUSTOM_QUEUE_1')]" is="#[MunitTools::equalTo(2)]" />