Skip to main content

Module subjects

Module subjects 

Source
Expand description

NATS subject builders for LabJack live data and archive exports.

The streamer publishes each channelโ€™s scans on a live subject, the archiver consumes the same subjects from local JetStream and writes Parquet, and the exporter listens on an export request subject. All of them build their subject names here so the layouts stay in one place.

Two layouts are supported:

  • Legacy, keyed by asset number: avenabox.<asset>.data.chNN, for example avenabox.1456.data.ch11. The root is used exactly as configured.
  • Structured, keyed by identity: avenars.<site>.<box>.<source>.live.chNN, for example avenars.i69.i69-mu1.i69-lj2.live.ch11. Every token is passed through sanitize_token.

The structured layout is chosen when the root is avenars or any of site, box or source ID is set (see uses_structured_namespace).

Functionsยง

archive_export_request_subject
Builds the NATS request subject that the exporter serves archive exports on.
live_labjack_channel_subject
Builds the live-data subject for one LabJack channel.
live_labjack_stream_subject
Builds the JetStream subject wildcard for all live channels from one source.
pad_asset
Formats an asset number with the three-digit legacy subject width.
pad_channel
Formats a LabJack channel number as the chNN token used in subjects.
present ๐Ÿ”’
Treats an empty identity field the same as a missing one.
sanitize_token ๐Ÿ”’
Converts arbitrary identity text into a single NATS subject token.
source_token ๐Ÿ”’
Picks the source token shared by every structured subject.
stream_subject_is_compatible
Checks whether an existing stream subject is compatible with a desired one.
uses_structured_namespace ๐Ÿ”’
Decides whether a config should use the structured subject namespace.