Ejemplo n.º 1
0
        public ActorConnectorChannel(
            ActorIdentity localActor,
            ActorTransportConnector remoteConnector,
            ActorChannelConfiguration channelConfiguration)
        {
            if (localActor == null)
            {
                throw new ArgumentNullException("localActor");
            }
            if (remoteConnector == null)
            {
                throw new ArgumentNullException("remoteConnector");
            }
            if (channelConfiguration == null)
            {
                throw new ArgumentNullException("channelConfiguration");
            }

            _localActor           = localActor;
            _connector            = remoteConnector;
            _channelConfiguration = channelConfiguration;

            _keepAliveTracker      = KeepAliveTracker.Create(KeepAliveInterval, new TimerCallback((s) => OnKeepAlive()));
            _keepAliveTimeoutTimer = new Timer(new TimerCallback((s) => OnKeepAliveTimeout()), null, Timeout.Infinite, Timeout.Infinite);
        }
Ejemplo n.º 2
0
 public ActorConnectorReconnectableChannel(
     ActorIdentity localActor,
     ActorTransportConnector remoteConnector,
     ActorChannelConfiguration channelConfiguration)
     : base(localActor, remoteConnector, channelConfiguration)
 {
     this.RetryPeriod = TimeSpan.FromSeconds(15);
 }
Ejemplo n.º 3
0
        private IActorChannel BuildActorCenterChannel(ActorIdentity centerActor, ActorIdentity localActor)
        {
            IPAddress actorCenterAddress  = ResolveIPAddress(centerActor.Address);
            int       actorCenterPort     = int.Parse(centerActor.Port);
            var       actorCenterEndPoint = new IPEndPoint(actorCenterAddress, actorCenterPort);

            var centerConnector = new ActorTransportConnector(actorCenterEndPoint);
            var centerChannel   = new ActorConnectorReconnectableChannel(
                localActor, centerConnector, this.ChannelConfiguration);

            return(centerChannel);
        }
Ejemplo n.º 4
0
        private IActorChannel BuildCenterActorChannel(ActorIdentity localActor)
        {
            IPAddress centerActorAddress = ResolveIPAddress(this.CenterActor.Address);

            int centerActorPort = -1;

            if (!int.TryParse(this.CenterActor.Port, out centerActorPort) || centerActorPort < 0)
            {
                throw new InvalidOperationException(string.Format(
                                                        "Invalid center actor port, [{0}].", this.CenterActor));
            }

            var centerActorEndPoint = new IPEndPoint(centerActorAddress, centerActorPort);

            var centerConnector = new ActorTransportConnector(centerActorEndPoint, this.ChannelConfiguration.TransportConfiguration);
            var centerChannel   = new ActorConnectorReconnectableChannel(
                localActor, centerConnector, this.ChannelConfiguration);

            return(centerChannel);
        }