-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Auto register consumer for amqp-job #721
Conversation
我测试的时候,直接 make JobConsumer 消费完消息后 Process 会重启,通过创建匿名类就是正常的 |
|
我测试没有遇到这个问题哦,你安装 dev-main 试试看 composer r friendsofhyperf/amqp-job:dev-main |
消费完还是会 stop ,然后再 start |
<?php
declare(strict_types=1);
namespace App\Job;
use FriendsOfHyperf\AmqpJob\Annotation\AmqpJob;
use FriendsOfHyperf\AmqpJob\Job;
use Hyperf\Contract\StdoutLoggerInterface;
#[AmqpJob(
exchange: 'hyperf',
routingKey: 'hyperf',
queue: 'hyperf',
consumerProcessNums: 3,
)]
class FooJob extends Job
{
public function __construct()
{
$this->setJobId(uniqid());
}
public function handle()
{
di(StdoutLoggerInterface::class)->info('FooJob#' . $this->getJobId());
}
} 并未出现重启的情况 |
Hyperf 版本是多少呢,我的,这是个最新的:
|
我的也是最新版呢 |
我重新创建了一个新项目也是这样,会自动重启 |
看看你的 Job 是怎么写的? |
和你上面发的是一样的 |
那就太奇怪了,你再分析看看,确定是 bug 再提个 PR |
我不同的环境都试了,都是用最新版本hyperf,都会出现重启, 通过这种方式创建就是正常的
|
我后面再试试看 |
那不清楚了,我这边通过构造函数初始化那些参数就不会重启,amqp 我试过自建和阿里云的, amqp 日志提示是客户端断掉了连接 |
可否提供 amqp 自建脚本? |
通过 Docker 构建的 ,https://hub.docker.com/r/bitnami/rabbitmq 最新版本 |
friendsofhyperf/amqp-job#3