| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- EN-Revision: 16590 -->
- <!-- Reviewed: no -->
- <sect1 id="zend.queue.adapters">
- <title>Adapters</title>
- <para>
- <classname>Zend_Queue</classname> supports all queues implementing the
- interface <classname>Zend_Queue_Adapter_AdapterInterface</classname>.
- The following Message Queue services are supported:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <ulink url="http://activemq.apache.org/">ApacheMQ</ulink>.
- </para>
- </listitem>
- <listitem>
- <para>
- A database driven queue via <classname>Zend_Db</classname>.
- </para>
- </listitem>
- <listitem>
- <para>
- A <ulink url="http://memcachedb.org/memcacheq/">MemcacheQ</ulink>
- queue driven via <classname>Memcache</classname>.
- </para>
- </listitem>
- <listitem>
- <para>
- A local array. Useful for unit testing.
- </para>
- </listitem>
- </itemizedlist>
- <note id="zend.queue.adapters.limitations">
- <title>Limitations</title>
- <para>
- Message transaction handling is not supported.
- </para>
- </note>
- <sect2 id="zend.queue.adapters.configuration">
- <title>Specific Adapters - Configuration settings</title>
- <para>
- If a default setting is indicated then the parameter is optional.
- If a default setting is not specified then the parameter is
- required.
- </para>
- <sect3 id="zend.queue.adapters.configuration.Apachemq">
- <title>ApacheMQ - Zend_Queue_Adapter_Apachemq</title>
- <para>
- Options here listed here are known requirements. Not all
- messaging servers require username or password.
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <emphasis>$options['name'] = '/temp/queue1';</emphasis>
- </para>
- <para>
- This is the name of the queue that you wish to start
- using. (Required)
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['host'] = 'host.domain.tld';</emphasis>
- </para>
- <para>
- <emphasis>$options['driverOptions']['host'] = '127.0.0.1';</emphasis>
- </para>
- <para>
- You may set host to an IP address or a hostname.
- </para>
- <para>
- Default setting for host is '127.0.0.1'.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['port'] = 61613;</emphasis>
- </para>
- <para>Default setting for port is 61613.</para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['username'] = 'username';</emphasis>
- </para>
- <para>
- Optional for some messaging servers. Read the manual
- for your messaging server.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['password'] = 'password';</emphasis>
- </para>
- <para>
- Optional for some messaging servers. Read the manual
- for your messaging server.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['timeout_sec'] = 2;</emphasis>
- </para>
- <para>
- <emphasis>$options['driverOptions']['timeout_usec'] = 0;</emphasis>
- </para>
- <para>
- This is the amount of time that
- <classname>Zend_Queue_Adapter_Activemq</classname> will wait for
- read activity on a socket before returning no messages.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
- <sect3 id="zend.queue.adapters.configuration.Db">
- <title>Db - Zend_Queue_Adapter_Db</title>
- <para>
- Driver options are checked for a few required options such
- as <emphasis>type</emphasis>, <emphasis>host</emphasis>,
- <emphasis>username</emphasis>, <emphasis>password</emphasis>,
- and <emphasis>dbname</emphasis>. You may pass along
- additional parameters for <methodname>Zend_DB::factory()</methodname> as parameters
- in <varname>$options['driverOptions']</varname>. An example of an additional
- option not listed here, but could be passed would be <emphasis>port</emphasis>.
- </para>
- <programlisting language="php"><![CDATA[
- $options = array(
- 'driverOptions' => array(
- 'host' => 'db1.domain.tld',
- 'username' => 'my_username',
- 'password' => 'my_password',
- 'dbname' => 'messaging',
- 'type' => 'pdo_mysql',
- 'port' => 3306, // optional parameter.
- ),
- 'options' => array(
- // use Zend_Db_Select for update, not all databases can support this
- // feature.
- Zend_Db_Select::FOR_UPDATE => true
- )
- );
- // Create a database queue.
- $queue = Zend_Queue::factory('Db', $options);
- ]]></programlisting>
- <itemizedlist>
- <listitem>
- <para>
- <emphasis>$options['name'] = 'queue1';</emphasis>
- </para>
- <para>
- This is the name of the queue that you wish to start using. (Required)
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['type'] = 'Pdo';</emphasis>
- </para>
- <para>
- <emphasis>type</emphasis> is the adapter you wish to have
- <methodname>Zend_Db::factory()</methodname> use. This is
- the first parameter for the
- <methodname>Zend_Db::factory()</methodname> class
- method call.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['host'] = 'host.domain.tld';</emphasis>
- </para>
- <para>
- <emphasis>$options['driverOptions']['host'] = '127.0.0.1';</emphasis>
- </para>
- <para>You may set host to an IP address or a hostname.</para>
- <para>Default setting for host is '127.0.0.1'.</para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['username'] = 'username';</emphasis>
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['password'] = 'password';</emphasis>
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['dbname'] = 'dbname';</emphasis>
- </para>
- <para>
- The database name that you have created the required tables for.
- See the notes section below.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
- <sect3 id="zend.queue.adapters.configuration.memcacheq">
- <title>MemcacheQ - Zend_Queue_Adapter_Memcacheq</title>
- <itemizedlist>
- <listitem>
- <para>
- <emphasis>$options['name'] = 'queue1';</emphasis>
- </para>
- <para>
- This is the name of the queue that you wish to start using. (Required)
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['host'] = 'host.domain.tld';</emphasis>
- </para>
- <para>
- <emphasis>$options['driverOptions']['host'] = '127.0.0.1;'</emphasis>
- </para>
- <para>You may set host to an IP address or a hostname.</para>
- <para>Default setting for host is '127.0.0.1'.</para>
- </listitem>
- <listitem>
- <para>
- <emphasis>$options['driverOptions']['port'] = 22201;</emphasis>
- </para>
- <para>The default setting for port is 22201.</para>
- </listitem>
- </itemizedlist>
- </sect3>
- <sect3 id="zend.queue.adapters.configuration.array">
- <title>Array - Zend_Queue_Adapter_Array</title>
- <itemizedlist>
- <listitem>
- <para>
- <emphasis>$options['name'] = 'queue1';</emphasis>
- </para>
- <para>
- This is the name of the queue that you wish to start using. (Required)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
- </sect2>
- <sect2 id="zend.queue.adapters.notes">
- <title>Notes for Specific Adapters</title>
- <para>The following adapters have notes:</para>
- <sect3 id="zend.queue.adapters.notes.activemq">
- <title>ActiveMQ</title>
- <para>
- Visibility duration for
- <classname>Zend_Queue_Adapter_ActiveMQ</classname> is not
- available.
- </para>
- <para>
- While Apache's ActiveMQ will support multiple subscriptions, the
- <classname>Zend_Queue</classname> does not. You must create a
- new <classname>Zend_Queue</classname> object for each individual
- subscription.
- </para>
- <para>
- ActiveMQ queue/topic names must begin with one of:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <filename>/queue/</filename>
- </para>
- </listitem>
- <listitem>
- <para>
- <filename>/topic/</filename>
- </para>
- </listitem>
- <listitem>
- <para>
- <filename>/temp-queue/</filename>
- </para>
- </listitem>
- <listitem>
- <para>
- <filename>/temp-topic/</filename>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- For example: <filename>/queue/testing</filename>
- </para>
- <para>
- The following functions are not supported:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>create()</methodname> - create queue.
- Calling this function will throw an exception.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>delete()</methodname> - delete queue.
- Calling this function will throw an exception.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getQueues()</methodname> - list queues.
- Calling this function will throw an exception.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
- <sect3 id="zend.queue.adapters.notes.zend_db">
- <title>Zend_Db</title>
- <para>
- The database <emphasis>CREATE TABLE ( ... )</emphasis> <acronym>SQL</acronym>
- statement can be found in <filename>Zend/Queue/Adapter/Db/queue.sql</filename>.
- </para>
- </sect3>
- <sect3 id="zend.queue.adapters.notes.memcacheQ">
- <title>MemcacheQ</title>
- <para>
- Memcache can be downloaded from <ulink
- url="http://www.danga.com/memcached/">http://www.danga.com/memcached/</ulink>.
- </para>
- <para>
- MemcacheQ can be downloaded from <ulink
- url="http://memcachedb.org/memcacheq/">http://memcachedb.org/memcacheq/</ulink>.
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>deleteMessage()</methodname> - Messages are deleted upon
- reception from the queue. Calling this function would
- have no effect. Calling this function will throw an
- error.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>count()</methodname> or <methodname>count($adapter)</methodname>
- - MemcacheQ does not support a method for counting the number of items in
- a queue. Calling this function will throw an error.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
- <sect3 id="zend.queue.adapters.notes.array">
- <title>Array (local)</title>
- <para>
- The Array queue is a <acronym>PHP</acronym> <methodname>array()</methodname>
- in local memory. The <classname>Zend_Queue_Adapter_Array</classname> is good for
- unit testing.
- </para>
- </sect3>
- </sect2>
- </sect1>
|