Beispiel #1
0
        public T GetService <T>(string scope, TimeoutSettings timeoutSettings) where T : class
        {
            var serviceName = typeof(T).GetServiceName();

            if (topology.GetEndPoint(serviceName, scope) == settings.EndPoint)
            {
                var implementation = serviceImplementationContainer.GetImplementation(serviceName, scope).Implementation;
                // todo: notready timeouts
                return((T)implementation);
            }
            return(serviceProxyContainer.GetProxy <T>(scope, timeoutSettings));
        }
Beispiel #2
0
        public RpcClientServer(ITopologyLoader topologyLoader, TimeoutSettings defaultTimeout, ISettingsLoader settingsLoader, RpcComponentOverrides componentOverrides = null)
        {
            topology            = topologyLoader.Load();
            this.defaultTimeout = defaultTimeout;
            settings            = settingsLoader.LoadHostSettings();
            var componentContainer = new RpcClientServerComponentContainer(this, componentOverrides ?? new RpcComponentOverrides());

            logger = componentContainer.GetLogger();
            serviceImplementationContainer = componentContainer.GetServiceImplementationContainer();
            requestReceiver       = componentContainer.GetRequestReceiverContainer().GetReceiver(settings.EndPoint.Protocol);
            serviceProxyContainer = componentContainer.GetIServiceProxyContainer();
        }
Beispiel #3
0
 public T GetService <T>(string scope, TimeoutSettings timeoutSettings) where T : class
 {
     return(proxyContainer.GetProxy <T>(scope, timeoutSettings));
 }