Skip to content

v2.27.0

Choose a tag to compare

@bpacholek bpacholek released this 14 Oct 08:26
· 41 commits to main since this release

Minor release.

Added

A subscription-limit failure is now a SubscriptionLimitException, a new final subclass of ConnectionException (#242).

The server answers a SUB beyond the connection's limit with -ERR 'maximum subscriptions exceeded'. The client used to report that, and the errors it builds for a reply inbox the -ERR dropped, as a plain ConnectionException. A caller could tell the limit apart only by matching the message. The client now builds the typed error in every place it built a limit error:

  • the read that meets the -ERR, whether it throws it or hands it to the error listener (the heartbeat, a reconnect's replay and the other reporting reads);
  • a request whose shared reply inbox was dropped for it;
  • a pull fetch or batched Direct Get whose reply inbox was dropped for it;
  • a guarded subscribe whose replayed SUB the new server rejected for it.

The type tells the reason, not the connection's state. The server sends the same -ERR when it refuses a SUB and keeps the connection open, and when an account's limit is lowered and it closes the connection about 20 ms later.

Who should upgrade: anyone who handles the subscription limit, such as symfony-nats-messenger, whose next release turns it into Symfony's TransportException (ideaconnect/symfony-nats-messenger#76).

Before upgrading

  • Existing handlers still catch it. Every catch (ConnectionException) and catch (NatsThrowable) matches, and the messages are unchanged. Only code that compares the exact class name sees the difference.
  • A pull consumer run still fails with a JetStreamException. When the subscribe reported the rejection, the typed error is its previous one.
  • Other server errors keep the plain class, a permissions violation and a fatal -ERR included.

Quality gates

  • PHPStan level 8.
  • 3659 unit tests (with data sets) on PHP 8.2 to 8.5, 159 live integration tests and 49 Behat scenarios. All runnable examples pass.
  • codecov/patch 100%: every changed line is covered. Total coverage 98.98%.
  • Infection covered MSI 92.86% (90% floor enforced in CI). It skipped 4941 of the 8863 mutants it generated as too slow, so the score does not include them. No mutant escaped in the changed lines.
  • New SubscriptionLimitExceptionTest, 6 cases. 3 of them fail on 2.26.8; the other 3 are guards.
  • JetStreamInboxRejectionTest and MuxInboxRejectionTest now assert the type of every limit error they produce. 24 of their cases fail on 2.26.8's source.
  • symfony-nats-messenger's unit suite, mutation gate and functional suite pass against this release, as does a live check on nats-server 2.12.15 at max_subscriptions 1 and 2.

The full record is in the CHANGELOG.