Table of Contents
List of Examples
mqueue
parametermq_add
usagemq_fetch
usagemq_pv_free
usageTable of Contents
This module offers generic message queue system in shared memory for inter-process communication via config file. One example of usage is to send time consuming operations to a timer process that consumes items in the queue, without affecting SIP message handling.
There can be defined many queues, access to values being done via pseudo variables.
Definition of memory queue
Default value is “none”.
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.
The parameter can be set many time, each holding the definition of one queue.
Example 1.1. Set mqueue
parameter
... modparam("mqueue", "mqueue", "name=myq;size=20;") modparam("mqueue", "mqueue", "name=qaz") ...
Add a new item (key, value) in the queue. If max size of queue is exceeded, the oldest one is removed.
Take oldest item from queue and fill $mqk(queue) and $mqv(queue) pseudo variables.
Return: true on success (1); false on failure (-1) or no item fetched (-2).