#[non_exhaustive]pub enum KafkaError {
Connect(Box<dyn StdError + Send + Sync>),
Publish(Box<dyn StdError + Send + Sync>),
Subscribe(Box<dyn StdError + Send + Sync>),
Consume(Box<dyn StdError + Send + Sync>),
NotConnected {
topic: String,
},
Closed {
topic: String,
},
InvalidOptions(String),
TransactionBusy {
id: String,
},
NoTransaction {
id: String,
},
}Expand description
Errors returned by KafkaBroker and the types it hands out.
Underlying rdkafka errors are boxed as sources so the client
library does not leak into this crate’s public API surface.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Connect(Box<dyn StdError + Send + Sync>)
Creating a client failed or the cluster was unreachable during the connect probe.
Publish(Box<dyn StdError + Send + Sync>)
Publishing a message failed or the broker did not confirm its delivery.
Subscribe(Box<dyn StdError + Send + Sync>)
Creating a consumer or subscribing it to its topic failed.
Consume(Box<dyn StdError + Send + Sync>)
Receiving a delivery from an open consumer failed.
NotConnected
A KafkaRetryPublisher was used before its broker
connected.
Only the early publisher can report this: it is the one handle minted before
Broker::connect, for builder-time wiring that needs a
live publisher (retry_via). Everything on the policy path pairs with the connected
broker, so “not connected” is not representable there.
Closed
A handle aliasing the connection was used after the broker shut down.
The lifecycle ladder makes misuse through the owner’s handle a compile error:
ConnectedBroker::shutdown consumes the
connected broker. Publishers paired off it earlier, and subscriptions still open, keep
aliasing the closed connection, so their operations report this instead of silently
succeeding against a dead connection.
Fields
InvalidOptions(String)
The requested combination of options cannot be executed.
The message names the offending option and the remediation.
TransactionBusy
begin_transaction found a transaction already open on this publisher.
One producer runs one transaction at a time, so a second begin means two flows share
one publisher; erroring beats silently merging their messages into one transaction.
Concurrent transactional flows need distinct publishers - one per partition via
TransactionalPartitions, or distinct explicit ids.
NoTransaction
commit or abort was called with no transaction open on this publisher.
Trait Implementations§
Source§impl Debug for KafkaError
impl Debug for KafkaError
Source§impl Display for KafkaError
impl Display for KafkaError
Source§impl Error for KafkaError
impl Error for KafkaError
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()