You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/05/08 04:53:20 UTC

[GitHub] [pulsar] BewareMyPower opened a new issue #6916: Send the same message without copying the internal payload?

BewareMyPower opened a new issue #6916:
URL: https://github.com/apache/pulsar/issues/6916


   I found that the same `Message` cannot be sent twice. If I want to retry sending the same message when failed with some reason, I need to call `send(T message)`, then new `Message` will be created and the internal payload will be copied.  If I send the same `Message` again by calling the deprecated `send(Message<T> message)`, an `InvalidMessageException` will be thrown because the message has been sent before.
   
   IMO, the overhead of copying the internal payload is unnecessary. Is there some way to reuse the same payload?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower edited a comment on issue #6916: Send the same message without copying the internal payload?

Posted by GitBox <gi...@apache.org>.
BewareMyPower edited a comment on issue #6916:
URL: https://github.com/apache/pulsar/issues/6916#issuecomment-626554022


   Well, with C++ client, I can use `MessageBuilder::setAllocatedContent` and maintain the payload string myself, eg. use `std::shared_ptr<std::string>`.
   
   With Java client, the internal payload won't be copied, the same byte array could be passed to `ByteBuffer.wrap` in `TypedMessageBuilder.value` method.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on issue #6916: Send the same message without copying the internal payload?

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on issue #6916:
URL: https://github.com/apache/pulsar/issues/6916#issuecomment-626554022


   Ok, with C++ client, I can use `MessageBuilder::setAllocatedContent` and maintain the payload string myself, eg. use `std::shared_ptr<std::string>`.
   
   With Java client, the internal payload won't be copied, the same byte array could be passed to `ByteBuffer.wrap` in `TypedMessageBuilder.value` method.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org