diff --git a/src/modules/nsq/doc/nsq_admin.xml b/src/modules/nsq/doc/nsq_admin.xml index 31a5bc293c4..ce7c167aee2 100644 --- a/src/modules/nsq/doc/nsq_admin.xml +++ b/src/modules/nsq/doc/nsq_admin.xml @@ -64,64 +64,6 @@ with NSQ for consuming messages. This one defers the message for processing to other NSQ worker processs so that it doesn't block itself, nor the SIP worker processes. -
- Event Routes - - The worker process issues an event-route where we can act on the received payload. The name of the event-route is composed by values extracted from the payload. - - - NSQ module will try to execute the event route from most significant to less significant. - define the event route like event_route[nsq:consumer-event[-payload_key_value[-payload_subkey_value]]] - - - we can set the key/subkey pair on a subscription base. check the payload on subscribe. - - - Define the event routes - -... -modparam("nsq", "consumer_event_key", "Event-Category") -modparam("nsq", "consumer_event_sub_key", "Event-Name") -... - -event_route[nsq:consumer-event-presence-update] -{ - # presence is the value extracted from Event-Category field in json payload - # update is the value extracted from Event-Name field in json payload - xlog("L_INFO", "received $(nsqE{nsq.json,Event-Package}) update for $(nsqE{kznsqjson,From})"); - ... -} - -event_route[nsq:consumer-event-presence] -{ - # presence is the value extracted from Event-Category field in json payload - xlog("L_INFO", "received $(nsqE{nsq.json,Event-Package}) update for $(nsqE{nsq.json,From})"); - ... -} - -event_route[nsq:consumer-event-event-category-event-name] -{ - # event-category is the name of the consumer_event_key parameter - # event-name is the name of the consumer_event_sub_key parameter - # this event route is executed if we can't find the previous - ... -} - -event_route[nsq:consumer-event-event-category] -{ - # event-category is the name of the consumer_event_key parameter - # this event route is executed if we can't find the previous - ... -} - -event_route[nsq:consumer-event] -{ - # this event route is executed if we can't find the previous -} - - - -
Aknowledge Messages @@ -161,29 +103,31 @@ event_route[nsq:consumer-event]
External Libraries or Applications - - - - libev. - - - - - libjson. - - - - - libevbuffsock. - - - - - libnsq. - - - - + + The following libraries or applications must be installed + + + + libev. + + + + + libjson. + + + + + libevbuffsock. + + + + + libnsq. + + + +
@@ -503,12 +447,22 @@ event_route[nsq:consumer-event-presence-update] Contains the payload of a consumed message + + Example usage of $nsqE pseudo variable + + xlog("L_INFO", "received payload $nsqE from NSQ"); + ... +} + + +
Transformations The prefix for nsq transformations is nsq. + You can use the transformation to extract values from the json structured $nsqE pseudo variable json @@ -517,6 +471,7 @@ event_route[nsq:consumer-event-presence-update] <function>nsq.json</function> usage ... +# extract value of "Custom-Data" from $nsqE pseudo variable and set it to $var(Custom-Data) $var(Custom-Data) = $(nsqE{nsq.json,Custom-Data}); if($var(Custom-Data) != $null) { xlog("L_INFO", "$ci|log|custom data: $var(Custom-Data)"); @@ -530,6 +485,65 @@ if($var(Custom-Data) != $null) {
+
+ Event Routes + + The worker process issues an event-route where we can act on the received payload. The name of the event-route is composed by values extracted from the payload. + + + NSQ module will try to execute the event route from most significant to less significant. + define the event route like event_route[nsq:consumer-event[-payload_key_value[-payload_subkey_value]]] + + + We can set the key/subkey pair on a subscription base. check the payload on subscribe. + + + Define the event routes + +... +modparam("nsq", "consumer_event_key", "Event-Category") +modparam("nsq", "consumer_event_sub_key", "Event-Name") +... + +event_route[nsq:consumer-event-presence-update] +{ + # presence is the value extracted from Event-Category field in json payload + # update is the value extracted from Event-Name field in json payload + xlog("L_INFO", "received $(nsqE{nsq.json,Event-Package}) update for $(nsqE{nsq.json,From})"); + ... +} + +event_route[nsq:consumer-event-presence] +{ + # presence is the value extracted from Event-Category field in json payload + xlog("L_INFO", "received $(nsqE{nsq.json,Event-Package}) update for $(nsqE{nsq.json,From})"); + ... +} + +event_route[nsq:consumer-event-event-category-event-name] +{ + # event-category is the name of the consumer_event_key parameter + # event-name is the name of the consumer_event_sub_key parameter + # this event route is executed if we can't find the previous + ... +} + +event_route[nsq:consumer-event-event-category] +{ + # event-category is the name of the consumer_event_key parameter + # this event route is executed if we can't find the previous + ... +} + +event_route[nsq:consumer-event] +{ + # this event route is executed if we can't find the previous +} + + + +
+