nats-io / nats.rs

Rust client for NATS, the cloud native messaging system.
Apache License 2.0
980 stars 159 forks source link

feat: implement `async_nats::client::Publisher` byte sink for sending multiple messages #1267

Open rvolosatovs opened 1 month ago

rvolosatovs commented 1 month ago

closes #1266

An example real-world use case for this looks like this following: https://github.com/rvolosatovs/wrpc/blob/85b043b84bd70fa2994cde8ced129d05b6739284/crates/transport-nats-next/src/lib.rs#L351-L412

This in an AsyncWrite implementation, which chunks bytes according to NATS payload limits and correctly handles polling and async wake up (using the Publisher introduced in this PR)

rvolosatovs commented 1 month ago

Test failure looks unrelated to the PR