[][src]Module dendrite::axon_utils

Axon Utilities

Module axon_utils exports items that can be used to create a complete Event Sourced CQRS application that uses AxonServer as an event store. The whole back-end can be packaged as a single application, but when growing load or complexity demands it, aspects can be taken out and converted to microservices that can be scaled horizontally.

The basic parts of a dendrite application are:

  • Command API — accepts commands on a gRPC API and forwards them (again over gRPC to AxonServer)
  • Command worker — subscribes to commands, verifies them against the command projection and sends emitted events to AxonServer
  • Event processor — subscribes to events and builds a query model from them (there are likely to be multiple query models for a single application)
  • Query API — accepts queries on a gRPC API and forwards them (again over gRPC to AxonServer)
  • Query processor — subscribes to queries, executes them against a query model and pass back the results

Structs

AggregateDefinition

The complete definition of an aggregate.

AxonConnection

A connection to AxonServer.

AxonServerHandle

A handle for AxonServer.

EmitApplicableEventsAndResponse

Struct that can be returned by a command handler to supply both the events that have to be emitted and the response to the caller.

QueryResult

Carries the result of a query from handler to processor.

TheAggregateRegistry

Concrete struct that implements AggregateRegistry.

TheHandlerRegistry

Concrete struct that implements the HandlerRegistry trait.

Traits

AggregateRegistry

Trait that needs to be implemented by the aggregate registry.

ApplicableTo

Describes a Message that is applicable to a particular projection type.

AsyncApplicableTo

Describes a Message that is asynchronously applicable to a particular projection type.

CommandSink

Trait that is implemented by an object that can be used to send commands to AxonServer.

HandlerRegistry

Describes a registry for handlers for a particular type projection (or context) and a particular return type.

QueryContext

Marker trait that describes the context for a query handler.

QuerySink

Trait that is implemented by an object that can be used to send queries to AxonServer.

TokenStore

Describes a token store.

VecU8Message

Describes a message that can be serialized to a mutable Vec<u8>.

Functions

axon_serialize

Converts a prost::Message to an Axon SerializedObject.

command_worker

Subscribes to commands, verifies them against the command projection and sends emitted events to AxonServer.

create_aggregate_definition

Creates a new aggregate definition as needed by function command_worker.

emit

Adds an event that can be applied to the command projection to be emitted to the result of a command handler.

emit_events

Creates a struct that can be returned by a command handler to supply the events that have to be emitted.

emit_events_and_response

Creates a struct that can be returned by a command handler to supply both the events that have to be emitted and the response to the caller.

empty_aggregate_registry

Creates an empty aggregate registry that can be populated with AggregateHandles (most likely: AggregateDefinitions).

empty_handler_registry

Creates an empty handler registry for a type of projection and a type of return values that can be populated with SubscriptionHandles.

event_processor

Subscribes to events and builds a query model from them.

init_command_sender

Polls AxonServer until it is available and ready.

query_events

Fetch all events for a given aggregate.

query_processor

Subscribes to queries, executes them against a query model and pass back the results.

wait_for_server

Polls AxonServer until it is available and ready.