Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpkafka的topic不支持正则? #40

Open
waytoviva opened this issue Jun 7, 2021 · 1 comment
Open

phpkafka的topic不支持正则? #40

waytoviva opened this issue Jun 7, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@waytoviva
Copy link

  • 你遇到了什么问题
    topic 含正则表达式 都不能用,显示以下错误, kafka [api]里kafkaConsumer.subscribe 的第一个参数 支持正则模式订阅,
Exception 'longlang\phpkafka\Exception\KafkaErrorException' with message '[17] The request attempted to perform an operation on an invalid topic.'

in /mnt/d/proj_path/vendor/longlang/phpkafka/src/Protocol/ErrorCode.php:385

Stack trace:
#0 /mnt/d/proj_path/vendor/longlang/phpkafka/src/Broker.php(126): longlang\phpkafka\Protocol\ErrorCode::check()
  • Kafka 环境是自建还是云服务?
    自建

  • 请执行下面的命令获取环境信息。

php -v & php --ri swoole & composer info | grep longlang/phpkafka

[1] 6007
[2] 6008
PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

swoole

Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.6.7
Built => May 25 2021 21:55:02
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 1.1.1f  31 Mar 2020
dtls => enabled
http2 => enabled
json => enabled
pcre => enabled
zlib => 1.2.11
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
longlang/phpkafka                  dev-master c7b5082 A kafka client. Support php-fpm and Swoole.
[1]-  Done                    php -v
[2]+  Done                    php --ri swoole
  • 提供最小可复现代码:
php

 $config = new ConsumerConfig($option);
 $config->setBroker(Yii::$app->params['KAFKA']['host']);
 $config->setTopic($this->topic); //这个值 要含正则时 才能触发

@waytoviva
Copy link
Author

见phprdkafka 文档 [https://arnaud.le-blanc.net/php-rdkafka-doc/phpdoc/rdkafka-kafkaconsumer.subscribe.html]

@Yurunsoft Yurunsoft added the enhancement New feature or request label Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants