pub struct InvalidProducerEpochError { /* private fields */ }Expand description
This error indicates that the produce request sent to the partition leader contains a
non-matching producer epoch. When encountering this error, user should abort the ongoing
transaction by calling KafkaProducer::abort_transaction which would try to send
initPidRequest and reinitialize the producer under the hood.
§Translation notes
Error code Errors::InvalidProducerEpoch. Java extends chain:
InvalidProducerEpochException -> ApplicationRecoverableException -> ApiException ->
KafkaException.
Implementations§
Source§impl InvalidProducerEpochError
impl InvalidProducerEpochError
Sourcepub fn new(message: impl Into<String>) -> Self
pub fn new(message: impl Into<String>) -> Self
Create the error with the given message and no cause,
mirroring Java’s (String message) constructor.
This keeps the plain name under CLAUDE.md §2: the dominant Java
shape among the classes this macro declares is
(String message) + (String message, Throwable cause), whose
parameter-name intersection is {message} — matched exactly by
(String message).
Sourcepub fn with_source(message: impl Into<String>, source: Error) -> Self
pub fn with_source(message: impl Into<String>, source: Error) -> Self
Create the error with the given message and an underlying cause,
mirroring Java’s (String message, Throwable cause) constructor.
Suffixed with the one parameter beyond the {message}
intersection (CLAUDE.md §2) — see new.
Sourcepub fn with_default_message() -> Self
pub fn with_default_message() -> Self
Create the error with the default message for its error code,
mirroring Java’s Errors.exception().
Not a constructor overload, so CLAUDE.md §2’s suffixing does not
apply: it translates the Errors static factory, which fills in
Errors.message() and has no Java constructor counterpart.
Trait Implementations§
Source§impl Clone for InvalidProducerEpochError
impl Clone for InvalidProducerEpochError
Source§impl Debug for InvalidProducerEpochError
impl Debug for InvalidProducerEpochError
Source§impl Display for InvalidProducerEpochError
impl Display for InvalidProducerEpochError
Source§impl Error for InvalidProducerEpochError
impl Error for InvalidProducerEpochError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()