docs.rs failed to build zirv-kafka-0.2.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
zirv-kafka
A convenient wrapper around the rdkafka crate that simplifies working with Apache Kafka in Rust applications.
Features
- Easy Kafka producer initialization and management through global instance
- Simplified message production with convenient macros
- Streamlined consumer setup and message handling
- Background thread management for continuous message polling
Installation
Add zirv-kafka
to your Cargo.toml
:
[]
= "0.2.0"
Producer Usage
Initialize the producer
Initialize the Kafka producer early in your application:
use init_kafka_producer;
async
Send messages
Send messages to Kafka topics using the produce_message!
macro:
use produce_message;
async
For more direct control, you can access the producer directly:
use get_kafka_producer;
use FutureRecord;
async
Consumer Usage
Create a consumer and start processing messages
Use the start_base_consumer!
macro to initialize a consumer and process messages:
use start_base_consumer;
For more control over the consumer, you can use the lower-level functions:
use BorrowedMessage;
use Arc;
use ;
Configuration
By default, the library uses the following configuration:
KAFKA_BROKERS
environment variable with a default of "localhost:9092" for consumers- For producers, it uses zirv-config to read:
kafka.bootstrap_servers
(default: "localhost:9092")kafka.message_timeout_ms
(default: 5000)
Requirements
- Rust (2021 edition or later)
- librdkafka development libraries if using dynamic linking
License
This project is licensed under either:
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)