Skip to main content

watch_kv_config

Function watch_kv_config 

Source
pub(crate) async fn watch_kv_config(
    store: Store,
    key: String,
    config_tx: Sender<SampleConfig>,
    shutdown_rx: Receiver<bool>,
)
Expand description

Watches local NATS KV for streamer configuration updates.

Parsed changes are sent through a watch channel so the active sampler can stop cleanly and restart with the new settings. A value is sent only when it differs from the last one in the channel. Non-Put operations, values that do not parse, and watch stream errors are logged and skipped. The task returns when the watch cannot be set up, the watch ends, or shutdown is signaled.

ยงArguments

  • store - Local KV bucket.
  • key - Configuration key to watch.
  • config_tx - Sender read by run_sampler and sample_with_config.
  • shutdown_rx - Shutdown flag shared with the rest of the process.