Skip to main content

Configuration

A Clustron Zaris client is configured by one connection string. You keep that string in standard .NET configuration — the ConnectionStrings section of appsettings.json — and pick it by name, exactly as you would a SQL Server or any other database connection string. There is no separate mode setting and no seed list to maintain; the string carries everything.

Use configuration so you can manage store settings externally instead of hardcoding them. For example, you can run an in-process store during development and a remote cluster in production by shipping a different appsettings file with the same key.

Basic configuration

Define your stores under the standard ConnectionStrings section. Each store is one entry whose key is a name you choose and whose value is a Zaris connection string. The example below defines one store named default that connects to a remote cluster:

{
"ConnectionStrings": {
"default": "zaris://localhost:7861/default"
}
}

Connection string anatomy

Each store is described by one connection string that carries the transport, the hosts, the store name, and any security or timeout options.

Scheme and hosts

The scheme selects the transport: zaris:// for a plaintext connection or zariss:// for TLS. After it come one or more comma-separated host:port seeds:

zaris://10.0.0.11:7861,10.0.0.12:7861/default

You only need one valid seed. The client uses it to discover the rest of the nodes in the cluster. List more than one seed for resilience and failover, in case the first is unavailable. Each host is an endpoint in the form <Machine/IP>:<ClientPort>, where the port is the client port set with -BaseClientPort when the store was created.

For an in-process (embedded) store, use the reserved host inproc and no port — zaris://inproc/default. An in-process store runs in memory inside your process and cannot use TLS.

Store name and options

The path after the hosts is the store name (required); it must equal the cluster's id. Optional query parameters carry security and timeouts: ?token=env:VAR (or file:/path, or a literal), ?ca=/path/ca.pem, ?tlsInsecure=true (dev only), ?connectTimeoutMs=5000, and ?requestTimeoutMs=5000.

Register the configuration

Register every store from configuration with AddClustronZarisFromConnectionStrings. This reads the standard ConnectionStrings section and registers each Zaris entry you defined above. Non-Zaris entries, such as a SQL Server string, are ignored.

using Clustron.Zaris.Client.DependencyInjection;

services.AddClustronZarisFromConnectionStrings(configuration);

To register just one named entry instead, pass the configuration and the key:

services.AddClustronZaris(configuration, "default");

Get a client

Resolve a client by the name you defined in configuration. This returns a client for the default store:

var client = await services
.GetRequiredService<IZarisClientProvider>()
.GetAsync("default");

Define multiple stores

You can define any number of stores under ConnectionStrings, one entry per key — some remote, some in-process. This example defines a remote orders store and an in-process local store. Resolve each one by name with GetAsync.

{
"ConnectionStrings": {
"orders": "zaris://orders-node:7861/orders",
"local": "zaris://inproc/local"
}
}
services.AddClustronZarisFromConnectionStrings(configuration); // registers "orders" and "local"

var ordersClient = await provider.GetAsync("orders");
var localClient = await provider.GetAsync("local");

Configuration keeps store settings in one place, lets you switch between in-process and remote by editing a string, supports multiple stores, and works with standard .NET dependency injection.

Next steps