soma.cell

Events: emit

Events: emit, in the reference of the Soma programming language (soma 3.2.4). A block marked ✓ is a whole program that soma check accepts; the others are excerpts.

In one process, emit trade(data) calls every cell that declares on trade(data: Map), synchronously, inside the emitter's transaction (a listener that raises fails the emitter; the emitter's rollback undoes the listeners' writes). soma check warns when no cell handles the event. Across processes the same statement goes over the signal bus ([peers]), where it is fire-and-forget:

// soma.toml
// [peers]
// exchange = "localhost:8082"

// Send (goes to all peers):
signal order(map("ticker", "BTC", "qty", 1))
// or:
emit trade(fill_data)

// Receive (auto-dispatched from bus):
on trade(data: Map) {
    record_fill(data)
}