Ejemplo n.º 1
0
        public IActorChannel BuildActorChannel(ActorIdentity localActor, string remoteActorType)
        {
            var remoteActorEndPoint = _directory.LookupRemoteActorEndPoint(remoteActorType);

            if (remoteActorEndPoint == null)
            {
                throw new ActorNotFoundException(string.Format(
                                                     "Cannot find remote actor endpoint, Type[{0}].", remoteActorType));
            }

            var channel = new ActorConnectorChannel(
                localActor,
                new ActorTransportConnector(remoteActorEndPoint),
                _channelConfiguration);

            return(channel);
        }
Ejemplo n.º 2
0
        public IActorChannel BuildActorChannel(ActorIdentity localActor, string remoteActorType)
        {
            var remoteActorEndPoints = _directory.LookupRemoteActorEndPoints(remoteActorType);

            if (remoteActorEndPoints == null || !remoteActorEndPoints.Any())
            {
                throw new ActorNotFoundException(string.Format(
                                                     "Cannot find remote actor endpoint, Type[{0}].", remoteActorType));
            }

            var channel = new ActorConnectorChannel(
                localActor,
                new ActorTransportConnector(remoteActorEndPoints.OrderBy(t => Guid.NewGuid()).FirstOrDefault(), _channelConfiguration.TransportConfiguration),
                _channelConfiguration);

            return(channel);
        }