Elastic.Channels 0.7.3

Prefix Reserved
dotnet add package Elastic.Channels --version 0.7.3                
NuGet\Install-Package Elastic.Channels -Version 0.7.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Elastic.Channels" Version="0.7.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Elastic.Channels --version 0.7.3                
#r "nuget: Elastic.Channels, 0.7.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Elastic.Channels as a Cake Addin
#addin nuget:?package=Elastic.Channels&version=0.7.3

// Install Elastic.Channels as a Cake Tool
#tool nuget:?package=Elastic.Channels&version=0.7.3                

Elastic.Channels

Provides an specialized System.Threading.Channels.ChannelWriter implementation that makes it easy to consume data pushed to that thread in batches.

The batches will emit either when a certain maximum is hit or when a batch's lifecycle exceeds a certain age.

This allows data of various rates to pushed in the same manner while different implementations to send the batched data to receivers can be implemented.

This package serves mainly as a core library with abstract classes and does not ship any useful implementations.

It ships with a NoopBufferedChannel implementation that does nothing in its `ExporExport implementation for unit test and benchmark purposes.

BufferedChannelBase<>

An abstract class that requires implementers to implement:

protected abstract Task<TResponse> Export(IReadOnlyCollection<TEvent> buffer, CancellationToken ctx);

Any implementation allows data to pushed to it through:

var e = new TEvent();
if (await channel.WaitToWriteAsync(e))
	written++;

ChannelOptionsBase<>

Implementers of BufferedChannelBase<> must also create their own implementation of ChannelOptionsBase<>. This to ensure each channel implementation creates an appropriately named options class.

Quick minimal implementation


public class Event { }
public class Response { }

public class NoopChannelOptions 
  : ChannelOptionsBase<Event, Response> { }

public class NoopBufferedChannel 
  : BufferedChannelBase<NoopChannelOptions, Event, Response>
{

  public NoopBufferedChannel(NoopChannelOptions options) 
    : base(options) { }

  protected override Task<Response> Export(IReadOnlyCollection<NoopEvent> buffer, CancellationToken ctx)
  {
    return Task.FromResult(new Response());
  }
}

Now once we instantiate an NoopBufferedChannel we can use it push data to it.

var e = new Event();
if (await noopChannel.WaitToWriteAsync(e))
	written++;

Both NoopBufferedChannel and a more specialized DiagnosticsBufferedChannel exist for test or debugging purposes.

DiagnosticsBufferedChannel.ToString() uncovers a lot of insights into the state machinery.

BufferOptions

Each ChannelOptionsBase<> implementation takes and exposes a BufferOptions instance. This controls the buffering behavior of BufferedChannelBase<>.

Option Description
InboundBufferMaxSize The maximum number of in flight instances that can be queued in memory. If this threshold is reached, events will be dropped
OutboundBufferMaxSize The number of events a local buffer should reach before sending the events in a single call to Elasticsearch.
OutboundBufferMaxLifetime The maximum age of buffer before its flushed
ExportMaxConcurrency Controls how many concurrent Export operations may occur
ExportMaxRetries The maximum number of retries over Export
ExportBackOfPeriod Func that calculates an appropriate backoff time for a retry
ExportBufferCallback Called once whenever a buffer is flushed, excluding retries
WaitHandle Inject a waithandle that will be signalled after each flush, excluding retries.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Elastic.Channels:

Package Downloads
Elastic.Ingest.Transport

Provides components to build a buffer-backed channel for publishing events to distributed systems over HTTP through Elastic.Transport

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.7.3 1,933 10/3/2024
0.7.2 114,368 9/18/2024
0.7.1 319 9/16/2024
0.7.0 422,996 4/10/2024
0.6.0 323 3/28/2024
0.5.7 14,839 2/13/2024
0.5.6 594 1/22/2024
0.5.5 594,316 7/12/2023
0.5.4 530 7/10/2023
0.5.3 550 7/5/2023
0.5.2 537 6/22/2023
0.5.1 538 5/4/2023
0.5.0 101,768 4/28/2023
0.4.3 578 4/17/2023
0.4.2 830 4/5/2023
0.4.1 558 4/5/2023
0.4.0 571 4/5/2023
0.3.2 22,821 2/27/2023
0.3.1 1,134 2/20/2023
0.3.0 805 2/16/2023
0.2.2 938 1/31/2023
0.2.1 773 1/31/2023
0.2.0 754 1/31/2023
0.1.0 961 1/25/2023