kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Maarek <steph...@simplemachines.com.au>
Subject Re: [DISCUSS] KIP 141 - ProducerRecordBuilder Interface
Date Sun, 23 Apr 2017 05:34:57 GMT
Good call.
That’s when I heavily miss Scala Case classes and options. You get clarity on optional vs
mandatory fields, one constructor, and immutability. If losing Immutability is an issue, then
the with pattern is a no-go and then I’ll just add a missing constructor the way Ismael
described it. That’ll make the PR way simpler, with limited refactoring.

Regarding the ConsumerRecord, I’m happy to have a look, but it’s the first time I see
it concretely. When would you manually construct such a record? Isn’t the client handling
all that for you behind the scene?

On 23/4/17, 3:21 pm, "Michael Pearce" <Michael.Pearce@ig.com> wrote:

    If moving to a wither pattern instead of a builder. How will this enforce immutability?
Eg current PR it is now changing to allow possible change values once set.
    Or are you proposing to change it to a mutable record? And move to a closable record similar
to the closing of the headers on send.
    How about also the consumer record, is this also being looked at so we don't have two
very different styles.
    Sent using OWA for iPhone
    From: ismaelj@gmail.com <ismaelj@gmail.com> on behalf of Ismael Juma <ismael@juma.me.uk>
    Sent: Saturday, April 22, 2017 11:53:45 PM
    To: dev@kafka.apache.org
    Subject: Re: [DISCUSS] KIP 141 - ProducerRecordBuilder Interface
    On Sat, Apr 22, 2017 at 6:16 PM, Matthias J. Sax <matthias@confluent.io>
    > I think Ismael's suggestion is a valid alternative.
    > However, `timestamp` is an optional field and thus we should have at
    > least two constructors for this:
    >  - ProducerRecord(String topic, K key, V value)
     - ProducerRecord(String topic, K key, V value, Long timestamp)
    Yes, the other one already exists.
    The information contained in this email is strictly confidential and for the use of the
addressee only, unless otherwise indicated. If you are not the intended recipient, please
do not read, copy, use or disclose to others this message or any attachment. Please also notify
the sender by replying to this email or by telephone (+44(020 7896 0011) and then delete the
email and any copies of it. Opinions, conclusion (etc) that do not relate to the official
business of this company shall be understood as neither given nor endorsed by it. IG is a
trading name of IG Markets Limited (a company registered in England and Wales, company number
04008957) and IG Index Limited (a company registered in England and Wales, company number
01190902). Registered address at Cannon Bridge House, 25 Dowgate Hill, London EC4R 2YA. Both
IG Markets Limited (register number 195355) and IG Index Limited (register number 114059)
are authorised and regulated by the Financial Conduct Authority.

View raw message