Skip to content

Commit

Permalink
Ensure IndexChannel and DatastreamChannel have constructor with callb…
Browse files Browse the repository at this point in the history
…ackListeners (#27)
  • Loading branch information
Mpdreamz authored Apr 5, 2023
1 parent c073cb9 commit 1198997
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using Elastic.Channels;
using Elastic.Channels.Diagnostics;
using Elastic.Ingest.Elasticsearch.Serialization;
using Elastic.Ingest.Transport;

Expand All @@ -16,7 +17,10 @@ public class DataStreamChannel<TEvent> : ElasticsearchChannelBase<TEvent, DataSt
private readonly CreateOperation _fixedHeader;

/// <inheritdoc cref="DataStreamChannel{TEvent}"/>
public DataStreamChannel(DataStreamChannelOptions<TEvent> options) : base(options)
public DataStreamChannel(DataStreamChannelOptions<TEvent> options) : this(options, null) { }

/// <inheritdoc cref="DataStreamChannel{TEvent}"/>
public DataStreamChannel(DataStreamChannelOptions<TEvent> options, ICollection<IChannelCallbacks<TEvent, BulkResponse>>? callbackListeners) : base(options, callbackListeners)
{
var target = Options.DataStream.ToString();
_fixedHeader = new CreateOperation { Index = target };
Expand Down
7 changes: 6 additions & 1 deletion src/Elastic.Ingest.Elasticsearch/Indices/IndexChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
using System;
using System.Collections.Generic;
using Elastic.Channels.Diagnostics;
using Elastic.Ingest.Elasticsearch.DataStreams;
using Elastic.Ingest.Elasticsearch.Serialization;
using Elastic.Ingest.Transport;
Expand All @@ -14,7 +16,10 @@ namespace Elastic.Ingest.Elasticsearch.Indices
public class IndexChannel<TEvent> : ElasticsearchChannelBase<TEvent, IndexChannelOptions<TEvent>>
{
/// <inheritdoc cref="IndexChannel{TEvent}"/>
public IndexChannel(IndexChannelOptions<TEvent> options) : base(options)
public IndexChannel(IndexChannelOptions<TEvent> options) : this(options, null) { }

/// <inheritdoc cref="IndexChannel{TEvent}"/>
public IndexChannel(IndexChannelOptions<TEvent> options, ICollection<IChannelCallbacks<TEvent, BulkResponse>>? callbackListeners) : base(options, callbackListeners)
{
TemplateName = string.Format(Options.IndexFormat, "template");
TemplateWildcard = string.Format(Options.IndexFormat, "*");
Expand Down

0 comments on commit 1198997

Please sign in to comment.