Ming.Handler (Ming v0.1.1)

View Source

Handler is a process, it allows execution of commands/event.

Telemetry

  • [:ming, :handler, :execute, :start]

    • Description: Emitted when an handler starts executing a request(command/event)
    • Measurements: %{system_time: integer()}
    • Metadata: %{application: Ming.CommandProcessor.t(), caller: pid(), execution_context: Ming.ExecutionContext.t()}
  • [:ming, :handler, :execute, :stop]

    • Description: Emitted when an handler stops executing a request(command/event)
    • Measurements: %{duration: non_neg_integer()}
    • Metadata: %{application: Ming.CommandProcessor.t(), caller: pid(), execution_context: Ming.ExecutionContext.t(), response: [map()], error: nil | any()}
  • [:ming, :handler, :execute, :exception]

    • Description: Emitted when an handler raises an exception
    • Measurements: %{duration: non_neg_integer()}
    • Metadata: %{application: Ming.CommandProcessor.t(), caller: pid(), execution_context: Ming.ExecutionContext.t(), kind: :throw | :error | :exit, reason: any(), stacktrace: list()}

Summary

Functions

Execute the given command against the aggregate.

Functions

execute(application, context, timeout \\ 5000)

Execute the given command against the aggregate.

  • context - includes command execution arguments

    (see Commanded.Aggregates.ExecutionContext for details).

  • timeout - an non-negative integer which specifies how many milliseconds to wait for a reply, or the atom :infinity to wait indefinitely. The default value is five seconds (5,000ms).

Return values

Returns {:ok, response} on success, or {:error, error} on failure.

  • response - response produced by the handler, can be an empty list.