View Source X3m.System.Dispatcher (X3m System v0.8.5)
Summary
Functions
Sets message.dry_run
to true
if it was (by default) false
and dispatches service call.
Functions
@spec authorized?(X3m.System.Message.t()) :: boolean() | {:service_unavailable, atom()}
@spec discover_service(X3m.System.Message.t()) :: {:unavailable, X3m.System.Message.t()} | {node() | :local, atom()}
@spec validate(X3m.System.Message.t()) :: X3m.System.Message.t()
Sets message.dry_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.