Skip to main content

Test-ZrConnection

Probes a Zaris store to confirm reachability, reporting whether the connection succeeded along with the server item count and elapsed time. It never throws on failure — the outcome is returned in the output object.

Syntax

Test-ZrConnection [-ConnectionString <string>] [-StoreName <string>] [-Endpoints <string[]>] [-TimeoutSec <int>]

Description

Test-ZrConnection opens a short-lived connection and probes the store. It uses the active Connect-ZrStore context when one exists; otherwise it uses the -StoreName and -Endpoints supplied on this cmdlet. The probe is non-mutating (it reads the server item count) and safe to run against production.

On failure the command does not raise a terminating error; instead it returns an object with Connected = false and the error message.

The returned object has StoreName, Connected, ServerCount (the server-reported item count), DurationMs, and TimestampUtc; on failure it also includes Error.

Parameters

ParameterTypeRequiredDescription
-ConnectionStringStringNoConnect via a Zaris connection string, e.g. zaris://host:7861/store; an alternative to -StoreName + -Endpoints. Ignored when a Connect-ZrStore session is active.
-StoreNameStringNoThe store to test. Required when no active connection exists; ignored when a Connect-ZrStore session is active.
-EndpointsString[]NoOne or more host:port seed endpoints. Required when no active connection exists; only the first is used. Ignored when a session is active.
-TimeoutSecInt32NoTimeout in seconds before the probe is abandoned. Range 1–120. Default 5.

Examples

Test the active session connection:

Test-ZrConnection

Probe a store directly, without a session connection:

Test-ZrConnection -ConnectionString "zaris://10.0.0.5:7861/OrdersStore"

Probe with a custom timeout:

Test-ZrConnection -ConnectionString "zaris://10.0.0.5:7861/OrdersStore" -TimeoutSec 15