madsim-rdkafka

Crates.iomadsim-rdkafka
lib.rsmadsim-rdkafka
version0.4.2+0.34.0
sourcesrc
created_at2022-09-26 03:32:27.060955
updated_at2024-05-13 04:51:38.186143
descriptionThe rdkafka simulator on madsim.
homepagehttps://github.com/madsim-rs/madsim
repositoryhttps://github.com/madsim-rs/madsim
max_upload_size
id673949
size457,259
crates-io (github:madsim-rs:crates-io)

documentation

README

madsim-rdkafka

Crate Docs

The rdkafka simulator on madsim. Mirrors rdkafka v0.34.0 and librdkafka 2.3.0.

Usage

Replace all rdkafka entries in your Cargo.toml:

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

API Modification

This crate roughly follows the rdkafka API but is NOT exactly the same.

The following functions are modified to be async:

  • FromClientConfig::from_config
  • FromClientConfigAndContext::from_config_and_context
  • ClientConfig::create
  • ClientConfig::create_with_context
  • Client::fetch_metadata1
  • Client::fetch_watermarks1
  • Client::fetch_group_list1
  • 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_times1
  • Consumer::fetch_metadata1
  • Consumer::fetch_watermarks1
  • Consumer::fetch_group_list1
  • Producer::flush
  • Producer::init_transactions
  • Producer::send_offsets_to_transaction
  • Producer::commit_transaction
  • Producer::abort_transaction

The associated constant ClientContext::ENABLE_REFRESH_OAUTH_TOKEN is changed to a function in order to make the trait object-safe.

DNS Resolution

This crate has cherry-picked a commit from Materialize to support rewriting broker addresses.

A new method is added to ClientContext:

  • ClientContext::rewrite_broker_addr

Footnotes

  1. wrapped in tokio::task::spawn_blocking 2 3 4 5 6 7

Commit count: 331

cargo fmt