Skip to main content

confluent_kafka/producer/
mod.rs

1// Copyright 2025 Confluent Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Producer types (org.apache.kafka.clients.producer)
16
17pub mod callback;
18mod dyn_producer;
19pub(crate) mod internals;
20mod kafka_producer;
21#[cfg(test)]
22mod mock_partitioner;
23mod mock_producer;
24mod partitioner;
25// The `Producer` interface lives in its own `producer.rs` file per CLAUDE.md's
26// "one Java class per file" rule, nested under the `producer` module that
27// mirrors the `org.apache.kafka.clients.producer` package.
28#[expect(clippy::module_inception)]
29mod producer;
30mod producer_buffer_exhausted_error;
31mod producer_config;
32mod producer_record;
33mod record_metadata;
34mod round_robin_partitioner;
35
36pub use callback::Callback;
37pub use dyn_producer::DynProducer;
38// The non-blocking send and its outcome are consumed only by the C FFI's
39// non-blocking send entry point; without the `ffi` feature nothing else names
40// them, and an unused `pub(crate)` re-export is a warning.
41#[cfg(feature = "ffi")]
42pub(crate) use dyn_producer::DynTrySend;
43pub use kafka_producer::KafkaProducer;
44#[cfg(feature = "ffi")]
45pub(crate) use kafka_producer::TrySendOutcome;
46#[cfg(test)]
47pub(crate) use mock_partitioner::MockPartitioner;
48pub use mock_producer::{MockProducer, MockProducerOptions, MockProducerOptionsBuilder};
49pub use partitioner::Partitioner;
50pub use producer::Producer;
51pub use producer_buffer_exhausted_error::ProducerBufferExhaustedError;
52pub use producer_config::ProducerConfig;
53pub use producer_record::{ProducerRecord, ProducerRecordOptions, ProducerRecordOptionsBuilder};
54pub use record_metadata::RecordMetadata;
55pub use round_robin_partitioner::RoundRobinPartitioner;