<html>
<head>
<base href="https://wiki.asterisk.org/wiki">
<link rel="stylesheet" href="/wiki/s/2030/1/7/_/styles/combined.css?spaceKey=TOP&forWysiwyg=true" type="text/css">
</head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
<h2><a href="https://wiki.asterisk.org/wiki/display/TOP/SmartProxy">SmartProxy</a></h2>
<h4>Page <b>added</b> by <a href="https://wiki.asterisk.org/wiki/display/~dlee">David M. Lee</a>
</h4>
<br/>
<div class="notificationGreySide">
<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Work in progress</td></tr></table></div>
<p>SmartProxy is a small template which reduces some of the repetition involved with using the <tt>ServiceLocator</tt>. Right now, it's somewhat light on functionality.</p>
<p>When created, it will contact the <tt>ServiceLocator</tt> to find a proxy matching the provided params. If none is found, things continue on. When the <tt>SmartProxy</tt> is dereferenced (<tt>operator-></tt>), it will check to see if the proxy has been successfully initialized. If not, it will try again. If it fails again to successfully initialize, it throws a <tt>ServiceNotFound</tt> exception.</p>
<h1><a name="SmartProxy-FutureWork"></a>Future Work</h1>
<h2><a name="SmartProxy-Automatedupdates"></a>Automated updates</h2>
<p>A useful feature of the smart proxy would be to register interest in events from the <tt>ServiceLocator</tt> and automagically update the proxy in response to those events.</p>
<p>The most non-controversial would be to initialize the proxy when new services are registered or unsuspended. Note that some changes will have to be made in the <tt>ServiceLocator</tt>'s events, since we currently do not get events when comparators are added to a service.</p>
<h3><a name="SmartProxy-Failover"></a>Failover</h3>
<p>Other updates the <tt>SmartProxy</tt> could do are a bit more problematic. Some of these depend upon the interpretation of what 'suspended' means for a service. Others depend upon the implementation or configuration of the service. Some may depend upon the needs of the client making the request.</p>
<ul>
        <li><b>Service Types/configuration</b>
        <ul>
                <li>Stateless</li>
                <li>Replicated</li>
                <li>Non-replicated</li>
                <li>Singleton</li>
        </ul>
        </li>
        <li><b>Service Discovery Events</b>
        <ul>
                <li>Service registered (incl. comparators)</li>
                <li>Service unregistered</li>
                <li>Service suspended</li>
                <li>Service unsuspended</li>
        </ul>
        </li>
        <li><b>Client states</b>
        <ul>
                <li>Initialized</li>
                <li>Uninitialized</li>
        </ul>
        </li>
        <li><b>Client events</b>
        <ul>
                <li>Service discovered</li>
                <li>Service lost</li>
                <li>Service suspended</li>
        </ul>
        </li>
</ul>
</div>
<div id="commentsSection" class="wiki-content pageSection">
<div style="float: right;">
<a href="https://wiki.asterisk.org/wiki/users/viewnotifications.action" class="grey">Change Notification Preferences</a>
</div>
<a href="https://wiki.asterisk.org/wiki/display/TOP/SmartProxy">View Online</a>
|
<a href="https://wiki.asterisk.org/wiki/display/TOP/SmartProxy?showComments=true&showCommentArea=true#addcomment">Add Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>