protected override ActorChannelConfiguration BuildChannelConfiguration() { var configuration = new ActorChannelConfiguration(); if (_appConfig.ContainsItem(AppConfigActorSettingItems.KeepAliveIntervalKey)) { var keepAliveInterval = _appConfig.GetItem <int>(AppConfigActorSettingItems.KeepAliveIntervalKey); if (keepAliveInterval < 1) { throw new InvalidProgramException( string.Format("Item [{0}] setting is invalid.", AppConfigActorSettingItems.KeepAliveIntervalKey)); } configuration.KeepAliveInterval = TimeSpan.FromMilliseconds(keepAliveInterval); } if (_appConfig.ContainsItem(AppConfigActorSettingItems.KeepAliveTimeoutKey)) { var keepAliveTimeout = _appConfig.GetItem <int>(AppConfigActorSettingItems.KeepAliveTimeoutKey); if (keepAliveTimeout < 1) { throw new InvalidProgramException( string.Format("Item [{0}] setting is invalid.", AppConfigActorSettingItems.KeepAliveTimeoutKey)); } configuration.KeepAliveTimeout = TimeSpan.FromMilliseconds(keepAliveTimeout); } if (_appConfig.ContainsItem(AppConfigActorSettingItems.KeepAliveEnabledKey)) { var keepAliveEnabled = _appConfig.GetItem <bool>(AppConfigActorSettingItems.KeepAliveEnabledKey); configuration.KeepAliveEnabled = keepAliveEnabled; } return(configuration); }
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); }
public ActorConnectorReconnectableChannel( ActorIdentity localActor, ActorTransportConnector remoteConnector, ActorChannelConfiguration channelConfiguration) : base(localActor, remoteConnector, channelConfiguration) { this.RetryPeriod = TimeSpan.FromSeconds(15); }
public ActorChannelSession( ActorIdentity localActor, ActorChannelConfiguration channelConfiguration, ActorTransportSession session) { _localActor = localActor; _channelConfiguration = channelConfiguration; _innerSession = session; _keepAliveTracker = KeepAliveTracker.Create(KeepAliveInterval, new TimerCallback((s) => OnKeepAlive())); _keepAliveTimeoutTimer = new Timer(new TimerCallback((s) => OnKeepAliveTimeout()), null, Timeout.Infinite, Timeout.Infinite); }
public ActorChannelFactory( IActorDirectory directory, ActorChannelConfiguration channelConfiguration) { if (directory == null) { throw new ArgumentNullException("directory"); } if (channelConfiguration == null) { throw new ArgumentNullException("channelConfiguration"); } _directory = directory; _channelConfiguration = channelConfiguration; }
public CenterActorDirectory( ActorIdentity centerActor, ActorChannelConfiguration channelConfiguration) { if (centerActor == null) { throw new ArgumentNullException("centerActor"); } if (channelConfiguration == null) { throw new ArgumentNullException("channelConfiguration"); } _centerActor = centerActor; _channelConfiguration = channelConfiguration; }
private ConcurrentDictionary <string, string> _actorKeys = new ConcurrentDictionary <string, string>(); // ActorKey -> SessionKey public ActorListenerChannel( ActorIdentity localActor, ActorTransportListener localListener, ActorChannelConfiguration channelConfiguration) { if (localActor == null) { throw new ArgumentNullException("localActor"); } if (localListener == null) { throw new ArgumentNullException("localListener"); } if (channelConfiguration == null) { throw new ArgumentNullException("channelConfiguration"); } _localActor = localActor; _listener = localListener; _channelConfiguration = channelConfiguration; }