public void Emit(IOp op) { if (op is MsgOp msgOp) { _msgOpStream.Emit(msgOp); } _opStream.Emit(op); }
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)); } }
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)); } }