/// <summary>
        /// Opens the component with given connection and credential parameters.
        /// </summary>
        /// <param name="correlationId">(optional) transaction id to trace execution through call chain.</param>
        public async override Task OpenAsync(string correlationId)
        {
            if (IsOpen())
            {
                return;
            }

            if (_connection == null)
            {
                _connection      = CreateConnection();
                _localConnection = true;
            }

            if (_localConnection)
            {
                await _connection.OpenAsync(correlationId);
            }

            if (!_connection.IsOpen())
            {
                throw new InvalidStateException(correlationId, "CONNECT_FAILED", "MQTT connection is not opened");
            }

            await base.OpenAsync(correlationId);

            _opened = true;
        }