mqueue_admin.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?xml version="1.0" encoding='ISO-8859-1'?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  4. <!-- Include general documentation entities -->
  5. <!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
  6. %docentities;
  7. ]>
  8. <!-- Module User's Guide -->
  9. <chapter>
  10. <title>&adminguide;</title>
  11. <section>
  12. <title>Overview</title>
  13. <para>
  14. This module offers generic message queue system in shared memory for
  15. inter-process communication via config file. One example of usage is
  16. to send time consuming operations to a timer process that consumes
  17. items in the queue, without affecting SIP message handling.
  18. </para>
  19. <para>
  20. There can be defined many queues, access to values being done via
  21. pseudo variables.
  22. </para>
  23. </section>
  24. <section>
  25. <title>Dependencies</title>
  26. <section>
  27. <title>&kamailio; Modules</title>
  28. <para>
  29. The following modules must be loaded before this module:
  30. <itemizedlist>
  31. <listitem>
  32. <para>
  33. <emphasis>None</emphasis>.
  34. </para>
  35. </listitem>
  36. </itemizedlist>
  37. </para>
  38. </section>
  39. <section>
  40. <title>External Libraries or Applications</title>
  41. <para>
  42. The following libraries or applications must be installed before running
  43. &kamailio; with this module loaded:
  44. <itemizedlist>
  45. <listitem>
  46. <para>
  47. <emphasis>None</emphasis>.
  48. </para>
  49. </listitem>
  50. </itemizedlist>
  51. </para>
  52. </section>
  53. </section>
  54. <section>
  55. <title>Exported Parameters</title>
  56. <section>
  57. <title><varname>mqueue</varname> (string)</title>
  58. <para>
  59. Definition of memory queue
  60. </para>
  61. <para>
  62. <emphasis>
  63. Default value is <quote>none</quote>.
  64. </emphasis>
  65. </para>
  66. <para>
  67. Value must be a list of parameters: attr=value;... The attribute 'name'
  68. is mandatory, defining the name of the queue. Optional attribute 'size'
  69. specifies the maximum number of items in queue, if it is execeeded the
  70. oldest one is removed.
  71. </para>
  72. <para>
  73. The parameter can be set many time, each holding the definition of one
  74. queue.
  75. </para>
  76. <example>
  77. <title>Set <varname>mqueue</varname> parameter</title>
  78. <programlisting format="linespecific">
  79. ...
  80. modparam("mqueue", "mqueue", "name=myq;size=20;")
  81. modparam("mqueue", "mqueue", "name=qaz")
  82. ...
  83. </programlisting>
  84. </example>
  85. </section>
  86. </section>
  87. <section>
  88. <title>Exported Functions</title>
  89. <section>
  90. <title>
  91. <function moreinfo="none">mq_add(queue, key, value)</function>
  92. </title>
  93. <para>
  94. Add a new item (key, value) in the queue. If max size of queue is
  95. exceeded, the oldest one is removed.
  96. </para>
  97. <example>
  98. <title><function>mq_add</function> usage</title>
  99. <programlisting format="linespecific">
  100. ...
  101. mq_add("myq", "$rU", "call from $fU");
  102. ...
  103. </programlisting>
  104. </example>
  105. </section>
  106. <section>
  107. <title>
  108. <function moreinfo="none">mq_fetch(queue)</function>
  109. </title>
  110. <para>
  111. Take oldest item from queue and fill $mqk(queue) and
  112. $mqv(queue) pseudo variables.
  113. </para>
  114. <para>
  115. Return: true on success (1); false on failure (-1) or
  116. no item fetched (-2).
  117. </para>
  118. <example>
  119. <title><function>mq_fetch</function> usage</title>
  120. <programlisting format="linespecific">
  121. ...
  122. while(mq_fetch("myq"))
  123. {
  124. xlog("$mqk(myq) - $mqv(myq)\n");
  125. }
  126. ...
  127. </programlisting>
  128. </example>
  129. </section>
  130. <section>
  131. <title>
  132. <function moreinfo="none">mq_pv_free(queue)</function>
  133. </title>
  134. <para>
  135. Free the item fetched in pseudo-variables. It is optional, a new fetch
  136. frees the old values.
  137. </para>
  138. <example>
  139. <title><function>mq_pv_free</function> usage</title>
  140. <programlisting format="linespecific">
  141. ...
  142. mq_pv_free("myq");
  143. ...
  144. </programlisting>
  145. </example>
  146. </section>
  147. </section>
  148. </chapter>