MCPcopy Create free account
hub / github.com/Migorithm/rustiful-backend / _commit_hook

Method _commit_hook

library/src/services/unit_of_work.rs:72–88  ·  view source on GitHub ↗

commit_hook is invoked right before the calling for commit which sorts out and processes outboxes and internally processable events.

(&mut self)

Source from the content-addressed store, hash-verified

70 /// commit_hook is invoked right before the calling for commit
71 /// which sorts out and processes outboxes and internally processable events.
72 pub async fn _commit_hook(&mut self) -> ApplicationResult<()> {
73 let event_sender = &mut self.context.write().await.sender;
74 let mut outboxes = vec![];
75
76 for e in self.repository.get_events() {
77 if e.externally_notifiable() {
78 outboxes.push(e.outbox());
79 };
80 if e.internally_notifiable() {
81 event_sender
82 .send(e.message_clone())
83 .await
84 .expect("Event Collecting failed!")
85 }
86 }
87 Outbox::add(self.executor(), outboxes).await
88 }
89}
90
91//TODO Using UOW, transaction handling

Callers 1

commitMethod · 0.80

Calls 5

get_eventsMethod · 0.80
externally_notifiableMethod · 0.80
outboxMethod · 0.80
internally_notifiableMethod · 0.80
executorMethod · 0.45

Tested by

no test coverage detected