Hi Becket,

On Wed, Jan 27, 2016 at 10:51 PM, Becket Qin <becket....@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

Reply via email to