Open cody-greene opened 9 months ago
is there something built in to the spec for batch publishing?
There are some aspects. Transaction-mode exists, but it's mutually exclusive with publisher confirms so I don't recommend it. A single BasicAck from the exchange can (theoretically) confirm multiple messages from the client so just sending everything as fast as possible seems to be the way to go.
Also thinking about this more, the WritableStream interface does not seem a good match for this library. Node streams are fragile (a single error results in a closed stream) but this is designed around recovery, retrying, etc. I think the best option is pub.sendAll(messages)
In certain cases I'd like to rapidly publish a lot of messages at once, with confirms enabled. Currently this means collecting a bunch of promises and using
Promise.all(...)
. It would be nice if I had a API conforming to the node WritableStream interface (where too many unconfirmed messages creates back-pressure), or maybe just asendAll(messages)
method.