Skip to main content

Developer guide

The Concepts section explains what Nodus is and why it behaves as it does. This section is the task-focused counterpart: each page is a how-to for one job you do with the API, with C# you can copy.

If you have not run a cluster yet, start with Getting started — it forms a two-node cluster end to end. Every page here assumes you have a running INodusNode.

The handle you work with

Every task in this guide operates on the single INodusNode handle returned by the entry point. You build it once and hold it for the life of the process.

await using INodusNode node = await NodusNode
.Configure(config)
.WithNodeIdentity(self)
.WithServices(services)
.StartAsync();

Each capability area is a property on node: node.Cluster, node.Leadership, node.Messaging, node.Events, node.Health, and node.Gossip.

The how-tos

Each page below covers one capability area. Read Building a node first — the others build on the handle it produces.

PageTaskPrimary area
Building a nodeConfigure, build, start, and shut down a node.NodusNode, INodusNode
Sending messagesSend point-to-point and broadcast, typed and raw.node.Messaging
Request/replySend a request and await a typed reply, with timeouts and error handling.node.Messaging
Subscribing to eventsReact to cluster events and membership and leadership changes.node.Events, node.Cluster, node.Leadership
Health and membershipQuery who is alive and reachable, and react to topology changes.node.Health, node.Cluster

Container prerequisites

Nodus core services log through ILogger<T> and resolve an IHttpClientFactory. Register both in the container you hand to a node, on every page in this guide.

var services = new ServiceCollection();
services.AddLogging(b => b.AddConsole()); // core logs through ILogger<T>
services.AddHttpClient(); // core resolves IHttpClientFactory
Register logging and HTTP

If either registration is missing, startup fails resolving core dependencies. Building a node covers the container in detail.

Next steps