All notable changes to ankusa_nats will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased

0.7.0 - 2026-10-28

Added

  • :max_message_bytes (default 1 MiB, NATS's max_payload; DEL-5). A message over it is never sent: an inline body whose base64 would not fit is checked in and published as a claim, and a body over the limit by itself is {:permanent, {:message_too_large, size, max}} without a server call. Requires an ankusa release with the max_message_bytes sink callback; publish core first.
  • Sink.NATS: a hook of an ordered: true sink carries the lane's key as the ankusa_ordering_key header (consumer-side ordering, ADR 0004).

Changed

  • Requires gnat ~> 1.18. The sink hands :password, :token and :nkey_seed to gnat as zero-arity functions, so neither the Gnat connection nor its Gnat.ConnectionSupervisor holds them in the clear in its state, :sys.get_status/1 or a crash report.
  • A publish over the server's max_payload is {:error, {:permanent, :max_payload_exceeded}} and is dead-lettered at once. gnat 1.18 refuses it before sending; on 1.17 the server closed the connection, cutting off every publish in flight on it.
  • Requires ankusa ~> 0.7 (Ankusa.Sink.Messaging, Ankusa.Sink.Connections); publish core first.
  • Ankusa.Sink.NATS is built on core's Ankusa.Sink.Messaging and Ankusa.Sink.Connections. Same headers and values; ankusa_message_version now comes before ankusa_idempotency_key, the order Ankusa.Sink.Kafka sends. An entry of :servers without a port raises ArgumentError instead of MatchError.

0.6.0 - 2026-10-14

Added

  • :idle_timeout_ms (default 600_000, 0 never, at least :publish_timeout_ms plus 1 s): a connection with no delivery for that long is closed (Ankusa.Sink.Reaper, requires core's) and the next delivery opens a new one.
  • Every message carries the ankusa_idempotency_key header: the same tenant-scoped key as the message's idempotency_key (Ankusa.Envelope.idempotency_key/1), always present. Requires ankusa 0.5 or newer: the key comes from Ankusa.Envelope.idempotency_key/1, which 0.4.x does not have, so the Hex requirement is now ~> 0.5.
  • ankusa_dedupe_key and ankusa_replay_id headers when present.

Changed

  • Requires ankusa ~> 0.6 (Ankusa.Sink.Reaper); publish core first.
  • The connection is a Gnat.ConnectionSupervisor registered through the instance's registry: starting it returns at once and the handshake runs in that supervisor, so a slow or dead server no longer stalls the DynamicSupervisor (and every other delivery) behind it. It reconnects on its own with a 2 s backoff; deliver/3 returns {:error, :not_connected} meanwhile.
  • The connection supervisor's child spec holds the connection settings inside a closure, so :sys.get_status/1 of Ankusa.Sink.NATS.Supervisor, or a supervisor report, never prints a password, token or nkey seed.
  • Breaking: every publish sets Nats-Msg-Id to the hook id (id:replay:<replay_id> on a replay), so a stream's duplicate window drops a re-publish of the same delivery inside the window (0.4.0 set none).

0.4.0 - 2026-10-02

Added

  • Ankusa.Sink.NATS implements Ankusa.Sink.describe/2, advertising its servers and subject to the AsyncAPI document the admin API serves. :servers now also takes one comma-separated string, as the YAML key documents.

Changed

  • The Hex requirement on ankusa is ~> 0.4 (was ~> 0.2): describe/2 needs Ankusa.Sink.Description, which core has from 0.4.0.

Removed

  • The sink no longer implements the removed Ankusa.Sink.ordering_key/2 callback: deliveries are unordered. The subject still decides which stream order the message joins, so NATS/JetStream's own per-subject ordering is unchanged. Requires the matching ankusa core.

0.3.0 - 2026-10-01

No code changes. Released as 0.3.0 in step with ankusa 0.3.0 and the other packages in this release.

0.2.1 - 2026-09-28

Added

  • A sha256 field on a claim-checked message: the lowercase hex digest of the payload, for the reader to verify the bytes it redeems against. It used to live inside the claim ref.

Changed

  • The message claim field is urn:ankusa:claim:v1:<tenant>:<claim_id>: a tenant and a canonical (uppercase) ULID, where it used to carry the pack id, byte offset/length, and digest. The message v stays 1. Both come from Ankusa.Sink.Message in ankusa 0.2.1.

0.2.0 - 2026-09-27

Added

  • Ankusa.Sink.NATS: publishes delivered hooks to a NATS JetStream subject on a stream the operator owns (the sink never creates one). Delivery is acknowledged by JetStream's publish ack, not by the write to the socket.
  • Ankusa.Sink.ordering_key/2, implemented by this sink as the subject: the scope order is defined within ("the order the stream received it"). Dispatch serializes deliveries sharing it and runs different subjects concurrently.
  • Message format v1 (shared with ankusa_rabbitmq/ankusa_kafka), claim check integration for payloads over :inline_max_bytes (default 64 KiB), and the same five NATS headers the Kafka sink sets on a record.
  • Supervised, self-reconnecting gnat connection per {instance, connection}; deliver/3 returns {:error, :not_connected} while one is down, which the source's retry policy already handles.

Changed

  • The message claim field is now a claim-check ref URN string instead of a nested ticket object, breaking for consumers; the message v stays 1.