evoq_fact behaviour (evoq v1.14.1)
View SourceFact behavior for evoq.
Facts are integration artifacts that cross bounded context boundaries. They translate domain events into serializable payloads for external consumption via pg (local) or mesh (WAN).
Key differences from domain events: - Binary keys (JSON-safe), not atom keys - Explicit public contract, not internal implementation detail - May have different structure/name than the source event - Versioned independently from the domain event
Required Callbacks
- fact_type() -> binary() - from_event(EventType, EventData, Metadata) -> {ok, Payload} | skip
Optional Callbacks
- 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.