public ServiceProxyInterceptor( Type serviceType, IServiceResolver serviceResolver, RpcHandler handler, RpcMethodFixture fixture, IServiceLoadBalancingStrategy strategy) { _serviceType = serviceType; _serviceResolver = serviceResolver; _handler = handler; _fixture = fixture; _strategy = strategy; }
public ServiceActor Resolve(Type serviceType, IServiceLoadBalancingStrategy strategy) { if (serviceType == null) { throw new ArgumentNullException("serviceType"); } if (strategy == null) { throw new ArgumentNullException("strategy"); } var services = _retriever.Retrieve(serviceType); return(strategy.Select(services)); }
public T Resolve <T>(IServiceLoadBalancingStrategy strategy) { return(_proxyGenerator.CreateServiceProxy <T>(this, _methodFixture, strategy)); }
public T CreateServiceProxy <T>(RpcHandler handler, RpcMethodFixture fixture, IServiceLoadBalancingStrategy strategy) { var proxy = _proxyGenerator.CreateInterfaceProxyWithoutTarget( typeof(T), new ProxyGenerationOptions(), new IInterceptor[] { new ServiceProxyInterceptor( typeof(T), _serviceResolver, handler, fixture, strategy) }); return((T)proxy); }