kw on
Contextual keyword — pipeline steps (§10.6)
The list of words: §1.4
Syntax
ActorMember = { Attr } ( "var" Ident ":" Type "=" Expr | "dep" Ident ":" Type
| "msg" Ident "(" [ Params ] ")" [ "->" Type ] Block
| "on" ( "activate" | "passivate" ) Block ) ;PStep = ( "respond" Expr | Expr ) [ "on" Ident ] [ "durable" | "best_effort" ] ;Suffix = "within" Binary | "retry" Binary [ "on" Type ] [ "backoff" Binary ] ;Grammar: App. A
Defined in
- 12.5 Sharded actors — The key is declared in the header (sharded by name
- 10.6 Pipelines — A pipeline is a linear chain of steps, each of which runs on its own node; data is passed from node to node directly, the caller receives on
- 1.4 Keywords — Reserved (cannot be used as names)
- 8.4 Chains — A chain links asynchronous steps so that either the whole chain is executed or the first unhandled error is returned.
- 14.2 Dynamic configuration — dynamic Name { …
- 12.1 Cluster declaration — A program has at most one cluster.
- 12.3 Routing and neighbour discovery — A call of service S
Examples
@idle(ACCOUNT_IDLE)
actor Account sharded by id: AccountId {
var balance: Money = Money.zero()
@transient var hits: u64 = 0
on activate { log.debug("account {id} up") }
msg deposit(x: Money) { balance += x }
msg balance() -> Money { balance }
}
Account(id).deposit(amount)pipeline uploadPhoto(img: Image) -> PhotoId {
validate
-> Store.put(it) on storage
-> respond it.id
-> resize(it, THUMB_SIZES) on gpu
-> moderate on ml durable
-> SearchIndex.add(it)
} on_error(e, step) { Dlq.push(e, step) }Related diagnostics
actor-not-hosted, pipeline-idempotency, respond-twice, respond-type, unknown-role, it-outside-chain, cluster-auth, cluster-decl, cluster-needs, cluster-seeds, placement-conflict, saga-without-role, service-not-served, topic-without-journal