ores.nats

Table of Contents

1. Diagram

ores.nats component diagram

Figure 1: ores.nats

2. Summary

ores.nats is the NATS messaging transport library for ORE Studio. It provides the three messaging patterns used across all services: synchronous request/reply, queue-group subscribe for load-balanced handlers, and JetStream for durable event streams. Every message body is serialised by wire_codec in the format the process resolved at startup, msgpack unless ORES_NATS_WIRE_FORMAT says otherwise, so the format is decided once and never renegotiated per message. Subject names follow the convention {domain}.v1.{entity}.{operation}, with an optional prefix for multi-instance deployments. The library is a direct dependency of every domain service.

3. Inputs

  • NATS server URL and optional subject prefix from configuration.
  • Encoded request messages from clients or other services, with a bearer token where the caller authenticated.
  • JetStream stream configuration for durable event streams.

4. Outputs

  • Encoded reply messages sent to the caller's reply subject.
  • Queue-group subscriptions delivering messages to exactly one handler instance.
  • JetStream published messages and consumer acknowledgements.

5. Entry points

  • include/ores.nats/service/client.hpp — connection, publish, subscribe and JetStream publish, the surface every caller uses.
  • include/ores.nats/service/jetstream_admin.hpp — stream provisioning.
  • include/ores.nats/service/subscription.hpp — queue-group subscribe.
  • include/ores.nats/service/jwks.hpp — the IAM public-key fetch the service runner uses to verify tokens.
  • include/ores.nats/domain/message.hpp — NATS message and correlation types.
  • include/ores.nats/domain/wire_codec.hpp — the encoder every caller writes through.
  • include/ores.nats/config/ — nats_options and CLI argument parsing.

6. Dependencies

  • nats.c — C NATS client library.
  • rfl — JSON and msgpack serialisation for message payloads.
  • ores.logging — structured logging.

7. See also

  • NATS — the upstream messaging technology: subjects, wildcards, queue groups, JetStream, NKey/JWT security.
  • ORE Studio Messaging Reference — index of every service's subject namespace and links to per-service messaging references.

Emacs 29.3 (Org mode 9.6.15)