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

feat(sink): use official default message_timeout_ms #18304

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/connector/src/sink/kafka.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ const fn _default_retry_backoff() -> Duration {
Duration::from_millis(100)
}

const fn _default_message_timeout_ms() -> usize {
5000
}

const fn _default_max_in_flight_requests_per_connection() -> usize {
5
}
Expand Down Expand Up @@ -152,12 +148,9 @@ pub struct RdKafkaPropertiesProducer {
/// Produce message timeout.
/// This value is used to limits the time a produced message waits for
/// successful delivery (including retries).
#[serde(
rename = "properties.message.timeout.ms",
default = "_default_message_timeout_ms"
)]
#[serde_as(as = "DisplayFromStr")]
message_timeout_ms: usize,
#[serde(rename = "properties.message.timeout.ms")]
#[serde_as(as = "Option<DisplayFromStr>")]
message_timeout_ms: Option<usize>,

/// The maximum number of unacknowledged requests the client will send on a single connection before blocking.
#[serde(
Expand Down Expand Up @@ -207,7 +200,9 @@ impl RdKafkaPropertiesProducer {
if let Some(v) = self.request_required_acks {
c.set("request.required.acks", v.to_string());
}
c.set("message.timeout.ms", self.message_timeout_ms.to_string());
if let Some(v) = self.message_timeout_ms {
c.set("message.timeout.ms", v.to_string());
}
c.set(
"max.in.flight.requests.per.connection",
self.max_in_flight_requests_per_connection.to_string(),
Expand Down Expand Up @@ -635,7 +630,10 @@ mod test {
c.rdkafka_properties_producer.compression_codec,
Some(CompressionCodec::Zstd)
);
assert_eq!(c.rdkafka_properties_producer.message_timeout_ms, 114514);
assert_eq!(
c.rdkafka_properties_producer.message_timeout_ms,
Some(114514)
);
assert_eq!(
c.rdkafka_properties_producer
.max_in_flight_requests_per_connection,
Expand Down
Loading