Example #1
0
        public void Emit(IOp op)
        {
            if (op is MsgOp msgOp)
            {
                _msgOpStream.Emit(msgOp);
            }

            _opStream.Emit(op);
        }
Example #2
0
        private async Task ReconnectAsync()
        {
            for (var attempts = 0; !IsConnected && attempts < MaxReconnectDueToFailureAttempts; attempts++)
            {
                try
                {
                    await ConnectAsync().ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    _logger.Error("Failed while trying to reconnect client.", ex);
                }
            }

            if (!IsConnected && !_isDisposed)
            {
                _eventMediator.Emit(new ClientAutoReconnectFailed(this));
            }
        }
Example #3
0
        private void Reconnect()
        {
            try
            {
                for (var attempts = 0; !IsConnected && attempts < MaxReconnectDueToFailureAttempts; attempts++)
                {
                    _logger.Debug($"Trying to reconnect after disconnection due to failure. attempt={attempts.ToString()}");
                    Connect();
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Failed while trying to reconnect client.", ex);
            }

            if (!IsConnected)
            {
                _eventMediator.Emit(new ClientAutoReconnectFailed(this));
            }
        }