Queue/Adapter/Db.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Queue
- subpackage
- Adapter
- version
- $Id: Db.php 23775 2011-03-01 17:25:24Z ralph $
Class for using connecting to a Zend_Db-based queuing system
- Extends from
- \Zend_Queue_Adapter_AdapterAbstract
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Queue
- subpackage
- Adapter
Properties
Methods



__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
Parameters
Name |
Type |
Description |
$options |
array|\Zend_Config |
|
$queue |
\Zend_Queue|null |
|
Throws



_initDbAdapter(
)
:
\Zend_Db_Adapter_Abstract
Initialize Db adapter using 'driverOptions' section of the _options array
Throws an exception if the adapter cannot connect to DB.
Returns
Throws



count(
\Zend_Queue $queue
=
null
)
:
integer
Return the approximate number of messages in the queue
Parameters
Returns
Throws



delete(
string $name
)
:
boolean
Delete a queue and all of it's messages
Returns false if the queue is not found, true if the queue exists
Parameters
Name |
Type |
Description |
$name |
string |
queue name |
Returns
Throws



deleteMessage(
\Zend_Queue_Message $message
)
:
boolean
Delete a message from the queue
Returns true if the message is deleted, false if the deletion is
unsuccessful.
Parameters
Returns
Throws



getCapabilities(
)
:
array
Return a list of queue capabilities functions
$array['function name'] = true or false
true is supported, false is not supported.
Returns



getQueues(
)
:
array
Get an array of all available queues
Not all adapters support getQueues(); use isSupported('getQueues')
to determine if the adapter supports this feature.
Returns



isExists(
string $name
)
:
boolean
Does a queue already exist?
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 |
Type |
Description |
$name |
string |
|
Returns
Throws



receive(
integer $maxMessages
=
null, integer $timeout
=
null, \Zend_Queue $queue
=
null
)
:
\Zend_Queue_Message_Iterator
Get messages in the queue
Parameters
Name |
Type |
Description |
$maxMessages |
integer |
Maximum number of messages to return |
$timeout |
integer |
Visibility timeout for these messages |
$queue |
\Zend_Queue |
|
Returns
Throws



send(
string $message, \Zend_Queue $queue
=
null
)
:
\Zend_Queue_Message
Send a message to the queue
Parameters
Name |
Type |
Description |
$message |
string |
Message to send to the active queue |
$queue |
\Zend_Queue |
|
Returns
Throws