Raxol.Architecture.CQRS.CommandDispatcher (Raxol v2.0.1)

View Source

Command dispatcher for CQRS pattern implementation.

Handles command routing, middleware processing, and handler management in a functional programming style.

Summary

Functions

Add middleware to the dispatcher.

Returns a specification to start this module under a supervisor.

Dispatch a command through the middleware chain to its handler.

Get dispatcher statistics.

List all registered handlers.

Register a command handler.

Remove middleware from the dispatcher.

Starts the command dispatcher.

Remove a handler for a command.

Types

command()

@type command() :: any()

handler()

@type handler() :: module()

middleware()

@type middleware() :: module()

statistics()

@type statistics() :: %{
  commands_processed: non_neg_integer(),
  commands_failed: non_neg_integer(),
  handlers_registered: non_neg_integer(),
  middleware_count: non_neg_integer()
}

Functions

add_middleware(middleware)

Add middleware to the dispatcher.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

dispatch(command)

Dispatch a command through the middleware chain to its handler.

get_statistics()

Get dispatcher statistics.

list_handlers()

List all registered handlers.

register_handler(command, handler)

Register a command handler.

remove_middleware(middleware)

Remove middleware from the dispatcher.

start_link(opts \\ [])

Starts the command dispatcher.

unregister_handler(command)

Remove a handler for a command.