All examples assume that you have the NATS server running on localhost and default TCP port 4222.
The examples cover only basic use cases, so for more details you can look into the tests.
- hello_nats.tcl - basic publishing and subscribing
- requests.tcl - sending requests and responding to them; using lambdas for callbacks
- logging.tcl - tracing public variables and customized logging using the
logger
package from Tcllib. - msg_headers.tcl - sending and receiving messages with headers; using
nats::msg
andnats::header
ensembles - js_msg.tcl - publishing and consuming messages from JetStream
- js_mgmt.tcl - JetStream asset management
- kv.tcl - Key-Value Store (basic usage)
- kv_mirror.tcl - advanced use of Key-Value Store connecting hub and leaf NATS nodes
Note that the repository as a whole is licensed under Apache 2.0, but the examples are released into the public domain, so you can just copy-paste them into your work.