void ValidateAndApplyLegacyConfiguration()
        {
            if (!legacyMode)
            {
                return;
            }

            if (RoutingTopology == null)
            {
                throw new Exception("A routing topology must be configured with one of the 'EndpointConfiguration.UseTransport<RabbitMQTransport>().UseXXXXRoutingTopology()` methods.");
            }

            if (string.IsNullOrEmpty(LegacyApiConnectionString))
            {
                throw new Exception("A connection string must be configured with 'EndpointConfiguration.UseTransport<RabbitMQTransport>().ConnectionString()` method.");
            }

            if (LegacyApiConnectionString.StartsWith("amqp", StringComparison.OrdinalIgnoreCase))
            {
                AmqpConnectionString.Parse(LegacyApiConnectionString)(this);
            }
            else
            {
                NServiceBusConnectionString.Parse(LegacyApiConnectionString)(this);
            }
        }
        /// <summary>
        /// Creates new instance of the RabbitMQ transport.
        /// </summary>
        /// <param name="topology">The custom topology to use.</param>
        /// <param name="connectionString">Connection string.</param>
        /// <param name="queueMode">The queue mode for receiving queues.</param>
        /// <param name="enableTimeouts">Whether to enable timeouts.</param>
        private protected RabbitMQTransport(IRoutingTopology topology, string connectionString, QueueMode queueMode, bool enableTimeouts)
            : base(TransportTransactionMode.ReceiveOnly,
                   supportsDelayedDelivery: enableTimeouts,
                   supportsPublishSubscribe: true,
                   supportsTTBR: queueMode == QueueMode.Classic)
        {
            Guard.AgainstNull(nameof(topology), topology);
            Guard.AgainstNull(nameof(connectionString), connectionString);

            QueueMode       = queueMode;
            RoutingTopology = topology;
            if (connectionString.StartsWith("amqp", StringComparison.OrdinalIgnoreCase))
            {
                AmqpConnectionString.Parse(connectionString)(this);
            }
            else
            {
                NServiceBusConnectionString.Parse(connectionString)(this);
            }
        }