Skip to content

v2.1.0 — NATS 2.11/2.12 client feature support

Choose a tag to compare

@bpacholek bpacholek released this 10 Jun 19:21
· 503 commits to main since this release

NATS 2.11 / 2.12 client feature support. A minor, backward-compatible release (new optional parameters and new methods only); the single behavior change is bug-driven. Implements the roadmap milestone (issues #4–#11, #13), hardened by an adversarial multi-agent review.

✨ New features

  • Per-message & KV TTL (Nats-TTL, ADR-43, #4) — publish(..., ttl:), KeyValueBucket::put(..., ttl:), and tombstone TTL on delete()/purge(). New MessageTtl formatter (seconds / Go duration / never).
  • Publish de-duplication (Nats-Msg-Id, #11) — publish(..., msgId:); publish() also takes a generic headers array.
  • Recurring & cron scheduled publishing (ADR-51, #6) — @every, 6-field cron, and the predefined aliases (@daily, @hourly, …); @at now accepts RFC3339 numeric offsets. Schedule::every()/cron()/predefined(); optional Nats-Schedule-Source/-Time-Zone/-Rollup headers.
  • Distributed counter CRDT (AllowMsgCounter/Nats-Incr, ADR-49, #9) — incrementCounter() / counterValue(), arbitrary-precision (string) safe.
  • Multi-subject consumer filters (filter_subjects, #10) — validated, mutually exclusive with the singular filter.
  • Atomic batch publish (AllowAtomicPublish, ADR-50, #8) — JetStreamContext::batch() → BatchPublisher (Nats-Batch-Id/-Sequence/-Commit; start sent as a request so a rejected batch aborts early; capped at 1000).
  • Pull priority groups + richer pull options (ADR-42, #7) — fetchBatch()/fetchNext() pull options (group/min_pending/min_ack_pending/priority/max_bytes/no_wait); PullConsumerIterator setters with Nats-Pin-Id capture and 423 re-pin; new unpinConsumer() / pinIdOf().
  • Batched / multi Direct Get (ADR-31, #13) — directGetBatch() / directGetLastForSubjects().

🐛 Behavior change (bug-driven)

  • Subject delete-markers (Nats-Marker-Reason, ADR-43, #5) — KV get()/getAll()/watch() and Object Store watch()/info() now treat a server-written delete-marker as a tombstone instead of surfacing it as a live empty value. Flagged [bugfix] (so it does not force a major bump); only reachable when a stream has subject_delete_marker_ttl set. See the migration note in the CHANGELOG.

✅ Quality

  • PHPStan level 8 clean; 490 unit tests passing.
  • Adversarially reviewed (9 reviewers + per-finding verification, 32 agents): 17 confirmed findings fixed, including a real ADR-50 batch-start protocol fix and several de-tautologized tests.

⚠️ Pending live verification

Atomic batch publish (#8) and batched Direct Get (#13) are unit-tested at the wire level but not yet verified against a live NATS 2.11/2.12 server.

Full changelog: https://github.com/ideaconnect/php-nats-jetstream-client/blob/main/CHANGELOG.md