- 
                Notifications
    You must be signed in to change notification settings 
- Fork 99
Open
Description
I am setting the Kafka headers as follows in the publisher record
   ```
  string app_name = AppInfo::app_info().app_name();
     string host_name = IPAddress::our_host_name();
    record->headers() = {{
        kafka::Header{kafka::Header::Key{"Source"},  kafka::Header::Value{app_name.c_str(), app_name.size()}},
        kafka::Header{kafka::Header::Key{"Host"}, kafka::Header::Value{host_name.c_str(), host_name.size()}}
    }};
When I try to print them in the consumer as follows as string they seem be clobbered
   const string Headers() const 
    { 
        std::ostringstream outs;
        KAFKA_API::Headers headers = _consumer_record.headers();
        std::for_each(headers.cbegin(), headers.cend(),
              [&outs](const auto& header) 
              {
                  outs << ((outs.str().length() == 0) ? "" : ",") << header.key << "=" << std::string((const char *)header.value.data(),header.value.size());
              });
        return outs.str(); 
    }
Output of Headers
` Headers [Source=^@^@^@^@^@^@^@^@Ð^H^@ð^F^?^@^@her,Host=^@^@^@^@^@^@^@^@Ð^H^@ð^F^?^@^@group.com]`
Any ideas what I am doing wrong ?
Metadata
Metadata
Assignees
Labels
No labels