Skip to main content

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:

PathSubjectExample
Reliablejams.reliable.<MessageType>jams.reliable.EntryComplete
Transientjams.transient.<MessageType>jams.transient.JobChanged
SCOM alertsjams.event.<MachineName>.scomjams.event.JAMSPROD1.scom

Wildcard filters used by the JAMS services:

FilterUsed 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.

note

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_RELIABLEJAMS_SCOM
CarriesReliable Scheduler messagesAlerts for SCOM
Subjectsjams.reliable.>jams.event.<MachineName>.>
StorageFileFile
RetentionWork queueWork queue
Max size1 GiB1 GiB
Max ageNone7 days
When fullReject new messagesDiscard 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.

Work-queue retention allows one consumer per subject

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​

ConsumerStreamTypeCreated by
JAMS_SCHEDULERJAMS_RELIABLEDurable pull consumer, explicit acknowledgement, 24-hour ack waitThe JAMS Scheduler
JAMS_SCOM_READERJAMS_SCOMDurable pull consumerThe 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.

note

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.

AddEntryTagEntryActionEntryComplete
EntryStartedEntrySubmittedNamedTimeChanged
RemoveEntryTagRestoreRequestSaveRequest
SendDataRequestSetEntryElementStateSetEntryState
VariableChangedWaitRequestWorkflowStateChange
WorkflowTracking

Transient​

Core NATS, best-effort. These say something changed. The authoritative value is in the JAMS database either way.

AgentChangedAgentStateUpdatedAgentStateAndVersionUpdated
AgentVersionUpdatedCfgChangedEntryChanged
FolderChangedJobChangedQueueChanged
ReinitializeAgentsResourceChanged

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\JAMSPurgeHistory Job, which runs weekly and now includes the line JAMSDBA 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
If you have customized the JAMSPurgeHistory Job

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​

SettingDefaultPurpose
MessageInboxRetentionDays90How long a processed message's identity is remembered. Must outlast the longest redelivery you could see.
ReliableForwardMaxAgeDays90In 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.
Neither setting exists until you create it

The defaults are built into the product. To change one, add it first:

JAMSDBA ADD CONFIGURATION MessageInboxRetentionDays 120
JAMSDBA GET CONFIGURATION MessageInboxRetentionDays
warning

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 /connzWhich side
JAMS NATS SenderA JAMS service publishing messages
JAMS NATS ListenerThe 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.