Changelog

View Source

1.15

  • PullConsumer now requests an idle_heartbeat (defaults to half of :request_expires, i.e. 2.5s) from the server on every long-poll pull request and runs a local watchdog. If no traffic (data, status, or 100 heartbeat) is observed within 2 * idle_heartbeat, the consumer assumes its pull request was lost (e.g. dropped during a JetStream leadership change without killing the TCP connection) and forces a reconnect. Configurable via the :idle_heartbeat and :heartbeat_check_interval options.
  • PullConsumer emits a new telemetry event [:gnat, :jetstream, :pull_consumer, :heartbeat_expired] when the watchdog fires. Measurements: %{gap_ms, threshold_ms}. Metadata: %{module, stream_name, consumer_name, connection_name}.

1.14

  • Add PullConsumer.handle_connected/2 optional callback to get consumer info
  • Add PullConsumer.handle_status/2 optional callback to observe status messages
  • Added support for batch_size option in PullConsumer options to pull messages and acknowledge them in batches.
  • Add Gnat.Jetstream.API.KV.Entry with from_message/2 for parsing a raw NATS message from a KV bucket's underlying stream into a structured entry (operation, key, value, revision, created, delta). Intended to be shared between the built-in KV.Watcher and user-supplied PullConsumer implementations (e.g. caches that need to detect when they are caught up with the stream). Returns :ignore for messages that are not KV records.
  • KV.Watcher now uses KV.Entry internally; its public callback API is unchanged. The push consumer it creates now enables server-driven flow control and a 5s idle heartbeat (matching nats.go's ordered-consumer defaults), so slow handlers apply backpressure instead of being dropped as slow consumers.
  • Behavior change (bugfix): PullConsumer no longer forwards JetStream informational status messages (e.g. 100 idle heartbeat, 409 leadership change) to c:handle_message/2. These are not stream records and cannot be acked. In single-message mode the consumer now drops them and re-issues a pull request.
  • Add an optional c:handle_status/2 callback to Gnat.Jetstream.PullConsumer for users who want to observe status messages (e.g. log on 409).

1.11

  • Allow clients to force authentication without server auth_required by @mmmries in #205
  • Support ephemeral consumers and auto-cleanup consumers in the PullConsumer module by @mmmries in #202
  • Implement regularly scheduled PING/PONG health check by @mmmries in #200
  • Add Erlang 28 with Elixir 1.18 to the build matrix by @davydog187 in #201
  • Use Pager module for KV.contents by @mmmries in #198
  • Hint :timeout option in KV's typespec by @rixmann in #193

1.10

  • Clarify authentication setup during test by @davydog187 in #187
  • Test on Elixir 1.18 and NATS 2.10.24 by @davydog187 in #188
  • Gnat.Jetstream.API.KV.info/3 by @davydog187 in #189
  • Remove function_exported? check for Keyword.validate!/2 by @davydog187 in #186
  • Tiny optimization to KV.list_buckets/1 by @davydog187 in #185
  • make KV-watcher emit :key_added events when the message has a header by @rixmann in #191
  • add :compression to stream attributes by @rixmann in #192
  • fix: unknown field domain in Stream.create (#194) by @c0deaddict
  • feat: add jetstream message metadata helper (#197) by @c0deaddict
  • fix: deliver policy (#196) by @c0deaddict

1.9

  • Housecleaning by @mmmries in #176
    • switch to charlist sigils
    • update to newest nkeys
    • require elixir 1.14 and erlang 25+
  • Fix incorrect useage of charlist by @davydog187 in #179
  • Soft deprecate is_kv_bucket_stream?/1 in favor of kv_bucket_stream?/1 by @davydog187 in #183
  • Clean up examples in KV by @davydog187 in #181
  • Document options for Gnat.Jetstream.API.KV by @davydog187 in #180

1.8

1.7

1.6

1.5

1.4

1.3

1.2

1.1

1.0

0.7.0

0.6.0

  • Dropped support for Erlang < 19 and Elixir <= 1.5
  • Added Telemetry to the project (thanks @rubysolo)
  • Switched to nimble_parsec for parsing
    • Updated benchmarking/performance information. We can now do 170k requests per second on a 16-core server.
  • Fixed a bug around re-subscribing for the ConsumerSupervisor
  • Pass sid when delivering message (thanks @entone)
  • Documentation fixes from @deini and @johannestroeger

0.5.0

  • Dropped support for Elixir 1.4 and OTP 18 releases. You will need to use Elixir 1.5+ and OTP 19+.
  • Switched to running our tests against gnatsd 1.3.0