Elastic.Channels 0.3.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Elastic.Channels --version 0.3.0                
NuGet\Install-Package Elastic.Channels -Version 0.3.0                
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.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Elastic.Channels --version 0.3.0                
#r "nuget: Elastic.Channels, 0.3.0"                
#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.3.0

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

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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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,550 10/3/2024
0.7.2 90,621 9/18/2024
0.7.1 318 9/16/2024
0.7.0 405,195 4/10/2024
0.6.0 322 3/28/2024
0.5.7 14,338 2/13/2024
0.5.6 593 1/22/2024
0.5.5 583,621 7/12/2023
0.5.4 527 7/10/2023
0.5.3 549 7/5/2023
0.5.2 536 6/22/2023
0.5.1 537 5/4/2023
0.5.0 101,113 4/28/2023
0.4.3 577 4/17/2023
0.4.2 829 4/5/2023
0.4.1 557 4/5/2023
0.4.0 568 4/5/2023
0.3.2 22,705 2/27/2023
0.3.1 1,133 2/20/2023
0.3.0 804 2/16/2023
0.2.2 937 1/31/2023
0.2.1 772 1/31/2023
0.2.0 753 1/31/2023
0.1.0 960 1/25/2023