Class for using connecting to a Zend_Db-based queuing system

category Zend
package Zend_Queue
subpackage Adapter
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Queue_Adapter_AdapterAbstract

 Methods

Constructor

__construct(array|\Zend_Config $options, \Zend_Queue|null $queue = null) : void

$options is an array of key/value pairs or an instance of Zend_Config containing configuration options. These options are common to most adapters:

See the Zend_Queue Adapter Notes documentation for example configurations.

Some options are used on a case-by-case basis by adapters:

access_key => (string) Amazon AWS Access Key secret_key => (string) Amazon AWS Secret Key dbname => (string) The name of the database to user username => (string) Connect to the database as this username. password => (string) Password associated with the username. host => (string) What host to connect to, defaults to localhost port => (string) The port of the database

inherited_from \Zend_Queue_Adapter_AdapterAbstract::__construct()

Parameters

$options

array\Zend_Config

$queue

\Zend_Queuenull

Constructor.

__construct(array|\Zend_Config $options, \Zend_Queue $queue = null) : void
Inherited

$options is an array of key/value pairs or an instance of Zend_Config containing configuration options. These options are common to most adapters:

See the Zend_Queue Adapter Notes documentation for example configurations.

Some options are used on a case-by-case basis by adapters:

access_key => (string) Amazon AWS Access Key secret_key => (string) Amazon AWS Secret Key dbname => (string) The name of the database to user username => (string) Connect to the database as this username. password => (string) Password associated with the username. host => (string) What host to connect to, defaults to localhost port => (string) The port of the database

inherited_from \Zend_Queue_Adapter_AdapterInterface::__construct()

Parameters

$options

$queue

Exceptions

\Zend_Queue_Exception

Return the approximate number of messages in the queue

count(\Zend_Queue $queue = null) : integer

Parameters

$queue

\Zend_Queue

Exceptions

\Zend_Queue_Exception

Returns

integer

Create a new queue

create(string $name, integer $timeout = null) : boolean

Visibility timeout is how long a message is left in the queue "invisible" to other readers. If the message is acknowleged (deleted) before the timeout, then the message is deleted. However, if the timeout expires then the message will be made available to other queue readers.

Parameters

$name

string

queue name

$timeout

integer

default visibility timeout

Exceptions

\Zend_Queue_Exception - database error

Returns

boolean

Delete a queue and all of it's messages

delete(string $name) : boolean

Returns false if the queue is not found, true if the queue exists

Parameters

$name

string

queue name

Exceptions

\Zend_Queue_Exception - database error

Returns

boolean

Delete a message from the queue

deleteMessage(\Zend_Queue_Message $message) : boolean

Returns true if the message is deleted, false if the deletion is unsuccessful.

Parameters

$message

\Zend_Queue_Message

Exceptions

\Zend_Queue_Exception - database error

Returns

boolean

Return a list of queue capabilities functions

getCapabilities() : array

$array['function name'] = true or false true is supported, false is not supported.

Returns

array

Returns the configuration options in this adapter.

getOptions() : array
Inherited
inherited_from \Zend_Queue_Adapter_AdapterInterface::getOptions()

Returns

array

get the Zend_Queue class that is attached to this object

getQueue() : \Zend_Queue | null
Inherited
inherited_from \Zend_Queue_Adapter_AdapterInterface::getQueue()

Returns

\Zend_Queuenull

getQueues()

getQueues() 

Does a queue already exist?

isExists(string $name) : boolean

Throws an exception if the adapter cannot determine if a queue exists. use isSupported('isExists') to determine if an adapter can test for queue existance.

Parameters

$name

string

Exceptions

\Zend_Queue_Exception

Returns

boolean

Indicates if a function is supported or not.

isSupported(string $name) : boolean
Inherited
inherited_from \Zend_Queue_Adapter_AdapterInterface::isSupported()

Parameters

$name

string

Returns

boolean

Get messages in the queue

receive(integer $maxMessages = null, integer $timeout = null, \Zend_Queue $queue = null) : \Zend_Queue_Message_Iterator

Parameters

$maxMessages

integer

Maximum number of messages to return

$timeout

integer

Visibility timeout for these messages

$queue

\Zend_Queue

Exceptions

\Zend_Queue_Exception - database error

Returns

\Zend_Queue_Message_Iterator

Send a message to the queue

send(string $message, \Zend_Queue $queue = null) : \Zend_Queue_Message

Parameters

$message

string

Message to send to the active queue

$queue

\Zend_Queue

Exceptions

\Zend_Queue_Exception - database error

Returns

\Zend_Queue_Message

set the Zend_Queue class for this object

setQueue(\Zend_Queue $queue) : \Zend_Queue_Adapter_AdapterInterface
Inherited
inherited_from \Zend_Queue_Adapter_AdapterInterface::setQueue()

Parameters

$queue

\Zend_Queue

Returns

\Zend_Queue_Adapter_AdapterInterface

Initialize Db adapter using 'driverOptions' section of the _options array

_initDbAdapter() : \Zend_Db_Adapter_Abstract

Throws an exception if the adapter cannot connect to DB.

Exceptions

\Zend_Queue_Exception

Returns

\Zend_Db_Adapter_Abstract

Get the queue ID

getQueueId(string $name) : integer | null

Returns the queue's row identifier.

Parameters

$name

string

Exceptions

\Zend_Queue_Exception

Returns

integernull

 Properties

 

$_messageRow

$_messageRow : \Zend_Db_Table_Row_Abstract

Default

null
 

$_messageTable

$_messageTable : \Zend_Queue_Adapter_Db_Message

Default

null
 

User-provided options

$_options : array

Default

array()
 

Contains the Zend_Queue that this object

$_queue : \Zend_Queue_Adapter_Abstract

Default

null
 

$_queueTable

$_queueTable : \Zend_Queue_Adapter_Db_Queue

Default

null
 

Internal array of queues to save on lookups

$_queues : array

Default

array()

 Constants

 

Default timeout for createQueue() function

CREATE_TIMEOUT_DEFAULT = 30 
 

Default timeout for recieve() function

RECEIVE_TIMEOUT_DEFAULT = 30