nexusrpc.handler.MiddlewareSafeOperationHandler
class documentation

class MiddlewareSafeOperationHandler(OperationHandler[Any, Any], ABC):

Known subclasses: nexusrpc.handler._core._EnsuredAwaitableOperationHandler

View In Hierarchy

An OperationHandler where start and cancel can be awaited by an async runtime. It can produce a result synchronously by returning StartOperationResultSync or asynchronously by returning StartOperationResultAsync in the same fashion that OperationHandler does.

Warning

This API is experimental and may change in the future.

@abstractmethod
async def cancel(self, ctx: CancelOperationContext, token: str):

Cancel an in progress operation identified by the given token.

@abstractmethod
async def start(self, ctx: StartOperationContext, input: Any) -> StartOperationResultSync[Any] | StartOperationResultAsync:

Start the operation and return it's result or an async token.