Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ defmodule Commanded.Application do
"""
@callback dispatch(
command :: struct(),
timeout_or_opts :: non_neg_integer() | :infinity | Keyword.t()
timeout_or_opts :: non_neg_integer() | :infinity | Router.dispatch_options()
) :: Router.dispatch_resp()

@doc false
Expand Down
2 changes: 1 addition & 1 deletion lib/commanded/commands/composite_router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ defmodule Commanded.Commands.CompositeRouter do
"""
@spec dispatch(
command :: struct(),
timeout_or_opts :: non_neg_integer() | :infinity | Keyword.t()
timeout_or_opts :: non_neg_integer() | :infinity | Router.dispatch_options()
) :: Router.dispatch_resp()
def dispatch(command, opts \\ [])

Expand Down
24 changes: 23 additions & 1 deletion lib/commanded/commands/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,33 @@ defmodule Commanded.Commands.Router do
:ok
| {:ok, aggregate_state :: struct()}
| {:ok, aggregate_version :: non_neg_integer()}
| {:ok, events :: [struct()]}
| {:ok, execution_result :: ExecutionResult.t()}
| {:error, :unregistered_command}
| {:error, :consistency_timeout}
| {:error, reason :: term()}

@type dispatch_consistency ::
:eventual | :strong | [module() | String.t()]

@type dispatch_return ::
:aggregate_state | :aggregate_version | :events | :execution_result | false

@type dispatch_option ::
{:application, Commanded.Application.t()}
| {:causation_id, String.t() | nil}
| {:command_uuid, String.t()}
| {:consistency, dispatch_consistency()}
| {:correlation_id, String.t() | nil}
| {:include_aggregate_version, boolean()}
| {:include_execution_result, boolean()}
| {:metadata, map()}
| {:returning, dispatch_return()}
| {:retry_attempts, non_neg_integer() | nil}
| {:timeout, non_neg_integer() | :infinity}

@type dispatch_options :: [dispatch_option()]
Comment thread
yordis marked this conversation as resolved.
Resolved

@doc """
Dispatch the given command to the registered handler.

Expand Down Expand Up @@ -475,7 +497,7 @@ defmodule Commanded.Commands.Router do
"""
@callback dispatch(
command :: struct(),
timeout_or_opts :: non_neg_integer() | :infinity | Keyword.t()
timeout_or_opts :: non_neg_integer() | :infinity | dispatch_options()
) :: dispatch_resp()

defmacro __before_compile__(_env) do
Expand Down
Loading