class documentation
class NexusClient(ABC, Generic[
Known subclasses: temporalio.workflow._NexusClient
A client for invoking Nexus operations.
Warning
This API is experimental and unstable.
Example:
nexus_client = workflow.create_nexus_client(
endpoint=my_nexus_endpoint,
service=MyService,
)
handle = await nexus_client.start_operation(
operation=MyService.my_operation,
input=MyOperationInput(value="hello"),
schedule_to_close_timeout=timedelta(seconds=10),
)
result = await handle.result()
| Async Method | execute |
Execute a Nexus operation and return its result. |
| Async Method | start |
Start a Nexus operation and return its handle. |
@overload
@abstractmethod
@abstractmethod
@abstractmethod
@abstractmethod
@abstractmethod
(source) ¶
@abstractmethod
async def execute_operation(self, operation:
@overloadnexusrpc.Operation[ InputT, OutputT], input: InputT, *, output_type: type[ OutputT] | None = None, schedule_to_close_timeout: timedelta | None = None, cancellation_type: NexusOperationCancellationType = NexusOperationCancellationType.WAIT_COMPLETED, headers: Mapping[ str, str] | None = None) -> OutputT:@abstractmethod
async def execute_operation(self, operation:
@overloadstr, input: Any, *, output_type: type[ OutputT] | None = None, schedule_to_close_timeout: timedelta | None = None, cancellation_type: NexusOperationCancellationType = NexusOperationCancellationType.WAIT_COMPLETED, headers: Mapping[ str, str] | None = None) -> OutputT:@abstractmethod
async def execute_operation(self, operation:
@overloadCallable[ [ ServiceHandlerT, temporalio.nexus.WorkflowRunOperationContext, InputT], Awaitable[ temporalio.nexus.WorkflowHandle[ OutputT]]], input: InputT, *, output_type: type[ OutputT] | None = None, schedule_to_close_timeout: timedelta | None = None, cancellation_type: NexusOperationCancellationType = NexusOperationCancellationType.WAIT_COMPLETED, headers: Mapping[ str, str] | None = None) -> OutputT:@abstractmethod
async def execute_operation(self, operation:
@overloadCallable[ [ ServiceT, nexusrpc.handler.StartOperationContext, InputT], Awaitable[ OutputT]], input: InputT, *, output_type: type[ OutputT] | None = None, schedule_to_close_timeout: timedelta | None = None, cancellation_type: NexusOperationCancellationType = NexusOperationCancellationType.WAIT_COMPLETED, headers: Mapping[ str, str] | None = None) -> OutputT:@abstractmethod
async def execute_operation(self, operation:
@abstractmethodCallable[ [ ServiceT, nexusrpc.handler.StartOperationContext, InputT], OutputT], input: InputT, *, output_type: type[ OutputT] | None = None, schedule_to_close_timeout: timedelta | None = None, cancellation_type: NexusOperationCancellationType = NexusOperationCancellationType.WAIT_COMPLETED, headers: Mapping[ str, str] | None = None) -> OutputT:(source) ¶
overridden in
temporalio.workflow._NexusClientExecute a Nexus operation and return its result.
| Parameters | |
operation:Any | The Nexus operation. |
input:Any | The Nexus operation input. |
outputtype[ | The Nexus operation output type. |
scheduletimedelta | None | Timeout for the entire operation attempt. |
cancellationNexusOperationCancellationType | Undocumented |
headers:Mapping[ | Headers to send with the Nexus HTTP request. |
| Returns | |
Any | The operation result. |
@overload
@abstractmethod
@abstractmethod
@abstractmethod
@abstractmethod
@abstractmethod
(source) ¶
@abstractmethod
async def start_operation(self, operation:
@overloadnexusrpc.Operation[ InputT, OutputT], input: InputT, *, output_type: type[ OutputT] | None = None, schedule_to_close_timeout: timedelta | None = None, cancellation_type: NexusOperationCancellationType = NexusOperationCancellationType.WAIT_COMPLETED, headers: Mapping[ str, str] | None = None) -> NexusOperationHandle[ OutputT]:@abstractmethod
async def start_operation(self, operation:
@overloadstr, input: Any, *, output_type: type[ OutputT] | None = None, schedule_to_close_timeout: timedelta | None = None, cancellation_type: NexusOperationCancellationType = NexusOperationCancellationType.WAIT_COMPLETED, headers: Mapping[ str, str] | None = None) -> NexusOperationHandle[ OutputT]:@abstractmethod
async def start_operation(self, operation:
@overloadCallable[ [ ServiceHandlerT, temporalio.nexus.WorkflowRunOperationContext, InputT], Awaitable[ temporalio.nexus.WorkflowHandle[ OutputT]]], input: InputT, *, output_type: type[ OutputT] | None = None, schedule_to_close_timeout: timedelta | None = None, cancellation_type: NexusOperationCancellationType = NexusOperationCancellationType.WAIT_COMPLETED, headers: Mapping[ str, str] | None = None) -> NexusOperationHandle[ OutputT]:@abstractmethod
async def start_operation(self, operation:
@overloadCallable[ [ ServiceHandlerT, nexusrpc.handler.StartOperationContext, InputT], Awaitable[ OutputT]], input: InputT, *, output_type: type[ OutputT] | None = None, schedule_to_close_timeout: timedelta | None = None, cancellation_type: NexusOperationCancellationType = NexusOperationCancellationType.WAIT_COMPLETED, headers: Mapping[ str, str] | None = None) -> NexusOperationHandle[ OutputT]:@abstractmethod
async def start_operation(self, operation:
@abstractmethodCallable[ [ ServiceHandlerT, nexusrpc.handler.StartOperationContext, InputT], OutputT], input: InputT, *, output_type: type[ OutputT] | None = None, schedule_to_close_timeout: timedelta | None = None, cancellation_type: NexusOperationCancellationType = NexusOperationCancellationType.WAIT_COMPLETED, headers: Mapping[ str, str] | None = None) -> NexusOperationHandle[ OutputT]:(source) ¶
overridden in
temporalio.workflow._NexusClientStart a Nexus operation and return its handle.
| Parameters | |
operation:Any | The Nexus operation. |
input:Any | The Nexus operation input. |
outputtype[ | The Nexus operation output type. |
scheduletimedelta | None | Timeout for the entire operation attempt. |
cancellationNexusOperationCancellationType | Undocumented |
headers:Mapping[ | Headers to send with the Nexus HTTP request. |
| Returns | |
Any | A handle to the Nexus operation. The result can be obtained as `python await handle.result() ` |