Repository navigation
v0.5.0
Zefir 0.5.0 adds nats: a Core NATS client written against std.Io.
nats
zefir-nats connects a Zig service to a NATS server: publish and subscribe, request and reply. It runs on any std.Io with real concurrency; zio is the runtime for services.
- Publish with headers and back-pressure; subscriptions with wildcards, queue groups, auto-unsubscribe and three overflow policies.
- Request and reply through one shared inbox subscription:
request,respond, andrequestManyfor scatter and gather. A request with no responders fails at once. - Bounded memory: every queue has a limit, and what does not fit waits for room or is dropped and counted.
- Reconnect with backoff, to the same server or to another one of the cluster, with the subscriptions and the inbox restored and a buffer for publishes; lame duck mode; a two-phase drain; events and statistics.
- Authentication: none, or a user and a password.
Not implemented yet: JetStream, TLS and mTLS, token, NKey and JWT authentication, WebSocket and the services API.
See the nats guide: a quick start in two programs, a sender and a receiver; every feature with a run against a real server; and the benchmark.
Other changes
- CI tests a pull request only on the modules it affects (#42).
- Documentation: the validator guide is in English, with an example for every rule (#39); log says it builds for 64-bit targets only (#41); the module list is grouped by area (#44).
zig fetch --save git+https://github.com/vkiryakov/zefir#v0.5.0const zefir = b.dependency("zefir", .{ .target = target, .optimize = optimize });
// in your module's .imports:
.{ .name = "nats", .module = zefir.module("zefir-nats") },The nats examples also need zio; the guide's Installation shows how to add it.
Until 1.0, breaking changes may happen in any minor release.