IEnumerable <ServiceRemotingDispatcher> GetDispatchers(Type actorType) { List <ServiceRemotingDispatcher> dispatchers = new List <ServiceRemotingDispatcher>(); StatefulServiceContext context = new StatefulServiceContext(); Func <StatefulServiceContext, ActorTypeInformation, ActorService> factory = FabricRuntime.ActorServiceFactories[actorType]; if (factory != null) { ActorService service = factory(context, ActorTypeInformation.Get(actorType)); foreach (ServiceReplicaListener replicaListener in service.ServiceReplicaListeners) { IServiceRemotingListener listener = replicaListener.CreateCommunicationListener(context) as IServiceRemotingListener; if (listener.Dispatcher != null) { dispatchers.Add(listener.Dispatcher); } } } return(dispatchers); }
IEnumerable <ServiceRemotingDispatcher> GetDispatchers(Type serviceType, ServiceEndpoint endpoint) { List <ServiceRemotingDispatcher> dispatchers = new List <ServiceRemotingDispatcher>(); StatelessServiceContext serviceContext = new StatelessServiceContext(); StatelessService service = Activator.CreateInstance(serviceType, serviceContext) as StatelessService; foreach (ServiceInstanceListener instanceListener in service.ServiceInstanceListeners) { if (instanceListener.Name.Equals(endpoint.Contract.Name)) { IServiceRemotingListener listener = instanceListener.CreateCommunicationListener(serviceContext) as IServiceRemotingListener; if (listener.Dispatcher != null) { dispatchers.Add(listener.Dispatcher); } } } return(dispatchers); }