Hi,
I am implementing a message exchange between C++ applications using Pulsar
technology.
To improve performances I would like to avoid copying my application data
when creating a new Pulsar::Message.
For this reason I would like to use
pulsar::MessageBuilder::setAllocatedContent().
However I’m in trouble currently because I don’t have a way to specify to
pulsar-client-cpp how to deallocate the buffer provided to
setAllocatedContent().

Moreover the current documentation is a bit unclear about this aspect:
  “The caller is responsible to ensure the memory buffer is valid until the
message has been persisted (or an error is returned).”
It’s not clear honestly when the message “has been persisted” in my opinion
given that the underlying PulsarMessageImpl is a refcounted data structure
and so it’s hard to tell when its refcount goes to zero (e.g. imagine some
Pulsar::Message being saved into some data structure for later use).

Would you accept a patch that expands the arguments of
pulsar::MessageBuilder::setAllocatedContent() by taking a deallocation
function pointer as well?

Thanks,
Marco

Reply via email to