I feared that was the case. Well they were certainly right when they said "this 
API is slightly funky"

Thanks for the quick confirmation.
Thunder


-----Original Message-----
From: Todd Palino [bonk...@gmail.com]
Received: Tuesday, 18 Nov 2014, 9:43PM
To: users@kafka.apache.org [users@kafka.apache.org]
Subject: Re: Using OffsetRequest to get the Head and Tail of a partition in a 
single request.

It is not possible, due to how the results for the offset request are stored 
within the broker and API (as a map). You will have to do 2 requests to get 
both offsets.

-Todd


> On Nov 18, 2014, at 8:52 PM, Thunder Stumpges <tstump...@ntent.com> wrote:
>
> Hey all,
>
> We are working on a .net client, and I have a question about the 
> OffsetRequest api 
> (https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-OffsetAPI)
>
> It seems to indicate that you would always get the "log end offset" (tail 
> offset) regardless of the input request:
>
>                "The response contains the starting offset of each segment for 
> the requested partition as well as the "log end offset" i.e. the offset of 
> the next message that would be appended to the given partition."
>
> However from inspecting the code, and experimenting with the API, that 
> doesn't seem to be the case. We cannot seem to fetch both the head (earliest 
> offset, based on Time specified as -2L ) and Tail which we would have 
> expected based on the comment above in the protocol docs.
>
> We can get either the earliest OR latest, but not both. We attempted to pass 
> two entries (the Array of [Partition,Time,MaxNumberOfOffsets] per the 
> protocol) for the same partition ID, one with a -1L and one with a -2L, 
> however we get only one result back, and from the code in KafkaApis.scala 
> handleOffsetRequest, it seems like there could never be multiple requests for 
> the same topic/partition.
>
> Does anyone know if this should be possible, or if there is a work-around for 
> this? Also, should something like this go to the dev group instead?
>
> Thanks
> Thunder
>

Reply via email to