... | ... |
@@ -35,6 +35,7 @@ Emmanuel Schmidbauer |
35 | 35 |
4.1. nats_url (str) |
36 | 36 |
4.2. num_publish_workers (int) |
37 | 37 |
4.3. subject_queue_group (str) |
38 |
+ 4.4. event_callback (str) |
|
38 | 39 |
|
39 | 40 |
5. Functions |
40 | 41 |
|
... | ... |
@@ -48,9 +49,10 @@ Emmanuel Schmidbauer |
48 | 49 |
1.1. Set nats_url parameter |
49 | 50 |
1.2. Set num_publish_workers parameter |
50 | 51 |
1.3. Set subject_queue_group parameter |
51 |
- 1.4. nats_publish usage |
|
52 |
- 1.5. Example usage of $natsData pseudo variable |
|
53 |
- 1.6. Define the event routes |
|
52 |
+ 1.4. Set event_callback parameter |
|
53 |
+ 1.5. nats_publish usage |
|
54 |
+ 1.6. Example usage of $natsData pseudo variable |
|
55 |
+ 1.7. Define the event routes |
|
54 | 56 |
|
55 | 57 |
Chapter 1. Admin Guide |
56 | 58 |
|
... | ... |
@@ -68,6 +70,7 @@ Chapter 1. Admin Guide |
68 | 70 |
4.1. nats_url (str) |
69 | 71 |
4.2. num_publish_workers (int) |
70 | 72 |
4.3. subject_queue_group (str) |
73 |
+ 4.4. event_callback (str) |
|
71 | 74 |
|
72 | 75 |
5. Functions |
73 | 76 |
|
... | ... |
@@ -115,6 +118,7 @@ Chapter 1. Admin Guide |
115 | 118 |
4.1. nats_url (str) |
116 | 119 |
4.2. num_publish_workers (int) |
117 | 120 |
4.3. subject_queue_group (str) |
121 |
+ 4.4. event_callback (str) |
|
118 | 122 |
|
119 | 123 |
4.1. nats_url (str) |
120 | 124 |
|
... | ... |
@@ -161,6 +165,24 @@ modparam("nats", "subject_queue_group", "MyQueue1:2021") |
161 | 165 |
modparam("nats", "subject_queue_group", "MyQueue2:2021") |
162 | 166 |
... |
163 | 167 |
|
168 |
+4.4. event_callback (str) |
|
169 |
+ |
|
170 |
+ Name of the KEMI function to be executed instead of the event route. |
|
171 |
+ |
|
172 |
+ Default value is not set. |
|
173 |
+ |
|
174 |
+ Example 1.4. Set event_callback parameter |
|
175 |
+... |
|
176 |
+modparam("nats", "event_callback", "ksr_nats_event") |
|
177 |
+ |
|
178 |
+-- event callback function implemented in Lua |
|
179 |
+function ksr_nats_event(evname) |
|
180 |
+ KSR.info("===== nats module received event: " .. evname .. |
|
181 |
+ ", data:" .. KSR.pv.gete('$natsData') .. "\n"); |
|
182 |
+ return 1; |
|
183 |
+end |
|
184 |
+... |
|
185 |
+ |
|
164 | 186 |
5. Functions |
165 | 187 |
|
166 | 188 |
5.1. nats_publish(subject, payload) |
... | ... |
@@ -169,7 +191,7 @@ modparam("nats", "subject_queue_group", "MyQueue2:2021") |
169 | 191 |
|
170 | 192 |
Publishes the payload to subject. |
171 | 193 |
|
172 |
- Example 1.4. nats_publish usage |
|
194 |
+ Example 1.5. nats_publish usage |
|
173 | 195 |
... |
174 | 196 |
$var(my_info) = "$ci=" + $ci + " $fU=" + $fU; |
175 | 197 |
nats_publish("mysubject", "$var(my_info)"); # publish $var(my_info) to "mysubjec |
... | ... |
@@ -178,7 +200,7 @@ t" |
178 | 200 |
|
179 | 201 |
6. Pseudo Variables |
180 | 202 |
|
181 |
- Example 1.5. Example usage of $natsData pseudo variable |
|
203 |
+ Example 1.6. Example usage of $natsData pseudo variable |
|
182 | 204 |
... |
183 | 205 |
xlog("L_INFO", "received payload $natsData"); |
184 | 206 |
} |
... | ... |
@@ -191,7 +213,7 @@ t" |
191 | 213 |
received payload. The name of the event-route name must match the |
192 | 214 |
subject of the message. |
193 | 215 |
|
194 |
- Example 1.6. Define the event routes |
|
216 |
+ Example 1.7. Define the event routes |
|
195 | 217 |
... |
196 | 218 |
modparam("nats", "subject_queue_group", "Kamailio-World:2021") |
197 | 219 |
modparam("nats", "subject_queue_group", "MyQueue1:2021") |