However, if you're used to working with immutables, it can feel natural that withPartition would return a new object, so it could be more prone to mistakes.

Cheers,
Michal

On 23/04/17 10:41, Michal Borowiecki wrote:

IMHO, the ProducerRecord is anyway not immutable until send, since key and value don't have to immutable, until serialized on send.

So if immutability is a concern, I think it would have to be enforced in send as Mike suggested, don't see much point in enforcing immutability prior to send.

Therefore the with pattern should not be discarded just for that reason.

Thanks,

Michal


On 23/04/17 06:34, Stephane Maarek wrote:
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.pea...@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. Cheers
     Mike
Sent using OWA for iPhone
     ________________________________________
     From:isma...@gmail.com  <isma...@gmail.com>  on behalf of Ismael 
Juma<ism...@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<matth...@confluent.io>
     wrote:
> 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. Ismael
     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.


--
Signature
<http://www.openbet.com/>         Michal Borowiecki
Senior Software Engineer L4
        T:      +44 208 742 1600

        
        +44 203 249 8448

        
        
        E:      michal.borowie...@openbet.com
        W:      www.openbet.com <http://www.openbet.com/>

        
        OpenBet Ltd

        Chiswick Park Building 9

        566 Chiswick High Rd

        London

        W4 5XT

        UK

        
<https://www.openbet.com/email_promo>

This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@openbet.com <mailto:postmas...@openbet.com> and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by OpenBet for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. OpenBet Ltd. Registered Office: Chiswick Park Building 9, 566 Chiswick High Road, London, W4 5XT, United Kingdom. A company registered in England and Wales. Registered no. 3134634. VAT no. GB927523612


--
Signature
<http://www.openbet.com/>         Michal Borowiecki
Senior Software Engineer L4
        T:      +44 208 742 1600

        
        +44 203 249 8448

        
        
        E:      michal.borowie...@openbet.com
        W:      www.openbet.com <http://www.openbet.com/>

        
        OpenBet Ltd

        Chiswick Park Building 9

        566 Chiswick High Rd

        London

        W4 5XT

        UK

        
<https://www.openbet.com/email_promo>

This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@openbet.com <mailto:postmas...@openbet.com> and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by OpenBet for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. OpenBet Ltd. Registered Office: Chiswick Park Building 9, 566 Chiswick High Road, London, W4 5XT, United Kingdom. A company registered in England and Wales. Registered no. 3134634. VAT no. GB927523612

Reply via email to