Keyword
messageActor
Back to Index messageActor(
actorType: text
actorId: uuid|text
messageType: text
spec: value
): value | Error
The messageActor function enables messaging Actors and receiving the response.
Availability
Discount | Rule | Reactor |
---|---|---|
Message Response
The return value from the call mirrors the expected response from the given message. Refer to the message reference for details.
Error Handling
While message format and spec is validated at compile-time, there are many reasons a message might fail. Therefor it’s recommended to handle Error responses separately.
Examples
From the Cookbook:
from orderState match 'pending' |> messageActor ( 'order' orderId 'applyCommands' { commands = [{ type = 'setOrderState' orderState = 'cancelled' }] } ) 'confirmed' |> 'Order is confirmed, no cancellation' 'cancelled' |> 'Order is already cancelled' |> orderState