NATS Streams and Subjects Reference
This page is a reference for anyone inspecting JAMS messaging with the NATS Admin CLI or the monitoring endpoint. You do not need any of it for normal operation. JAMS creates and maintains all of it.
Subjects
Every message goes to a subject built from a fixed prefix and the message type:
| Path | Subject | Example |
|---|---|---|
| Reliable | jams.reliable.<MessageType> | jams.reliable.EntryComplete |
| Transient | jams.transient.<MessageType> | jams.transient.JobChanged |
| SCOM alerts | jams.event.<MachineName>.scom | jams.event.JAMSPROD1.scom |
Wildcard filters used by the JAMS services:
| Filter | Used by |
|---|---|
jams.reliable.> | The JAMS_RELIABLE stream and the Scheduler's durable consumer |
jams.transient.> | The Scheduler's core NATS subscription |
jams.event.<MachineName>.> | The JAMS_SCOM stream |
Subjects are named after the message type, not the Job, Folder, or Agent involved, so depth cannot be broken out by Job. Depth is visible per stream and per consumer.
Streams
JAMS creates two JetStream streams. Both are created if absent when the services start. An existing stream whose settings differ from the current version is updated in place.
Streams and consumers are created only by the running JAMS services, not by the installer or a database step. If nats stream ls shows nothing, the relevant JAMS service has not started and connected successfully.
JAMS_RELIABLE | JAMS_SCOM | |
|---|---|---|
| Carries | Reliable Scheduler messages | Alerts for SCOM |
| Subjects | jams.reliable.> | jams.event.<MachineName>.> |
| Storage | File | File |
| Retention | Work queue | Work queue |
| Max size | 1 GiB | 1 GiB |
| Max age | None | 7 days |
| When full | Reject new messages | Discard the oldest messages |
Work queue retention means an acknowledged message is removed from the stream. The stream holds only unprocessed work, so on a healthy system both streams are close to empty.
The two "when full" behaviors differ on purpose. JAMS_RELIABLE rejects new messages so unprocessed work is never thrown away. The sender sees the error and retries. JAMS_SCOM discards its oldest entries and expires anything unread after seven days, so a management pack that has stopped collecting cannot make a JAMS operation fail.
You cannot attach a second consumer to jams.reliable.> to watch traffic. The attempt is rejected, and reading from the Scheduler's own consumer would take messages away from it. To look at messages safely, see Using the NATS Admin CLI.
Consumers
| Consumer | Stream | Type | Created by |
|---|---|---|---|
JAMS_SCHEDULER | JAMS_RELIABLE | Durable pull consumer, explicit acknowledgement, 24-hour ack wait | The JAMS Scheduler |
JAMS_SCOM_READER | JAMS_SCOM | Durable pull consumer | The JAMS SCOM management pack |
Transient messages have no consumer and no stream. They are an ordinary core NATS subscription on jams.transient.>, delivered to whoever is listening at that moment.
The Scheduler deletes and recreates the JAMS_SCHEDULER consumer whenever it starts listening: at service start, on each failover role change, and after any connection recovery. This makes anything left unacknowledged by a crash redeliver immediately instead of waiting out the 24-hour timeout. Seeing the consumer's counts reset is normal.
Message Types
Reliable
Stored in JAMS_RELIABLE. These change state and must not be lost.
AddEntryTag | EntryAction | EntryComplete |
EntryStarted | EntrySubmitted | NamedTimeChanged |
RemoveEntryTag | RestoreRequest | SaveRequest |
SendDataRequest | SetEntryElementState | SetEntryState |
VariableChanged | WaitRequest | WorkflowStateChange |
WorkflowTracking |
Transient
Core NATS, best-effort. These say something changed. The authoritative value is in the JAMS database either way.
AgentChanged | AgentStateUpdated | AgentStateAndVersionUpdated |
AgentVersionUpdated | CfgChanged | EntryChanged |
FolderChanged | JobChanged | QueueChanged |
ReinitializeAgents | ResourceChanged |
SCOM
SCOMAlert messages are published as JSON to jams.event.<MachineName>.scom. See SCOM Integration with NATS.
Message Format
Payloads are UTF-8 JSON. Every reliable message carries a MessageId, a GUID assigned once when it is first published. It is also sent as the NATS Nats-Msg-Id header.
Delivery Guarantees
Reliable messages are delivered at least once and processed exactly once.
JetStream guarantees the message is not lost. It is written to disk before the publish is acknowledged, and it is redelivered if the Scheduler does not acknowledge it. A redelivery after a crash, a restart, or a cross-node forward is normal.
JAMS handles duplicates on the receiving side. The Scheduler records each MessageId in the JAMS database in the same transaction as the message's effects, and acknowledges the message only after that transaction commits. A message that arrives twice is recognized and skipped, with a log entry:
Skipping ... which was already processed
Transient messages are best-effort. They are not stored and not redelivered. If nothing is listening when one is published, it is gone. This is the same guarantee these notifications had before.
Processed-Message Records in the JAMS Database
The duplicate check is backed by the SchedulerMessageInbox table: one narrow row per reliable message processed, holding the message ID, its type, and when it was processed.
Retention and Purging
Records are kept for 90 days by default. Two things remove them:
- The stock
\JAMS\JAMSPurgeHistoryJob, which runs weekly and now includes the lineJAMSDBA PURGE MESSAGEINBOX/LOG. The upgrade adds this line automatically. - The Scheduler itself, which prunes when it takes control.
You can also run it on demand:
JAMSDBA PURGE MESSAGEINBOX/LOG
The upgrade only appends the purge line to a Job whose source is unmodified. If you have edited \JAMS\JAMSPurgeHistory, add the line yourself. Without it you rely on the Scheduler's prune at activation, which on a system that rarely restarts may not run often enough.
Retention Settings
| Setting | Default | Purpose |
|---|---|---|
MessageInboxRetentionDays | 90 | How long a processed message's identity is remembered. Must outlast the longest redelivery you could see. |
ReliableForwardMaxAgeDays | 90 | In a failover pair, the oldest a queued message may be and still be forwarded to the active node. Older messages are logged and dropped. Capped at MessageInboxRetentionDays. |
The defaults are built into the product. To change one, add it first:
JAMSDBA ADD CONFIGURATION MessageInboxRetentionDays 120
JAMSDBA GET CONFIGURATION MessageInboxRetentionDays
Do not lower MessageInboxRetentionDays to save space without understanding the trade-off. A message redelivered after its record has been purged is no longer recognized as a duplicate and is processed a second time. The table is small. On all but the busiest systems, 90 days costs very little.
Client Connection Names
Name in /connz | Which side |
|---|---|
JAMS NATS Sender | A JAMS service publishing messages |
JAMS NATS Listener | The Scheduler consuming messages |
What NATS Does Not Do
- NATS is not clustered. Each machine runs a standalone server with its own store. A failover pair has two independent brokers. See NATS in a Failover Environment.
- NATS does not decide which node is active. That is the JAMS database.
- NATS does not hold your schedule. Losing the message store loses only messages not yet processed. The Scheduler rebuilds its schedule from the database on start.
- Messages are processed one at a time, in order, as they were under MSMQ.