php-kafka-consumer

码农软件 · 软件分类 · PHP开发工具 · 2019-11-09 17:14:02

软件介绍

php-kafka-consumer 主要是对 php_rdkafka 的 consumer 的 API 进行一层封装,增加了原程序中所没有的与 zookeeper 交互的功能。在此基础上实现了 rebalance 功能以及 group 功能。 经过简单的压力测试,单个进程的消费能力能达到每秒钟7.8W条,压测详细内容见压力测试

依赖

php_zookeeper

php_rdkafka (建议使用1.0.0版本)

librdkafka(建议使用0.9.1版本)

使用

<?php 
include 'consumer.php';

function call_back_func($msg) {
    echo "$msg->payload\n";
}

function handle_error_call_back($msg) {
    echo $msg->errstr();
}

$consumer = New Consumer("localhost:2181");
$consumer->setGroupId("group-test");
$consumer->setTopic("topic-test");
$consumer->setOffsetAutoReset(Consumer::smallest);
$consumer->setErrHandler("handle_error_call_back");

try {
    $consumer->start("echo_message");
}
catch(Exception $e) {
    printf("error: %s\n", $e->getMessage());
}

本文地址:https://codercto.com/soft/d/18625.html

Distributed Algorithms: An Intuitive Approach

Distributed Algorithms: An Intuitive Approach

Wan Fokkink / MIT Press / 2018-2-2 / USD 48.00

The new edition of a guide to distributed algorithms that emphasizes examples and exercises rather than the intricacies of mathematical models. This book offers students and researchers a guide to ......一起来看看 《Distributed Algorithms: An Intuitive Approach》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

在线进制转换器
在线进制转换器

各进制数互转换器

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具