pub struct KafkaAdapter { /* private fields */ }Expand description
Kafka transport adapter for event streaming.
Delivers subscription events to Apache Kafka topics.
Uses the entity_id as the message key for consistent partitioning.
§Feature Flag
This adapter has two implementations:
- With
kafkafeature: delivery throughfraiseql_kafka::KafkaEgress, the one producer this workspace builds - Without
kafkafeature: a stub that fails loud on every delivery (#784)
§Example
ⓘ
use fraiseql_core::runtime::subscription::{KafkaAdapter, KafkaConfig};
let config = KafkaConfig::new("kafka+ssl://localhost:9093", "fraiseql-events")
.with_client_id("my-service")
.with_compression("lz4");
let adapter = KafkaAdapter::new(config)?;
adapter.deliver(&event, "orderCreated").await?;Implementations§
Source§impl KafkaAdapter
impl KafkaAdapter
Sourcepub fn new(config: KafkaConfig) -> Result<Self, SubscriptionError>
pub fn new(config: KafkaConfig) -> Result<Self, SubscriptionError>
Connect this adapter’s shared Kafka egress.
The endpoint is screened and security.protocol set from its scheme before any
client exists — by fraiseql_kafka::KafkaEgress, the one place in this
workspace that builds a producer, so this transport and the CDC outbox sink
cannot disagree about what is safe (#1102).
§Errors
SubscriptionError::Internal if the endpoint is refused (no scheme,
unsupported scheme, unopted-in plaintext, blocked broker host, unresolvable SASL
credentials) or if the producer cannot be created.
Trait Implementations§
Source§impl Debug for KafkaAdapter
Available on crate feature kafka only.
impl Debug for KafkaAdapter
Available on crate feature
kafka only.Source§impl TransportAdapter for KafkaAdapter
impl TransportAdapter for KafkaAdapter
Source§fn deliver<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
event: &'life1 SubscriptionEvent,
subscription_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), SubscriptionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn deliver<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
event: &'life1 SubscriptionEvent,
subscription_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), SubscriptionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Deliver an event to the transport. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for KafkaAdapter
impl !UnwindSafe for KafkaAdapter
impl Freeze for KafkaAdapter
impl Send for KafkaAdapter
impl Sync for KafkaAdapter
impl Unpin for KafkaAdapter
impl UnsafeUnpin for KafkaAdapter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more