[ 
https://issues.apache.org/jira/browse/MINIFICPP-427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16524540#comment-16524540
 ] 

ASF GitHub Bot commented on MINIFICPP-427:
------------------------------------------

Github user dtrodrigues commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/360#discussion_r198360594
  
    --- Diff: extensions/librdkafka/PublishKafka.h ---
    @@ -115,14 +121,35 @@ class PublishKafka: public core::Processor {
           buffer.reserve(max_seg_size_);
           read_size_ = 0;
           status_ = 0;
    +      rd_kafka_resp_err_t err;
    +
    +      for (auto kv : flowFile_->getAttributes()) {
    +        if (regex_match(kv.first, attributeNameRegex_)) {
    +          if (!hdrs) {
    +            hdrs = rd_kafka_headers_new(8);
    --- End diff --
    
    8 was mostly arbitrary, I used the value from 
https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_example.c#L416
 since some value needed to be used. 0 is also an option but it looks like if 0 
is chosen, any additions will grow the list to 16 elements. If a number besides 
0 is chosen, when list runs out of room, the list is grown by 2*the list size.


> Add headers support in PublishKafka
> -----------------------------------
>
>                 Key: MINIFICPP-427
>                 URL: https://issues.apache.org/jira/browse/MINIFICPP-427
>             Project: NiFi MiNiFi C++
>          Issue Type: Improvement
>            Reporter: Pierre Villard
>            Assignee: Dustin Rodrigues
>            Priority: Major
>
> Would be nice to add headers support in PublishKafka (assuming Kafka 0.11+) 
> in order to preserve attributes of the flow files.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to