Skip to content

Latest commit

 

History

History

examples

Examples

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.

  1. hello_nats.tcl - basic publishing and subscribing
  2. requests.tcl - sending requests and responding to them; using lambdas for callbacks
  3. logging.tcl - tracing public variables and customized logging using the logger package from Tcllib.
  4. msg_headers.tcl - sending and receiving messages with headers; using nats::msg and nats::header ensembles
  5. js_msg.tcl - publishing and consuming messages from JetStream
  6. js_mgmt.tcl - JetStream asset management
  7. kv.tcl - Key-Value Store (basic usage)
  8. 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.