angzarr_client.router.server¶
gRPC servicer adapters for the unified runtime routers.
Async (grpc.aio) wrappers that plug a CommandHandlerRouter /
SagaRouter / ProcessManagerRouter / ProjectorRouter /
UpcasterRouter into the corresponding generated gRPC servicer
class. Each adapter:
Delegates the
HandleRPC to the router’s.dispatchmethod (the dispatch layer is sync compute — runs inside the async handler withoutawait).Translates
CommandRejectedErrorto gRPCFAILED_PRECONDITION.Translates
DispatchErrorto its carriedgrpc.StatusCode.
Audit #68 design call: async-native servicers (replaces the prior
sync grpcio.server shape). The dispatch layer stays synchronous —
it’s pure compute and runs fine inside an async handler.
Classes¶
gRPC adapter for a unified |
|
gRPC adapter for a unified |
|
gRPC adapter for a unified |
|
gRPC adapter for a unified |
|
gRPC adapter for a unified |
Module Contents¶
- class angzarr_client.router.server.CommandHandlerGrpc(router: Any)¶
Bases:
angzarr_client.proto.angzarr.command_handler_pb2_grpc.CommandHandlerServiceServicergRPC adapter for a unified
CommandHandlerRouter.Audit #45: implements all three RPCs declared by the proto:
Handle(always functional),HandleFact(gated on whether the aggregate declared any@handles_factmethods), andReplay(gated on whether the aggregate opted in via@command_handler(supports_replay=True)).- async Handle(request: angzarr_client.proto.angzarr.types_pb2.ContextualCommand, context: grpc.aio.ServicerContext) angzarr_client.proto.angzarr.command_handler_pb2.BusinessResponse¶
Process command and return business response (events or revocation request)
- async HandleFact(request: angzarr_client.proto.angzarr.command_handler_pb2.FactRequest, context: grpc.aio.ServicerContext) angzarr_client.proto.angzarr.types_pb2.EventBook¶
Process fact events - update aggregate state based on external realities. Optional: if unimplemented, facts are persisted as-is (pass-through).
- async Replay(request: angzarr_client.proto.angzarr.command_handler_pb2.ReplayRequest, context: grpc.aio.ServicerContext) angzarr_client.proto.angzarr.command_handler_pb2.ReplayResponse¶
Replay events to compute state (for conflict detection) Optional: only needed if aggregate supports MERGE_COMMUTATIVE
- class angzarr_client.router.server.SagaGrpc(router: Any)¶
Bases:
angzarr_client.proto.angzarr.saga_pb2_grpc.SagaServiceServicergRPC adapter for a unified
SagaRouter.- async Handle(request: angzarr_client.proto.angzarr.saga_pb2.SagaHandleRequest, context: grpc.aio.ServicerContext) angzarr_client.proto.angzarr.saga_pb2.SagaResponse¶
Translate source events into commands for target domains. Commands use angzarr_deferred — framework stamps explicit sequences on delivery.
- class angzarr_client.router.server.ProcessManagerGrpc(router: Any)¶
Bases:
angzarr_client.proto.angzarr.process_manager_pb2_grpc.ProcessManagerServiceServicergRPC adapter for a unified
ProcessManagerRouter.- async Handle(request: angzarr_client.proto.angzarr.process_manager_pb2.ProcessManagerHandleRequest, context: grpc.aio.ServicerContext) angzarr_client.proto.angzarr.process_manager_pb2.ProcessManagerHandleResponse¶
Handle with trigger + process state. Returns commands for other aggregates and events for the PM’s own domain.
PMs do not rebuild destination aggregate state — they translate events into commands/facts and rely on destination_sequences for command stamping. See process manager design philosophy.
- class angzarr_client.router.server.ProjectorGrpc(router: Any)¶
Bases:
angzarr_client.proto.angzarr.projector_pb2_grpc.ProjectorServiceServicergRPC adapter for a unified
ProjectorRouter.- async Handle(request: angzarr_client.proto.angzarr.types_pb2.EventBook, context: grpc.aio.ServicerContext) angzarr_client.proto.angzarr.types_pb2.Projection¶
Async projection - projector should persist and return
- async HandleSpeculative(request: angzarr_client.proto.angzarr.types_pb2.EventBook, context: grpc.aio.ServicerContext) angzarr_client.proto.angzarr.types_pb2.Projection¶
Speculative processing - projector must avoid external side effects
- class angzarr_client.router.server.UpcasterGrpc(router: Any)¶
Bases:
angzarr_client.proto.angzarr.upcaster_pb2_grpc.UpcasterServiceServicergRPC adapter for a unified
UpcasterRouter.- async Upcast(request: angzarr_client.proto.angzarr.upcaster_pb2.UpcastRequest, context: grpc.aio.ServicerContext) angzarr_client.proto.angzarr.upcaster_pb2.UpcastResponse¶
Transform events to current version Returns events in same order, transformed where applicable