-
Notifications
You must be signed in to change notification settings - Fork 882
Description
In high performance scenarios, it's not uncommon to serialize a payload into e.g. a pooled memory buffer.
However, since the size of shared buffers very rarely align with the actual payload size, it's unusually not feasible get get a hold of the serialized segment as a proper array. Instead, the serialized data is then commonly accessible through ReadOnlyMemory/ReadOnlySpan.
At the moment, there looks to be no way to directly produce a kafka message from such a buffer. Best we can do is to create an IProduer<byte[], byte[]>, which then means having to wastefully copy the buffer into a new array.
It would be very ueful if IProducer offered some Produce method that takes in a ReadOnlySpan for such scenarios. Naturally that would then implement sidestepping the producers configured serialisers, and writing raw data straight to librdkafka.