public DefaultOutgoingBatchRouter(IConvertOutgoingMessagesToBrokeredMessages outgoingMessageConverter, IManageMessageSenderLifeCycle senders, ReadOnlySettings settings, IHandleOversizedBrokeredMessages oversizedMessageHandler)
        {
            this.outgoingMessageConverter = outgoingMessageConverter;
            this.senders  = senders;
            this.settings = settings;
            this.oversizedMessageHandler = oversizedMessageHandler;

            backOffTimeOnThrottle        = settings.Get <TimeSpan>(WellKnownConfigurationKeys.Connectivity.MessageSenders.BackOffTimeOnThrottle);
            maxRetryAttemptsOnThrottle   = settings.Get <int>(WellKnownConfigurationKeys.Connectivity.MessageSenders.RetryAttemptsOnThrottle);
            maximuMessageSizeInKilobytes = settings.Get <int>(WellKnownConfigurationKeys.Connectivity.MessageSenders.MaximumMessageSizeInKilobytes);
        }
        public OutgoingBatchRouter(BatchedOperationsToBrokeredMessagesConverter outgoingMessageConverter, MessageSenderLifeCycleManager sendersLifeCycleManager, ReadOnlySettings settings, IHandleOversizedBrokeredMessages oversizedMessageHandler)
        {
            this.outgoingMessageConverter = outgoingMessageConverter;
            this.sendersLifeCycleManager  = sendersLifeCycleManager;
            this.oversizedMessageHandler  = oversizedMessageHandler;

            sendViaFromConfiguration    = settings.Get <bool>(WellKnownConfigurationKeys.Connectivity.SendViaReceiveQueue);
            transportTypeIsNetMessaging = settings.Get <TransportType>(WellKnownConfigurationKeys.Connectivity.TransportType) == TransportType.NetMessaging;

            backOffTimeOnThrottle        = settings.Get <TimeSpan>(WellKnownConfigurationKeys.Connectivity.MessageSenders.BackOffTimeOnThrottle);
            maxRetryAttemptsOnThrottle   = settings.Get <int>(WellKnownConfigurationKeys.Connectivity.MessageSenders.RetryAttemptsOnThrottle);
            maximuMessageSizeInKilobytes = settings.Get <int>(WellKnownConfigurationKeys.Connectivity.MessageSenders.MaximumMessageSizeInKilobytes);
        }
        /// <summary>
        /// Behavior for oversized messages.
        /// <remarks>Default is throw an exception using <see cref="ThrowOnOversizedBrokeredMessages" />.</remarks>
        /// </summary>
        public AzureServiceBusMessageSenderSettings OversizedBrokeredMessageHandler(IHandleOversizedBrokeredMessages instance)
        {
            settings.Set(WellKnownConfigurationKeys.Connectivity.MessageSenders.OversizedBrokeredMessageHandlerInstance, instance);

            return(this);
        }