You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Jay Kreps <ja...@gmail.com> on 2012/02/01 04:47:59 UTC

Why are requests extending Send?

I notice that the new requests like OffsetRequest and TopicMetadataRequest
are directly implement Send. They don't need to do this, they just need to
fill in a ByteBuffer, that can be wrapped in a ByteBufferSend, right?
Otherwise we end up writing the send logic in each response, which doesn't
really make sense.

-Jay

Re: Why are requests extending Send?

Posted by Prashanth Menon <pr...@gmail.com>.
Hmm, I don't see TopicMetadataRequest or OffsetRequest extending Send
directly.  I see them extending Request like the other request, atleast on
the 0.8 branch.  Maybe I'm missing something?

In this same vein, something I'd like to bring up is with regard to
responses.  It'd be nice to have a generic Response class with a "def
writeTo(channel: GatheringByteChannel)", especially considering the fetch
and produce response structure has changed such much.  This is something
I've done for the work on kafka-240.  We could then have a more generic
"ResponseSend" that implements the send logic for all Response
implementations.  Does that make sense?  Sorry, didn't mean to hijack this
thread :)


On Tue, Jan 31, 2012 at 10:47 PM, Jay Kreps <ja...@gmail.com> wrote:

> I notice that the new requests like OffsetRequest and TopicMetadataRequest
> are directly implement Send. They don't need to do this, they just need to
> fill in a ByteBuffer, that can be wrapped in a ByteBufferSend, right?
> Otherwise we end up writing the send logic in each response, which doesn't
> really make sense.
>
> -Jay
>