C# sdk 0.2

On our journey to release 1.0 of our .NET SDK, we will take many small steps and publish incremental 0.x packages.

0.2 is the first useful version of the Actyx .NET SDK. Get it on NuGet.
It comes with the bare minimum of event-related functions, to be executed against a running Actyx 2.x instance.


AppManifest manifest = new AppManifest()
{
    AppId = "com.example.dotnet-sdk-demo",
    DisplayName = "Actyx C# SDK Demo",
    Version = "1.0.0"
};

var actyx = await Actyx.Create(manifest, new ActyxOpts());


var q = new AutoCappedQuery() {
    Query = new Aql("FROM allEvents")
};
var allKnownEvents = await actyx.QueryAllKnown(q);

foreach (var axEvent in allKnownEvents.Events) {
    Console.WriteLine(axEvent.Payload);
}

var allKnownChunked = actyx.QueryAllKnownChunked(q, 1000);

// Native C# style:
await foreach (var axChunk in allKnownChunked.ToAsyncEnumerable()) {
    Console.WriteLine("Got chunk of size:" + axChunk.Events.Count);
}

// Observable style:
var subscription = actyx.QueryAllKnownChunked(new AutoCappedQuery(), 1000)
    .Subscribe(axChunk => Console.WriteLine("Got chunk of size:" + axChunk.Events.Count));

If you are trying it out, make sure to send us all sorts of feedback you have! (Simply post in this very thread.)

For version 0.2, we would be specifically interested in:

  • Do you like working with IObservable, or would you prefer a different representation for async streams?

  • Does the design of our data types feel idiomatic?

Stay tuned for version 0.3!
It will contain a system for typing your event payloads, similar to what is included in the TS SDK already.

Cheers!
- The Actyx C# task force

2 Likes

Watch me give a quick demo of how to use the SDK 0.2.2.