ZeroEventHubClient 1.0.3

dotnet add package ZeroEventHubClient --version 1.0.3                
NuGet\Install-Package ZeroEventHubClient -Version 1.0.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="ZeroEventHubClient" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ZeroEventHubClient --version 1.0.3                
#r "nuget: ZeroEventHubClient, 1.0.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 ZeroEventHubClient as a Cake Addin
#addin nuget:?package=ZeroEventHubClient&version=1.0.3

// Install ZeroEventHubClient as a Cake Tool
#tool nuget:?package=ZeroEventHubClient&version=1.0.3                

ZeroEventHub

NuGet version (ZeroEventHubClient)

This repository contains information specific to the dotnet port of the ZeroEventHub. Please see the main repository for an overview of what this project is about.

Client

We recommend that you store the latest checkpoint/cursor for each partition in the client's database. Example of simple single-partition consumption. Note about the example:

  • Things starting with "my" is supplied by you
  • Things starting with "their" is supplied by the service you connect to
// Step 1: Setup
const int TheirPartitionCount = 1; //documented contract with server
var requestCallback = new Func<HttpRequestMessage, Task>(message =>
{
    // you can setup the authentication on the request
});
var client = new Client(TheirServerUrl, TheirPartitionCount, requestCallback);

// Step 2: Load the cursors from last time we ran
var cursors = GetMyCursorFromDb();
if (!cursor.Any()){
    // we have never run before, so we can get all events with Cursor.First(0)
    // (if we just want to receive new events from now, we would use Cursor.Last(0))
    cursors = new[] { Cursor.First(0) };
}

// Step 3: Enter listening loop...
while (ShouldContinue)
{
    // Step 4: Use ZeroEventHub client to fetch the next page of events.
    var eventReceiver = new EventReceiver<MyDataType>();
    await client.FetchEvents(cursors, MyPageHint, eventReceiver);

    // Step 5: Write the effect of changes to our own database and the updated
    //         cursor value in the same transaction.
    using var transactionScope = new TransactionScope();
    MyWriteEffectOfEventsToDb(eventReceiver.Events);

    cursors = eventReceiver.LatestCheckpoints;
    MyWriteCursorsToDb(cursors);
}

Development

To run the test suite, assuming you already have dotnet 6 installed and added to your PATH:

dotnet restore
dotnet test

To pass the CI checks, you may need to run the following before pushing your changes:

dotnet format
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 17,683 7/6/2023
1.0.2 239 7/5/2023
1.0.1 7,189 2/16/2023