Zend_Queue-Adapters.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.queue.adapters">
  4. <title>Adapters</title>
  5. <para>
  6. <classname>Zend_Queue</classname> supports all queues implementing the
  7. interface <classname>Zend_Queue_Adapter_AdapterInterface</classname>.
  8. The following Message Queue services are supported:
  9. </para>
  10. <itemizedlist>
  11. <listitem>
  12. <para>
  13. <ulink url="http://activemq.apache.org/">ApacheMQ</ulink>.
  14. </para>
  15. </listitem>
  16. <listitem>
  17. <para>
  18. A database driven queue via <classname>Zend_Db</classname>.
  19. </para>
  20. </listitem>
  21. <listitem>
  22. <para>
  23. A <ulink url="http://memcachedb.org/memcacheq/">MemcacheQ</ulink>
  24. queue driven via <classname>Memcache</classname>.
  25. </para>
  26. </listitem>
  27. <listitem>
  28. <para>
  29. A local array. Useful for unit testing.
  30. </para>
  31. </listitem>
  32. </itemizedlist>
  33. <note id="zend.queue.adapters.limitations">
  34. <title>Limitations</title>
  35. <para>
  36. Message transaction handling is not supported.
  37. </para>
  38. </note>
  39. <sect2 id="zend.queue.adapters.configuration">
  40. <title>Specific Adapters - Configuration settings</title>
  41. <para>
  42. If a default setting is indicated then the parameter is optional.
  43. If a default setting is not specified then the parameter is
  44. required.
  45. </para>
  46. <sect3 id="zend.queue.adapters.configuration.Apachemq">
  47. <title>ApacheMQ - Zend_Queue_Adapter_Apachemq</title>
  48. <para>
  49. Options here listed here are known requirements. Not all
  50. messaging servers require username or password.
  51. </para>
  52. <itemizedlist>
  53. <listitem>
  54. <para>
  55. <emphasis>$options['name'] = '/temp/queue1';</emphasis>
  56. </para>
  57. <para>
  58. This is the name of the queue that you wish to start
  59. using. (Required)
  60. </para>
  61. </listitem>
  62. <listitem>
  63. <para>
  64. <emphasis>$options['driverOptions']['host'] = 'host.domain.tld';</emphasis>
  65. </para>
  66. <para>
  67. <emphasis>$options['driverOptions']['host'] = '127.0.0.1';</emphasis>
  68. </para>
  69. <para>
  70. You may set host to an IP address or a hostname.
  71. </para>
  72. <para>
  73. Default setting for host is '127.0.0.1'.
  74. </para>
  75. </listitem>
  76. <listitem>
  77. <para>
  78. <emphasis>$options['driverOptions']['port'] = 61613;</emphasis>
  79. </para>
  80. <para>Default setting for port is 61613.</para>
  81. </listitem>
  82. <listitem>
  83. <para>
  84. <emphasis>$options['driverOptions']['username'] = 'username';</emphasis>
  85. </para>
  86. <para>
  87. Optional for some messaging servers. Read the manual
  88. for your messaging server.
  89. </para>
  90. </listitem>
  91. <listitem>
  92. <para>
  93. <emphasis>$options['driverOptions']['password'] = 'password';</emphasis>
  94. </para>
  95. <para>
  96. Optional for some messaging servers. Read the manual
  97. for your messaging server.
  98. </para>
  99. </listitem>
  100. <listitem>
  101. <para>
  102. <emphasis>$options['driverOptions']['timeout_sec'] = 2;</emphasis>
  103. </para>
  104. <para>
  105. <emphasis>$options['driverOptions']['timeout_usec'] = 0;</emphasis>
  106. </para>
  107. <para>
  108. This is the amount of time that
  109. <classname>Zend_Queue_Adapter_Activemq</classname> will wait for
  110. read activity on a socket before returning no messages.
  111. </para>
  112. </listitem>
  113. </itemizedlist>
  114. </sect3>
  115. <sect3 id="zend.queue.adapters.configuration.Db">
  116. <title>Db - Zend_Queue_Adapter_Db</title>
  117. <para>
  118. Driver options are checked for a few required options such
  119. as <emphasis>type</emphasis>, <emphasis>host</emphasis>,
  120. <emphasis>username</emphasis>, <emphasis>password</emphasis>,
  121. and <emphasis>dbname</emphasis>. You may pass along
  122. additional parameters for <methodname>Zend_DB::factory()</methodname> as parameters
  123. in <varname>$options['driverOptions']</varname>. An example of an additional
  124. option not listed here, but could be passed would be <emphasis>port</emphasis>.
  125. </para>
  126. <programlisting language="php"><![CDATA[
  127. $options = array(
  128. 'driverOptions' => array(
  129. 'host' => 'db1.domain.tld',
  130. 'username' => 'my_username',
  131. 'password' => 'my_password',
  132. 'dbname' => 'messaging',
  133. 'type' => 'pdo_mysql',
  134. 'port' => 3306, // optional parameter.
  135. ),
  136. 'options' => array(
  137. // use Zend_Db_Select for update, not all databases can support this
  138. // feature.
  139. Zend_Db_Select::FOR_UPDATE => true
  140. )
  141. );
  142. // Create a database queue.
  143. $queue = Zend_Queue::factory('Db', $options);
  144. ]]></programlisting>
  145. <itemizedlist>
  146. <listitem>
  147. <para>
  148. <emphasis>$options['name'] = 'queue1';</emphasis>
  149. </para>
  150. <para>
  151. This is the name of the queue that you wish to start using. (Required)
  152. </para>
  153. </listitem>
  154. <listitem>
  155. <para>
  156. <emphasis>$options['driverOptions']['type'] = 'Pdo';</emphasis>
  157. </para>
  158. <para>
  159. <emphasis>type</emphasis> is the adapter you wish to have
  160. <methodname>Zend_Db::factory()</methodname> use. This is
  161. the first parameter for the
  162. <methodname>Zend_Db::factory()</methodname> class
  163. method call.
  164. </para>
  165. </listitem>
  166. <listitem>
  167. <para>
  168. <emphasis>$options['driverOptions']['host'] = 'host.domain.tld';</emphasis>
  169. </para>
  170. <para>
  171. <emphasis>$options['driverOptions']['host'] = '127.0.0.1';</emphasis>
  172. </para>
  173. <para>You may set host to an IP address or a hostname.</para>
  174. <para>Default setting for host is '127.0.0.1'.</para>
  175. </listitem>
  176. <listitem>
  177. <para>
  178. <emphasis>$options['driverOptions']['username'] = 'username';</emphasis>
  179. </para>
  180. </listitem>
  181. <listitem>
  182. <para>
  183. <emphasis>$options['driverOptions']['password'] = 'password';</emphasis>
  184. </para>
  185. </listitem>
  186. <listitem>
  187. <para>
  188. <emphasis>$options['driverOptions']['dbname'] = 'dbname';</emphasis>
  189. </para>
  190. <para>
  191. The database name that you have created the required tables for.
  192. See the notes section below.
  193. </para>
  194. </listitem>
  195. </itemizedlist>
  196. </sect3>
  197. <sect3 id="zend.queue.adapters.configuration.memcacheq">
  198. <title>MemcacheQ - Zend_Queue_Adapter_Memcacheq</title>
  199. <itemizedlist>
  200. <listitem>
  201. <para>
  202. <emphasis>$options['name'] = 'queue1';</emphasis>
  203. </para>
  204. <para>
  205. This is the name of the queue that you wish to start using. (Required)
  206. </para>
  207. </listitem>
  208. <listitem>
  209. <para>
  210. <emphasis>$options['driverOptions']['host'] = 'host.domain.tld';</emphasis>
  211. </para>
  212. <para>
  213. <emphasis>$options['driverOptions']['host'] = '127.0.0.1;'</emphasis>
  214. </para>
  215. <para>You may set host to an IP address or a hostname.</para>
  216. <para>Default setting for host is '127.0.0.1'.</para>
  217. </listitem>
  218. <listitem>
  219. <para>
  220. <emphasis>$options['driverOptions']['port'] = 22201;</emphasis>
  221. </para>
  222. <para>The default setting for port is 22201.</para>
  223. </listitem>
  224. </itemizedlist>
  225. </sect3>
  226. <sect3 id="zend.queue.adapters.configuration.array">
  227. <title>Array - Zend_Queue_Adapter_Array</title>
  228. <itemizedlist>
  229. <listitem>
  230. <para>
  231. <emphasis>$options['name'] = 'queue1';</emphasis>
  232. </para>
  233. <para>
  234. This is the name of the queue that you wish to start using. (Required)
  235. </para>
  236. </listitem>
  237. </itemizedlist>
  238. </sect3>
  239. </sect2>
  240. <sect2 id="zend.queue.adapters.notes">
  241. <title>Notes for Specific Adapters</title>
  242. <para>The following adapters have notes:</para>
  243. <sect3 id="zend.queue.adapters.notes.activemq">
  244. <title>ActiveMQ</title>
  245. <para>
  246. Visibility duration for
  247. <classname>Zend_Queue_Adapter_ActiveMQ</classname> is not
  248. available.
  249. </para>
  250. <para>
  251. While Apache's ActiveMQ will support multiple subscriptions, the
  252. <classname>Zend_Queue</classname> does not. You must create a
  253. new <classname>Zend_Queue</classname> object for each individual
  254. subscription.
  255. </para>
  256. <para>
  257. ActiveMQ queue/topic names must begin with one of:
  258. </para>
  259. <itemizedlist>
  260. <listitem>
  261. <para>
  262. <filename>/queue/</filename>
  263. </para>
  264. </listitem>
  265. <listitem>
  266. <para>
  267. <filename>/topic/</filename>
  268. </para>
  269. </listitem>
  270. <listitem>
  271. <para>
  272. <filename>/temp-queue/</filename>
  273. </para>
  274. </listitem>
  275. <listitem>
  276. <para>
  277. <filename>/temp-topic/</filename>
  278. </para>
  279. </listitem>
  280. </itemizedlist>
  281. <para>
  282. For example: <filename>/queue/testing</filename>
  283. </para>
  284. <para>
  285. The following functions are not supported:
  286. </para>
  287. <itemizedlist>
  288. <listitem>
  289. <para>
  290. <methodname>create()</methodname> - create queue.
  291. Calling this function will throw an exception.
  292. </para>
  293. </listitem>
  294. <listitem>
  295. <para>
  296. <methodname>delete()</methodname> - delete queue.
  297. Calling this function will throw an exception.
  298. </para>
  299. </listitem>
  300. <listitem>
  301. <para>
  302. <methodname>getQueues()</methodname> - list queues.
  303. Calling this function will throw an exception.
  304. </para>
  305. </listitem>
  306. </itemizedlist>
  307. </sect3>
  308. <sect3 id="zend.queue.adapters.notes.zend_db">
  309. <title>Zend_Db</title>
  310. <para>
  311. The database <emphasis>CREATE TABLE ( ... )</emphasis> <acronym>SQL</acronym>
  312. statement can be found in <filename>Zend/Queue/Adapter/Db/queue.sql</filename>.
  313. </para>
  314. </sect3>
  315. <sect3 id="zend.queue.adapters.notes.memcacheQ">
  316. <title>MemcacheQ</title>
  317. <para>
  318. Memcache can be downloaded from <ulink
  319. url="http://www.danga.com/memcached/">http://www.danga.com/memcached/</ulink>.
  320. </para>
  321. <para>
  322. MemcacheQ can be downloaded from <ulink
  323. url="http://memcachedb.org/memcacheq/">http://memcachedb.org/memcacheq/</ulink>.
  324. </para>
  325. <itemizedlist>
  326. <listitem>
  327. <para>
  328. <methodname>deleteMessage()</methodname> - Messages are deleted upon
  329. reception from the queue. Calling this function would
  330. have no effect. Calling this function will throw an
  331. error.
  332. </para>
  333. </listitem>
  334. <listitem>
  335. <para>
  336. <methodname>count()</methodname> or <methodname>count($adapter)</methodname>
  337. - MemcacheQ does not support a method for counting the number of items in
  338. a queue. Calling this function will throw an error.
  339. </para>
  340. </listitem>
  341. </itemizedlist>
  342. </sect3>
  343. <sect3 id="zend.queue.adapters.notes.array">
  344. <title>Array (local)</title>
  345. <para>
  346. The Array queue is a <acronym>PHP</acronym> <methodname>array()</methodname>
  347. in local memory. The <classname>Zend_Queue_Adapter_Array</classname> is good for
  348. unit testing.
  349. </para>
  350. </sect3>
  351. </sect2>
  352. </sect1>