<div dir="ltr"><span id="docs-internal-guid-60d63e60-044d-fdbe-ca23-afd67f499047"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">The new event_virtual module addresses the problem of reliability for events delivery. Previously, the modules generating and sending events had first of all no way to find the sending was successful or not, and even more there was no available mechanism to do failover to a another backend (i.e. figure out if event delivery via rabbitmq failed and if so, try to deliver the event via datagram or text file).</span></p><br><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">The event_virtual module provides a solution for detecting the failure of events delivery and for doing the failover. Even more, beside failure handling, the module addresses the issue of load balancing (or dispatching) for events across multiple backends.</span></p><br><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Shortly, the new event_virtual module provides the possibility to create virtual backends for the OpenSIPS Event Interface. A virtual backend can aggregate multiple real backends (transport protocols that are implemented by different OpenSIPS modules) such as: event_xmlrpc, event_rabbitmq, event_datagram or event_flatstore etc.</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">The main advantage brought by this module is that when an event is triggered, the virtual module pushes the event to the read backends with three different policies which can be specified in the virtual subscription socket.Those policies are:</span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"> * parallel - the event is pushed to all defined backends at the same time;</span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"> * failover - for every event raised, try the backends in the order in which they</span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">   are given in the virtual socket, until the first successful delivery;</span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"> * round-robin - for every event raised, use the backends alternatively, in the order in</span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">   which they are given (for each raised event notify a different backend).</span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">For example, if we don&#39;t want to lose event notifications in case one of the registered external applications fails, we can set up other backend to deliver the event.The virtual socket could be:</span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">virtual:FAILOVER <a href="http://rabbitmq:guest:guest@127.0.0.1:5672/pike">rabbitmq:guest:guest@127.0.0.1:5672/pike</a> flatstore:/var/log/opensips.log</span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Another scenario could be if we want to do some &quot;load balancing&quot; if we receive too many events to one subscriber.The socket could be:</span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><br class=""></span><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">virtual:ROUND-ROBIN udp:<a href="http://127.0.0.1:8081">127.0.0.1:8081</a> xmlrpc:127.0.0.1:8080:block_ip</span></p><br><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">For more details, take a look at the module readme:</span></p><span style="font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><a href="http://www.opensips.org/html/docs/modules/2.2.x/event_virtual.html">http://www.opensips.org/html/docs/modules/2.2.x/event_virtual.html</a></span></span><br></div>