nats 0.5.1

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, to avoid unnecessary copying of Msg structs on the GC heap. This also matches with (my) typical deployment profile of small, single purpose processes with a single message processing thread.

If necessary for blocking IO or longer computations, you can copy the data required from the Msg struct, and send to a task(fibre) or another thread. See example in the query_responder of the test app.

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 (requires libsodium for ed25519 keys)
  • [ ] ? Support (de)serialisation protocols: msgpack, cerealed, none (passthru ubyte[])

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

Authors:
  • kookman
Dependencies:
vibe-d:inet, vibe-d:data, vibe-d:core, nbuff
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