A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://arnaud-lb.github.io/php-rdkafka-doc/phpdoc/rdkafka.examples-low-level-consumer-multi.html below:

Low level consumer: Multiple topics/partitions

This examples show how to consumer from multiple topics and/or partitions when using the low-level consumer.

Example #1 Low-level consumer: multiple topics/partitions example

<?php// Consuming from multiple topics and/or partitions can be done by telling
// librdkafka to forward all messages from these topics/partitions to an
// internal queue, and then consuming from this queue.
$queue $rk->newQueue();$topicConf = new RdKafka\TopicConf();
$topicConf->set(...);$topic1 $rk->newTopic("topic1"$topicConf);
$topic1->consumeQueueStart(0RD_KAFKA_OFFSET_BEGINNING$queue);
$topic1->consumeQueueStart(1RD_KAFKA_OFFSET_BEGINNING$queue);$topic2 $rk->newTopic("topic2"$topicConf);
$topic2->consumeQueueStart(0RD_KAFKA_OFFSET_BEGINNING$queue);// Now, consume from the queue instead of the topics:while (true) {
    
$message $queue->consume(120*1000);
    
// ...
}?>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4