Releases: Kazmirchuk/nats-tcl
Release v3.0
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 onordered_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 calleddisconnect
Warnings
metadata
is moved fromjet_stream
class tonats
namespaceconsume
is now deprecated - usefetch
instead
Plus many more unit tests (233 in total!), improved error handling, documentation and examples.
Release v2.0.3
This release introduces preliminary support for NATS Key-Value storage.
Summary of my changes since PR #23 :
Core NATS
- added
-trace
to the methodjet_stream
to log all JetStream requests similarly to--trace
in NATS CLI (remember to set-log_level
todebug
as well) - added new functions
nats::isotime_to_msec
andnats::msec_to_isotime
- basically working around limitations ofclock
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
tocreate_kv_bucket
Key-Value
- removed the
-timeout
option from methodshistory
andkeys
(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 thekv_watcher
object - removed
-idle_heartbeat
fromwatch
(might come back depending on how I implement #26 ) key
is now mandatory argument forwatch
. 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
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
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
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
andsubscribe
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 wrongPUB
when given an emptyreply
argument
Breaking changes compared to 1.0:
- Core NATS:
- removed the
logger
method (not needed anymore)
- removed the
- 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
- synchronous
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 fromconsume
; 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 dictstream_info
- the stream name argument is now mandatory
- removed
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
Fully functional Tcl NATS client with JetStream support
First release
Finished most functionality that one can expect from a NATS client. Waiting for feedback about API before freezing it in v1.0.