You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Ralf (Jira)" <ji...@apache.org> on 2022/09/19 16:49:00 UTC

[jira] [Created] (CAMEL-18527) Camel Kafka Component: batch producer with individual headers

Ralf created CAMEL-18527:
----------------------------

             Summary: Camel Kafka Component: batch producer with individual headers
                 Key: CAMEL-18527
                 URL: https://issues.apache.org/jira/browse/CAMEL-18527
             Project: Camel
          Issue Type: New Feature
          Components: camel-kafka
    Affects Versions: 3.18.2
            Reporter: Ralf


Hi all, if we look at classes KafkaProducer and KeyValueIterator, we see that it is possible to send a batch of kafka messages, but only with identical set of headers which is determined by the „parent“ Exchange which holds the Iterator or Iterable in its body.

In our usecase, the body contains a list of Exchanges which we want to use to determine the individual headers for every batch-instance in the same way like currently the „parent“ Exchange is used. Actually we solve our demands by creating some copy/pasting the mentioned classes and applying minor changes to it (which is a dirty hack).

Our proposal is to define a new configuration flag named like „batchWithIndividualHeaders“ which enables the creation of individual headers.

To implement this, the constructor parameter „propagatedHeaders“ in class KeyValueHolderIterator might by replaced with some kind of Provider-Lambda which relays to KafkaProducer::getPropagatedHeaders, but is called inside KeyValueHolderIterator for every batch-element.

IMHO this is a common usecase and worth to implement it in the camel library itself.

 

see also [entry in dev-maillist|https://lists.apache.org/thread/t534295xdbq7nbn5ydfhjrkqo64kvnv4]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)