Hi Yeah this sounds reasonable, you are welcome to create a JIRA and send a PR.
On Mon, Sep 19, 2022 at 3:15 PM r.wiedm...@bitproquo.org < r.wiedm...@bitproquo.org> wrote: > 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. > > > What do you think? -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2