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

php在调用producer发送消息时如何设置不需要等待进程结束 #45

Open
jackxpwu opened this issue Nov 26, 2019 · 1 comment

Comments

@jackxpwu
Copy link

准备在接口调用中使用kafka记录日志,但是发送消息后会有一个1.5秒左右的时间等待时间,如何设置能够发送完消息不需要等待

@jackxpwu
Copy link
Author

在使用producer的时候,发现程序总是要等待一两秒才退出。

setLogLevel(LOG_DEBUG); $rk->addBrokers("127.0.0.1"); $topic = $rk->newTopic("test"); for ($i = 0; $i < 10; $i++) { $topic->produce(RD_KAFKA_PARTITION_UA, 0, "Message $i"); $rk->poll(0); } 由于 produce 是异步的所以,程序在结束前 producer 会等待确认消息是否已经发送成功,但是等待的时间实在是太久了,有一两秒,如何配置才能使其不用异步去处理。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant