-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Added config produce_retry and producer_retry_sleep for kafka.
#7473
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
Conversation
src/kafka/publish/kafka.php
Outdated
| 'produce' => [ | ||
| 'max_retries' => 3, | ||
| 'retry_delay' => 0.1, | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
展开成 producer_max_retries 和 producer_retry_delay 会不会更好?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果展开的话可以用 produce_max_retries 跟 produce_retry_delay 或者 produce_retry 、produce_retry_sleep。 因为 swoole/kafka 内部设置重试时调用的是 setProduceRetry 与 setProduceRetrySleep。
参考之前 producer_epoch 的设置对应的调用方法是 setProducerEpoch。
可以到后面再考虑把通用、生产者、消费者配置区分开的,毕竟 kafka 可配置的参数很多,都在同一层级的话会比较乱。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在混着用更乱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我调整成 produce_retry ,produce_retry_sleep 吧
| 'produce_retry' => 3, | ||
| 'produce_retry_sleep' => 0.1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'produce_retry' => 3, | |
| 'produce_retry_sleep' => 0.1, | |
| 'producer_retry' => 3, | |
| 'producer_retry_sleep' => 0.1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
produce_retry and producer_retry_sleep for kafka.

Changed
This PR introduces support for configuring retry behavior in the Kafka producer by adding two new options:
produce.max_retries: Number of times to retry sending a message if it initially fails.produce.retry_delay: Time to wait (in seconds) between each retry attempt.These values are injected into the producer via two new setter methods:
setProduceRetry(int $times)setProduceRetrySleep(float $seconds)