RdKafka::newTopic

(PECL rdkafka >= 0.9.1)

RdKafka::newTopicCreate a new topic instance

Description

public RdKafka\Topic RdKafka::newTopic ( string $topic_name [, RdKafka\TopicConf $topic_conf = NULL ] )

Creates a new topic instance for topic_name.

Parameters

topic_name

Topic name

topic_conf

Optional configuration that will be used instead of the default topic configuration.

Note:

Creating two topic instances for the same topic name with different configurations has no effect. Every topic instance will use the configuration of the first instance.

Return Values

Returns a RdKafka\Topic (more specifically, either a RdKafka\ConsumerTopic or a RdKafka\ProducerTopic).

Examples

Example #1 RdKafka::newTopic() example

<?php
$conf 
= new RdKafka\TopicConf();
$conf->set("...""...");

$topic $kafka->newTopic("myTopic"$conf);
?>