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/09/01 04:12:43 UTC

[GitHub] [pulsar] BewareMyPower commented on issue #7945: How to send a c++ struct using schema in producer ?

BewareMyPower commented on issue #7945:
URL: https://github.com/apache/pulsar/issues/7945#issuecomment-684187324


   There're 2 ways to create a `Message` with C++ client
   
   ```c++
       /**
        * Set content of the message. The message contents will be managed by the system.
        */
       MessageBuilder& setContent(const void* data, size_t size);
       MessageBuilder& setContent(const std::string& data);
   
       /**
        * Set content of the message to a buffer already allocated by the caller. No copies of
        * this buffer will be made. The caller is responsible to ensure the memory buffer is
        * valid until the message has been persisted (or an error is returned).
        */
       MessageBuilder& setAllocatedContent(void* data, size_t size);
   ```
   
   - data: the pointer to your struct
   - size: the struct's size


----------------------------------------------------------------
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