Skip to content

Commit

Permalink
feat: Allow configurable producer acks (#27664)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite authored Jan 18, 2025
1 parent fb69265 commit 2e4be90
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rust/capture/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,6 @@ pub struct KafkaConfig {
pub kafka_metadata_max_age_ms: u32,
#[envconfig(default = "2")]
pub kafka_producer_max_retries: u32,
#[envconfig(default = "all")]
pub kafka_producer_acks: String,
}
4 changes: 3 additions & 1 deletion rust/capture/src/sinks/kafka.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ impl KafkaSink {
.set(
"queue.buffering.max.kbytes",
(config.kafka_producer_queue_mib * 1024).to_string(),
);
)
.set("acks", config.kafka_producer_acks.to_string());

if !&config.kafka_client_id.is_empty() {
client_config.set("client.id", &config.kafka_client_id);
Expand Down Expand Up @@ -400,6 +401,7 @@ mod tests {
kafka_client_id: "".to_string(),
kafka_metadata_max_age_ms: 60000,
kafka_producer_max_retries: 2,
kafka_producer_acks: "all".to_string(),
};
let sink = KafkaSink::new(config, handle, limiter, None).expect("failed to create sink");
(cluster, sink)
Expand Down
1 change: 1 addition & 0 deletions rust/capture/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub static DEFAULT_CONFIG: Lazy<Config> = Lazy::new(|| Config {
kafka_client_id: "".to_string(),
kafka_metadata_max_age_ms: 60000,
kafka_producer_max_retries: 2,
kafka_producer_acks: "all".to_string(),
},
otel_url: None,
otel_sampling_rate: 0.0,
Expand Down

0 comments on commit 2e4be90

Please sign in to comment.