nats-client

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT

README

nats-client

A Go package for connecting to and interacting with a NATS server.

release codecov license build powered by conventional commits nats built with just gitHub commit activity go reference

One client, connection and JetStream together.

Connection management, JetStream, KV buckets and consumers behind one client and one constructor. Three authentication modes, and create-or-update helpers so setup is idempotent.

Install

go get github.com/osapi-io/nats-client

Features

See the client docs for quick start, authentication, and per-feature reference.

Feature Description Docs Source
Connection management Connect to NATS with configurable options and auth modes docs connect.go
JetStream Create and manage JetStream streams docs jetstream.go
Key-Value stores CRUD operations on NATS KV buckets docs kv.go
KV-backed streams KV storage with stream notifications docs kv_stream.go
Consumer helpers JetStream consumer message processing docs consumer.go
Object Store Large blob storage with automatic chunking docs objectstore.go

Examples

Each example is a standalone Go program you can read and run.

Example What it shows
auth-none-stream Stream publish/subscribe without authentication
auth-none-kv KV store operations without authentication
auth-user-pass-stream Stream with username/password authentication
auth-nkeys-stream Stream with NKey authentication
workqueue-stream Work queue pattern with consumer groups

Documentation

Contributing

See the Contributing guide for prerequisites, setup, conventions, and the PR workflow.

License

The MIT License.

Directories

Path Synopsis
pkg
client
Package client provides a NATS JetStream client with connection management, KV stores, KV-backed streams, and consumer helpers.
Package client provides a NATS JetStream client with connection management, KV stores, KV-backed streams, and consumer helpers.
client/mocks
Package mocks provides generated mock implementations for testing.
Package mocks provides generated mock implementations for testing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL