X3m.System.Dispatcher (X3m System v0.8.2) View Source
Link to this section Summary
Functions
Sets message.dru_run
to true
if it was (by default) false
and dispatches service call.
Link to this section Functions
Specs
authorized?(X3m.System.Message.t()) :: boolean() | {:service_unavailable, atom()}
Specs
discover_service(X3m.System.Message.t()) :: {:unavailable, X3m.System.Message.t()} | {node() | :local, atom()}
Specs
validate(X3m.System.Message.t()) :: X3m.System.Message.t()
Sets message.dru_run
to true
if it was (by default) false
and dispatches service call.
Pay attention if you have some side effects (like persistence of unique values in DB)
in your command handling. Such validations should be either avoided or
Aggregate needs to implement rollback/2
and commit/2
callbacks.
If service call is valid, message.response
will be in {:ok, aggregate_version}
format,
otherwise response will have error message as it would have if dispatch was called.