Skip to content

Releases: Kazmirchuk/nats-tcl

Release v3.0

23 Dec 16:31
Compare
Choose a tag to compare

The "near future" has finally come, so here is a new major release with full support for NATS Key/Value Store!

Including support for the newest features in NATS 2.10:

  • subject transforms
  • metadata in streams, consumers and KV buckets
  • stream compression
  • better alignment with JetStream Client API v2

Moreover: nats-tcl is the first among all NATS clients to support KV API v1.1 - the new way to build hub/leaf node deployments based on subject transforms.

New features

Core NATS

  • support for creating a named connection object using TclOO create
  • new cget option -status to get the current connection status
  • new configure option -request_timeout - 10s by default
  • new jet_stream option -api_prefix
  • automatic "garbage collection" of TclOO objects after destroying the "parent" connection object
  • new proc mymethod

JetStream

  • support for ordered consumers per ADR-15 and ADR-17 #26
  • new add_stream options: -mirror, -sources #25 , -mirror_direct, -republish
  • new method stream_direct_get #24
  • new methods account_info, api_prefix, timeout, update_stream, update_consumer
  • new procs: make_stream_source, make_subject_transform, make_republish

Key/Value

  • improved implementation of kv_watcher based on ordered_consumer
  • KV buckets use "Direct Get" under the hood
  • new methods create_kv_aggregate, create_kv_mirror
  • new proc make_kv_origin
  • new watch options -idle_heartbeat and -updates_only

Bugfixes

  • fixed the message headers parser that would fail if a header value contained a colon, or the "Description" header contained a space
  • fix a bug with sync requests that do not return at all, if a user calls disconnect
  • fix a bug when buffered PUBs are not flushed after reconnecting, if there are no SUBs to restore
  • fixed a bug in CloseSocket : don't try to flush the socket while we're reconnecting, and user called disconnect

Warnings

  • metadata is moved from jet_stream class to nats namespace
  • consume is now deprecated - use fetch instead

Plus many more unit tests (233 in total!), improved error handling, documentation and examples.

Release v2.0.3

26 Sep 10:54
Compare
Choose a tag to compare
Release v2.0.3 Pre-release
Pre-release

This release introduces preliminary support for NATS Key-Value storage.

Summary of my changes since PR #23 :
Core NATS

  • added -trace to the method jet_stream to log all JetStream requests similarly to --trace in NATS CLI (remember to set -log_level to debug as well)
  • added new functions nats::isotime_to_msec and nats::msec_to_isotime - basically working around limitations of clock that doesn't work with milliseconds

JetStream

  • added a convenience method empty_kv_bucket to delete all messages in a bucket without deleting the bucket itself
  • added -description to create_kv_bucket

Key-Value

  • removed the -timeout option from methods history and keys (but I'll add a test checking what happens in case of disconnection)
  • content of the bucket status dict is now documented in KvAPI
  • removed unwatch - to stop watching, just destroy the kv_watcher object
  • removed -idle_heartbeat from watch (might come back depending on how I implement #26 )
  • key is now mandatory argument for watch. Use ">" to watch all keys

Note that this release is not production-ready, and is intended only for development. Once the open issues are solved, a proper v2.1 will be released in the near future.

Release v2.0.2

17 Jul 08:44
Compare
Choose a tag to compare

Fixed bugs:

  • on Windows, if the TCP connection is lost, it may throw the "POSIX ECONNRESET" error that is not handled by the package, resulting in immediate transition of the client to the "closed" state. This is now fixed, and the reconnection mechanism works as expected.

Release v2.0.1

08 Mar 16:04
Compare
Choose a tag to compare

A hotfix for a bug described in this PR

When NATS closes the connection, the client may read and try to process an incomplete line, producing unexpected error logs. This is now fixed.

Release v2.0

05 Mar 12:53
Compare
Choose a tag to compare

I'm very happy to announce the 2.0 release after 1,5 years of work! Better support for JetStream was the main focus, and also core NATS functionality has received many improvements.

Here is a summary of most important changes compared to 1.0.

New features:

  • JetStream:

    • asset management (creating/querying/deleting streams and consumers; loading configuration from JSON)
    • directly get/delete a message
    • all types of message acknowledgments
    • access to message metadata
    • removed a limitation in the synchronous version of consume that could fetch only one message at a time
  • Core NATS:

    • ensemble commands that encapsulate work with messages and headers
    • more useful error reporting in many cases
    • publish and subscribe can be called, while a connection is still being established
    • new option -utf8_convert to convert Tcl strings to UTF-8 when sending a message and convert from UTF-8 to Tcl strings when receiving a message
    • refactor the implementation for clean separation of old-style and new-style requests
    • when a connection is lost, pending requests are marked as timed out
    • improved logging
    • reduced number of imports from Tcllib

Also:

  • better, more extensive API documentation that is now split into 2 pages for readability
  • examples
  • refactored test framework and more unit tests (140+ in total)
  • the package is now available as a Tcl module (single *.tm file)

Fixed bugs:

  • consume is much more stable, also in case of disconnections
  • proper handling of DNS resolution failure
  • fixed the publish method that formatted a wrong PUB when given an empty reply argument

Breaking changes compared to 1.0:

  • Core NATS:
    • removed the logger method (not needed anymore)
  • JetStream:
    • synchronous consume now always returns a list of messages even with -batch_size=1
    • every call to jet_stream method now returns a new JS object, so remember to destroy it when no longer needed

For the rest, your code should keep working as-is. However, if you have code that accesses messages and headers as dicts, I recommend to rewrite it using the new ensemble commands nats::msg and nats::header for much better readability.
Therefore, -header option in publish is deprecated.

Other breaking changes compared to the master branch as of September 2022:

  • Core NATS:
    • -check_connection is not needed anymore
  • JetStream:
    • removed -idle_heartbeat, -no_wait and -custom_reqID options from consume; using -expires is supported but not recommended
    • removed -callback from all JetStream asset management calls; they are only synchronous now
    • stream_names returns a proper list of stream names instead of a dict
    • stream_info - the stream name argument is now mandatory

I hope this library will be useful for the Tcl community. And I am curious about the projects where it is used. Feel free to share in the discussion forum.

Release v1.0

29 Sep 14:01
Compare
Choose a tag to compare

Fully functional Tcl NATS client with JetStream support

First release

21 Jun 18:27
Compare
Choose a tag to compare

Finished most functionality that one can expect from a NATS client. Waiting for feedback about API before freezing it in v1.0.