Skip to main content

Watch-ZrPrefix

Streams change notifications for every Zaris key under a prefix, emitting an event object for each change until cancelled or a limit is reached.

Syntax

Watch-ZrPrefix [-Prefix] <string> [-IncludeSnapshot] [-ConnectionString <string>] [-StoreName <string>] [-Endpoints <string[]>] [-TimeoutSec <int>]

Description

Watch-ZrPrefix subscribes to the connected Zaris store and continuously emits an event object for every change to any key beginning with the given prefix. It runs inline and blocks the pipeline, streaming until you press Ctrl+C (or the pipeline is otherwise cancelled); there is no built-in time or event-count limit. Specify -IncludeSnapshot to receive the current matching entries before live updates begin.

Values are deserialized automatically when possible; binary values that cannot be deserialized are returned as byte arrays. The cmdlet requires an active connection (Connect-ZrStore) or a one-shot independent connection supplied through -StoreName and -Endpoints.

Parameters

ParameterTypeRequiredDescription
-PrefixStringYesThe key prefix to watch for changes. Positional (position 0). Must not be null or empty.
-IncludeSnapshotSwitchParameterNoEmit the current matching entries as an initial snapshot before streaming live changes.
-ConnectionStringStringNoConnect via a Zaris connection string, e.g. zaris://host:7861/store; an alternative to -StoreName + -Endpoints for a one-shot connection. Ignored when a Connect-ZrStore session is active.
-StoreNameStringNoStore to operate on for a one-shot independent connection instead of the active Connect-ZrStore context. Belongs to the Independent parameter set; use together with -Endpoints.
-EndpointsString[]NoOne or more store node endpoints (host:port) for an independent connection. Only the first endpoint is used as the seed. Ignored when a Connect-ZrStore session is active.
-TimeoutSecInt32NoConnection timeout, in seconds, for an independent connection (used with -Endpoints). Range 1–120. Default 5. Does not limit how long the watch streams.

Each emitted event object has Event, Key, Revision, Value, and Timestamp.

Examples

Emit the current session: entries, then stream every subsequent change under that prefix until Ctrl+C:

Watch-ZrPrefix -Prefix "session:" -IncludeSnapshot

Stream live changes under a prefix (no initial snapshot) until Ctrl+C:

Watch-ZrPrefix -Prefix "config:"

Watch a namespace over a one-shot independent connection instead of the active session:

Watch-ZrPrefix -Prefix "orders:" -ConnectionString "zaris://10.0.0.11:7861/orders"