public CorrelatingRemotingMessageHandler(ILog log, ServiceContext serviceContext, IService serviceImplementation, Action <CallSummary> raiseSummary) { _innerHandler = new ServiceRemotingMessageDispatcher(serviceContext, serviceImplementation); MethodResolver.AddMethodsForProxyOrService(serviceImplementation.GetType().GetInterfaces(), typeof(IService)); _log = log; _raiseSummary = raiseSummary; }
public TServiceInterface CreateActorServiceProxy <TServiceInterface>(Uri serviceUri, long partitionKey, string listenerName = null) where TServiceInterface : IService { TServiceInterface proxy = _actorProxyFactory.CreateActorServiceProxy <TServiceInterface>(serviceUri, partitionKey, GetListenerName(listenerName)); MethodResolver.AddMethodsForProxyOrService(proxy.GetType().GetInterfaces(), typeof(IService)); return(proxy); }
#pragma warning disable CS0693 // Type parameter has the same name as the type parameter from outer type public TActorInterface CreateActorProxy <TActorInterface>(Uri serviceUri, ActorId actorId, string listenerName = null) where TActorInterface : IActor #pragma warning restore CS0693 // Type parameter has the same name as the type parameter from outer type { TActorInterface proxy = _actorProxyFactory.CreateActorProxy <TActorInterface>(serviceUri, actorId, GetListenerName(listenerName)); MethodResolver.AddMethodsForProxyOrService(proxy.GetType().GetInterfaces(), typeof(IActor)); return(proxy); }
public CorrelatingRemotingMessageHandler(ILog log, ActorService actorService) { _innerHandler = new ActorServiceRemotingDispatcher(actorService, null); MethodResolver.AddMethodsForProxyOrService(actorService.GetType().GetInterfaces(), typeof(IService)); MethodResolver.AddMethodsForProxyOrService(actorService.ActorTypeInformation.InterfaceTypes, typeof(IActor)); _log = log; _raiseSummary = null; }
public TServiceInterface CreateServiceProxy <TServiceInterface>(Uri serviceUri, ServicePartitionKey partitionKey = null, TargetReplicaSelector targetReplicaSelector = TargetReplicaSelector.Default, string listenerName = null) where TServiceInterface : IService { TServiceInterface proxy = _serviceProxyFactory.CreateServiceProxy <TServiceInterface>(serviceUri, partitionKey, targetReplicaSelector, listenerName); MethodResolver.AddMethodsForProxyOrService(proxy.GetType().GetInterfaces(), typeof(IService)); return(proxy); }
#pragma warning disable CS0693 // Type parameter has the same name as the type parameter from outer type public TServiceInterface CreateServiceProxy <TServiceInterface>(Uri serviceUri, ServicePartitionKey partitionKey = null, TargetReplicaSelector targetReplicaSelector = TargetReplicaSelector.Default, string listenerName = null) where TServiceInterface : IService #pragma warning restore CS0693 // Type parameter has the same name as the type parameter from outer type { TServiceInterface proxy = _serviceProxyFactory.CreateServiceProxy <TServiceInterface>(serviceUri, partitionKey, targetReplicaSelector, listenerName); MethodResolver.AddMethodsForProxyOrService(proxy.GetType().GetInterfaces(), typeof(IService)); return(proxy); }
public async Task <IServiceRemotingResponseMessage> HandleRequestResponseAsync( IServiceRemotingRequestContext requestContext, IServiceRemotingRequestMessage requestMessage) { Dictionary <string, string> context = ExtractContextProperties(requestMessage); string methodName = MethodResolver.GetMethodName(requestMessage); Exception gex = null; using (L.Context(context)) { using (var time = new TimeMeasure()) { try { return(await _innerHandler.HandleRequestResponseAsync(requestContext, requestMessage)); } catch (Exception ex) { gex = ex; throw; } finally { if (_raiseSummary != null) { var summary = new CallSummary(methodName, gex, time.ElapsedTicks); _raiseSummary(summary); } _log.Request(methodName, time.ElapsedTicks, gex, context.ToDictionary(k => k.Key, v => (object)(v.Value))); } } } }