pub(crate) fn main() -> Result<(), LJMError>Expand description
Starts the streamer service, configuration watchers, and sampler supervisor.
Connects to local NATS, opens the configuration bucket, mirrors the central
configuration once if central sync is configured (a failure is logged and the
local value is used), loads the configuration, initializes LJM, and then spawns
run_sampler, watch_kv_config and, if configured, run_central_kv_sync.
It waits for the sampler to stop or for Ctrl+C, sets the shutdown flag, and gives
the tasks 300 ms to stop before returning.
ยงErrors
Returns an error if the local credentials cannot be loaded, NATS_SERVERS is
invalid, the local connection fails, the KV bucket cannot be opened or created,
the central server list is invalid, the configuration key is missing or invalid,
LJM initialization fails, the sampler task panics, or the Ctrl+C handler cannot
be installed. Stopping after repeated sampler failures is not an error.