Example #1
0
    def _getProxy(self, subscriber, options):
        """Internal method to create & cache remoteObject proxies to remote
        pubsubs (subscribers).
        """
        try:
            # If we already have a proxy for the _svcname_, return it.
            with self._lock:
                return self._proxyCache[subscriber]

        except KeyError:
            # Create a new proxy to the external pubsub and cache it

            # Fill in possible authentication and security params
            kwdargs = { 'timeout': self.remote_timeout }
            #kwdargs = {}
            if options.has_key('auth'):
                kwdargs['auth'] = options['auth']
            if options.has_key('secure'):
                kwdargs['secure'] = options['secure']
            if options.has_key('transport'):
                kwdargs['transport'] = options['transport']

            # subscriber can be a service name or a host:port
            if not (':' in subscriber):
                proxy_obj = ro.remoteObjectProxy(subscriber, **kwdargs)
            else:
                (host, port) = subscriber.split(':')
                port = int(port)
                proxy_obj = ro.remoteObjectClient(host, port, **kwdargs)
                
            with self._lock:
                self._proxyCache[subscriber] = proxy_obj
            self.logger.debug("Created proxy for '%s'" % (subscriber))

            return proxy_obj
Example #2
0
def get_ms_handle(host=None):
    if not host:
        host = ro.get_myhost()

    # Create a handle to the manager service
    ms = ro.remoteObjectClient(host, ro.managerServicePort)
    
    return ms