# Queue

Push items into a queue and pull them out in order.

## Do things in Queue

Add a **Queue** step and choose an **Operation**. Choose the row to see the fields of each.

- [Queue Operation](https://docs.gorunner.io/apps/queue#fields-f-operate): Push items · Pull items (removes) · Peek items (keeps) · Queue length · Clear queue

Later steps read a step’s output by its name: see [Use data from earlier steps](https://docs.gorunner.io/build/use-data-from-earlier-steps).

## Limits

- Queues are kept for the workspace, in the database. **Test step** uses its own copy, apart from published runs.
- One item holds at most 16 MB.
- One pull or peek takes at most 10,000 items.

Not in your list? See [When an app isn’t here](https://docs.gorunner.io/apps/when-an-app-isnt-here#q-not-in-list).

## For developers

In the API, which calls apps pieces, Queue is `pieceId: "queue"` with `actionId: "operate"`, set by `operation`. [Get an app](https://docs.gorunner.io/api/apps/get-app) returns every field.

It can change something outside the run (`writes_external`). See [How versions and side effects work](https://docs.gorunner.io/apps#q-versions).

### Queue › Queue Operation

Push to, pull from, peek, measure, or clear a FIFO queue. The Test step uses its own copy of the queues, separate from published runs.

### Push items

- **Queue Name · Required**: Name of the queue (its key).
- **Items · Optional**: Item to push. A JSON array pushes each element as a separate item; any other value pushes one item.

### Pull items (removes) and Peek items (keeps)

- **Queue Name · Required**: Name of the queue (its key).
- **Number of Items · Optional**: How many items to pull/peek from the front of the queue. A pull whose items are more than one step may pass on (MAX_STEP_OUTPUT_BYTES, 16 MB by default) takes none and fails, so pull fewer at a time. Default: 1.

### Queue length and Clear queue

- **Queue Name · Required**: Name of the queue (its key).

Source: https://docs.gorunner.io/apps/queue
