nats 0.5.2

A nats pubsub client for vibe.d


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

nats

A basic Nats client library for Dlang, built on vibe.d

Aims to allow high-performance zero copy message processing, and minimal GC allocation generated by the library itself in the "hot loop" (ie normal message receipt and processing).

For this reason, the NatsHandlers receive the Msg struct as a scope parameter, and currently all message processing is handled synchronously in the eventloop (main) thread, to avoid unnecessary copying of Msg structs onto the GC heap. This also matches with (my) typical deployment profile of small, single purpose processes with a single message processing thread, optimized for minimal latency message processing.

If necessary for blocking IO or more computate intensive tasks that might otherwise block the event/message processing loop, you can copy the data required from the Msg struct, and send it to a task(fibre) or another thread. See example in the query_responder in the test app (src/app.d).

Current features supported:

  • [x] Implement SUB api
  • [x] Implement PUB api
  • [x] Implement flush logic
  • [x] Implement request-response subscriptions
  • [x] Support proper connect options
  • [x] Support reconnect logic
  • [x] Support large messages
  • [x] Support distributed queues (subscriber groups)
  • [x] Disconnect/clean shutdown
  • [ ] Support Nats 2.0 Nkey-based authentication
  • [ ] Support HPUB/HMSG (Nats message headers)
  • [ ] ? Add support for Jetstream (perhaps belongs in a separate module from the basic client)
  • [ ] ? Support (de)serialisation protocols: msgpack, cerealed, none (passthru ubyte[])

For example usage, see the test app (src/app.d).

Authors:
  • kookman
Dependencies:
nbuff, vibe-inet, vibe-core, vibe-serialization
Versions:
0.6.0 2024-Oct-08
0.5.2 2024-Sep-16
0.5.1 2021-May-27
0.5.0 2021-May-27
0.4.1 2021-May-25
Show all 23 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 61 downloads total

Score:
0.7
Short URL:
nats.dub.pm