#kafka #rdkafka #simulator #commit-message #async #oauth-token

madsim-rdkafka

madsim 上的 rdkafka 模拟器

10 个版本

0.4.2+0.34.0 2024 年 5 月 13 日
0.4.1+0.34.0 2024 年 5 月 8 日
0.3.4+0.34.0 2024 年 3 月 22 日
0.3.3+0.34.0 2024 年 2 月 28 日
0.2.8-alpha2022 年 9 月 26 日

#29模拟

Download history 4133/week @ 2024-04-15 3527/week @ 2024-04-22 1505/week @ 2024-04-29 3573/week @ 2024-05-06 2727/week @ 2024-05-13 2476/week @ 2024-05-20 1215/week @ 2024-05-27 994/week @ 2024-06-03 844/week @ 2024-06-10 792/week @ 2024-06-17 613/week @ 2024-06-24 1323/week @ 2024-07-01 736/week @ 2024-07-08 854/week @ 2024-07-15 520/week @ 2024-07-22 732/week @ 2024-07-29

2,877 每月下载量

Apache-2.0

515KB
10K SLoC

madsim-rdkafka

Crate Docs

madsim 上的 rdkafka 模拟器。与 rdkafka v0.34.0 和 librdkafka 2.3.0 兼容。

用法

替换 Cargo.toml 中的所有 rdkafka 条目

[dependencies]
rdkafka = { version = "0.4", package = "madsim-rdkafka" }

API 修改

此包大致遵循 rdkafka API,但并不完全相同。

以下函数被修改为 async

  • FromClientConfig::from_config
  • FromClientConfigAndContext::from_config_and_context
  • ClientConfig::create
  • ClientConfig::create_with_context
  • Client::fetch_metadata[^1]
  • Client::fetch_watermarks[^1]
  • Client::fetch_group_list[^1]
  • Consumer::seek
  • Consumer::seek_partitions
  • Consumer::commit
  • Consumer::commit_consumer_state
  • Consumer::commit_message
  • Consumer::committed
  • Consumer::committed_offsets
  • Consumer::offsets_for_timestamp
  • Consumer::offsets_for_times[^1]
  • Consumer::fetch_metadata[^1]
  • Consumer::fetch_watermarks[^1]
  • Consumer::fetch_group_list[^1]
  • Producer::flush
  • Producer::init_transactions
  • Producer::send_offsets_to_transaction
  • Producer::commit_transaction
  • Producer::abort_transaction

[^1]: 包装在 tokio::task::spawn_blocking

关联常量 ClientContext::ENABLE_REFRESH_OAUTH_TOKEN 已更改为函数,以便使特质对象安全。

DNS 解析

此包已从 Materialize 中选择了一个提交以支持重写代理地址。

ClientContext 添加了一个新方法

  • ClientContext::rewrite_broker_addr

依赖项

~13–28MB
~379K SLoC