public BatchChannel(SocketOptions options, IChannel channel, BatchLetterBuilder batchBuilder) { _channel = channel; _options = options.Batch; _batchBuilder = batchBuilder; _channel.ChannelConnected += abstractChannel => ChannelConnected(this); _channel.ChannelDisconnected += ChannelOnDisconnected; _channel.ChannelQueueEmpty += abstractChannel => { /* NOOP */ }; _channel.ChannelInitialized += ChannelOnInitialized; _channel.ChannelConnecting += abstractChannel => ChannelConnecting(this); _channel.ChannelDisconnecting += (abstractChannel, reason) => ChannelDisconnecting(this, reason); _channel.Received += ChannelOnReceived; _channel.Sent += ChannelOnSent; _channel.FailedToSend += ChannelOnFailedToSend; _slidingTimeoutTimer = new Timer(_options.Extend.TotalMilliseconds) { AutoReset = false }; _slidingTimeoutTimer.Elapsed += SlidingTimeoutTimerOnElapsed; }
public SocketOptions() { Batch = new BatchOptions {Enabled = true, Extend = TimeSpan.FromMilliseconds(100), MaxExtend = TimeSpan.FromSeconds(1), MaxLetters = 4000}; Heartbeat = new HeartbeatOptions {Interval = 1000}; Notification = new NotificationOptions {ReceivedNotifyOnAllAckStates = false}; NodeId = Guid.NewGuid(); ReconnectInterval = TimeSpan.FromMilliseconds(1000); ShutdownWait = TimeSpan.FromMilliseconds(1500); MaximumInitializeTime = TimeSpan.FromMilliseconds(4000); }
public BatchChannel(SocketOptions options, IChannel channel, BatchLetterBuilder batchBuilder) { _channel = channel; _options = options.Batch; _batchBuilder = batchBuilder; _channel.ChannelConnected += abstractChannel => ChannelConnected?.Invoke(this); _channel.ChannelDisconnected += ChannelOnDisconnected; _channel.ChannelQueueEmpty += abstractChannel => { /* NOOP */ }; _channel.ChannelInitialized += ChannelOnInitialized; _channel.ChannelConnecting += abstractChannel => ChannelConnecting?.Invoke(this); _channel.ChannelDisconnecting += (abstractChannel, reason) => ChannelDisconnecting?.Invoke(this, reason); _channel.Received += ChannelOnReceived; _channel.Sent += ChannelOnSent; _channel.FailedToSend += ChannelOnFailedToSend; _slidingTimeoutTimer = new Timer(SlidingTimeoutTimerOnElapsed, null, -1, -1); }
public BatchChannel(SocketOptions options, IChannel channel, BatchLetterBuilder batchBuilder) { _channel = channel; _options = options.Batch; _batchBuilder = batchBuilder; _channel.ChannelConnected += abstractChannel => ChannelConnected(this); _channel.ChannelDisconnected += ChannelOnDisconnected; _channel.ChannelQueueEmpty += abstractChannel => { /* NOOP */ }; _channel.ChannelInitialized += ChannelOnInitialized; _channel.ChannelConnecting += abstractChannel => ChannelConnecting(this); _channel.ChannelDisconnecting += (abstractChannel, reason) => ChannelDisconnecting(this, reason); _channel.Received += ChannelOnReceived; _channel.Sent += ChannelOnSent; _channel.FailedToSend += ChannelOnFailedToSend; _slidingTimeoutTimer = new Timer(_options.Extend.TotalMilliseconds) {AutoReset = false}; _slidingTimeoutTimer.Elapsed += SlidingTimeoutTimerOnElapsed; }