public Router(IRequestPipelineFactory factory) { Pipeline = factory.CreatePipeline(factory); Pipeline.AddContributer(factory.CreateCodecContributor()); Pipeline.AddContributer(factory.CreateResourceBinderContributor()); Pipeline.AddContributer(factory.CreateAuthorizeContributor()); Pipeline.AddContributer(factory.CreateRouteContributor()); Pipeline.SetResponseGeneratorContributor(factory.CreateResponseGeneratorContributor()); foreach (var contributor in factory.CreateAdditonalContributors()) Pipeline.AddContributer(contributor); }
/// <summary> /// Transport coordinates the client requests over the connection pool nodes and is in charge of falling over on different nodes /// </summary> /// <param name="configurationValues">The connectionsettings to use for this transport</param> /// <param name="pipelineProvider">In charge of create a new pipeline, safe to pass null to use the default</param> /// <param name="dateTimeProvider">The date time proved to use, safe to pass null to use the default</param> /// <param name="memoryStreamFactory">The memory stream provider to use, safe to pass null to use the default</param> public Transport( TConnectionSettings configurationValues, IRequestPipelineFactory pipelineProvider, IDateTimeProvider dateTimeProvider, IMemoryStreamFactory memoryStreamFactory ) { configurationValues.ThrowIfNull(nameof(configurationValues)); configurationValues.ConnectionPool.ThrowIfNull(nameof(configurationValues.ConnectionPool)); configurationValues.Connection.ThrowIfNull(nameof(configurationValues.Connection)); configurationValues.RequestResponseSerializer.ThrowIfNull(nameof(configurationValues.RequestResponseSerializer)); this.Settings = configurationValues; this.PipelineProvider = pipelineProvider ?? new RequestPipelineFactory(); this.DateTimeProvider = dateTimeProvider ?? Elasticsearch.Net.DateTimeProvider.Default; this.MemoryStreamFactory = memoryStreamFactory ?? configurationValues.MemoryStreamFactory; }
/// <summary> /// Transport coordinates the client requests over the connection pool nodes and is in charge of falling over on different nodes /// </summary> /// <param name="configurationValues">The connectionsettings to use for this transport</param> /// <param name="requestPipelineProvider">In charge of create a new pipeline, safe to pass null to use the default</param> /// <param name="dateTimeProvider">The date time proved to use, safe to pass null to use the default</param> /// <param name="memoryStreamFactory">The memory stream provider to use, safe to pass null to use the default</param> public Transport( TConnectionSettings configurationValues, IRequestPipelineFactory pipelineProvider, IDateTimeProvider dateTimeProvider, IMemoryStreamFactory memoryStreamFactory ) { configurationValues.ThrowIfNull(nameof(configurationValues)); configurationValues.ConnectionPool.ThrowIfNull(nameof(configurationValues.ConnectionPool)); configurationValues.Connection.ThrowIfNull(nameof(configurationValues.Connection)); configurationValues.Serializer.ThrowIfNull(nameof(configurationValues.Serializer)); this.Settings = configurationValues; this.PipelineProvider = pipelineProvider ?? new RequestPipelineFactory(); this.DateTimeProvider = dateTimeProvider ?? Providers.DateTimeProvider.Default; this.MemoryStreamFactory = memoryStreamFactory ?? new MemoryStreamFactory(); this._semaphore = new SemaphoreSlim(1, 1); }
/// <summary> /// Transport coordinates the client requests over the connection pool nodes and is in charge of falling over on different nodes /// </summary> /// <param name="configurationValues">The connection settings to use for this transport</param> /// <param name="pipelineProvider">In charge of create a new pipeline, safe to pass null to use the default</param> /// <param name="dateTimeProvider">The date time proved to use, safe to pass null to use the default</param> /// <param name="memoryStreamFactory">The memory stream provider to use, safe to pass null to use the default</param> public Transport(TransportConfiguration configurationValues, IRequestPipelineFactory <TransportConfiguration> pipelineProvider = null, IDateTimeProvider dateTimeProvider = null, IMemoryStreamFactory memoryStreamFactory = null) : base(configurationValues, pipelineProvider, dateTimeProvider, memoryStreamFactory) { }
public RequestPipeline(IRequestPipelineFactory factory, IRequestContributor responseContributor) { queue = new Queue<IRequestContributor>(); this.factory = factory; this.responseGeneratorContributor = responseContributor; }