public void ReceiveEndpoint(IEndpointDefinition definition, IEndpointNameFormatter endpointNameFormatter, Action <TEndpointConfigurator> configureEndpoint) { endpointNameFormatter ??= EndpointNameFormatter; if (_instanceEndpointConfigurator != null) { _configurator.ReceiveEndpoint(definition, endpointNameFormatter, endpointConfigurator => { _transportConfigurator.ConfigureServiceEndpoint(endpointConfigurator); endpointConfigurator.AddDependency(_instanceEndpointConfigurator); ConfigureServiceEndpoint(endpointConfigurator, _instanceEndpointConfigurator, configureEndpoint); }); } else { var controlEndpointDefinition = new ServiceControlEndpointDefinition(definition); _configurator.ReceiveEndpoint(controlEndpointDefinition, endpointNameFormatter, controlEndpointConfigurator => { _transportConfigurator.ConfigureControlEndpoint(controlEndpointConfigurator); _configurator.ReceiveEndpoint(definition, endpointNameFormatter, endpointConfigurator => { endpointConfigurator.AddDependency(controlEndpointConfigurator); _transportConfigurator.ConfigureServiceEndpoint(endpointConfigurator); ConfigureServiceEndpoint(endpointConfigurator, controlEndpointConfigurator, configureEndpoint); }); }); } if (_options.InstanceServiceEndpointEnabled) { var instanceServiceEndpointDefinition = new InstanceServiceEndpointDefinition(definition, _instance); _configurator.ReceiveEndpoint(instanceServiceEndpointDefinition, endpointNameFormatter, endpointConfigurator => { _transportConfigurator.ConfigureInstanceServiceEndpoint(endpointConfigurator); ConfigureServiceEndpoint(endpointConfigurator, configureEndpoint); }); } }