class OperationHandler(ABC, Generic[
Known subclasses: nexusrpc.handler._operation_handler.SyncOperationHandler
Base class for an operation handler in a Nexus service implementation.
To define a Nexus operation handler, create a method on your service handler class
that takes self and returns an instance of OperationHandler, and apply
the @nexusrpc.handler.operation_handler decorator.
To create an operation handler that is limited to returning synchronously, use
@nexusrpc.handler.SyncOperationHandler to create the
instance of OperationHandler from the start method.
| Method | cancel |
Cancel the operation. |
| Method | start |
Start the operation, completing either synchronously or asynchronously. |
CancelOperationContext, token: str) -> None | Awaitable[ None]:
¶
nexusrpc.handler._operation_handler.SyncOperationHandlerCancel the operation.
StartOperationContext, input: InputT) -> StartOperationResultSync[ OutputT] | Awaitable[ StartOperationResultSync[ OutputT]] | StartOperationResultAsync | Awaitable[ StartOperationResultAsync]:
¶
nexusrpc.handler._operation_handler.SyncOperationHandlerStart the operation, completing either synchronously or asynchronously.
Returns the result synchronously, or returns an operation token. Which path is taken may be decided at operation handling time.