public ServiceEndpointConfigurator(IServiceInstance instance, IEndpointConfigurationObserverConnector connector,
                                           IReceiveEndpointConfigurator serviceEndpointConfigurator, IReceiveEndpointConfigurator controlEndpointConfigurator = null)
        {
            _serviceEndpointConfigurator = serviceEndpointConfigurator;
            _controlEndpointConfigurator = controlEndpointConfigurator;

            _configurationHandles = new List <ConnectHandle>();

            _endpoint = instance.CreateServiceEndpoint(serviceEndpointConfigurator);

            ConnectConfigurationObserver(serviceEndpointConfigurator);

            _configurationHandles.Add(connector.ConnectEndpointConfigurationObserver(this));
        }
        public static IEndpointConfigurationObserverConnector UseDefaultRetries(this IEndpointConfigurationObserverConnector connector,
                                                                                IServiceProvider serviceProvider,
                                                                                Action <DefaultReceiveEndpointRetriesOptions> configOptions = null)
        {
            var options = new DefaultReceiveEndpointRetriesOptions();

            configOptions?.Invoke(options);

            connector.ConnectEndpointConfigurationObserver(new DefaultReceiveEndpointRetriesConfigurationObserver(
                                                               serviceProvider,
                                                               options));

            return(connector);
        }