Sub Example not working
iGusev opened this issue · 11 comments
iGusev commented
child process pids 80477 be terminated, trying reload
last all pid:
80477
child process pids 80478 be terminated, trying reload
last all pid:
80478
child process pids 80479 be terminated, trying reload
last all pid:
80479
child process pids 80480 be terminated, trying reload
last all pid:
80480
child process pids 80481 be terminated, trying reload
last all pid:
80481
child process pids 80482 be terminated, trying reload
last all pid:
80482
yunnian commented
php --ri nsq , 看下版本号是多少,以及当前运行的环境
iGusev commented
% php --version
PHP 7.3.1 (cli) (built: Jan 10 2019 13:15:37) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies
% php --ri nsq
nsq
nsq support => enabled
version => 3.5.0
author => zhenyu.wu[email:wuzhenyu@kuangjue.com]
yunnian commented
MacOS Centos Ubuntu?
iGusev commented
i checked on mac os and ubuntu
luoxun commented
the same question
hppking commented
通过 ip:4161/lookup?topic=name 查看producers->broadcast_address 地址,是否nsq client ping pass?
xiaochengfu commented
我也遇到了相同的问题,docker环境下
docker run -it --rm -v $PWD:/home/wwwroot hp/php php --ri nsq
nsq
nsq support => enabled
version => 3.5.0
author => zhenyu.wu[email:wuzhenyu@kuangjue.com]
php环境
docker run -it --rm -v $PWD:/home/wwwroot hp/php -v
PHP 7.4.1 (fpm-fcgi) (built: Dec 18 2019 22:32:13)
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
作者能否帮忙解决下,订阅实现不了的话,估计要放弃了,感谢,已加群,暂未同意
littlexiang commented
我也遇到了相同的问题,docker环境下
docker run -it --rm -v $PWD:/home/wwwroot hp/php php --ri nsq nsq nsq support => enabled version => 3.5.0 author => zhenyu.wu[email:wuzhenyu@kuangjue.com]
php环境
docker run -it --rm -v $PWD:/home/wwwroot hp/php -v PHP 7.4.1 (fpm-fcgi) (built: Dec 18 2019 22:32:13) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies
作者能否帮忙解决下,订阅实现不了的话,估计要放弃了,感谢,已加群,暂未同意
docker环境下要确保php能访问到nsqd的broadcast_address
xiaochengfu commented
已解决,非常感谢 @littlexiang ,nsqd启动命令加上--broadcast-address=192.168.1.12就好了
command: /nsqd --broadcast-address=192.168.1.12 --lookupd-tcp-address=nsqlookupd:4160 --data-path=/data
pecherskiy-v commented
child process pids 2782 be terminated, trying reload
last all pid:
2782
child process pids 2783 be terminated, trying reload
last all pid:
2783
# php -v
PHP 8.0.12 (cli) (built: Oct 21 2021 16:26:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.12, Copyright (c) Zend Technologies
with Xdebug v3.1.1, Copyright (c) 2002-2021, by Derick Rethans
# php --ri nsq
nsq
nsq support => enabled
version => 3.5.1
author => zhenyu.wu[email:wuzhenyu@kuangjue.com]
nsqd
command:
- /nsqd
- -lookupd-tcp-address=nsqlookupd:4160
- -broadcast-address=nsqd
nsqlookupd
command:
- /nsqlookupd
$nsqLookupd = new \NsqLookupd("nsqlookupd:4161");
$this->nsq->subscribe($nsqLookupd, $nsqlConfig, function ($msg,$bev) use ($output) {
$output->writeln($msg->payload);
$output->writeln($msg->attempts);
$output->writeln($msg->messageId);
$output->writeln($msg->timestamp);
});
install:
pecl install nsq
fanymagnet commented
Use this pattern for your daemon:
<?php
use Composer\Autoload\ClassLoader;
/** @var ClassLoader $classLoader */
$classLoader = require dirname(__DIR__) . '/vendor/autoload.php';
// Other your code
foreach ($classLoader->getClassMap() as $class => $path) {
class_exists($class);
}
$nsq->subscribe(...);