Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Fede1024 Rust rdkafka Non Blocking Message Production

From Leeroopedia


Knowledge Sources
Domains Messaging, Async_Programming
Last Updated 2026-02-07 19:00 GMT

Overview

A non-retrying message enqueue operation that immediately returns a delivery future or an error if the queue is full.

Description

Non-Blocking Message Production differs from the standard send() in that it does not retry when the producer's internal queue is full. Instead, it immediately returns either a DeliveryFuture (on successful enqueue) or the error and original record (on failure). This gives the caller full control over retry logic and backpressure handling.

This is useful in scenarios where you want to implement custom retry strategies, need immediate feedback on queue status, or are operating in test code where retries would mask issues.

Usage

Use send_result instead of send when you need immediate feedback on enqueue success without automatic retry. Common in testing scenarios and when implementing custom backpressure mechanisms.

Theoretical Basis

Pseudo-code logic:

// Abstract algorithm
match producer.send_result(record) {
    Ok(delivery_future) => {
        // Message enqueued, await delivery confirmation
        let result = delivery_future.await;
    }
    Err((error, record)) => {
        // Queue full or other error, handle immediately
        // No automatic retry
    }
}

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment