OxL Справочник OxL
РусскийEnglish

fn emitInOf

emit inside atomic(db): the element is written to the outbox of the transaction's shard and published after the commit.

Example:

oxl✓ проверяется в CI
use std.orm { Db }

@table("orders")
data Order {
  @pk id: i64
  userId: u64
}

data OrderPlaced { id: i64 }

topic OrderEvents: OrderPlaced

cluster demo {
  role store { journal }
}

// inside atomic(db) the event goes to the outbox of the transaction and is published after the commit
fn place(db: Db, o: Order) db {
  atomic(db) {
    db.insert(o)
    emit OrderEvents(OrderPlaced{ id: o.id })
  }
}
pub(api) fn emitInOf<T: Serializable>(dbh: i64, h: i64, x: &T, key: bytes) -> ()  db

Потокобезопасность. the outbox belongs to the transaction; the element becomes visible to subscribers only after the commit.

С версии. 1.0.0-beta

Параметры

ИмяТип
dbhi64
hi64
x&T
keybytes

Возвращает

()

Эффекты

db

Определено в: std/topic/topic.oxl:371

См. также