File: mqueue_admin.xml

package info (click to toggle)
kamailio 4.2.0-2%2Bdeb8u3
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 56,276 kB
  • sloc: ansic: 552,836; xml: 166,484; sh: 8,659; makefile: 7,676; sql: 6,235; perl: 3,487; yacc: 3,428; python: 1,457; cpp: 1,219; php: 1,047; java: 449; pascal: 194; cs: 40; awk: 27
file content (199 lines) | stat: -rw-r--r-- 5,010 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [

<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
%docentities;

]>

<!-- Module User's Guide -->

<chapter>
    
    <title>&adminguide;</title>
    
    <section>
	<title>Overview</title>
	<para>
		The mqueue module offers a generic message queue system in shared memory for
		inter-process communication using the config file. One example of usage is
		to send time consuming operations to one or several timer processes that consumes
		items in the queue, without affecting SIP message handling in the socket-listening 
		process.
	</para>
	<para>
		There can be many defined queues. Access to queued values is done via
		pseudo variables.
	</para>
    </section>
    <section>
	<title>Dependencies</title>
	<section>
	    <title>&kamailio; Modules</title>
	    <para>
		The following modules must be loaded before this module:
	    	<itemizedlist>
		    <listitem>
			<para>
			    <emphasis>None</emphasis>.
			</para>
		    </listitem>
	    	</itemizedlist>
	    </para>
	</section>
	<section>
	    <title>External Libraries or Applications</title>
	    <para>
		The following libraries or applications must be installed before running
		&kamailio; with this module loaded:
	    	<itemizedlist>
		    <listitem>
			<para>
			    <emphasis>None</emphasis>.
			</para>
		    </listitem>
	    	</itemizedlist>
	    </para>
	</section>
    </section>
    <section>
	<title>Parameters</title>

	<section id="mqueue.p.mqueue">
	    <title><varname>mqueue</varname> (string)</title>
	    <para>
		Definition of a memory queue
	    </para>
	    <para>
		<emphasis>
		    Default value is <quote>none</quote>.
		</emphasis>
	    </para>
		<para>
		Value must be a list of parameters: attr=value;... The attribute 'name'
		is mandatory, defining the name of the queue. Optional attribute 'size'
		specifies the maximum number of items in queue, if it is execeeded the
		oldest one is removed.
	    </para>
		<para>
		The parameter can be set many times, each holding the definition of one
		queue.
	    </para>
	    <example>
		<title>Set <varname>mqueue</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("mqueue", "mqueue", "name=myq;size=20;")
modparam("mqueue", "mqueue", "name=qaz")
...
</programlisting>
	    </example>
	</section>

	</section>
	
    <section>
	<title>Functions</title>
 	<section id="mqueue.f.mq_add">
	    <title>
		<function moreinfo="none">mq_add(queue, key, value)</function>
	    </title>
	    <para>
		Add a new item (key, value) in the queue. If max size of queue is
		exceeded, the oldest one is removed.
	    </para>
		<example>
		<title><function>mq_add</function> usage</title>
		<programlisting format="linespecific">
...
mq_add("myq", "$rU", "call from $fU");
...
</programlisting>
	    </example>
	</section>
	
 	<section id="mqueue.f.mq_fetch">
	    <title>
		<function moreinfo="none">mq_fetch(queue)</function>
	    </title>
	    <para>
		Take oldest item from queue and fill $mqk(queue) and
		$mqv(queue) pseudo variables.
	    </para>
	    <para>
		Return: true on success (1); false on failure (-1) or
		no item fetched (-2).
	    </para>
		<example>
		<title><function>mq_fetch</function> usage</title>
		<programlisting format="linespecific">
...
while(mq_fetch("myq"))
{
   xlog("$mqk(myq) - $mqv(myq)\n");
}
...
</programlisting>
	    </example>
	</section>
	
 	<section id="mqueue.f.mq_pv_free">
	    <title>
		<function moreinfo="none">mq_pv_free(queue)</function>
	    </title>
	    <para>
		Free the item fetched in pseudo-variables. It is optional, a new fetch
		frees the previous values.
	    </para>
		<example>
		<title><function>mq_pv_free</function> usage</title>
		<programlisting format="linespecific">
...
mq_pv_free("myq");
...
</programlisting>
	    </example>
	</section>

	<section id="mqueue.f.mq_size">
	    <title>
		<function moreinfo="none">mq_size(queue)</function>
	    </title>
	    <para>
		Returns the current number of elements in the mqueue.
	    </para>
		<example>
		<title><function>mq_size</function> usage</title>
		<programlisting format="linespecific">
...
$var(q_size) = mq_size("queue");
xlog("L_INFO", "Size of queue is: $var(q_size)\n");
...
</programlisting>
	    </example>
	</section>
	
    </section>

    <section>
	<title>Exported Pseudo-variables</title>
		<itemizedlist>
			<listitem>
				<emphasis>$mqv(mqueue)</emphasis> - the most recent item key fetched from the specified mqueue
			</listitem>
			<listitem>
				<emphasis>$mqv(mqueue)</emphasis> - the most recent item value fetched from the specified mqueue
			</listitem>
			<listitem>
				<emphasis>$mq_size(mqueue)</emphasis> - the size of the specified mqueue
			</listitem>
		</itemizedlist>
		<para>
		Exported pseudo-variables are documented at &kamwikilink;.
		</para>
    </section>

</chapter>