class CRM_Queue_Queue_Sql extends CRM_Queue_Queue

A queue implementation which stores items in the CiviCRM SQL database

Methods

__construct(array $queueSpec)

Create a reference to queue. After constructing the queue, one should usually call createQueue (if it's a new queue) or loadQueue (if it's known to be an existing queue).

string
getName()

Determine the string name of this queue.

createQueue()

Perform any registation or resource-allocation for a new queue

loadQueue()

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

deleteQueue()

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

bool
existsQueue()

Check if the queue exists.

createItem(mixed $data, array $options = array())

Add a new item to the queue.

int
numberOfItems()

Determine number of items remaining in the queue.

object
claimItem(int $lease_time = 3600)

Get the next item.

object
stealItem(int $lease_time = 3600)

Get the next item, even if there's an active lease

deleteItem(CRM_Core_DAO $dao)

Remove an item from the queue.

releaseItem(CRM_Core_DAO $dao)

Return an item that could not be processed.

Details

at line 47
__construct(array $queueSpec)

Create a reference to queue. After constructing the queue, one should usually call createQueue (if it's a new queue) or loadQueue (if it's known to be an existing queue).

Parameters

array $queueSpec Array with keys: - type: string, required, e.g. "interactive", "immediate", "stomp", "beanstalk" - name: string, required, e.g. "upgrade-tasks" - reset: bool, optional; if a queue is found, then it should be flushed; default to TRUE - (additional keys depending on the queue provider).

in CRM_Queue_Queue at line 67
string getName()

Determine the string name of this queue.

Return Value

string

at line 54
createQueue()

Perform any registation or resource-allocation for a new queue

at line 61
loadQueue()

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

at line 68
deleteQueue()

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

at line 82
bool existsQueue()

Check if the queue exists.

Return Value

bool

at line 95
createItem(mixed $data, array $options = array())

Add a new item to the queue.

Parameters

mixed $data Serializable PHP object or array.
array $options Queue-dependent options; for example, if this is a priority-queue, then $options might specify the item's priority.

at line 109
int numberOfItems()

Determine number of items remaining in the queue.

Return Value

int

at line 128
object claimItem(int $lease_time = 3600)

Get the next item.

Parameters

int $lease_time Seconds.

Return Value

object with key 'data' that matches the inputted data

at line 171
object stealItem(int $lease_time = 3600)

Get the next item, even if there's an active lease

Parameters

int $lease_time Seconds.

Return Value

object with key 'data' that matches the inputted data

at line 200
deleteItem(CRM_Core_DAO $dao)

Remove an item from the queue.

Parameters

CRM_Core_DAO $dao The item returned by claimItem.

at line 211
releaseItem(CRM_Core_DAO $dao)

Return an item that could not be processed.

Parameters

CRM_Core_DAO $dao The item returned by claimItem.