---
title: "Phalcon Queue"
version: "5.20"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.phalcon.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Phalcon Queue

:::info[NOTE]
All classes are prefixed with `Phalcon`
:::

## Queue\AdapterFactory

Class

Maps an adapter name to its ConnectionFactory. Mirrors
Phalcon\Storage\AdapterFactory.

- [`Phalcon\Factory\AbstractConfigFactory`](/5.20/api/phalcon_factory/#factoryabstractconfigfactory)
- [`Phalcon\Factory\AbstractFactory`](/5.20/api/phalcon_factory/#factoryabstractfactory)
- **`Phalcon\Queue\AdapterFactory`**

`Phalcon\Config\ConfigInterface` · `Phalcon\Contracts\Queue\ConnectionFactory` · `Phalcon\Contracts\Queue\QueueTypes` · `Phalcon\Factory\AbstractFactory` · `Phalcon\Queue\Adapter\Beanstalk\BeanstalkConnectionFactory` · `Phalcon\Queue\Adapter\Memory\MemoryConnectionFactory` · `Phalcon\Queue\Adapter\Redis\RedisConnectionFactory` · `Phalcon\Queue\Adapter\Stream\StreamConnectionFactory` · `Phalcon\Queue\Exceptions\Exception`

### Method Summary

<ApiItem href="#queueadapterfactory-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"array","name":"services","default":"[]"}]}>
AdapterFactory constructor.
</ApiItem>
<ApiItem href="#queueadapterfactory-newinstance" visibility="public" name="newInstance" returnType="ConnectionFactoryInterface" params={[{"type":"string","name":"name","default":null},{"type":"array","name":"options","default":"[]"}]}>
Creates a new ConnectionFactory for the named adapter.
</ApiItem>
<ApiItem href="#queueadapterfactory-getexceptionclass" visibility="protected" name="getExceptionClass" returnType="string" params={[]}>
Returns the exception class for the factory
</ApiItem>
<ApiItem href="#queueadapterfactory-getservices" visibility="protected" name="getServices" returnType="array" params={[]}>
Returns the available adapters.
</ApiItem>

### Methods

<h4 id="queueadapterfactory-__construct"><code>__construct()</code></h4>

```php
public function __construct( array $services = [] );
```

AdapterFactory constructor.

<h4 id="queueadapterfactory-newinstance"><code>newInstance()</code></h4>

```php
public function newInstance(
string $name,
array $options = []
): ConnectionFactoryInterface;
```

Creates a new ConnectionFactory for the named adapter.

<h4 id="queueadapterfactory-getexceptionclass"><code>getExceptionClass()</code></h4>

```php
protected function getExceptionClass(): string;
```

Returns the exception class for the factory

<h4 id="queueadapterfactory-getservices"><code>getServices()</code></h4>

```php
protected function getServices(): array;
```

Returns the available adapters.

## Queue\Adapter\AbstractConsumer

Abstract

Shared consumer base. Implements the blocking `receive()` as a polling loop
on top of the abstract `receiveNoWait()`; concrete consumers provide the
transport-specific `receiveNoWait`, `acknowledge`, `reject` and `getQueue`.

Transports with a native blocking receive (Redis BRPOP, Beanstalk reserve)
override `receive()` instead of polling.

- **`Phalcon\Queue\Adapter\AbstractConsumer`** - implements [`Phalcon\Contracts\Queue\Consumer`](/5.20/api/phalcon_contracts/#contractsqueueconsumer)
- [`Phalcon\Queue\Adapter\Beanstalk\BeanstalkConsumer`](#queueadapterbeanstalkbeanstalkconsumer)
- [`Phalcon\Queue\Adapter\Memory\MemoryConsumer`](#queueadaptermemorymemoryconsumer)
- [`Phalcon\Queue\Adapter\Redis\RedisConsumer`](#queueadapterredisredisconsumer)
- [`Phalcon\Queue\Adapter\Stream\StreamConsumer`](#queueadapterstreamstreamconsumer)

`Phalcon\Contracts\Queue\Consumer` · `Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Queue`

### Method Summary

<ApiItem href="#queueadapterabstractconsumer-acknowledge" visibility="public" name="acknowledge" returnType="void" params={[{"type":"MessageInterface","name":"message","default":null}]}>
Acknowledges the message; the transport may then discard it.
</ApiItem>
<ApiItem href="#queueadapterabstractconsumer-getqueue" visibility="public" name="getQueue" returnType="QueueInterface" params={[]}>
Returns the queue this consumer reads from.
</ApiItem>
<ApiItem href="#queueadapterabstractconsumer-receive" visibility="public" name="receive" returnType="MessageInterface|null" params={[{"type":"int","name":"timeout","default":"0"}]}>
Receives a message, blocking up to timeout milliseconds (0 = block
</ApiItem>
<ApiItem href="#queueadapterabstractconsumer-receivenowait" visibility="public" name="receiveNoWait" returnType="MessageInterface|null" params={[]}>
Receives a message without blocking, or null when none is ready.
</ApiItem>
<ApiItem href="#queueadapterabstractconsumer-reject" visibility="public" name="reject" returnType="void" params={[{"type":"MessageInterface","name":"message","default":null},{"type":"bool","name":"requeue","default":"false"}]}>
Rejects the message. When requeue is true the transport redelivers it.
</ApiItem>
<ApiItem href="#queueadapterabstractconsumer-setpollinterval" visibility="public" name="setPollInterval" returnType="void" params={[{"type":"int","name":"pollInterval","default":null}]}>
Sets the poll interval (in milliseconds) used by `receive()`.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="pollInterval" type="int" default="200">
Milliseconds slept between poll attempts.
</ApiItem>
<ApiItem kind="property" visibility="protected" name="queue" type="QueueInterface" default="">
The queue this consumer reads from.
</ApiItem>

### Methods

<h4 id="queueadapterabstractconsumer-acknowledge"><code>acknowledge()</code></h4>

```php
abstract public function acknowledge( MessageInterface $message ): void;
```

Acknowledges the message; the transport may then discard it.

<h4 id="queueadapterabstractconsumer-getqueue"><code>getQueue()</code></h4>

```php
public function getQueue(): QueueInterface;
```

Returns the queue this consumer reads from.

<h4 id="queueadapterabstractconsumer-receive"><code>receive()</code></h4>

```php
public function receive( int $timeout = 0 ): MessageInterface|null;
```

Receives a message, blocking up to timeout milliseconds (0 = block
until one is available), by polling `receiveNoWait()` every
`pollInterval` milliseconds. Returns null when none arrives in time.

<h4 id="queueadapterabstractconsumer-receivenowait"><code>receiveNoWait()</code></h4>

```php
abstract public function receiveNoWait(): MessageInterface|null;
```

Receives a message without blocking, or null when none is ready.

<h4 id="queueadapterabstractconsumer-reject"><code>reject()</code></h4>

```php
abstract public function reject(
MessageInterface $message,
bool $requeue = false
): void;
```

Rejects the message. When requeue is true the transport redelivers it.

<h4 id="queueadapterabstractconsumer-setpollinterval"><code>setPollInterval()</code></h4>

```php
public function setPollInterval( int $pollInterval ): void;
```

Sets the poll interval (in milliseconds) used by `receive()`.

## Queue\Adapter\AbstractContext

Abstract

Shared transport-session base. Every transport builds the same destination
value objects (GenericQueue / GenericTopic) and the same uniquely named
temporary queue, so those factories live here once. Concrete contexts
implement the transport-specific factories (consumer, producer, message,
subscription consumer) and the storage operations.

- **`Phalcon\Queue\Adapter\AbstractContext`** - implements [`Phalcon\Contracts\Queue\Context`](/5.20/api/phalcon_contracts/#contractsqueuecontext)
- [`Phalcon\Queue\Adapter\Beanstalk\BeanstalkContext`](#queueadapterbeanstalkbeanstalkcontext)
- [`Phalcon\Queue\Adapter\Memory\MemoryContext`](#queueadaptermemorymemorycontext)
- [`Phalcon\Queue\Adapter\Redis\RedisContext`](#queueadapterredisrediscontext)
- [`Phalcon\Queue\Adapter\Stream\StreamContext`](#queueadapterstreamstreamcontext)

`Phalcon\Contracts\Queue\Context` · `Phalcon\Contracts\Queue\Queue` · `Phalcon\Contracts\Queue\Topic`

### Method Summary

<ApiItem href="#queueadapterabstractcontext-createqueue" visibility="public" name="createQueue" returnType="QueueInterface" params={[{"type":"string","name":"queueName","default":null}]}>
Creates a queue destination by name.
</ApiItem>
<ApiItem href="#queueadapterabstractcontext-createtemporaryqueue" visibility="public" name="createTemporaryQueue" returnType="QueueInterface" params={[]}>
Creates a uniquely named temporary queue.
</ApiItem>
<ApiItem href="#queueadapterabstractcontext-createtopic" visibility="public" name="createTopic" returnType="TopicInterface" params={[{"type":"string","name":"topicName","default":null}]}>
Creates a topic destination by name.
</ApiItem>

### Methods

<h4 id="queueadapterabstractcontext-createqueue"><code>createQueue()</code></h4>

```php
public function createQueue( string $queueName ): QueueInterface;
```

Creates a queue destination by name.

<h4 id="queueadapterabstractcontext-createtemporaryqueue"><code>createTemporaryQueue()</code></h4>

```php
public function createTemporaryQueue(): QueueInterface;
```

Creates a uniquely named temporary queue.

<h4 id="queueadapterabstractcontext-createtopic"><code>createTopic()</code></h4>

```php
public function createTopic( string $topicName ): TopicInterface;
```

Creates a topic destination by name.

## Queue\Adapter\AbstractMessage

Abstract

Shared base for the concrete adapter messages.

@todo Remove in v7. Kept only for backwards compatibility; compose
Phalcon\Queue\Adapter\Traits\MessageTrait directly instead of extending this.

- **`Phalcon\Queue\Adapter\AbstractMessage`** - implements [`Phalcon\Contracts\Queue\Message`](/5.20/api/phalcon_contracts/#contractsqueuemessage)
- [`Phalcon\Queue\Adapter\Beanstalk\BeanstalkMessage`](#queueadapterbeanstalkbeanstalkmessage)
- [`Phalcon\Queue\Adapter\Memory\MemoryMessage`](#queueadaptermemorymemorymessage)
- [`Phalcon\Queue\Adapter\Redis\RedisMessage`](#queueadapterredisredismessage)
- [`Phalcon\Queue\Adapter\Stream\StreamMessage`](#queueadapterstreamstreammessage)

`Phalcon\Contracts\Queue\Message` · `Phalcon\Queue\Adapter\Traits\MessageTrait`

## Queue\Adapter\AbstractProducer

Abstract

Shared producer base. Defaults every optional capability (delivery delay,
priority, time to live) to "unsupported": the getter returns null and the
setter throws the matching exception for any non-null value. A concrete
producer overrides only the capabilities its transport actually supports,
and implements `send()`.

- **`Phalcon\Queue\Adapter\AbstractProducer`** - implements [`Phalcon\Contracts\Queue\Producer`](/5.20/api/phalcon_contracts/#contractsqueueproducer)
- [`Phalcon\Queue\Adapter\Beanstalk\BeanstalkProducer`](#queueadapterbeanstalkbeanstalkproducer)
- [`Phalcon\Queue\Adapter\Memory\MemoryProducer`](#queueadaptermemorymemoryproducer)
- [`Phalcon\Queue\Adapter\Redis\RedisProducer`](#queueadapterredisredisproducer)
- [`Phalcon\Queue\Adapter\Stream\StreamProducer`](#queueadapterstreamstreamproducer)

`Phalcon\Contracts\Queue\Destination` · `Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Producer` · `Phalcon\Queue\Exceptions\DeliveryDelayNotSupportedException` · `Phalcon\Queue\Exceptions\PriorityNotSupportedException` · `Phalcon\Queue\Exceptions\TimeToLiveNotSupportedException`

### Method Summary

<ApiItem href="#queueadapterabstractproducer-getdeliverydelay" visibility="public" name="getDeliveryDelay" returnType="int|null" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterabstractproducer-getpriority" visibility="public" name="getPriority" returnType="int|null" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterabstractproducer-gettimetolive" visibility="public" name="getTimeToLive" returnType="int|null" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterabstractproducer-send" visibility="public" name="send" returnType="void" params={[{"type":"DestinationInterface","name":"destination","default":null},{"type":"MessageInterface","name":"message","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterabstractproducer-setdeliverydelay" visibility="public" name="setDeliveryDelay" returnType="ProducerInterface" params={[{"type":"mixed","name":"deliveryDelay","default":"null"}]}>
</ApiItem>
<ApiItem href="#queueadapterabstractproducer-setpriority" visibility="public" name="setPriority" returnType="ProducerInterface" params={[{"type":"mixed","name":"priority","default":"null"}]}>
</ApiItem>
<ApiItem href="#queueadapterabstractproducer-settimetolive" visibility="public" name="setTimeToLive" returnType="ProducerInterface" params={[{"type":"mixed","name":"timeToLive","default":"null"}]}>
</ApiItem>

### Methods

<h4 id="queueadapterabstractproducer-getdeliverydelay"><code>getDeliveryDelay()</code></h4>

```php
public function getDeliveryDelay(): int|null;
```

<h4 id="queueadapterabstractproducer-getpriority"><code>getPriority()</code></h4>

```php
public function getPriority(): int|null;
```

<h4 id="queueadapterabstractproducer-gettimetolive"><code>getTimeToLive()</code></h4>

```php
public function getTimeToLive(): int|null;
```

<h4 id="queueadapterabstractproducer-send"><code>send()</code></h4>

```php
abstract public function send(
DestinationInterface $destination,
MessageInterface $message
): void;
```

<h4 id="queueadapterabstractproducer-setdeliverydelay"><code>setDeliveryDelay()</code></h4>

```php
public function setDeliveryDelay( mixed $deliveryDelay = null ): ProducerInterface;
```

<h4 id="queueadapterabstractproducer-setpriority"><code>setPriority()</code></h4>

```php
public function setPriority( mixed $priority = null ): ProducerInterface;
```

<h4 id="queueadapterabstractproducer-settimetolive"><code>setTimeToLive()</code></h4>

```php
public function setTimeToLive( mixed $timeToLive = null ): ProducerInterface;
```

## Queue\Adapter\AbstractSubscriptionConsumer

Abstract

Shared subscription-consumer base.

@todo Remove in v7. Kept only for backwards compatibility; compose
Phalcon\Queue\Adapter\Traits\SubscriptionConsumerTrait directly instead of
extending this.

- **`Phalcon\Queue\Adapter\AbstractSubscriptionConsumer`** - implements [`Phalcon\Contracts\Queue\SubscriptionConsumer`](/5.20/api/phalcon_contracts/#contractsqueuesubscriptionconsumer)
- [`Phalcon\Queue\Adapter\Beanstalk\BeanstalkSubscriptionConsumer`](#queueadapterbeanstalkbeanstalksubscriptionconsumer)
- [`Phalcon\Queue\Adapter\Memory\MemorySubscriptionConsumer`](#queueadaptermemorymemorysubscriptionconsumer)
- [`Phalcon\Queue\Adapter\Redis\RedisSubscriptionConsumer`](#queueadapterredisredissubscriptionconsumer)
- [`Phalcon\Queue\Adapter\Stream\StreamSubscriptionConsumer`](#queueadapterstreamstreamsubscriptionconsumer)

`Phalcon\Contracts\Queue\SubscriptionConsumer` · `Phalcon\Queue\Adapter\Traits\SubscriptionConsumerTrait`

## Queue\Adapter\Beanstalk\BeanstalkConnection

Class

Dependency-free socket client for the Beanstalkd work queue, implementing
the subset of the 1.2 protocol the adapter needs (use/watch/ignore, put,
reserve-with-timeout, delete/release/bury/touch). Recovered and trimmed
from the original Phalcon\Queue\Beanstalk transport.

- **`Phalcon\Queue\Adapter\Beanstalk\BeanstalkConnection`**

`Phalcon\Contracts\Queue\QueueTypes` · `Phalcon\Queue\Exceptions\Exception` · `Phalcon\Traits\Php\FileTrait`

### Method Summary

<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"string","name":"host","default":"\"127.0.0.1\""},{"type":"int","name":"port","default":"11300"},{"type":"bool","name":"persistent","default":"false"}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-buryjob" visibility="public" name="buryJob" returnType="bool" params={[{"type":"string","name":"id","default":null},{"type":"int","name":"priority","default":null}]}>
Puts a reserved job into the "buried" state.
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-connect" visibility="public" name="connect" returnType="resource" params={[]}>
Opens the socket connection to the Beanstalkd server.
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-deletejob" visibility="public" name="deleteJob" returnType="bool" params={[{"type":"string","name":"id","default":null}]}>
Removes a job from the server entirely.
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-disconnect" visibility="public" name="disconnect" returnType="bool" params={[]}>
Closes the connection to the server.
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-ignoretube" visibility="public" name="ignoreTube" returnType="bool" params={[{"type":"string","name":"tube","default":null}]}>
Removes the named tube from the watch list for the connection.
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-put" visibility="public" name="put" returnType="false|int" params={[{"type":"string","name":"data","default":null},{"type":"int","name":"priority","default":null},{"type":"int","name":"delay","default":null},{"type":"int","name":"ttr","default":null}]}>
Puts a job on the queue using the currently used tube. Returns the new
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-read" visibility="public" name="read" returnType="false|string" params={[{"type":"int","name":"length","default":"0"}]}>
Reads a packet from the socket. Verifies the connection is available
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-readstatus" visibility="public" name="readStatus" returnType="array" params={[]}>
Reads the latest status line and splits it into tokens.
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-releasejob" visibility="public" name="releaseJob" returnType="bool" params={[{"type":"string","name":"id","default":null},{"type":"int","name":"priority","default":null},{"type":"int","name":"delay","default":null}]}>
Puts a reserved job back into the ready queue.
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-reserve" visibility="public" name="reserve" returnType="array|null" params={[{"type":"mixed","name":"timeout","default":"null"}]}>
Reserves a ready job from a watched tube. A null timeout blocks until a
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-statstube" visibility="public" name="statsTube" returnType="array|false" params={[{"type":"string","name":"tube","default":null}]}>
Returns the Beanstalkd statistics for a tube as an associative array, or
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-touchjob" visibility="public" name="touchJob" returnType="bool" params={[{"type":"string","name":"id","default":null}]}>
Extends the time-to-run of a reserved job.
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-usetube" visibility="public" name="useTube" returnType="bool" params={[{"type":"string","name":"tube","default":null}]}>
Changes the tube new jobs are put on. By default this is "default".
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-watchtube" visibility="public" name="watchTube" returnType="bool" params={[{"type":"string","name":"tube","default":null}]}>
Adds the named tube to the watch list for the connection.
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnection-write" visibility="public" name="write" returnType="false|int" params={[{"type":"string","name":"data","default":null}]}>
Writes data to the socket, connecting first when needed.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="connection" type="resource|null" default="null">
Connection resource.
</ApiItem>
<ApiItem kind="property" visibility="protected" name="host" type="string" default="&quot;127.0.0.1&quot;">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="persistent" type="bool" default="false">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="port" type="int" default="11300">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="usedTube" type="string" default="&quot;default&quot;">
Tube currently selected with `use`. A fresh connection uses "default".
</ApiItem>
<ApiItem kind="property" visibility="protected" name="watchedTubes" type="array&lt;string, bool&gt;" default="[]">
Tubes currently on the watch list, keyed by tube name. A fresh
connection watches "default".
</ApiItem>

### Methods

<h4 id="queueadapterbeanstalkbeanstalkconnection-__construct"><code>__construct()</code></h4>

```php
public function __construct(
string $host = "127.0.0.1",
int $port = 11300,
bool $persistent = false
);
```

<h4 id="queueadapterbeanstalkbeanstalkconnection-buryjob"><code>buryJob()</code></h4>

```php
public function buryJob(
string $id,
int $priority
): bool;
```

Puts a reserved job into the "buried" state.

<h4 id="queueadapterbeanstalkbeanstalkconnection-connect"><code>connect()</code></h4>

```php
public function connect(): resource;
```

Opens the socket connection to the Beanstalkd server.

<h4 id="queueadapterbeanstalkbeanstalkconnection-deletejob"><code>deleteJob()</code></h4>

```php
public function deleteJob( string $id ): bool;
```

Removes a job from the server entirely.

<h4 id="queueadapterbeanstalkbeanstalkconnection-disconnect"><code>disconnect()</code></h4>

```php
public function disconnect(): bool;
```

Closes the connection to the server.

<h4 id="queueadapterbeanstalkbeanstalkconnection-ignoretube"><code>ignoreTube()</code></h4>

```php
public function ignoreTube( string $tube ): bool;
```

Removes the named tube from the watch list for the connection.

<h4 id="queueadapterbeanstalkbeanstalkconnection-put"><code>put()</code></h4>

```php
public function put(
string $data,
int $priority,
int $delay,
int $ttr
): false|int;
```

Puts a job on the queue using the currently used tube. Returns the new
job id, or false when the server did not accept it.

<h4 id="queueadapterbeanstalkbeanstalkconnection-read"><code>read()</code></h4>

```php
public function read( int $length = 0 ): false|string;
```

Reads a packet from the socket. Verifies the connection is available
first.

<h4 id="queueadapterbeanstalkbeanstalkconnection-readstatus"><code>readStatus()</code></h4>

```php
public function readStatus(): array;
```

Reads the latest status line and splits it into tokens.

<h4 id="queueadapterbeanstalkbeanstalkconnection-releasejob"><code>releaseJob()</code></h4>

```php
public function releaseJob(
string $id,
int $priority,
int $delay
): bool;
```

Puts a reserved job back into the ready queue.

<h4 id="queueadapterbeanstalkbeanstalkconnection-reserve"><code>reserve()</code></h4>

```php
public function reserve( mixed $timeout = null ): array|null;
```

Reserves a ready job from a watched tube. A null timeout blocks until a
job is available; otherwise it blocks up to timeout seconds. Returns
[id, body] or null when none is reserved.

<h4 id="queueadapterbeanstalkbeanstalkconnection-statstube"><code>statsTube()</code></h4>

```php
public function statsTube( string $tube ): array|false;
```

Returns the Beanstalkd statistics for a tube as an associative array, or
false when the tube does not exist.

<h4 id="queueadapterbeanstalkbeanstalkconnection-touchjob"><code>touchJob()</code></h4>

```php
public function touchJob( string $id ): bool;
```

Extends the time-to-run of a reserved job.

<h4 id="queueadapterbeanstalkbeanstalkconnection-usetube"><code>useTube()</code></h4>

```php
public function useTube( string $tube ): bool;
```

Changes the tube new jobs are put on. By default this is "default".

<h4 id="queueadapterbeanstalkbeanstalkconnection-watchtube"><code>watchTube()</code></h4>

```php
public function watchTube( string $tube ): bool;
```

Adds the named tube to the watch list for the connection.

<h4 id="queueadapterbeanstalkbeanstalkconnection-write"><code>write()</code></h4>

```php
public function write( string $data ): false|int;
```

Writes data to the socket, connecting first when needed.

## Queue\Adapter\Beanstalk\BeanstalkConnectionFactory

Class

Builds a BeanstalkContext.

Options:
  - host:         server host (default 127.0.0.1).
  - port:         server port (default 11300).
  - persistent:   use a persistent socket (default false).
  - ttr:          default time-to-run in seconds for every job (default 86400).
  - pollInterval: milliseconds between subscription poll passes (default 200).

- **`Phalcon\Queue\Adapter\Beanstalk\BeanstalkConnectionFactory`** - implements [`Phalcon\Contracts\Queue\ConnectionFactory`](/5.20/api/phalcon_contracts/#contractsqueueconnectionfactory)

`Phalcon\Contracts\Queue\ConnectionFactory` · `Phalcon\Contracts\Queue\Context` · `Phalcon\Contracts\Queue\QueueTypes`

### Method Summary

<ApiItem href="#queueadapterbeanstalkbeanstalkconnectionfactory-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"array","name":"options","default":"[]"}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconnectionfactory-createcontext" visibility="public" name="createContext" returnType="ContextInterface" params={[]}>
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="options" type="array" default="[]">
</ApiItem>

### Methods

<h4 id="queueadapterbeanstalkbeanstalkconnectionfactory-__construct"><code>__construct()</code></h4>

```php
public function __construct( array $options = [] );
```

<h4 id="queueadapterbeanstalkbeanstalkconnectionfactory-createcontext"><code>createContext()</code></h4>

```php
public function createContext(): ContextInterface;
```

## Queue\Adapter\Beanstalk\BeanstalkConsumer

Class

Receives messages from a single Beanstalkd tube over its own connection.
`receive()` is overridden to use the native blocking reserve. Implements
VisibilityAware: a reserved job has a time-to-run window that `touch()`
extends; acknowledging deletes the job, rejecting releases it (requeue) or
buries it.

- [`Phalcon\Queue\Adapter\AbstractConsumer`](#queueadapterabstractconsumer)
- **`Phalcon\Queue\Adapter\Beanstalk\BeanstalkConsumer`** - implements [`Phalcon\Contracts\Queue\VisibilityAware`](/5.20/api/phalcon_contracts/#contractsqueuevisibilityaware)

`Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Queue` · `Phalcon\Contracts\Queue\VisibilityAware` · `Phalcon\Queue\Adapter\AbstractConsumer` · `Phalcon\Queue\Adapter\MessageEnvelope`

### Method Summary

<ApiItem href="#queueadapterbeanstalkbeanstalkconsumer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"BeanstalkConnection","name":"connection","default":null},{"type":"QueueInterface","name":"queue","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconsumer-acknowledge" visibility="public" name="acknowledge" returnType="void" params={[{"type":"MessageInterface","name":"message","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconsumer-receive" visibility="public" name="receive" returnType="MessageInterface|null" params={[{"type":"int","name":"timeout","default":"0"}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconsumer-receivenowait" visibility="public" name="receiveNoWait" returnType="MessageInterface|null" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconsumer-reject" visibility="public" name="reject" returnType="void" params={[{"type":"MessageInterface","name":"message","default":null},{"type":"bool","name":"requeue","default":"false"}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkconsumer-touch" visibility="public" name="touch" returnType="bool" params={[{"type":"MessageInterface","name":"message","default":null}]}>
Extends the time-to-run window of a reserved job (VisibilityAware).
</ApiItem>

### Constants

<ApiItem kind="constant" name="DEFAULT_PRIORITY" type="int" default="100">
Default Beanstalkd priority used when releasing or burying.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="connection" type="BeanstalkConnection" default="">
</ApiItem>

### Methods

<h4 id="queueadapterbeanstalkbeanstalkconsumer-__construct"><code>__construct()</code></h4>

```php
public function __construct(
BeanstalkConnection $connection,
QueueInterface $queue
);
```

<h4 id="queueadapterbeanstalkbeanstalkconsumer-acknowledge"><code>acknowledge()</code></h4>

```php
public function acknowledge( MessageInterface $message ): void;
```

<h4 id="queueadapterbeanstalkbeanstalkconsumer-receive"><code>receive()</code></h4>

```php
public function receive( int $timeout = 0 ): MessageInterface|null;
```

<h4 id="queueadapterbeanstalkbeanstalkconsumer-receivenowait"><code>receiveNoWait()</code></h4>

```php
public function receiveNoWait(): MessageInterface|null;
```

<h4 id="queueadapterbeanstalkbeanstalkconsumer-reject"><code>reject()</code></h4>

```php
public function reject(
MessageInterface $message,
bool $requeue = false
): void;
```

<h4 id="queueadapterbeanstalkbeanstalkconsumer-touch"><code>touch()</code></h4>

```php
public function touch( MessageInterface $message ): bool;
```

Extends the time-to-run window of a reserved job (VisibilityAware).

## Queue\Adapter\Beanstalk\BeanstalkContext

Class

Beanstalkd transport session. A queue maps to a Beanstalkd tube. Producers
share the context connection (`use` + `put`); each consumer owns its own
connection, because Beanstalkd only lets the reserving connection delete,
release, bury or touch a job. The destination factories come from
AbstractContext.

- [`Phalcon\Queue\Adapter\AbstractContext`](#queueadapterabstractcontext)
- **`Phalcon\Queue\Adapter\Beanstalk\BeanstalkContext`** - implements [`Phalcon\Contracts\Queue\Inspectable`](/5.20/api/phalcon_contracts/#contractsqueueinspectable)

`Phalcon\Contracts\Queue\Consumer` · `Phalcon\Contracts\Queue\Destination` · `Phalcon\Contracts\Queue\Inspectable` · `Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Producer` · `Phalcon\Contracts\Queue\Queue` · `Phalcon\Contracts\Queue\SubscriptionConsumer` · `Phalcon\Queue\Adapter\AbstractContext` · `Phalcon\Queue\Adapter\QueueDestinationGuard`

### Method Summary

<ApiItem href="#queueadapterbeanstalkbeanstalkcontext-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"string","name":"host","default":null},{"type":"int","name":"port","default":null},{"type":"bool","name":"persistent","default":"false"},{"type":"int","name":"ttr","default":"86400"},{"type":"int","name":"pollInterval","default":"200"}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkcontext-close" visibility="public" name="close" returnType="void" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkcontext-createconsumer" visibility="public" name="createConsumer" returnType="ConsumerInterface" params={[{"type":"DestinationInterface","name":"destination","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkcontext-createmessage" visibility="public" name="createMessage" returnType="MessageInterface" params={[{"type":"string","name":"body","default":"\"\""},{"type":"array","name":"properties","default":"[]"},{"type":"array","name":"headers","default":"[]"}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkcontext-createproducer" visibility="public" name="createProducer" returnType="ProducerInterface" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkcontext-createsubscriptionconsumer" visibility="public" name="createSubscriptionConsumer" returnType="SubscriptionConsumerInterface" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkcontext-getstats" visibility="public" name="getStats" returnType="array" params={[{"type":"QueueInterface","name":"queue","default":null}]}>
Returns the Beanstalkd `stats-tube` fields for the queue's tube as an
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkcontext-getttr" visibility="public" name="getTtr" returnType="int" params={[]}>
Default time-to-run (seconds) for new jobs. Used by BeanstalkProducer.
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkcontext-purgequeue" visibility="public" name="purgeQueue" returnType="void" params={[{"type":"QueueInterface","name":"queue","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkcontext-putmessage" visibility="public" name="putMessage" returnType="void" params={[{"type":"string","name":"tube","default":null},{"type":"string","name":"payload","default":null},{"type":"int","name":"priority","default":null},{"type":"int","name":"delay","default":null},{"type":"int","name":"ttr","default":null}]}>
Puts a serialized payload on a tube via the shared connection.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="connection" type="BeanstalkConnection|null" default="null">
Shared connection used by producers and purges.
</ApiItem>
<ApiItem kind="property" visibility="protected" name="host" type="string" default="&quot;127.0.0.1&quot;">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="persistent" type="bool" default="false">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="pollInterval" type="int" default="200">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="port" type="int" default="11300">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="ttr" type="int" default="86400">
</ApiItem>

### Methods

<h4 id="queueadapterbeanstalkbeanstalkcontext-__construct"><code>__construct()</code></h4>

```php
public function __construct(
string $host,
int $port,
bool $persistent = false,
int $ttr = 86400,
int $pollInterval = 200
);
```

<h4 id="queueadapterbeanstalkbeanstalkcontext-close"><code>close()</code></h4>

```php
public function close(): void;
```

<h4 id="queueadapterbeanstalkbeanstalkcontext-createconsumer"><code>createConsumer()</code></h4>

```php
public function createConsumer( DestinationInterface $destination ): ConsumerInterface;
```

<h4 id="queueadapterbeanstalkbeanstalkcontext-createmessage"><code>createMessage()</code></h4>

```php
public function createMessage(
string $body = "",
array $properties = [],
array $headers = []
): MessageInterface;
```

<h4 id="queueadapterbeanstalkbeanstalkcontext-createproducer"><code>createProducer()</code></h4>

```php
public function createProducer(): ProducerInterface;
```

<h4 id="queueadapterbeanstalkbeanstalkcontext-createsubscriptionconsumer"><code>createSubscriptionConsumer()</code></h4>

```php
public function createSubscriptionConsumer(): SubscriptionConsumerInterface;
```

<h4 id="queueadapterbeanstalkbeanstalkcontext-getstats"><code>getStats()</code></h4>

```php
public function getStats( QueueInterface $queue ): array;
```

Returns the Beanstalkd `stats-tube` fields for the queue's tube as an
associative array, with numeric values cast to int (the `name` field is
kept as a string). When the tube exists the result is the full Beanstalkd
stats-tube field set (current-jobs-*, total-jobs, the `cmd-*` counters and
tube-configuration fields).

The `current-jobs-*` backlog keys are always present: an unknown tube
(no jobs, not used or watched) has zero backlog, so those keys are
returned at zero. This keeps the backlog shape independent of transient
watcher state. Runs on a fresh short-lived connection (like purgeQueue)
so the read never shares the producer's socket.

<h4 id="queueadapterbeanstalkbeanstalkcontext-getttr"><code>getTtr()</code></h4>

```php
public function getTtr(): int;
```

Default time-to-run (seconds) for new jobs. Used by BeanstalkProducer.

<h4 id="queueadapterbeanstalkbeanstalkcontext-purgequeue"><code>purgeQueue()</code></h4>

```php
public function purgeQueue( QueueInterface $queue ): void;
```

<h4 id="queueadapterbeanstalkbeanstalkcontext-putmessage"><code>putMessage()</code></h4>

```php
public function putMessage(
string $tube,
string $payload,
int $priority,
int $delay,
int $ttr
): void;
```

Puts a serialized payload on a tube via the shared connection.
Internal transport API used by BeanstalkProducer.

## Queue\Adapter\Beanstalk\BeanstalkMessage

Class

Beanstalkd-backed message. Carries the reserved job id so the consumer can
delete, release, bury or touch it; all other behavior comes from
MessageTrait.

- [`Phalcon\Queue\Adapter\AbstractMessage`](#queueadapterabstractmessage)
- **`Phalcon\Queue\Adapter\Beanstalk\BeanstalkMessage`**

`Phalcon\Queue\Adapter\AbstractMessage`

### Method Summary

<ApiItem href="#queueadapterbeanstalkbeanstalkmessage-getjobid" visibility="public" name="getJobId" returnType="string|null" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkmessage-setjobid" visibility="public" name="setJobId" returnType="void" params={[{"type":"string","name":"jobId","default":null}]}>
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="jobId" type="string|null" default="null">
The reserved Beanstalkd job id, or null before it is reserved.
</ApiItem>

### Methods

<h4 id="queueadapterbeanstalkbeanstalkmessage-getjobid"><code>getJobId()</code></h4>

```php
public function getJobId(): string|null;
```

<h4 id="queueadapterbeanstalkbeanstalkmessage-setjobid"><code>setJobId()</code></h4>

```php
public function setJobId( string $jobId ): void;
```

## Queue\Adapter\Beanstalk\BeanstalkProducer

Class

Sends messages to a Beanstalkd tube. Delivery delay (rounded down to whole
seconds) and message priority are supported natively; Beanstalkd has no
message expiry, so time to live is not (the default from AbstractProducer
rejects it).

- [`Phalcon\Queue\Adapter\AbstractProducer`](#queueadapterabstractproducer)
- **`Phalcon\Queue\Adapter\Beanstalk\BeanstalkProducer`**

`Phalcon\Contracts\Queue\Destination` · `Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Producer` · `Phalcon\Queue\Adapter\AbstractProducer` · `Phalcon\Queue\Adapter\MessageEnvelope` · `Phalcon\Queue\Adapter\QueueDestinationGuard`

### Method Summary

<ApiItem href="#queueadapterbeanstalkbeanstalkproducer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"BeanstalkContext","name":"context","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkproducer-getdeliverydelay" visibility="public" name="getDeliveryDelay" returnType="int|null" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkproducer-getpriority" visibility="public" name="getPriority" returnType="int|null" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkproducer-send" visibility="public" name="send" returnType="void" params={[{"type":"DestinationInterface","name":"destination","default":null},{"type":"MessageInterface","name":"message","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkproducer-setdeliverydelay" visibility="public" name="setDeliveryDelay" returnType="ProducerInterface" params={[{"type":"mixed","name":"deliveryDelay","default":"null"}]}>
</ApiItem>
<ApiItem href="#queueadapterbeanstalkbeanstalkproducer-setpriority" visibility="public" name="setPriority" returnType="ProducerInterface" params={[{"type":"mixed","name":"priority","default":"null"}]}>
</ApiItem>

### Constants

<ApiItem kind="constant" name="DEFAULT_PRIORITY" type="int" default="100">
Default Beanstalkd priority (0 = most urgent).
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="context" type="BeanstalkContext" default="">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="deliveryDelay" type="int|null" default="null">
Delivery delay in milliseconds, or null when not set.
</ApiItem>
<ApiItem kind="property" visibility="protected" name="priority" type="int|null" default="null">
Job priority, or null when not set.
</ApiItem>

### Methods

<h4 id="queueadapterbeanstalkbeanstalkproducer-__construct"><code>__construct()</code></h4>

```php
public function __construct( BeanstalkContext $context );
```

<h4 id="queueadapterbeanstalkbeanstalkproducer-getdeliverydelay"><code>getDeliveryDelay()</code></h4>

```php
public function getDeliveryDelay(): int|null;
```

<h4 id="queueadapterbeanstalkbeanstalkproducer-getpriority"><code>getPriority()</code></h4>

```php
public function getPriority(): int|null;
```

<h4 id="queueadapterbeanstalkbeanstalkproducer-send"><code>send()</code></h4>

```php
public function send(
DestinationInterface $destination,
MessageInterface $message
): void;
```

<h4 id="queueadapterbeanstalkbeanstalkproducer-setdeliverydelay"><code>setDeliveryDelay()</code></h4>

```php
public function setDeliveryDelay( mixed $deliveryDelay = null ): ProducerInterface;
```

<h4 id="queueadapterbeanstalkbeanstalkproducer-setpriority"><code>setPriority()</code></h4>

```php
public function setPriority( mixed $priority = null ): ProducerInterface;
```

## Queue\Adapter\Beanstalk\BeanstalkSubscriptionConsumer

Class

Consumes from several Beanstalkd tubes at once. The round-robin poll loop
lives in SubscriptionConsumerTrait.

- [`Phalcon\Queue\Adapter\AbstractSubscriptionConsumer`](#queueadapterabstractsubscriptionconsumer)
- **`Phalcon\Queue\Adapter\Beanstalk\BeanstalkSubscriptionConsumer`**

`Phalcon\Queue\Adapter\AbstractSubscriptionConsumer`

### Method Summary

<ApiItem href="#queueadapterbeanstalkbeanstalksubscriptionconsumer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"BeanstalkContext","name":"context","default":null},{"type":"int","name":"pollInterval","default":"200"}]}>
The context is retained for transports that may later need it for a
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="context" type="BeanstalkContext" default="">
</ApiItem>

### Methods

<h4 id="queueadapterbeanstalkbeanstalksubscriptionconsumer-__construct"><code>__construct()</code></h4>

```php
public function __construct(
BeanstalkContext $context,
int $pollInterval = 200
);
```

The context is retained for transports that may later need it for a
native multi-queue receive; the shared poll loop does not use it.

## Queue\Adapter\GenericQueue

Class

A named queue destination shared by every transport. A queue name is the
only knowledge a destination carries, so the adapters need no transport
specific subclass.

- **`Phalcon\Queue\Adapter\GenericQueue`** - implements [`Phalcon\Contracts\Queue\Queue`](/5.20/api/phalcon_contracts/#contractsqueuequeue)

`Phalcon\Contracts\Queue\Queue`

### Method Summary

<ApiItem href="#queueadaptergenericqueue-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"string","name":"queueName","default":null}]}>
GenericQueue constructor.
</ApiItem>
<ApiItem href="#queueadaptergenericqueue-getqueuename" visibility="public" name="getQueueName" returnType="string" params={[]}>
Returns the queue name.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="queueName" type="string" default="&quot;&quot;">
</ApiItem>

### Methods

<h4 id="queueadaptergenericqueue-__construct"><code>__construct()</code></h4>

```php
public function __construct( string $queueName );
```

GenericQueue constructor.

<h4 id="queueadaptergenericqueue-getqueuename"><code>getQueueName()</code></h4>

```php
public function getQueueName(): string;
```

Returns the queue name.

## Queue\Adapter\GenericTopic

Class

A named topic destination shared by every transport. A topic name is the
only knowledge a destination carries, so the adapters need no transport
specific subclass.

- **`Phalcon\Queue\Adapter\GenericTopic`** - implements [`Phalcon\Contracts\Queue\Topic`](/5.20/api/phalcon_contracts/#contractsqueuetopic)

`Phalcon\Contracts\Queue\Topic`

### Method Summary

<ApiItem href="#queueadaptergenerictopic-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"string","name":"topicName","default":null}]}>
GenericTopic constructor.
</ApiItem>
<ApiItem href="#queueadaptergenerictopic-gettopicname" visibility="public" name="getTopicName" returnType="string" params={[]}>
Returns the topic name.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="topicName" type="string" default="&quot;&quot;">
</ApiItem>

### Methods

<h4 id="queueadaptergenerictopic-__construct"><code>__construct()</code></h4>

```php
public function __construct( string $topicName );
```

GenericTopic constructor.

<h4 id="queueadaptergenerictopic-gettopicname"><code>getTopicName()</code></h4>

```php
public function getTopicName(): string;
```

Returns the topic name.

## Queue\Adapter\Memory\MemoryConnectionFactory

Class

Builds a MemoryContext. The Memory transport takes no options.

- **`Phalcon\Queue\Adapter\Memory\MemoryConnectionFactory`** - implements [`Phalcon\Contracts\Queue\ConnectionFactory`](/5.20/api/phalcon_contracts/#contractsqueueconnectionfactory)

`Phalcon\Contracts\Queue\ConnectionFactory` · `Phalcon\Contracts\Queue\Context` · `Phalcon\Contracts\Queue\QueueTypes`

### Method Summary

<ApiItem href="#queueadaptermemorymemoryconnectionfactory-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"array","name":"options","default":"[]"}]}>
MemoryConnectionFactory constructor.
</ApiItem>
<ApiItem href="#queueadaptermemorymemoryconnectionfactory-createcontext" visibility="public" name="createContext" returnType="ContextInterface" params={[]}>
Creates a new in-process context.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="options" type="array" default="[]">
</ApiItem>

### Methods

<h4 id="queueadaptermemorymemoryconnectionfactory-__construct"><code>__construct()</code></h4>

```php
public function __construct( array $options = [] );
```

MemoryConnectionFactory constructor.

<h4 id="queueadaptermemorymemoryconnectionfactory-createcontext"><code>createContext()</code></h4>

```php
public function createContext(): ContextInterface;
```

Creates a new in-process context.

## Queue\Adapter\Memory\MemoryConsumer

Class

Receives messages from a single in-process queue. `receive()` is the
polling loop inherited from AbstractConsumer.

- [`Phalcon\Queue\Adapter\AbstractConsumer`](#queueadapterabstractconsumer)
- **`Phalcon\Queue\Adapter\Memory\MemoryConsumer`**

`Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Queue` · `Phalcon\Queue\Adapter\AbstractConsumer`

### Method Summary

<ApiItem href="#queueadaptermemorymemoryconsumer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"MemoryContext","name":"context","default":null},{"type":"QueueInterface","name":"queue","default":null}]}>
MemoryConsumer constructor.
</ApiItem>
<ApiItem href="#queueadaptermemorymemoryconsumer-acknowledge" visibility="public" name="acknowledge" returnType="void" params={[{"type":"MessageInterface","name":"message","default":null}]}>
No-op: a received message has already been removed from the queue.
</ApiItem>
<ApiItem href="#queueadaptermemorymemoryconsumer-receivenowait" visibility="public" name="receiveNoWait" returnType="MessageInterface|null" params={[]}>
Removes and returns the next message, or null when the queue is empty.
</ApiItem>
<ApiItem href="#queueadaptermemorymemoryconsumer-reject" visibility="public" name="reject" returnType="void" params={[{"type":"MessageInterface","name":"message","default":null},{"type":"bool","name":"requeue","default":"false"}]}>
Rejects the message. When requeue is true it is put back on the queue.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="context" type="MemoryContext" default="">
</ApiItem>

### Methods

<h4 id="queueadaptermemorymemoryconsumer-__construct"><code>__construct()</code></h4>

```php
public function __construct(
MemoryContext $context,
QueueInterface $queue
);
```

MemoryConsumer constructor.

<h4 id="queueadaptermemorymemoryconsumer-acknowledge"><code>acknowledge()</code></h4>

```php
public function acknowledge( MessageInterface $message ): void;
```

No-op: a received message has already been removed from the queue.

<h4 id="queueadaptermemorymemoryconsumer-receivenowait"><code>receiveNoWait()</code></h4>

```php
public function receiveNoWait(): MessageInterface|null;
```

Removes and returns the next message, or null when the queue is empty.

<h4 id="queueadaptermemorymemoryconsumer-reject"><code>reject()</code></h4>

```php
public function reject(
MessageInterface $message,
bool $requeue = false
): void;
```

Rejects the message. When requeue is true it is put back on the queue.

## Queue\Adapter\Memory\MemoryContext

Class

In-process transport session. Owns the named FIFO queues that this context's
producers and consumers share. The destination factories (createQueue /
createTopic / createTemporaryQueue) come from AbstractContext.

- [`Phalcon\Queue\Adapter\AbstractContext`](#queueadapterabstractcontext)
- **`Phalcon\Queue\Adapter\Memory\MemoryContext`**

`Phalcon\Contracts\Queue\Consumer` · `Phalcon\Contracts\Queue\Destination` · `Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Producer` · `Phalcon\Contracts\Queue\Queue` · `Phalcon\Contracts\Queue\SubscriptionConsumer` · `Phalcon\Queue\Adapter\AbstractContext` · `Phalcon\Queue\Adapter\QueueDestinationGuard`

### Method Summary

<ApiItem href="#queueadaptermemorymemorycontext-close" visibility="public" name="close" returnType="void" params={[]}>
Closes the context and drops every stored message.
</ApiItem>
<ApiItem href="#queueadaptermemorymemorycontext-createconsumer" visibility="public" name="createConsumer" returnType="ConsumerInterface" params={[{"type":"DestinationInterface","name":"destination","default":null}]}>
Creates a consumer for the given queue destination.
</ApiItem>
<ApiItem href="#queueadaptermemorymemorycontext-createmessage" visibility="public" name="createMessage" returnType="MessageInterface" params={[{"type":"string","name":"body","default":"\"\""},{"type":"array","name":"properties","default":"[]"},{"type":"array","name":"headers","default":"[]"}]}>
Creates a message.
</ApiItem>
<ApiItem href="#queueadaptermemorymemorycontext-createproducer" visibility="public" name="createProducer" returnType="ProducerInterface" params={[]}>
Creates a producer.
</ApiItem>
<ApiItem href="#queueadaptermemorymemorycontext-createsubscriptionconsumer" visibility="public" name="createSubscriptionConsumer" returnType="SubscriptionConsumerInterface" params={[]}>
Creates a subscription consumer.
</ApiItem>
<ApiItem href="#queueadaptermemorymemorycontext-popmessage" visibility="public" name="popMessage" returnType="MessageInterface|null" params={[{"type":"string","name":"queueName","default":null}]}>
Removes the front message from a queue, or null when it is empty.
</ApiItem>
<ApiItem href="#queueadaptermemorymemorycontext-purgequeue" visibility="public" name="purgeQueue" returnType="void" params={[{"type":"QueueInterface","name":"queue","default":null}]}>
Removes all messages from the given queue.
</ApiItem>
<ApiItem href="#queueadaptermemorymemorycontext-pushmessage" visibility="public" name="pushMessage" returnType="void" params={[{"type":"string","name":"queueName","default":null},{"type":"MessageInterface","name":"message","default":null}]}>
Appends a message to the back of a queue.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="queues" type="array&lt;string, list&lt;MessageInterface&gt;&gt;" default="[]">
Named queues: queue name => list of messages (FIFO).
</ApiItem>

### Methods

<h4 id="queueadaptermemorymemorycontext-close"><code>close()</code></h4>

```php
public function close(): void;
```

Closes the context and drops every stored message.

<h4 id="queueadaptermemorymemorycontext-createconsumer"><code>createConsumer()</code></h4>

```php
public function createConsumer( DestinationInterface $destination ): ConsumerInterface;
```

Creates a consumer for the given queue destination.

<h4 id="queueadaptermemorymemorycontext-createmessage"><code>createMessage()</code></h4>

```php
public function createMessage(
string $body = "",
array $properties = [],
array $headers = []
): MessageInterface;
```

Creates a message.

<h4 id="queueadaptermemorymemorycontext-createproducer"><code>createProducer()</code></h4>

```php
public function createProducer(): ProducerInterface;
```

Creates a producer.

<h4 id="queueadaptermemorymemorycontext-createsubscriptionconsumer"><code>createSubscriptionConsumer()</code></h4>

```php
public function createSubscriptionConsumer(): SubscriptionConsumerInterface;
```

Creates a subscription consumer.

<h4 id="queueadaptermemorymemorycontext-popmessage"><code>popMessage()</code></h4>

```php
public function popMessage( string $queueName ): MessageInterface|null;
```

Removes the front message from a queue, or null when it is empty.
Internal transport API used by MemoryConsumer.

<h4 id="queueadaptermemorymemorycontext-purgequeue"><code>purgeQueue()</code></h4>

```php
public function purgeQueue( QueueInterface $queue ): void;
```

Removes all messages from the given queue.

<h4 id="queueadaptermemorymemorycontext-pushmessage"><code>pushMessage()</code></h4>

```php
public function pushMessage(
string $queueName,
MessageInterface $message
): void;
```

Appends a message to the back of a queue.
Internal transport API used by MemoryProducer.

## Queue\Adapter\Memory\MemoryMessage

Class

In-process message. All behavior comes from MessageTrait.

- [`Phalcon\Queue\Adapter\AbstractMessage`](#queueadapterabstractmessage)
- **`Phalcon\Queue\Adapter\Memory\MemoryMessage`**

`Phalcon\Queue\Adapter\AbstractMessage`

## Queue\Adapter\Memory\MemoryProducer

Class

Sends messages into an in-process queue. The Memory transport delivers
immediately and in-process, so delivery delay, priority and time to live are
not supported (the defaults from AbstractProducer reject them).

- [`Phalcon\Queue\Adapter\AbstractProducer`](#queueadapterabstractproducer)
- **`Phalcon\Queue\Adapter\Memory\MemoryProducer`**

`Phalcon\Contracts\Queue\Destination` · `Phalcon\Contracts\Queue\Message` · `Phalcon\Queue\Adapter\AbstractProducer` · `Phalcon\Queue\Adapter\QueueDestinationGuard`

### Method Summary

<ApiItem href="#queueadaptermemorymemoryproducer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"MemoryContext","name":"context","default":null}]}>
</ApiItem>
<ApiItem href="#queueadaptermemorymemoryproducer-send" visibility="public" name="send" returnType="void" params={[{"type":"DestinationInterface","name":"destination","default":null},{"type":"MessageInterface","name":"message","default":null}]}>
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="context" type="MemoryContext" default="">
</ApiItem>

### Methods

<h4 id="queueadaptermemorymemoryproducer-__construct"><code>__construct()</code></h4>

```php
public function __construct( MemoryContext $context );
```

<h4 id="queueadaptermemorymemoryproducer-send"><code>send()</code></h4>

```php
public function send(
DestinationInterface $destination,
MessageInterface $message
): void;
```

## Queue\Adapter\Memory\MemorySubscriptionConsumer

Class

Consumes from several in-process queues at once. The round-robin poll loop
lives in SubscriptionConsumerTrait.

- [`Phalcon\Queue\Adapter\AbstractSubscriptionConsumer`](#queueadapterabstractsubscriptionconsumer)
- **`Phalcon\Queue\Adapter\Memory\MemorySubscriptionConsumer`**

`Phalcon\Queue\Adapter\AbstractSubscriptionConsumer`

### Method Summary

<ApiItem href="#queueadaptermemorymemorysubscriptionconsumer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"MemoryContext","name":"context","default":null}]}>
The context is retained for transports that may later need it for a
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="context" type="MemoryContext" default="">
</ApiItem>

### Methods

<h4 id="queueadaptermemorymemorysubscriptionconsumer-__construct"><code>__construct()</code></h4>

```php
public function __construct( MemoryContext $context );
```

The context is retained for transports that may later need it for a
native multi-queue receive; the shared poll loop does not use it.

## Queue\Adapter\MessageEnvelope

Class

Encodes and decodes the \{body, properties, headers\} envelope shared by every
transport that persists a message as a serialized string (Stream, Redis,
Beanstalk). Centralizes the wire shape, the object-injection-safe
`allowed_classes => false` guard, and the missing-key defaults, so each
adapter only supplies its own concrete message factory around `decode()`.

- **`Phalcon\Queue\Adapter\MessageEnvelope`**

`Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\QueueTypes`

### Method Summary

<ApiItem href="#queueadaptermessageenvelope-decode" visibility="public" name="decode" returnType="array|null" params={[{"type":"string","name":"payload","default":null}]}>
Decodes a serialized payload into a normalized \{body, properties,
</ApiItem>
<ApiItem href="#queueadaptermessageenvelope-encode" visibility="public" name="encode" returnType="string" params={[{"type":"MessageInterface","name":"message","default":null}]}>
Serializes a message into its wire envelope.
</ApiItem>

### Methods

<h4 id="queueadaptermessageenvelope-decode"><code>decode()</code></h4>

```php
public static function decode( string $payload ): array|null;
```

Decodes a serialized payload into a normalized \{body, properties,
headers\} array, or null when the payload is not a valid envelope.

<h4 id="queueadaptermessageenvelope-encode"><code>encode()</code></h4>

```php
public static function encode( MessageInterface $message ): string;
```

Serializes a message into its wire envelope.

## Queue\Adapter\QueueDestinationGuard

Class

Shared "destination must be a queue" guard. Producers (on send) and contexts
(on createConsumer) both reject any non-queue destination with the same typed
exception; this keeps that single rule in one place. The `action` verb
("send to", "consume from") tailors the message to the caller.

- **`Phalcon\Queue\Adapter\QueueDestinationGuard`**

`Phalcon\Contracts\Queue\Destination` · `Phalcon\Contracts\Queue\Queue` · `Phalcon\Queue\Exceptions\InvalidDestinationException`

### Method Summary

<ApiItem href="#queueadapterqueuedestinationguard-assertqueue" visibility="public" name="assertQueue" returnType="void" params={[{"type":"DestinationInterface","name":"destination","default":null},{"type":"string","name":"action","default":null}]}>
Throws InvalidDestinationException unless the destination is a queue.
</ApiItem>

### Methods

<h4 id="queueadapterqueuedestinationguard-assertqueue"><code>assertQueue()</code></h4>

```php
public static function assertQueue(
DestinationInterface $destination,
string $action
): void;
```

Throws InvalidDestinationException unless the destination is a queue.

## Queue\Adapter\Redis\RedisConnectionFactory

Class

Connects to a Redis server (ext-redis) and builds a RedisContext. The
connection (connect/pconnect, auth, database select) is delegated to
Phalcon\Storage\Adapter\Redis so the queue reuses the framework's hardened
connection handling instead of re-implementing it.

Options:
  - host:         server host (default 127.0.0.1).
  - port:         server port (default 6379).
  - timeout:      connection timeout in seconds (default 0).
  - persistent:   use a persistent connection (default false).
  - persistentId: identifier for the persistent connection.
  - auth:         password, or [user, password] for ACL auth.
  - index:        database index to SELECT (default 0).
  - prefix:       key prefix for every queue (default "phalcon_queue:").
  - pollInterval: milliseconds between subscription poll passes (default 200).

- **`Phalcon\Queue\Adapter\Redis\RedisConnectionFactory`** - implements [`Phalcon\Contracts\Queue\ConnectionFactory`](/5.20/api/phalcon_contracts/#contractsqueueconnectionfactory)

`Phalcon\Contracts\Queue\ConnectionFactory` · `Phalcon\Contracts\Queue\Context` · `Phalcon\Contracts\Queue\QueueTypes` · `Phalcon\Queue\Exceptions\Exception` · `Phalcon\Storage\Adapter\Redis` · `Phalcon\Storage\Exception` · `Phalcon\Storage\SerializerFactory`

### Method Summary

<ApiItem href="#queueadapterredisredisconnectionfactory-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"array","name":"options","default":"[]"}]}>
</ApiItem>
<ApiItem href="#queueadapterredisredisconnectionfactory-createcontext" visibility="public" name="createContext" returnType="ContextInterface" params={[]}>
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="options" type="array" default="[]">
</ApiItem>

### Methods

<h4 id="queueadapterredisredisconnectionfactory-__construct"><code>__construct()</code></h4>

```php
public function __construct( array $options = [] );
```

<h4 id="queueadapterredisredisconnectionfactory-createcontext"><code>createContext()</code></h4>

```php
public function createContext(): ContextInterface;
```

## Queue\Adapter\Redis\RedisConsumer

Class

Receives messages from a single Redis queue. `receive()` is overridden to
use the native blocking BRPOP (in one-second chunks, so due delayed
messages keep getting promoted) instead of the inherited polling loop.

- [`Phalcon\Queue\Adapter\AbstractConsumer`](#queueadapterabstractconsumer)
- **`Phalcon\Queue\Adapter\Redis\RedisConsumer`**

`Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Queue` · `Phalcon\Queue\Adapter\AbstractConsumer`

### Method Summary

<ApiItem href="#queueadapterredisredisconsumer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"RedisContext","name":"context","default":null},{"type":"QueueInterface","name":"queue","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterredisredisconsumer-acknowledge" visibility="public" name="acknowledge" returnType="void" params={[{"type":"MessageInterface","name":"message","default":null}]}>
No-op: a received message has already been removed from the queue.
</ApiItem>
<ApiItem href="#queueadapterredisredisconsumer-receive" visibility="public" name="receive" returnType="MessageInterface|null" params={[{"type":"int","name":"timeout","default":"0"}]}>
</ApiItem>
<ApiItem href="#queueadapterredisredisconsumer-receivenowait" visibility="public" name="receiveNoWait" returnType="MessageInterface|null" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterredisredisconsumer-reject" visibility="public" name="reject" returnType="void" params={[{"type":"MessageInterface","name":"message","default":null},{"type":"bool","name":"requeue","default":"false"}]}>
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="context" type="RedisContext" default="">
</ApiItem>

### Methods

<h4 id="queueadapterredisredisconsumer-__construct"><code>__construct()</code></h4>

```php
public function __construct(
RedisContext $context,
QueueInterface $queue
);
```

<h4 id="queueadapterredisredisconsumer-acknowledge"><code>acknowledge()</code></h4>

```php
public function acknowledge( MessageInterface $message ): void;
```

No-op: a received message has already been removed from the queue.

<h4 id="queueadapterredisredisconsumer-receive"><code>receive()</code></h4>

```php
public function receive( int $timeout = 0 ): MessageInterface|null;
```

<h4 id="queueadapterredisredisconsumer-receivenowait"><code>receiveNoWait()</code></h4>

```php
public function receiveNoWait(): MessageInterface|null;
```

<h4 id="queueadapterredisredisconsumer-reject"><code>reject()</code></h4>

```php
public function reject(
MessageInterface $message,
bool $requeue = false
): void;
```

## Queue\Adapter\Redis\RedisContext

Class

Redis transport session (ext-redis). Each queue is a Redis list; messages
are LPUSHed on send and RPOP/BRPOPed on receive, giving FIFO delivery.
Delayed messages live in a companion sorted set (`<key>:delayed`) scored by
their due time in milliseconds, and are promoted into the list once due. The
destination factories come from AbstractContext.

- [`Phalcon\Queue\Adapter\AbstractContext`](#queueadapterabstractcontext)
- **`Phalcon\Queue\Adapter\Redis\RedisContext`**

`Phalcon\Contracts\Queue\Consumer` · `Phalcon\Contracts\Queue\Destination` · `Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Producer` · `Phalcon\Contracts\Queue\Queue` · `Phalcon\Contracts\Queue\SubscriptionConsumer` · `Phalcon\Queue\Adapter\AbstractContext` · `Phalcon\Queue\Adapter\MessageEnvelope` · `Phalcon\Queue\Adapter\QueueDestinationGuard` · `Redis`

### Method Summary

<ApiItem href="#queueadapterredisrediscontext-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"RedisService","name":"redis","default":null},{"type":"string","name":"prefix","default":"\"phalcon_queue:\""},{"type":"int","name":"pollInterval","default":"200"}]}>
</ApiItem>
<ApiItem href="#queueadapterredisrediscontext-blockingpop" visibility="public" name="blockingPop" returnType="MessageInterface|null" params={[{"type":"string","name":"queueName","default":null},{"type":"int","name":"timeout","default":null}]}>
Blocking pop from the back of a queue list. Promotes any due delayed
</ApiItem>
<ApiItem href="#queueadapterredisrediscontext-close" visibility="public" name="close" returnType="void" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterredisrediscontext-createconsumer" visibility="public" name="createConsumer" returnType="ConsumerInterface" params={[{"type":"DestinationInterface","name":"destination","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterredisrediscontext-createmessage" visibility="public" name="createMessage" returnType="MessageInterface" params={[{"type":"string","name":"body","default":"\"\""},{"type":"array","name":"properties","default":"[]"},{"type":"array","name":"headers","default":"[]"}]}>
</ApiItem>
<ApiItem href="#queueadapterredisrediscontext-createproducer" visibility="public" name="createProducer" returnType="ProducerInterface" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterredisrediscontext-createsubscriptionconsumer" visibility="public" name="createSubscriptionConsumer" returnType="SubscriptionConsumerInterface" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterredisrediscontext-popmessage" visibility="public" name="popMessage" returnType="MessageInterface|null" params={[{"type":"string","name":"queueName","default":null}]}>
Non-blocking pop from the back of a queue list, or null when empty.
</ApiItem>
<ApiItem href="#queueadapterredisrediscontext-purgequeue" visibility="public" name="purgeQueue" returnType="void" params={[{"type":"QueueInterface","name":"queue","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterredisrediscontext-pushmessage" visibility="public" name="pushMessage" returnType="void" params={[{"type":"string","name":"queueName","default":null},{"type":"MessageInterface","name":"message","default":null},{"type":"int","name":"delay","default":"0"}]}>
Sends a message to a queue. With a positive delay (milliseconds) the
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="pollInterval" type="int" default="200">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="prefix" type="string" default="&quot;phalcon_queue:&quot;">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="redis" type="RedisService" default="">
</ApiItem>

### Methods

<h4 id="queueadapterredisrediscontext-__construct"><code>__construct()</code></h4>

```php
public function __construct(
RedisService $redis,
string $prefix = "phalcon_queue:",
int $pollInterval = 200
);
```

<h4 id="queueadapterredisrediscontext-blockingpop"><code>blockingPop()</code></h4>

```php
public function blockingPop(
string $queueName,
int $timeout
): MessageInterface|null;
```

Blocking pop from the back of a queue list. Promotes any due delayed
messages first, then blocks up to timeout seconds. Internal transport
API used by RedisConsumer.

<h4 id="queueadapterredisrediscontext-close"><code>close()</code></h4>

```php
public function close(): void;
```

<h4 id="queueadapterredisrediscontext-createconsumer"><code>createConsumer()</code></h4>

```php
public function createConsumer( DestinationInterface $destination ): ConsumerInterface;
```

<h4 id="queueadapterredisrediscontext-createmessage"><code>createMessage()</code></h4>

```php
public function createMessage(
string $body = "",
array $properties = [],
array $headers = []
): MessageInterface;
```

<h4 id="queueadapterredisrediscontext-createproducer"><code>createProducer()</code></h4>

```php
public function createProducer(): ProducerInterface;
```

<h4 id="queueadapterredisrediscontext-createsubscriptionconsumer"><code>createSubscriptionConsumer()</code></h4>

```php
public function createSubscriptionConsumer(): SubscriptionConsumerInterface;
```

<h4 id="queueadapterredisrediscontext-popmessage"><code>popMessage()</code></h4>

```php
public function popMessage( string $queueName ): MessageInterface|null;
```

Non-blocking pop from the back of a queue list, or null when empty.
Promotes any due delayed messages first. Internal transport API used
by RedisConsumer.

<h4 id="queueadapterredisrediscontext-purgequeue"><code>purgeQueue()</code></h4>

```php
public function purgeQueue( QueueInterface $queue ): void;
```

<h4 id="queueadapterredisrediscontext-pushmessage"><code>pushMessage()</code></h4>

```php
public function pushMessage(
string $queueName,
MessageInterface $message,
int $delay = 0
): void;
```

Sends a message to a queue. With a positive delay (milliseconds) the
message is parked in the delayed set; otherwise it is pushed onto the
front of the list. Internal transport API used by RedisProducer.

## Queue\Adapter\Redis\RedisMessage

Class

Redis-backed message. All behavior comes from MessageTrait.

- [`Phalcon\Queue\Adapter\AbstractMessage`](#queueadapterabstractmessage)
- **`Phalcon\Queue\Adapter\Redis\RedisMessage`**

`Phalcon\Queue\Adapter\AbstractMessage`

## Queue\Adapter\Redis\RedisProducer

Class

Sends messages to a Redis queue. Delivery delay is supported (via the
delayed sorted set); priority and time to live are not (the defaults from
AbstractProducer reject them).

- [`Phalcon\Queue\Adapter\AbstractProducer`](#queueadapterabstractproducer)
- **`Phalcon\Queue\Adapter\Redis\RedisProducer`**

`Phalcon\Contracts\Queue\Destination` · `Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Producer` · `Phalcon\Queue\Adapter\AbstractProducer` · `Phalcon\Queue\Adapter\QueueDestinationGuard`

### Method Summary

<ApiItem href="#queueadapterredisredisproducer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"RedisContext","name":"context","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterredisredisproducer-getdeliverydelay" visibility="public" name="getDeliveryDelay" returnType="int|null" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterredisredisproducer-send" visibility="public" name="send" returnType="void" params={[{"type":"DestinationInterface","name":"destination","default":null},{"type":"MessageInterface","name":"message","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterredisredisproducer-setdeliverydelay" visibility="public" name="setDeliveryDelay" returnType="ProducerInterface" params={[{"type":"mixed","name":"deliveryDelay","default":"null"}]}>
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="context" type="RedisContext" default="">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="deliveryDelay" type="int|null" default="null">
Delivery delay in milliseconds, or null when not set.
</ApiItem>

### Methods

<h4 id="queueadapterredisredisproducer-__construct"><code>__construct()</code></h4>

```php
public function __construct( RedisContext $context );
```

<h4 id="queueadapterredisredisproducer-getdeliverydelay"><code>getDeliveryDelay()</code></h4>

```php
public function getDeliveryDelay(): int|null;
```

<h4 id="queueadapterredisredisproducer-send"><code>send()</code></h4>

```php
public function send(
DestinationInterface $destination,
MessageInterface $message
): void;
```

<h4 id="queueadapterredisredisproducer-setdeliverydelay"><code>setDeliveryDelay()</code></h4>

```php
public function setDeliveryDelay( mixed $deliveryDelay = null ): ProducerInterface;
```

## Queue\Adapter\Redis\RedisSubscriptionConsumer

Class

Consumes from several Redis queues at once. The round-robin poll loop lives
in SubscriptionConsumerTrait.

- [`Phalcon\Queue\Adapter\AbstractSubscriptionConsumer`](#queueadapterabstractsubscriptionconsumer)
- **`Phalcon\Queue\Adapter\Redis\RedisSubscriptionConsumer`**

`Phalcon\Queue\Adapter\AbstractSubscriptionConsumer`

### Method Summary

<ApiItem href="#queueadapterredisredissubscriptionconsumer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"RedisContext","name":"context","default":null},{"type":"int","name":"pollInterval","default":"200"}]}>
The context is retained for transports that may later need it for a
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="context" type="RedisContext" default="">
</ApiItem>

### Methods

<h4 id="queueadapterredisredissubscriptionconsumer-__construct"><code>__construct()</code></h4>

```php
public function __construct(
RedisContext $context,
int $pollInterval = 200
);
```

The context is retained for transports that may later need it for a
native multi-queue receive; the shared poll loop does not use it.

## Queue\Adapter\Stream\StreamConnectionFactory

Class

Builds a StreamContext.

Options:
  - storageDir:   directory holding the queue files (default: a private
                  "phalcon_queue" subdirectory of the system temp dir).
  - pollInterval: milliseconds between consumer poll attempts (default 200).

- **`Phalcon\Queue\Adapter\Stream\StreamConnectionFactory`** - implements [`Phalcon\Contracts\Queue\ConnectionFactory`](/5.20/api/phalcon_contracts/#contractsqueueconnectionfactory)

`Phalcon\Contracts\Queue\ConnectionFactory` · `Phalcon\Contracts\Queue\Context` · `Phalcon\Contracts\Queue\QueueTypes`

### Method Summary

<ApiItem href="#queueadapterstreamstreamconnectionfactory-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"array","name":"options","default":"[]"}]}>
</ApiItem>
<ApiItem href="#queueadapterstreamstreamconnectionfactory-createcontext" visibility="public" name="createContext" returnType="ContextInterface" params={[]}>
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="options" type="array" default="[]">
</ApiItem>

### Methods

<h4 id="queueadapterstreamstreamconnectionfactory-__construct"><code>__construct()</code></h4>

```php
public function __construct( array $options = [] );
```

<h4 id="queueadapterstreamstreamconnectionfactory-createcontext"><code>createContext()</code></h4>

```php
public function createContext(): ContextInterface;
```

## Queue\Adapter\Stream\StreamConsumer

Class

Receives messages from a single filesystem queue. `receive()` is the
polling loop inherited from AbstractConsumer.

- [`Phalcon\Queue\Adapter\AbstractConsumer`](#queueadapterabstractconsumer)
- **`Phalcon\Queue\Adapter\Stream\StreamConsumer`**

`Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Queue` · `Phalcon\Queue\Adapter\AbstractConsumer`

### Method Summary

<ApiItem href="#queueadapterstreamstreamconsumer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"StreamContext","name":"context","default":null},{"type":"QueueInterface","name":"queue","default":null},{"type":"int","name":"pollInterval","default":"200"}]}>
</ApiItem>
<ApiItem href="#queueadapterstreamstreamconsumer-acknowledge" visibility="public" name="acknowledge" returnType="void" params={[{"type":"MessageInterface","name":"message","default":null}]}>
No-op: a received message has already been removed from the queue file.
</ApiItem>
<ApiItem href="#queueadapterstreamstreamconsumer-receivenowait" visibility="public" name="receiveNoWait" returnType="MessageInterface|null" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterstreamstreamconsumer-reject" visibility="public" name="reject" returnType="void" params={[{"type":"MessageInterface","name":"message","default":null},{"type":"bool","name":"requeue","default":"false"}]}>
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="context" type="StreamContext" default="">
</ApiItem>

### Methods

<h4 id="queueadapterstreamstreamconsumer-__construct"><code>__construct()</code></h4>

```php
public function __construct(
StreamContext $context,
QueueInterface $queue,
int $pollInterval = 200
);
```

<h4 id="queueadapterstreamstreamconsumer-acknowledge"><code>acknowledge()</code></h4>

```php
public function acknowledge( MessageInterface $message ): void;
```

No-op: a received message has already been removed from the queue file.

<h4 id="queueadapterstreamstreamconsumer-receivenowait"><code>receiveNoWait()</code></h4>

```php
public function receiveNoWait(): MessageInterface|null;
```

<h4 id="queueadapterstreamstreamconsumer-reject"><code>reject()</code></h4>

```php
public function reject(
MessageInterface $message,
bool $requeue = false
): void;
```

## Queue\Adapter\Stream\StreamContext

Class

Filesystem transport session. Each queue is one append-only file under the
configured directory; cross-process safety comes from flock. One message
per line, stored as base64(serialize([...])) so bodies with newlines are
safe. The destination factories come from AbstractContext.

- [`Phalcon\Queue\Adapter\AbstractContext`](#queueadapterabstractcontext)
- **`Phalcon\Queue\Adapter\Stream\StreamContext`**

`Phalcon\Contracts\Queue\Consumer` · `Phalcon\Contracts\Queue\Destination` · `Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Producer` · `Phalcon\Contracts\Queue\Queue` · `Phalcon\Contracts\Queue\SubscriptionConsumer` · `Phalcon\Queue\Adapter\AbstractContext` · `Phalcon\Queue\Adapter\MessageEnvelope` · `Phalcon\Queue\Adapter\QueueDestinationGuard` · `Phalcon\Traits\Php\FileTrait`

### Method Summary

<ApiItem href="#queueadapterstreamstreamcontext-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"string","name":"storageDir","default":null},{"type":"int","name":"pollInterval","default":"200"}]}>
</ApiItem>
<ApiItem href="#queueadapterstreamstreamcontext-close" visibility="public" name="close" returnType="void" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterstreamstreamcontext-createconsumer" visibility="public" name="createConsumer" returnType="ConsumerInterface" params={[{"type":"DestinationInterface","name":"destination","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterstreamstreamcontext-createmessage" visibility="public" name="createMessage" returnType="MessageInterface" params={[{"type":"string","name":"body","default":"\"\""},{"type":"array","name":"properties","default":"[]"},{"type":"array","name":"headers","default":"[]"}]}>
</ApiItem>
<ApiItem href="#queueadapterstreamstreamcontext-createproducer" visibility="public" name="createProducer" returnType="ProducerInterface" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterstreamstreamcontext-createsubscriptionconsumer" visibility="public" name="createSubscriptionConsumer" returnType="SubscriptionConsumerInterface" params={[]}>
</ApiItem>
<ApiItem href="#queueadapterstreamstreamcontext-popmessage" visibility="public" name="popMessage" returnType="MessageInterface|null" params={[{"type":"string","name":"queueName","default":null}]}>
Removes the front message from a queue file, or null when it is empty.
</ApiItem>
<ApiItem href="#queueadapterstreamstreamcontext-purgequeue" visibility="public" name="purgeQueue" returnType="void" params={[{"type":"QueueInterface","name":"queue","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterstreamstreamcontext-pushmessage" visibility="public" name="pushMessage" returnType="void" params={[{"type":"string","name":"queueName","default":null},{"type":"MessageInterface","name":"message","default":null}]}>
Appends a message to the back of a queue file.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="pollInterval" type="int" default="200">
Milliseconds slept between poll attempts by consumers.
</ApiItem>
<ApiItem kind="property" visibility="protected" name="storageDir" type="string" default="&quot;&quot;">
Directory (with trailing separator) that holds the queue files.
</ApiItem>

### Methods

<h4 id="queueadapterstreamstreamcontext-__construct"><code>__construct()</code></h4>

```php
public function __construct(
string $storageDir,
int $pollInterval = 200
);
```

<h4 id="queueadapterstreamstreamcontext-close"><code>close()</code></h4>

```php
public function close(): void;
```

<h4 id="queueadapterstreamstreamcontext-createconsumer"><code>createConsumer()</code></h4>

```php
public function createConsumer( DestinationInterface $destination ): ConsumerInterface;
```

<h4 id="queueadapterstreamstreamcontext-createmessage"><code>createMessage()</code></h4>

```php
public function createMessage(
string $body = "",
array $properties = [],
array $headers = []
): MessageInterface;
```

<h4 id="queueadapterstreamstreamcontext-createproducer"><code>createProducer()</code></h4>

```php
public function createProducer(): ProducerInterface;
```

<h4 id="queueadapterstreamstreamcontext-createsubscriptionconsumer"><code>createSubscriptionConsumer()</code></h4>

```php
public function createSubscriptionConsumer(): SubscriptionConsumerInterface;
```

<h4 id="queueadapterstreamstreamcontext-popmessage"><code>popMessage()</code></h4>

```php
public function popMessage( string $queueName ): MessageInterface|null;
```

Removes the front message from a queue file, or null when it is empty.
Internal transport API used by StreamConsumer.

<h4 id="queueadapterstreamstreamcontext-purgequeue"><code>purgeQueue()</code></h4>

```php
public function purgeQueue( QueueInterface $queue ): void;
```

<h4 id="queueadapterstreamstreamcontext-pushmessage"><code>pushMessage()</code></h4>

```php
public function pushMessage(
string $queueName,
MessageInterface $message
): void;
```

Appends a message to the back of a queue file.
Internal transport API used by StreamProducer.

## Queue\Adapter\Stream\StreamMessage

Class

Filesystem-backed message. All behavior comes from MessageTrait.

- [`Phalcon\Queue\Adapter\AbstractMessage`](#queueadapterabstractmessage)
- **`Phalcon\Queue\Adapter\Stream\StreamMessage`**

`Phalcon\Queue\Adapter\AbstractMessage`

## Queue\Adapter\Stream\StreamProducer

Class

Appends messages to a filesystem queue. The Stream transport delivers in
insertion order with no scheduling, so delivery delay, priority and time to
live are not supported (the defaults from AbstractProducer reject them).

- [`Phalcon\Queue\Adapter\AbstractProducer`](#queueadapterabstractproducer)
- **`Phalcon\Queue\Adapter\Stream\StreamProducer`**

`Phalcon\Contracts\Queue\Destination` · `Phalcon\Contracts\Queue\Message` · `Phalcon\Queue\Adapter\AbstractProducer` · `Phalcon\Queue\Adapter\QueueDestinationGuard`

### Method Summary

<ApiItem href="#queueadapterstreamstreamproducer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"StreamContext","name":"context","default":null}]}>
</ApiItem>
<ApiItem href="#queueadapterstreamstreamproducer-send" visibility="public" name="send" returnType="void" params={[{"type":"DestinationInterface","name":"destination","default":null},{"type":"MessageInterface","name":"message","default":null}]}>
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="context" type="StreamContext" default="">
</ApiItem>

### Methods

<h4 id="queueadapterstreamstreamproducer-__construct"><code>__construct()</code></h4>

```php
public function __construct( StreamContext $context );
```

<h4 id="queueadapterstreamstreamproducer-send"><code>send()</code></h4>

```php
public function send(
DestinationInterface $destination,
MessageInterface $message
): void;
```

## Queue\Adapter\Stream\StreamSubscriptionConsumer

Class

Consumes from several filesystem queues at once. The round-robin poll loop
lives in SubscriptionConsumerTrait.

- [`Phalcon\Queue\Adapter\AbstractSubscriptionConsumer`](#queueadapterabstractsubscriptionconsumer)
- **`Phalcon\Queue\Adapter\Stream\StreamSubscriptionConsumer`**

`Phalcon\Queue\Adapter\AbstractSubscriptionConsumer`

### Method Summary

<ApiItem href="#queueadapterstreamstreamsubscriptionconsumer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"StreamContext","name":"context","default":null},{"type":"int","name":"pollInterval","default":"200"}]}>
The context is retained for transports that may later need it for a
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="context" type="StreamContext" default="">
</ApiItem>

### Methods

<h4 id="queueadapterstreamstreamsubscriptionconsumer-__construct"><code>__construct()</code></h4>

```php
public function __construct(
StreamContext $context,
int $pollInterval = 200
);
```

The context is retained for transports that may later need it for a
native multi-queue receive; the shared poll loop does not use it.

## Queue\Adapter\Traits\MessageTrait

Trait

Shared implementation of every Message getter/setter, plus the
correlation-id / message-id / timestamp / reply-to header conveniences.
Concrete adapter messages use this trait.

The convenience accessors are stored as transport headers under fixed keys
for binary compatibility with the wider interop ecosystem.

- **`Phalcon\Queue\Adapter\Traits\MessageTrait`**

`Phalcon\Contracts\Queue\QueueTypes`

[`Phalcon\Queue\Adapter\AbstractMessage`](#queueadapterabstractmessage)

### Method Summary

<ApiItem href="#queueadaptertraitsmessagetrait-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"string","name":"body","default":"\"\""},{"type":"array","name":"properties","default":"[]"},{"type":"array","name":"headers","default":"[]"}]}>
Message constructor.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-getbody" visibility="public" name="getBody" returnType="string" params={[]}>
Returns the message body.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-getcorrelationid" visibility="public" name="getCorrelationId" returnType="string|null" params={[]}>
Returns the correlation id used to correlate request/reply messages.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-getheader" visibility="public" name="getHeader" returnType="mixed" params={[{"type":"string","name":"name","default":null},{"type":"mixed","name":"defaultValue","default":"null"}]}>
Returns a single header value, or the default when it is not set.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-getheaders" visibility="public" name="getHeaders" returnType="array" params={[]}>
Returns all transport headers.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-getmessageid" visibility="public" name="getMessageId" returnType="string|null" params={[]}>
Returns the message id.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-getproperties" visibility="public" name="getProperties" returnType="array" params={[]}>
Returns all application properties.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-getproperty" visibility="public" name="getProperty" returnType="mixed" params={[{"type":"string","name":"name","default":null},{"type":"mixed","name":"defaultValue","default":"null"}]}>
Returns a single property value, or the default when it is not set.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-getreplyto" visibility="public" name="getReplyTo" returnType="string|null" params={[]}>
Returns the reply-to destination name.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-gettimestamp" visibility="public" name="getTimestamp" returnType="int|null" params={[]}>
Returns the timestamp (in milliseconds) or null when it is not set.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-isredelivered" visibility="public" name="isRedelivered" returnType="bool" params={[]}>
Whether the message has been redelivered.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-setbody" visibility="public" name="setBody" returnType="void" params={[{"type":"string","name":"body","default":null}]}>
Sets the message body.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-setcorrelationid" visibility="public" name="setCorrelationId" returnType="void" params={[{"type":"string","name":"correlationId","default":null}]}>
Sets the correlation id.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-setheader" visibility="public" name="setHeader" returnType="void" params={[{"type":"string","name":"name","default":null},{"type":"mixed","name":"value","default":null}]}>
Sets a single transport header.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-setheaders" visibility="public" name="setHeaders" returnType="void" params={[{"type":"array","name":"headers","default":null}]}>
Replaces all transport headers.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-setmessageid" visibility="public" name="setMessageId" returnType="void" params={[{"type":"string","name":"messageId","default":null}]}>
Sets the message id.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-setproperties" visibility="public" name="setProperties" returnType="void" params={[{"type":"array","name":"properties","default":null}]}>
Replaces all application properties.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-setproperty" visibility="public" name="setProperty" returnType="void" params={[{"type":"string","name":"name","default":null},{"type":"mixed","name":"value","default":null}]}>
Sets a single application property.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-setredelivered" visibility="public" name="setRedelivered" returnType="void" params={[{"type":"bool","name":"redelivered","default":null}]}>
Marks the message as redelivered.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-setreplyto" visibility="public" name="setReplyTo" returnType="void" params={[{"type":"string","name":"replyTo","default":null}]}>
Sets the reply-to destination name.
</ApiItem>
<ApiItem href="#queueadaptertraitsmessagetrait-settimestamp" visibility="public" name="setTimestamp" returnType="void" params={[{"type":"int","name":"timestamp","default":null}]}>
Sets the timestamp (in milliseconds).
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="body" type="string" default="&quot;&quot;">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="headers" type="array" default="[]">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="properties" type="array" default="[]">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="redelivered" type="bool" default="false">
</ApiItem>

### Methods

<h4 id="queueadaptertraitsmessagetrait-__construct"><code>__construct()</code></h4>

```php
public function __construct(
string $body = "",
array $properties = [],
array $headers = []
);
```

Message constructor.

<h4 id="queueadaptertraitsmessagetrait-getbody"><code>getBody()</code></h4>

```php
public function getBody(): string;
```

Returns the message body.

<h4 id="queueadaptertraitsmessagetrait-getcorrelationid"><code>getCorrelationId()</code></h4>

```php
public function getCorrelationId(): string|null;
```

Returns the correlation id used to correlate request/reply messages.

<h4 id="queueadaptertraitsmessagetrait-getheader"><code>getHeader()</code></h4>

```php
public function getHeader(
string $name,
mixed $defaultValue = null
): mixed;
```

Returns a single header value, or the default when it is not set.

<h4 id="queueadaptertraitsmessagetrait-getheaders"><code>getHeaders()</code></h4>

```php
public function getHeaders(): array;
```

Returns all transport headers.

<h4 id="queueadaptertraitsmessagetrait-getmessageid"><code>getMessageId()</code></h4>

```php
public function getMessageId(): string|null;
```

Returns the message id.

<h4 id="queueadaptertraitsmessagetrait-getproperties"><code>getProperties()</code></h4>

```php
public function getProperties(): array;
```

Returns all application properties.

<h4 id="queueadaptertraitsmessagetrait-getproperty"><code>getProperty()</code></h4>

```php
public function getProperty(
string $name,
mixed $defaultValue = null
): mixed;
```

Returns a single property value, or the default when it is not set.

<h4 id="queueadaptertraitsmessagetrait-getreplyto"><code>getReplyTo()</code></h4>

```php
public function getReplyTo(): string|null;
```

Returns the reply-to destination name.

<h4 id="queueadaptertraitsmessagetrait-gettimestamp"><code>getTimestamp()</code></h4>

```php
public function getTimestamp(): int|null;
```

Returns the timestamp (in milliseconds) or null when it is not set.

<h4 id="queueadaptertraitsmessagetrait-isredelivered"><code>isRedelivered()</code></h4>

```php
public function isRedelivered(): bool;
```

Whether the message has been redelivered.

<h4 id="queueadaptertraitsmessagetrait-setbody"><code>setBody()</code></h4>

```php
public function setBody( string $body ): void;
```

Sets the message body.

<h4 id="queueadaptertraitsmessagetrait-setcorrelationid"><code>setCorrelationId()</code></h4>

```php
public function setCorrelationId( string $correlationId ): void;
```

Sets the correlation id.

<h4 id="queueadaptertraitsmessagetrait-setheader"><code>setHeader()</code></h4>

```php
public function setHeader(
string $name,
mixed $value
): void;
```

Sets a single transport header.

<h4 id="queueadaptertraitsmessagetrait-setheaders"><code>setHeaders()</code></h4>

```php
public function setHeaders( array $headers ): void;
```

Replaces all transport headers.

<h4 id="queueadaptertraitsmessagetrait-setmessageid"><code>setMessageId()</code></h4>

```php
public function setMessageId( string $messageId ): void;
```

Sets the message id.

<h4 id="queueadaptertraitsmessagetrait-setproperties"><code>setProperties()</code></h4>

```php
public function setProperties( array $properties ): void;
```

Replaces all application properties.

<h4 id="queueadaptertraitsmessagetrait-setproperty"><code>setProperty()</code></h4>

```php
public function setProperty(
string $name,
mixed $value
): void;
```

Sets a single application property.

<h4 id="queueadaptertraitsmessagetrait-setredelivered"><code>setRedelivered()</code></h4>

```php
public function setRedelivered( bool $redelivered ): void;
```

Marks the message as redelivered.

<h4 id="queueadaptertraitsmessagetrait-setreplyto"><code>setReplyTo()</code></h4>

```php
public function setReplyTo( string $replyTo ): void;
```

Sets the reply-to destination name.

<h4 id="queueadaptertraitsmessagetrait-settimestamp"><code>setTimestamp()</code></h4>

```php
public function setTimestamp( int $timestamp ): void;
```

Sets the timestamp (in milliseconds).

## Queue\Adapter\Traits\SubscriptionConsumerTrait

Trait

Shared subscription-consumer implementation. Implements the round-robin poll
loop that dispatches each subscribed consumer's messages to its callback; a
callback returning false stops consumption. The loop relies only on the
consumer's `receiveNoWait()`, so it is transport-agnostic. Concrete adapters
keep just the constructor that captures their context and poll interval.

- **`Phalcon\Queue\Adapter\Traits\SubscriptionConsumerTrait`**

`Phalcon\Contracts\Queue\QueueTypes`

[`Phalcon\Queue\Adapter\AbstractSubscriptionConsumer`](#queueadapterabstractsubscriptionconsumer)

### Method Summary

<ApiItem href="#queueadaptertraitssubscriptionconsumertrait-consume" visibility="public" name="consume" returnType="void" params={[{"type":"int","name":"timeout","default":"0"}]}>
Polls every subscription, dispatching each message to its callback,
</ApiItem>
<ApiItem href="#queueadaptertraitssubscriptionconsumertrait-subscribe" visibility="public" name="subscribe" returnType="void" params={[{"type":"\\Phalcon\\Contracts\\Queue\\Consumer","name":"consumer","default":null},{"type":"callable","name":"callback","default":null}]}>
Subscribes a consumer; the callback receives each delivered message.
</ApiItem>
<ApiItem href="#queueadaptertraitssubscriptionconsumertrait-unsubscribe" visibility="public" name="unsubscribe" returnType="void" params={[{"type":"\\Phalcon\\Contracts\\Queue\\Consumer","name":"consumer","default":null}]}>
Removes a previously subscribed consumer.
</ApiItem>
<ApiItem href="#queueadaptertraitssubscriptionconsumertrait-unsubscribeall" visibility="public" name="unsubscribeAll" returnType="void" params={[]}>
Removes every subscribed consumer.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="pollInterval" type="int" default="200">
Milliseconds slept between poll passes.
</ApiItem>
<ApiItem kind="property" visibility="protected" name="subscriptions" type="array" default="[]">
Subscriptions keyed by queue name: [consumer, callback].
</ApiItem>

### Methods

<h4 id="queueadaptertraitssubscriptionconsumertrait-consume"><code>consume()</code></h4>

```php
public function consume( int $timeout = 0 ): void;
```

Polls every subscription, dispatching each message to its callback,
blocking up to timeout milliseconds (0 = block until a callback
returns false).

<h4 id="queueadaptertraitssubscriptionconsumertrait-subscribe"><code>subscribe()</code></h4>

```php
public function subscribe(
\Phalcon\Contracts\Queue\Consumer $consumer,
callable $callback
): void;
```

Subscribes a consumer; the callback receives each delivered message.

<h4 id="queueadaptertraitssubscriptionconsumertrait-unsubscribe"><code>unsubscribe()</code></h4>

```php
public function unsubscribe( \Phalcon\Contracts\Queue\Consumer $consumer ): void;
```

Removes a previously subscribed consumer.

<h4 id="queueadaptertraitssubscriptionconsumertrait-unsubscribeall"><code>unsubscribeAll()</code></h4>

```php
public function unsubscribeAll(): void;
```

Removes every subscribed consumer.

## Queue\Cli\ConsumerTask

Class

Optional CLI runner for a queue worker - the only class coupled to
Phalcon\Cli. A thin adapter: it resolves the context from the `queueFactory`
service, binds one queue to one processor (both given as command arguments),
and runs a Worker whose lifetime bounds come from CLI options. Users not on
Phalcon\Cli use Worker directly.

Usage:
    &lt;task> &lt;queueName> &lt;processorServiceId> \
        [--max-messages=N] [--max-time=SECONDS] \
        [--max-memory=MB] [--jitter=SECONDS]

Register it in your own Phalcon\Cli\Console; it is not auto-wired into
FactoryDefault.

- `\stdClass`
- [`Phalcon\Di\Injectable`](/5.20/api/phalcon_di/#diinjectable)
- [`Phalcon\Cli\Task`](/5.20/api/phalcon_cli/#clitask)
- **`Phalcon\Queue\Cli\ConsumerTask`**

`Phalcon\Cli\Dispatcher` · `Phalcon\Cli\Task` · `Phalcon\Config\Config` · `Phalcon\Config\ConfigInterface` · `Phalcon\Contracts\Queue\Processor` · `Phalcon\Di\DiInterface` · `Phalcon\Queue\Consumer\QueueConsumer` · `Phalcon\Queue\Consumer\Worker` · `Phalcon\Queue\Consumer\WorkerOptions` · `Phalcon\Queue\QueueFactory`

### Method Summary

<ApiItem href="#queuecliconsumertask-mainaction" visibility="public" name="mainAction" returnType="int" params={[]}>
</ApiItem>

### Methods

<h4 id="queuecliconsumertask-mainaction"><code>mainAction()</code></h4>

```php
public function mainAction(): int;
```

## Queue\Consumer\BoundProcessor

Class

Binds a processor to a queue, together with the consumer that reads it.

- **`Phalcon\Queue\Consumer\BoundProcessor`**

`Phalcon\Contracts\Queue\Consumer` · `Phalcon\Contracts\Queue\Processor` · `Phalcon\Contracts\Queue\Queue`

### Method Summary

<ApiItem href="#queueconsumerboundprocessor-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"QueueInterface","name":"queue","default":null},{"type":"ProcessorInterface","name":"processor","default":null},{"type":"ConsumerInterface","name":"consumer","default":null}]}>
</ApiItem>
<ApiItem href="#queueconsumerboundprocessor-getconsumer" visibility="public" name="getConsumer" returnType="ConsumerInterface" params={[]}>
</ApiItem>
<ApiItem href="#queueconsumerboundprocessor-getprocessor" visibility="public" name="getProcessor" returnType="ProcessorInterface" params={[]}>
</ApiItem>
<ApiItem href="#queueconsumerboundprocessor-getqueue" visibility="public" name="getQueue" returnType="QueueInterface" params={[]}>
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="consumer" type="ConsumerInterface" default="">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="processor" type="ProcessorInterface" default="">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="queue" type="QueueInterface" default="">
</ApiItem>

### Methods

<h4 id="queueconsumerboundprocessor-__construct"><code>__construct()</code></h4>

```php
public function __construct(
QueueInterface $queue,
ProcessorInterface $processor,
ConsumerInterface $consumer
);
```

<h4 id="queueconsumerboundprocessor-getconsumer"><code>getConsumer()</code></h4>

```php
public function getConsumer(): ConsumerInterface;
```

<h4 id="queueconsumerboundprocessor-getprocessor"><code>getProcessor()</code></h4>

```php
public function getProcessor(): ProcessorInterface;
```

<h4 id="queueconsumerboundprocessor-getqueue"><code>getQueue()</code></h4>

```php
public function getQueue(): QueueInterface;
```

## Queue\Consumer\Events

Class

Lifecycle event names fired by the queue consumer through
Phalcon\Events\Manager. One public constant per event.

- **`Phalcon\Queue\Consumer\Events`**

### Constants

<ApiItem kind="constant" name="AFTER_END" type="string" default="&quot;queue:afterEnd&quot;">
</ApiItem>
<ApiItem kind="constant" name="AFTER_PROCESS" type="string" default="&quot;queue:afterProcess&quot;">
</ApiItem>
<ApiItem kind="constant" name="AFTER_RECEIVE" type="string" default="&quot;queue:afterReceive&quot;">
</ApiItem>
<ApiItem kind="constant" name="BEFORE_PROCESS" type="string" default="&quot;queue:beforeProcess&quot;">
</ApiItem>
<ApiItem kind="constant" name="BEFORE_RECEIVE" type="string" default="&quot;queue:beforeReceive&quot;">
</ApiItem>
<ApiItem kind="constant" name="BEFORE_START" type="string" default="&quot;queue:beforeStart&quot;">
</ApiItem>
<ApiItem kind="constant" name="PROCESSOR_EXCEPTION" type="string" default="&quot;queue:processorException&quot;">
</ApiItem>

## Queue\Consumer\QueueConsumer

Class

Lean consumption runner. Binds processors to queues, polls each bound queue
round-robin, and dispatches messages to their processors while firing the
lifecycle events on `Phalcon\Queue\Consumer\Events` through the events
manager. The long-running operational shell (lifetime, signals) lives in
`Phalcon\Queue\Consumer\Worker`, which drives `consumeOnce()` and shares the
stop signal through `stop()` / `isStopRequested()`.

- [`Phalcon\Events\AbstractEventsAware`](/5.20/api/phalcon_events/#eventsabstracteventsaware)
- **`Phalcon\Queue\Consumer\QueueConsumer`** - implements [`Phalcon\Events\EventsAwareInterface`](/5.20/api/phalcon_events/#eventseventsawareinterface)

`Phalcon\Contracts\Queue\Consumer` · `Phalcon\Contracts\Queue\Context` · `Phalcon\Contracts\Queue\Message` · `Phalcon\Contracts\Queue\Processor` · `Phalcon\Contracts\Queue\Queue` · `Phalcon\Events\AbstractEventsAware` · `Phalcon\Events\EventsAwareInterface` · `Throwable`

### Method Summary

<ApiItem href="#queueconsumerqueueconsumer-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"ContextInterface","name":"context","default":null}]}>
</ApiItem>
<ApiItem href="#queueconsumerqueueconsumer-bind" visibility="public" name="bind" returnType="QueueConsumer" params={[{"type":"QueueInterface","name":"queue","default":null},{"type":"ProcessorInterface","name":"processor","default":null}]}>
Binds a processor to a queue. Returns self for chaining.
</ApiItem>
<ApiItem href="#queueconsumerqueueconsumer-consume" visibility="public" name="consume" returnType="void" params={[{"type":"int","name":"timeout","default":"0"}]}>
Runs the consumption loop, blocking up to timeout milliseconds (0 =
</ApiItem>
<ApiItem href="#queueconsumerqueueconsumer-consumeonce" visibility="public" name="consumeOnce" returnType="int" params={[]}>
Polls every bound queue once, dispatching any messages found. Returns
</ApiItem>
<ApiItem href="#queueconsumerqueueconsumer-end" visibility="public" name="end" returnType="void" params={[]}>
Fires the `queue:afterEnd` event. Called once the loop exits.
</ApiItem>
<ApiItem href="#queueconsumerqueueconsumer-isstoprequested" visibility="public" name="isStopRequested" returnType="bool" params={[]}>
Whether a stop has been requested (by a signal, `stop()`, or an
</ApiItem>
<ApiItem href="#queueconsumerqueueconsumer-setpollinterval" visibility="public" name="setPollInterval" returnType="void" params={[{"type":"int","name":"pollInterval","default":null}]}>
Sets the poll interval (in milliseconds).
</ApiItem>
<ApiItem href="#queueconsumerqueueconsumer-start" visibility="public" name="start" returnType="bool" params={[]}>
Resets the stop flag and fires `queue:beforeStart`. Returns false when a
</ApiItem>
<ApiItem href="#queueconsumerqueueconsumer-stop" visibility="public" name="stop" returnType="void" params={[]}>
Requests the consumption loop to stop after the current message.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="bindings" type="array&lt;string, BoundProcessor&gt;" default="[]">
Bound processors keyed by queue name.
</ApiItem>
<ApiItem kind="property" visibility="protected" name="context" type="ContextInterface" default="">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="pollInterval" type="int" default="200">
Milliseconds slept between poll passes when nothing was received.
</ApiItem>
<ApiItem kind="property" visibility="protected" name="shouldStop" type="bool" default="false">
</ApiItem>

### Methods

<h4 id="queueconsumerqueueconsumer-__construct"><code>__construct()</code></h4>

```php
public function __construct( ContextInterface $context );
```

<h4 id="queueconsumerqueueconsumer-bind"><code>bind()</code></h4>

```php
public function bind(
QueueInterface $queue,
ProcessorInterface $processor
): QueueConsumer;
```

Binds a processor to a queue. Returns self for chaining.

<h4 id="queueconsumerqueueconsumer-consume"><code>consume()</code></h4>

```php
public function consume( int $timeout = 0 ): void;
```

Runs the consumption loop, blocking up to timeout milliseconds (0 =
block until stopped). The simple loop; production setups use Worker.

<h4 id="queueconsumerqueueconsumer-consumeonce"><code>consumeOnce()</code></h4>

```php
public function consumeOnce(): int;
```

Polls every bound queue once, dispatching any messages found. Returns
the number of messages processed in this pass, so callers (the Worker)
can apply a message-count limit across several bound queues.

<h4 id="queueconsumerqueueconsumer-end"><code>end()</code></h4>

```php
public function end(): void;
```

Fires the `queue:afterEnd` event. Called once the loop exits.

<h4 id="queueconsumerqueueconsumer-isstoprequested"><code>isStopRequested()</code></h4>

```php
public function isStopRequested(): bool;
```

Whether a stop has been requested (by a signal, `stop()`, or an
`afterReceive` listener returning false).

<h4 id="queueconsumerqueueconsumer-setpollinterval"><code>setPollInterval()</code></h4>

```php
public function setPollInterval( int $pollInterval ): void;
```

Sets the poll interval (in milliseconds).

<h4 id="queueconsumerqueueconsumer-start"><code>start()</code></h4>

```php
public function start(): bool;
```

Resets the stop flag and fires `queue:beforeStart`. Returns false when a
listener cancels the start.

<h4 id="queueconsumerqueueconsumer-stop"><code>stop()</code></h4>

```php
public function stop(): void;
```

Requests the consumption loop to stop after the current message.

## Queue\Consumer\Worker

Class

Long-running operational shell around a QueueConsumer. Owns the outer loop,
the bounded lifetime (max messages / seconds / memory, plus jitter) and -
when ext-pcntl is available - graceful shutdown on SIGTERM/SIGINT/SIGQUIT.
The current message always finishes before the loop stops (drain, not
guillotine), because the stop flag is only checked between iterations.

- **`Phalcon\Queue\Consumer\Worker`**

`Phalcon\Traits\Php\InfoTrait`

### Method Summary

<ApiItem href="#queueconsumerworker-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"QueueConsumer","name":"consumer","default":null},{"type":"WorkerOptions|null","name":"options","default":"null"}]}>
</ApiItem>
<ApiItem href="#queueconsumerworker-handlesignal" visibility="public" name="handleSignal" returnType="void" params={[{"type":"int","name":"signal","default":null}]}>
Signal handler: requests a graceful stop.
</ApiItem>
<ApiItem href="#queueconsumerworker-run" visibility="public" name="run" returnType="int" params={[]}>
Runs the worker until a lifetime bound trips or a stop is requested.
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="consumer" type="QueueConsumer" default="">
</ApiItem>
<ApiItem kind="property" visibility="protected" name="options" type="WorkerOptions" default="">
</ApiItem>

### Methods

<h4 id="queueconsumerworker-__construct"><code>__construct()</code></h4>

```php
public function __construct(
QueueConsumer $consumer,
WorkerOptions|null $options = null
);
```

<h4 id="queueconsumerworker-handlesignal"><code>handleSignal()</code></h4>

```php
public function handleSignal( int $signal ): void;
```

Signal handler: requests a graceful stop.

<h4 id="queueconsumerworker-run"><code>run()</code></h4>

```php
public function run(): int;
```

Runs the worker until a lifetime bound trips or a stop is requested.
Returns the number of messages processed.

## Queue\Consumer\WorkerOptions

Class

Immutable lifetime bounds for a Worker. A value of 0 means "no limit".
The worker stops on whichever bound trips first.

- **`Phalcon\Queue\Consumer\WorkerOptions`**

### Method Summary

<ApiItem href="#queueconsumerworkeroptions-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"int","name":"maxMessages","default":"0"},{"type":"int","name":"maxSeconds","default":"0"},{"type":"int","name":"maxMemory","default":"0"},{"type":"int","name":"jitter","default":"0"}]}>
</ApiItem>
<ApiItem href="#queueconsumerworkeroptions-getjitter" visibility="public" name="getJitter" returnType="int" params={[]}>
</ApiItem>
<ApiItem href="#queueconsumerworkeroptions-getmaxmemory" visibility="public" name="getMaxMemory" returnType="int" params={[]}>
</ApiItem>
<ApiItem href="#queueconsumerworkeroptions-getmaxmessages" visibility="public" name="getMaxMessages" returnType="int" params={[]}>
</ApiItem>
<ApiItem href="#queueconsumerworkeroptions-getmaxseconds" visibility="public" name="getMaxSeconds" returnType="int" params={[]}>
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="jitter" type="int" default="0">
Seconds added to maxSeconds (randomised per worker) so a pool does not
restart in lockstep.
</ApiItem>
<ApiItem kind="property" visibility="protected" name="maxMemory" type="int" default="0">
Memory ceiling in megabytes.
</ApiItem>
<ApiItem kind="property" visibility="protected" name="maxMessages" type="int" default="0">
Maximum number of messages to process.
</ApiItem>
<ApiItem kind="property" visibility="protected" name="maxSeconds" type="int" default="0">
Maximum run time in seconds.
</ApiItem>

### Methods

<h4 id="queueconsumerworkeroptions-__construct"><code>__construct()</code></h4>

```php
public function __construct(
int $maxMessages = 0,
int $maxSeconds = 0,
int $maxMemory = 0,
int $jitter = 0
);
```

<h4 id="queueconsumerworkeroptions-getjitter"><code>getJitter()</code></h4>

```php
public function getJitter(): int;
```

<h4 id="queueconsumerworkeroptions-getmaxmemory"><code>getMaxMemory()</code></h4>

```php
public function getMaxMemory(): int;
```

<h4 id="queueconsumerworkeroptions-getmaxmessages"><code>getMaxMessages()</code></h4>

```php
public function getMaxMessages(): int;
```

<h4 id="queueconsumerworkeroptions-getmaxseconds"><code>getMaxSeconds()</code></h4>

```php
public function getMaxSeconds(): int;
```

## Queue\Exceptions\DeliveryDelayNotSupportedException

Class

Thrown when the transport does not support a delivery delay.

- `\Exception`
- [`Phalcon\Queue\Exceptions\Exception`](#queueexceptionsexception)
- **`Phalcon\Queue\Exceptions\DeliveryDelayNotSupportedException`**

### Method Summary

<ApiItem href="#queueexceptionsdeliverydelaynotsupportedexception-__construct" visibility="public" name="__construct" returnType="" params={[]}>
</ApiItem>

### Methods

<h4 id="queueexceptionsdeliverydelaynotsupportedexception-__construct"><code>__construct()</code></h4>

```php
public function __construct();
```

## Queue\Exceptions\Exception

Class

Generic exception for the Queue component, and the base for every typed
queue exception.

- `\Exception`
- **`Phalcon\Queue\Exceptions\Exception`** - implements [`Phalcon\Queue\Exceptions\QueueThrowable`](#queueexceptionsqueuethrowable)
- [`Phalcon\Queue\Exceptions\DeliveryDelayNotSupportedException`](#queueexceptionsdeliverydelaynotsupportedexception)
- [`Phalcon\Queue\Exceptions\InvalidDestinationException`](#queueexceptionsinvaliddestinationexception)
- [`Phalcon\Queue\Exceptions\InvalidMessageException`](#queueexceptionsinvalidmessageexception)
- [`Phalcon\Queue\Exceptions\PriorityNotSupportedException`](#queueexceptionsprioritynotsupportedexception)
- [`Phalcon\Queue\Exceptions\PurgeQueueNotSupportedException`](#queueexceptionspurgequeuenotsupportedexception)
- [`Phalcon\Queue\Exceptions\SubscriptionConsumerNotSupportedException`](#queueexceptionssubscriptionconsumernotsupportedexception)
- [`Phalcon\Queue\Exceptions\TemporaryQueueNotSupportedException`](#queueexceptionstemporaryqueuenotsupportedexception)
- [`Phalcon\Queue\Exceptions\TimeToLiveNotSupportedException`](#queueexceptionstimetolivenotsupportedexception)

`Exception`

## Queue\Exceptions\InvalidDestinationException

Class

Thrown when a destination is not valid for the operation, for example a
Topic passed where a Queue is required. The action verb ("send to",
"consume from") tailors the message to the failing operation.

- `\Exception`
- [`Phalcon\Queue\Exceptions\Exception`](#queueexceptionsexception)
- **`Phalcon\Queue\Exceptions\InvalidDestinationException`**

### Method Summary

<ApiItem href="#queueexceptionsinvaliddestinationexception-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"string","name":"action","default":null}]}>
</ApiItem>

### Methods

<h4 id="queueexceptionsinvaliddestinationexception-__construct"><code>__construct()</code></h4>

```php
public function __construct( string $action );
```

## Queue\Exceptions\InvalidMessageException

Class

Thrown when a message is not valid for the operation.

- `\Exception`
- [`Phalcon\Queue\Exceptions\Exception`](#queueexceptionsexception)
- **`Phalcon\Queue\Exceptions\InvalidMessageException`**

### Method Summary

<ApiItem href="#queueexceptionsinvalidmessageexception-__construct" visibility="public" name="__construct" returnType="" params={[]}>
</ApiItem>

### Methods

<h4 id="queueexceptionsinvalidmessageexception-__construct"><code>__construct()</code></h4>

```php
public function __construct();
```

## Queue\Exceptions\PriorityNotSupportedException

Class

Thrown when the transport does not support message priority.

- `\Exception`
- [`Phalcon\Queue\Exceptions\Exception`](#queueexceptionsexception)
- **`Phalcon\Queue\Exceptions\PriorityNotSupportedException`**

### Method Summary

<ApiItem href="#queueexceptionsprioritynotsupportedexception-__construct" visibility="public" name="__construct" returnType="" params={[]}>
</ApiItem>

### Methods

<h4 id="queueexceptionsprioritynotsupportedexception-__construct"><code>__construct()</code></h4>

```php
public function __construct();
```

## Queue\Exceptions\PurgeQueueNotSupportedException

Class

Thrown when the transport does not support purging a queue.

- `\Exception`
- [`Phalcon\Queue\Exceptions\Exception`](#queueexceptionsexception)
- **`Phalcon\Queue\Exceptions\PurgeQueueNotSupportedException`**

### Method Summary

<ApiItem href="#queueexceptionspurgequeuenotsupportedexception-__construct" visibility="public" name="__construct" returnType="" params={[]}>
</ApiItem>

### Methods

<h4 id="queueexceptionspurgequeuenotsupportedexception-__construct"><code>__construct()</code></h4>

```php
public function __construct();
```

## Queue\Exceptions\QueueThrowable

Interface

Base throwable contract for the Queue component. Every queue exception
implements it, so callers can catch all queue errors with a single type.

- `\Throwable`
- **`Phalcon\Queue\Exceptions\QueueThrowable`**

`Throwable`

## Queue\Exceptions\SubscriptionConsumerNotSupportedException

Class

Thrown when the transport does not support subscription consumers.

- `\Exception`
- [`Phalcon\Queue\Exceptions\Exception`](#queueexceptionsexception)
- **`Phalcon\Queue\Exceptions\SubscriptionConsumerNotSupportedException`**

### Method Summary

<ApiItem href="#queueexceptionssubscriptionconsumernotsupportedexception-__construct" visibility="public" name="__construct" returnType="" params={[]}>
</ApiItem>

### Methods

<h4 id="queueexceptionssubscriptionconsumernotsupportedexception-__construct"><code>__construct()</code></h4>

```php
public function __construct();
```

## Queue\Exceptions\TemporaryQueueNotSupportedException

Class

Thrown when the transport does not support temporary queues.

- `\Exception`
- [`Phalcon\Queue\Exceptions\Exception`](#queueexceptionsexception)
- **`Phalcon\Queue\Exceptions\TemporaryQueueNotSupportedException`**

### Method Summary

<ApiItem href="#queueexceptionstemporaryqueuenotsupportedexception-__construct" visibility="public" name="__construct" returnType="" params={[]}>
</ApiItem>

### Methods

<h4 id="queueexceptionstemporaryqueuenotsupportedexception-__construct"><code>__construct()</code></h4>

```php
public function __construct();
```

## Queue\Exceptions\TimeToLiveNotSupportedException

Class

Thrown when the transport does not support a message time to live.

- `\Exception`
- [`Phalcon\Queue\Exceptions\Exception`](#queueexceptionsexception)
- **`Phalcon\Queue\Exceptions\TimeToLiveNotSupportedException`**

### Method Summary

<ApiItem href="#queueexceptionstimetolivenotsupportedexception-__construct" visibility="public" name="__construct" returnType="" params={[]}>
</ApiItem>

### Methods

<h4 id="queueexceptionstimetolivenotsupportedexception-__construct"><code>__construct()</code></h4>

```php
public function __construct();
```

## Queue\QueueFactory

Class

Builds a queue Context from the standard Phalcon config shape. Mirrors
Phalcon\Cache\CacheFactory.

- [`Phalcon\Factory\AbstractConfigFactory`](/5.20/api/phalcon_factory/#factoryabstractconfigfactory)
- **`Phalcon\Queue\QueueFactory`**

`Phalcon\Config\ConfigInterface` · `Phalcon\Contracts\Queue\Context` · `Phalcon\Contracts\Queue\QueueTypes` · `Phalcon\Factory\AbstractConfigFactory` · `Phalcon\Queue\Exceptions\Exception`

### Method Summary

<ApiItem href="#queuequeuefactory-__construct" visibility="public" name="__construct" returnType="" params={[{"type":"AdapterFactory|null","name":"factory","default":"null"}]}>
A default AdapterFactory is created when none is supplied, so the
</ApiItem>
<ApiItem href="#queuequeuefactory-load" visibility="public" name="load" returnType="ContextInterface" params={[{"type":"mixed","name":"config","default":null}]}>
Builds a Context from a config array/object.
</ApiItem>
<ApiItem href="#queuequeuefactory-newinstance" visibility="public" name="newInstance" returnType="ContextInterface" params={[{"type":"string","name":"name","default":null},{"type":"array","name":"options","default":"[]"}]}>
Builds a Context for the named adapter.
</ApiItem>
<ApiItem href="#queuequeuefactory-getexceptionclass" visibility="protected" name="getExceptionClass" returnType="string" params={[]}>
Returns the exception class for the factory
</ApiItem>

### Properties

<ApiItem kind="property" visibility="protected" name="adapterFactory" type="AdapterFactory" default="">
</ApiItem>

### Methods

<h4 id="queuequeuefactory-__construct"><code>__construct()</code></h4>

```php
public function __construct( AdapterFactory|null $factory = null );
```

A default AdapterFactory is created when none is supplied, so the
factory is usable straight from the DI container.

<h4 id="queuequeuefactory-load"><code>load()</code></h4>

```php
public function load( mixed $config ): ContextInterface;
```

Builds a Context from a config array/object.

<h4 id="queuequeuefactory-newinstance"><code>newInstance()</code></h4>

```php
public function newInstance(
string $name,
array $options = []
): ContextInterface;
```

Builds a Context for the named adapter.

<h4 id="queuequeuefactory-getexceptionclass"><code>getExceptionClass()</code></h4>

```php
protected function getExceptionClass(): string;
```

Returns the exception class for the factory

Source: https://docs.phalcon.io/5.20/api/phalcon_queue/index.mdx
