@@ -336,6 +336,45 @@ func HelloCallerWorkflow(ctx workflow.Context, name string, language service.Lan
336336```
337337<!--SNIPEND-->
338338
339+ ### Set Nexus Operation timeouts
340+
341+ Nexus Operations support [three types of timeouts](/nexus/operations#timeouts) that control how long the caller is willing to wait at different stages of the Operation lifecycle.
342+ Set these timeouts in `NexusOperationOptions` when calling `ExecuteOperation`.
343+
344+ #### Schedule-to-Close timeout
345+
346+ The [Schedule-to-Close timeout](/nexus/operations#schedule-to-close-timeout) limits the total duration of the Operation from when it is scheduled to when it completes.
347+ The Nexus Machinery automatically retries failed requests until this timeout is exceeded.
348+
349+ ```go
350+ fut := c.ExecuteOperation(ctx, service.HelloOperationName, service.HelloInput{Name: name, Language: language}, workflow.NexusOperationOptions{
351+ ScheduleToCloseTimeout: 10 * time.Minute,
352+ })
353+ ```
354+
355+ #### Schedule-to-Start timeout
356+
357+ The [Schedule-to-Start timeout](/nexus/operations#schedule-to-start-timeout) limits how long the caller will wait for the Operation to be started by the handler.
358+ If not set, no Schedule-to-Start timeout is enforced.
359+
360+ ```go
361+ fut := c.ExecuteOperation(ctx, service.HelloOperationName, service.HelloInput{Name: name, Language: language}, workflow.NexusOperationOptions{
362+ ScheduleToStartTimeout: 2 * time.Minute,
363+ })
364+ ```
365+
366+ #### Start-to-Close timeout
367+
368+ The [Start-to-Close timeout](/nexus/operations#start-to-close-timeout) limits how long the caller will wait for an asynchronous Operation to complete after it has been started.
369+ This timeout only applies to asynchronous Operations.
370+ If not set, no Start-to-Close timeout is enforced.
371+
372+ ```go
373+ fut := c.ExecuteOperation(ctx, service.HelloOperationName, service.HelloInput{Name: name, Language: language}, workflow.NexusOperationOptions{
374+ StartToCloseTimeout: 5 * time.Minute,
375+ })
376+ ```
377+
339378### Register the caller Workflow in a Worker
340379
341380After developing the caller Workflow, the next step is to register it with a Worker.
0 commit comments