Expand description
bevy_event_bus: Connect Bevy events to external message brokers
This crate provides an interface similar to Bevy’s EventReader/EventWriter but connected to external message brokers like Kafka.
Re-exports§
pub use backends::EventBusBackend;pub use backends::event_bus_backend::StreamTrimStrategy;pub use config::Kafka;pub use config::Redis;pub use config::BackendMarker;pub use config::EventBusConfig;pub use config::InMemory;pub use config::ProcessingLimits;pub use config::TopologyMode;pub use decoder::DecodedEvent;pub use decoder::DecoderFn;pub use decoder::DecoderRegistry;pub use decoder::TypedDecoder;pub use backends::kafka_backend::KafkaEventBusBackend;pub use backends::redis_backend::RedisAckWorkerStats;pub use backends::redis_backend::RedisEventBusBackend;pub use config::kafka::KafkaBackendConfig;pub use config::kafka::KafkaChannelCapacities;pub use config::kafka::KafkaConnectionConfig;pub use config::kafka::KafkaConsumerConfig;pub use config::kafka::KafkaConsumerGroupSpec;pub use config::kafka::KafkaEventMetadata;pub use config::kafka::KafkaInitialOffset;pub use config::kafka::KafkaProducerConfig;pub use config::kafka::KafkaTopicSpec;pub use config::kafka::KafkaTopologyConfig;pub use config::kafka::UncommittedEvent;pub use config::redis::RedisBackendConfig;pub use config::redis::RedisConnectionConfig;pub use config::redis::RedisConsumerConfig;pub use config::redis::RedisConsumerGroupSpec;pub use config::redis::RedisProducerConfig;pub use config::redis::RedisRuntimeTuning;pub use config::redis::RedisStreamSpec;pub use config::redis::RedisTopologyBuilder;pub use config::redis::RedisTopologyConfig;pub use config::redis::RedisTopologyEventBinding;pub use config::redis::TrimStrategy;
Modules§
- backends
- config
- Configuration system for backend-agnostic event bus readers and writers
- decoder
- Multi-decoder pipeline supporting multiple event types per topic
- prelude
- Re-export common items for convenience
Structs§
- Backend
Capabilities - Backend
Down Event - Backend
Ready Event - Backend
Status - Consumer
Metrics - Basic consumer metrics (frame-scoped counters + cumulative stats)
- Decoded
Event Buffer - Multi-decoded event storage that groups all successfully decoded events by topic
This replaces
DrainedTopicMetadatafor the new multi-decoder pipeline - Drain
Metrics Event - Event emitted after each drain with snapshot metrics (optional for user systems)
- Drained
Topic Metadata - Per-topic metadata-aware message buffers filled by drain system each frame
- Event
BusConsumer Config - Configuration controlling how many events are drained each frame
- Event
BusDecode Error - Event fired when message deserialization fails
- Event
BusError - Event fired when any operation on the event bus fails
- Event
BusError Queue - Queue of errors emitted by writers so they can be flushed outside of the system parameter borrow.
- Event
BusPlugin - Plugin for integrating with external event brokers
- Event
BusPlugins - Plugin bundle that configures everything needed for the event bus
- Event
Metadata - Generic event metadata that works across all backends
- Event
Wrapper - Unified event wrapper that provides direct access to event data along with its metadata.
Wrappers are only produced for externally sourced events, so metadata is always present.
The wrapper can be used directly as the event thanks to the
Derefimplementation. - Kafka
Event Reader - Kafka-specific
BusEventReaderimplementation that can optionally perform manual commits and expose consumer lag metrics. - Kafka
Event Writer - Kafka-specific writer that extends the generic writer with partition keys, headers and flush support.
- Kafka
Metadata - Kafka-specific metadata
- Processed
Message - Pre-processed message with payload and metadata already converted for efficient reading
- Redis
Event Reader - Redis-specific
BusEventReaderimplementation that exposes manual acknowledgements. - Redis
Event Writer - Redis-specific writer that provides stream trimming and configuration-driven options.
- Shared
Runtime - Bevy resource wrapper for a shared Tokio runtime (Arc for cheap clone into async tasks)
- Topic
Decoded Events - Storage for all decoded events from a single topic, organized by event type
Enums§
- Event
BusError Type - Types of errors that can occur in the event bus
- Kafka
Reader Error - Errors that can occur when working with the Kafka-specific reader.
- Kafka
Writer Error - Errors emitted by the Kafka-specific writer when backend operations fail.
- Redis
Reader Error - Errors that can occur when working with the Redis-specific reader.
- Redis
Writer Error - Errors emitted by the Redis-specific writer when backend operations fail.
Traits§
- Backend
Metadata - Trait for backend-specific metadata extensions
- BusEvent
- Marker trait for events that can be sent/received via the event bus.
- BusEvent
Reader - Common capabilities shared by all bus event readers.
- BusEvent
Writer - Common interface shared by all outbound event writers.
Functions§
- block_
on - Block on a future using the shared runtime.
- ensure_
runtime - Ensure a SharedRuntime resource exists in the provided app.
- runtime
- Get a reference to the shared Tokio runtime (Arc inside OnceCell)