Documentation

CRM_Queue_Queue_SqlTrait

Trait defines methods that are commonly used to implement a SQL-backed queue.

Table of Contents

Methods

createItem()  : mixed
Add a new item to the queue.
createQueue()  : mixed
Perform any registation or resource-allocation for a new queue
deleteItem()  : mixed
Remove an item from the queue.
deleteItems()  : void
deleteQueue()  : mixed
Release any resources claimed by the queue (memory, DB rows, etc)
existsQueue()  : bool
Check if the queue exists.
fetchItem()  : CRM_Queue_DAO_QueueItem|object|null
Get the full data for an item.
fetchItems()  : array<string|int, mixed>
getStatistic()  : int|float|null
loadQueue()  : mixed
Perform any loading or pre-fetch for an existing queue.
releaseItem()  : mixed
Return an item that could not be processed.
releaseItems()  : void
freeDAOs()  : mixed

Methods

createItem()

Add a new item to the queue.

public createItem(mixed $data[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$data : mixed

Serializable PHP object or array.

$options : array<string|int, mixed> = []

Queue-dependent options; for example, if this is a priority-queue, then $options might specify the item's priority. Ex: ['release_time' => strtotime('+3 hours')]

createQueue()

Perform any registation or resource-allocation for a new queue

public createQueue() : mixed

deleteItem()

Remove an item from the queue.

public deleteItem(CRM_Core_DAO|stdClass $item) : mixed
Parameters
$item : CRM_Core_DAO|stdClass

The item returned by claimItem.

deleteItems()

public deleteItems(mixed $items) : void
Parameters
$items : mixed

deleteQueue()

Release any resources claimed by the queue (memory, DB rows, etc)

public deleteQueue() : mixed

existsQueue()

Check if the queue exists.

public existsQueue() : bool
Return values
bool

fetchItem()

Get the full data for an item.

public fetchItem(int|string $id) : CRM_Queue_DAO_QueueItem|object|null

This is a passive peek - it does not claim/steal/release anything.

Parameters
$id : int|string

The unique ID of the task within the queue.

Return values
CRM_Queue_DAO_QueueItem|object|null

$dao

fetchItems()

public fetchItems(array<string|int, mixed> $ids) : array<string|int, mixed>
Parameters
$ids : array<string|int, mixed>
Return values
array<string|int, mixed>

loadQueue()

Perform any loading or pre-fetch for an existing queue.

public loadQueue() : mixed

releaseItem()

Return an item that could not be processed.

public releaseItem(CRM_Core_DAO $item) : mixed
Parameters
$item : CRM_Core_DAO

The item returned by claimItem.

releaseItems()

public releaseItems(mixed $items) : void
Parameters
$items : mixed

freeDAOs()

protected freeDAOs(mixed $mixed) : mixed
Parameters
$mixed : mixed

        
On this page

Search results