kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre-Yves Ritschard <...@spootnik.org>
Subject Re: [DISCUSS] KIP-45 Standardize all client sequence interaction on j.u.Collection.
Date Wed, 03 Feb 2016 19:55:30 GMT

A good compromise would be to add an arity with a single TopicPartition.

Jason Gustafson writes:

> Most of the use cases of pause/resume that I've seen work only on single
> partitions (e.g in Kafka Streams), so the current varargs method is kind of
> nice. It would also be nice to be able to do the following:
>
> consumer.pause(consumer.assignment());
>
> Both variants seem convenient in different situations.
>
> -Jason
>
> On Wed, Feb 3, 2016 at 6:34 AM, Ismael Juma <ismael@juma.me.uk> wrote:
>
>> Hi Becket,
>>
>> On Wed, Jan 27, 2016 at 10:51 PM, Becket Qin <becket.qin@gmail.com> wrote:
>>
>> > 2. For seek(), pause(), resume(), it depends on how easily user can use
>> > them.
>> >     If we take current interface, and user have a list of partitions to
>> > pause(), what they can do is something like:
>> >     pause(patitionList.toArray());
>> >     If we change that to take a collection and user have only one
>> partition
>> > to pause. They have to do:
>> >     pause(new List<>(partition));
>> >     Personally I think the current interface handles both single
>> partition
>> > and a list of partitions better. It is not ideal that we have to adapt to
>> > the interface. I just feel it is weirder to create a new list.
>> >
>>
>> This is not quite right. `toArray` returns an `Object[]`, you would need
>> the more verbose:
>>
>> consumer.pause(partitionList.toArray(new TopicPartition[0]));
>>
>> And for the other case, the recommended approach would be:
>>
>> consumer.assign(Collections.singleton(partition));
>>
>> Or, more concisely (with a static import):
>>
>> consumer.assign(singletonList(partition));
>>
>> Do people often call `seek()`, `pause()` and `resume()` with a single
>> partition?
>>
>> Ismael
>>


Mime
View raw message