pub struct TransactionTopicEmitter { /* private fields */ }Expand description
Emitter for transaction boundary events.
Tracks in-flight transactions and emits BEGIN/END events to dedicated topic.
Implementations§
Source§impl TransactionTopicEmitter
impl TransactionTopicEmitter
Sourcepub fn new(config: TransactionTopicConfig) -> Self
pub fn new(config: TransactionTopicConfig) -> Self
Create a new transaction topic emitter.
Sourcepub fn topic_name(&self) -> String
pub fn topic_name(&self) -> String
Get the transaction topic name.
Sourcepub fn stats(&self) -> TransactionTopicStatsSnapshot
pub fn stats(&self) -> TransactionTopicStatsSnapshot
Get current statistics.
Sourcepub async fn begin_transaction(
&self,
txn_id: &str,
lsn: &str,
ts_ms: i64,
) -> Option<TransactionEvent>
pub async fn begin_transaction( &self, txn_id: &str, lsn: &str, ts_ms: i64, ) -> Option<TransactionEvent>
Register transaction begin.
Returns BEGIN event if emission is enabled.
Sourcepub async fn track_event(
&self,
txn_id: &str,
data_collection: &str,
ts_ms: i64,
) -> Option<TransactionContext>
pub async fn track_event( &self, txn_id: &str, data_collection: &str, ts_ms: i64, ) -> Option<TransactionContext>
Track an event within a transaction.
Returns (total_order, data_collection_order) for event enrichment. Returns None if transaction not found.
Sourcepub async fn end_transaction(
&self,
txn_id: &str,
ts_ms: i64,
) -> Option<TransactionEvent>
pub async fn end_transaction( &self, txn_id: &str, ts_ms: i64, ) -> Option<TransactionEvent>
End a transaction and emit END event.
Returns END event if emission is enabled.
Sourcepub async fn in_flight_count(&self) -> usize
pub async fn in_flight_count(&self) -> usize
Get number of in-flight transactions.
Sourcepub async fn clear_in_flight(&self)
pub async fn clear_in_flight(&self)
Clear all in-flight transactions (e.g., on reconnect).
Sourcepub async fn enrich_event(&self, event: &mut CdcEvent) -> bool
pub async fn enrich_event(&self, event: &mut CdcEvent) -> bool
Enrich a CDC event with transaction context.
Modifies the event’s transaction metadata in place.
Trait Implementations§
Source§impl Clone for TransactionTopicEmitter
impl Clone for TransactionTopicEmitter
Auto Trait Implementations§
impl Freeze for TransactionTopicEmitter
impl !RefUnwindSafe for TransactionTopicEmitter
impl Send for TransactionTopicEmitter
impl Sync for TransactionTopicEmitter
impl Unpin for TransactionTopicEmitter
impl UnsafeUnpin for TransactionTopicEmitter
impl !UnwindSafe for TransactionTopicEmitter
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