evoq_hope behaviour (evoq v1.14.1)
View SourceHope behavior for evoq.
Hopes are integration artifacts for outbound RPC requests between agents or bounded contexts. Unlike facts (fire-and-forget), hopes expect a response.
Key characteristics: - Binary keys (JSON-safe), serializable for transport - Represent a request/intention directed at another agent - Cross boundary via mesh RPC or similar transport - Named "hope" because the caller hopes for a response but cannot guarantee one (distributed systems reality)
Required Callbacks
- hope_type() -> binary() - new(Params) -> {ok, Hope} | {error, Reason} - to_payload(Hope) -> map() - from_payload(Payload) -> {ok, Hope} | {error, Reason}
Optional Callbacks
- validate(Hope) -> ok | {error, Reason} - serialize(Payload) -> {ok, binary()} | {error, Reason} - deserialize(Binary) -> {ok, map()} | {error, Reason} - schema() -> map()
Summary
Functions
Default deserialization using OTP 27 json module.
Default serialization using OTP 27 json module.