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.