RdKafka\KafkaConsumer::assign

(PECL rdkafka >= 1.0.0, librdkafka >= 0.9)

RdKafka\KafkaConsumer::assignUpdate the assignment set

Description

public RdKafka\KafkaConsumer::assign ([ array $topic_partitions = NULL ] ) : void

Update the assignment set to topic_partitions.

The assignment set is the set of partitions actually being consumed by the KafkaConsumer.

Note:

For automatic partition assignment, use RdKafka\KafkaConsumer::subscribe()

Note:

The default configuration for assigned topics can be changed in RdKafka\Conf::set().

Parameters

topic_partitions (array)

Array of RdKafka\TopicPartition to assign

Errors/Exceptions

Examples

Example #1 RdKafka\KafkaConsumer::assign() example

<?php
$kafkaConsumer
->assign([
    new 
RdKafka\TopicPartition("logs"0),
    new 
RdKafka\TopicPartition("logs"1),
]);
?>

See Also