Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ public SerDes serDes() {
return serDes;
}

/** Creates a new builder with default values. */
public static Builder builder() {
return new Builder(null, null, null);
}

/** Creates a new builder pre-populated with this config's values. */
public Builder toBuilder() {
return new Builder(timeout, heartbeatTimeout, serDes);
}

/** Builder for {@link CallbackConfig}. */
public static class Builder {
private Duration timeout;
private Duration heartbeatTimeout;
Expand All @@ -60,12 +63,24 @@ private Builder(Duration timeout, Duration heartbeatTimeout, SerDes serDes) {
this.serDes = serDes;
}

/**
* Sets the maximum duration to wait for the callback to complete before timing out.
*
* @param timeout the timeout duration
* @return this builder for method chaining
*/
public Builder timeout(Duration timeout) {
ParameterValidator.validateOptionalDuration(timeout, "Callback timeout");
this.timeout = timeout;
return this;
}

/**
* Sets the maximum duration between heartbeats before the callback is considered failed.
*
* @param heartbeatTimeout the heartbeat timeout duration
* @return this builder for method chaining
*/
public Builder heartbeatTimeout(Duration heartbeatTimeout) {
ParameterValidator.validateOptionalDuration(heartbeatTimeout, "Heartbeat timeout");
this.heartbeatTimeout = heartbeatTimeout;
Expand All @@ -87,6 +102,7 @@ public Builder serDes(SerDes serDes) {
return this;
}

/** Builds the {@link CallbackConfig} instance. */
public CallbackConfig build() {
return new CallbackConfig(this);
}
Expand Down
Loading
Loading