Zend_Queue-Adapters.xml 15 KB

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