Skip to main content

Response

Enum Response 

Source
pub enum Response {
Show 37 variants Authenticated { session_id: String, expires_in: u64, }, ScramServerFirst { message: Bytes, }, ScramServerFinal { message: Bytes, session_id: Option<String>, expires_in: Option<u64>, }, Published { offset: u64, partition: u32, }, Messages { messages: Vec<MessageData>, }, TopicCreated { name: String, partitions: u32, }, Topics { topics: Vec<String>, }, TopicDeleted, OffsetCommitted, Offset { offset: Option<u64>, }, Metadata { name: String, partitions: u32, }, ClusterMetadata { controller_id: Option<String>, brokers: Vec<BrokerInfo>, topics: Vec<TopicMetadata>, }, SchemaRegistered { id: i32, }, Schema { id: i32, schema: String, }, Pong, OffsetBounds { earliest: u64, latest: u64, }, Groups { groups: Vec<String>, }, GroupDescription { consumer_group: String, offsets: HashMap<String, HashMap<u32, u64>>, }, GroupDeleted, OffsetForTimestamp { offset: Option<u64>, }, Error { message: String, }, Ok, ProducerIdInitialized { producer_id: u64, producer_epoch: u16, }, IdempotentPublished { offset: u64, partition: u32, duplicate: bool, }, TransactionStarted { txn_id: String, }, PartitionsAddedToTxn { txn_id: String, partition_count: usize, }, TransactionalPublished { offset: u64, partition: u32, sequence: i32, }, OffsetsAddedToTxn { txn_id: String, }, TransactionCommitted { txn_id: String, }, TransactionAborted { txn_id: String, }, QuotasDescribed { entries: Vec<QuotaEntry>, }, QuotasAltered { altered_count: usize, }, Throttled { throttle_time_ms: u64, quota_type: String, entity: String, }, TopicConfigAltered { topic: String, changed_count: usize, }, PartitionsCreated { topic: String, new_partition_count: u32, }, RecordsDeleted { topic: String, results: Vec<DeleteRecordsResult>, }, TopicConfigsDescribed { configs: Vec<TopicConfigDescription>, },
}
Expand description

Protocol response messages

§Stability

WARNING: Variant order must remain stable for postcard serialization compatibility. Adding new variants should only be done at the end of the enum.

Variants§

§

Authenticated

Authentication successful

Fields

§session_id: String

Session token for subsequent requests

§expires_in: u64

Session timeout in seconds

§

ScramServerFirst

SCRAM-SHA-256: Server-first message (challenge)

Fields

§message: Bytes

Server-first-message bytes (r=<nonce>,s=<salt>,i=<iterations>)

§

ScramServerFinal

SCRAM-SHA-256: Server-final message (verification or error)

Fields

§message: Bytes

Server-final-message bytes (v=<verifier> or e=<error>)

§session_id: Option<String>

Session ID (if authentication succeeded)

§expires_in: Option<u64>

Session timeout in seconds (if authentication succeeded)

§

Published

Success response with offset

Fields

§offset: u64
§partition: u32
§

Messages

Messages response

Fields

§messages: Vec<MessageData>
§

TopicCreated

Topic created

Fields

§name: String
§partitions: u32
§

Topics

List of topics

Fields

§topics: Vec<String>
§

TopicDeleted

Topic deleted

§

OffsetCommitted

Offset committed

§

Offset

Offset response

Fields

§offset: Option<u64>
§

Metadata

Metadata

Fields

§name: String
§partitions: u32
§

ClusterMetadata

Full cluster metadata for topic(s)

Fields

§controller_id: Option<String>

Controller node ID (Raft leader)

§brokers: Vec<BrokerInfo>

Broker/node list

§topics: Vec<TopicMetadata>

Topic metadata

§

SchemaRegistered

Schema registration result

Fields

§id: i32
§

Schema

Schema details

Fields

§id: i32
§schema: String
§

Pong

Pong

§

OffsetBounds

Offset bounds for a partition

Fields

§earliest: u64
§latest: u64
§

Groups

List of consumer groups

Fields

§groups: Vec<String>
§

GroupDescription

Consumer group details with all offsets

Fields

§consumer_group: String
§offsets: HashMap<String, HashMap<u32, u64>>

topic → partition → offset

§

GroupDeleted

Consumer group deleted

§

OffsetForTimestamp

Offset for a timestamp

Fields

§offset: Option<u64>

The first offset with timestamp >= the requested timestamp None if no matching offset was found

§

Error

Error response

Fields

§message: String
§

Ok

Success

§

ProducerIdInitialized

Producer ID initialized

Fields

§producer_id: u64

Assigned or existing producer ID

§producer_epoch: u16

Current epoch (increments on reconnect)

§

IdempotentPublished

Idempotent publish result

Fields

§offset: u64

Offset where message was written

§partition: u32

Partition the message was written to

§duplicate: bool

Whether this was a duplicate (message already existed)

§

TransactionStarted

Transaction started successfully

Fields

§txn_id: String

Transaction ID

§

PartitionsAddedToTxn

Partitions added to transaction

Fields

§txn_id: String

Transaction ID

§partition_count: usize

Number of partitions now in transaction

§

TransactionalPublished

Transactional publish result

Fields

§offset: u64

Offset where message was written (pending commit)

§partition: u32

Partition the message was written to

§sequence: i32

Sequence number accepted

§

OffsetsAddedToTxn

Offsets added to transaction

Fields

§txn_id: String

Transaction ID

§

TransactionCommitted

Transaction committed

Fields

§txn_id: String

Transaction ID

§

TransactionAborted

Transaction aborted

Fields

§txn_id: String

Transaction ID

§

QuotasDescribed

Quota descriptions

Fields

§entries: Vec<QuotaEntry>

List of quota entries

§

QuotasAltered

Quotas altered successfully

Fields

§altered_count: usize

Number of quota alterations applied

§

Throttled

Throttle response (returned when quota exceeded)

Fields

§throttle_time_ms: u64

Time to wait before retrying (milliseconds)

§quota_type: String

Quota type that was exceeded

§entity: String

Entity that exceeded quota

§

TopicConfigAltered

Topic configuration altered

Fields

§topic: String

Topic name

§changed_count: usize

Number of configurations changed

§

PartitionsCreated

Partitions created

Fields

§topic: String

Topic name

§new_partition_count: u32

New total partition count

§

RecordsDeleted

Records deleted

Fields

§topic: String

Topic name

§results: Vec<DeleteRecordsResult>

Results per partition

§

TopicConfigsDescribed

Topic configurations described

Fields

§configs: Vec<TopicConfigDescription>

Configuration descriptions per topic

Implementations§

Source§

impl Response

Source

pub fn to_bytes(&self) -> Result<Vec<u8>, ProtocolError>

Serialize response to bytes

Source

pub fn from_bytes(data: &[u8]) -> Result<Response, ProtocolError>

Deserialize response from bytes

Trait Implementations§

Source§

impl Clone for Response

Source§

fn clone(&self) -> Response

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Response

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Response

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Response, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Response

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,