The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Jacek Laskowski (37) [Avatar] Offline
#1
Hi,

On page 62 in the Note "What's a Fluent Interface?" there's this sentence:

> the returned KStream object is a new instance

Why? Is this (going to be) explained in this book? What would happen if it the same instance were returned?

BTW I also think the fluent API in the note is not consistent as firstName method does not have with prefix as the others.

Jacek
Bill Bejeck (47) [Avatar] Offline
#2
Hi Jacek,

Thanks for the question!

The KStream fluent API returns a new instance each time because you are building a topology of processing nodes. So you can't return the same instance each time as you need different nodes to perform distinct actions.

With the Processor API it is more obvious as you manually create each node in the topology.

I'll review the chapter to make sure I explain why a new instance is returned each time.

Cheers,
Bill