Hi Chia-Ping,

I agree that `Headers
<https://kafka.apache.org/38/javadoc/org/apache/kafka/common/header/Headers.html>`
extending `Iterable<Header>` includes unnecessary mutable methods like
add() and remove(). However, Headers does offer a useful `lastHeader()`
method.
While I understand your point that it's not overly complex to iterate
through and get the last header, I'm concerned that using
`Iterable<Header>` might create a *non-unified developer experience*
between these callbacks and the existing ProducerRecord.headers()
<https://kafka.apache.org/38/javadoc/org/apache/kafka/clients/producer/ProducerRecord.html#headers()>
and ConsumerRecord.headers()
<https://kafka.apache.org/38/javadoc/org/apache/kafka/clients/consumer/ConsumerRecord.html#headers()>
.

Could this be an issue?

Regards,
Rich


On Thu, Aug 22, 2024 at 10:05 PM Chia-Ping Tsai <chia7...@gmail.com> wrote:

> hi Rich
>
> Headers is a sub class of Iterable<Header> already, so changing the type
> from Headers to Iterable<Header> does not make code complicated :)
>
> The point is “should we pass a mutable interface to users in those
> callback function?”
>
> IMHO, the answer is NO.
>
> Best,
> Chia-Ping
>
> >
> > Rich C. <chenjy.r...@gmail.com> 於 2024年8月23日 上午8:26 寫道:
> >
> > Hi Chia-Ping,
> >
> > I initially considered `Iterable<Header>`, but eventually went with
> > `Headers`. Because ProducerRecord.headers()
> > <
> https://kafka.apache.org/38/javadoc/org/apache/kafka/clients/producer/ProducerRecord.html#headers()
> >
> > type is `Headers`.
> >
> > Regards,
> > Rich
> >
> >
> >> On Thu, Aug 22, 2024 at 4:50 PM Chia-Ping Tsai <chia7...@apache.org>
> wrote:
> >>
> >> hi Rich
> >>
> >> Sorry for late response. I have just one comment:
> >>
> >> Have we consider replacing `Headers` by `Iterable<Header>`? There are
> some
> >> disadvantages of using `Headers`:
> >>
> >> 1. `Headers` have many setters and they are meaningless to users.
> >> 2. If users do want to modify `Headers`, they can get inconsistent
> results
> >> as `Headers` can be either readonly of modifiable.
> >>
> >> Best,
> >> Chia-Ping
> >>
> >>> On 2024/07/23 03:13:59 "Rich C." wrote:
> >>> Hi Everyone,
> >>>
> >>> I hope this email finds you well.
> >>>
> >>> I would like to start a discussion on KIP-512. The initial version of
> >>> KIP-512 was created in 2019, and I have resurrected it in 2024 with
> more
> >>> details about the motivation behind it.
> >>>
> >>> You can view the current version of the KIP here: KIP-512: Make Record
> >>> Headers Available in onAcknowledgement.
> >>> <
> >>
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-512%3A+make+Record+Headers+available+in+onAcknowledgement
> >>>
> >>>
> >>> Let's focus on discussing the necessity of this feature first. If we
> >> agree
> >>> on its importance, we can then move on to discussing the proposed
> >> changes.
> >>>
> >>> Looking forward to your feedback.
> >>>
> >>> Best regards,
> >>> Rich
> >>>
> >>
>

Reply via email to