@@ -267,8 +267,8 @@ type NexusClient interface {
267
267
ExecuteOperation (ctx Context , operation any, input any, options NexusOperationOptions ) NexusOperationFuture
268
268
}
269
269
270
- // Create a [NexusClient] from a service name and an endpoint name.
271
- func NewNexusClient (service , endpoint string ) NexusClient
270
+ // Create a [NexusClient] from an endpoint name and a service name.
271
+ func NewNexusClient (endpoint , service string ) NexusClient
272
272
```
273
273
274
274
**Usage**:
@@ -282,7 +282,7 @@ import (
282
282
)
283
283
284
284
func MyCallerWorkflow(ctx workflow.Context) (MyOutput, error) {
285
- client := workflow.NewNexusClient (" payments" , " prod- payments" )
285
+ client := workflow.NewNexusClient (ctx, " prod- payments" , " payments" )
286
286
fut := client.ExecuteOperation (ctx, " start-transaction" , MyInput{ID: " tx-deadbeef" }, workflow.NexusOperationOptions {
287
287
ScheduleToCloseTimeout: time.Hour ,
288
288
})
@@ -303,8 +303,8 @@ More interceptors are likely to come later.
303
303
304
304
``` go
305
305
type WorkflowOutboundInterceptor interface {
306
- NewNexusClient (service, endpoint string ) workflow.NexusClient
307
- RequestCancelNexusOperation (ctx Context , service , operation, id string , options nexus.CancelOperationOptions ) error
306
+ ExecuteNexusOperation (ctx workflow. Context , client workflow.NexusClient , operation any, input any, options NexusOperationOptions )
307
+ RequestCancelNexusOperation (ctx workflow. Context , client workflow. NexusClient , operation any , id string , options nexus.CancelOperationOptions ) error
308
308
}
309
309
```
310
310
@@ -327,6 +327,7 @@ sequenceDiagram
327
327
UserHandler-->>HandlerWorker: OperationID
328
328
HandlerWorker-->>HandlerTemporal: RespondNexusTaskCompleted(OperationID)
329
329
HandlerTemporal-->>CallerTemporal: OperationID
330
+ CallerTemporal->>CallerTemporal: Record NexusOperationStarted(OperationID)
330
331
end
331
332
CallerWorker->>CallerTemporal: PollWorkflowTaskQueue
332
333
CallerTemporal-->>CallerWorker: Workflow Task (NexusOperationStarted)
@@ -339,6 +340,7 @@ sequenceDiagram
339
340
ArbitraryHandlerWorker->>HandlerTemporal: RespondWorkflowTaskCompleted<br>(WorkflowExecutionCompleted)
340
341
HandlerTemporal-->>ArbitraryHandlerWorker: OK
341
342
HandlerTemporal->>CallerTemporal: POST callback with operation (workflow) result
343
+ CallerTemporal->>CallerTemporal: Record NexusOperationCompleted
342
344
CallerTemporal-->>HandlerTemporal: OK
343
345
CallerWorker->>CallerTemporal: PollWorkflowTaskQueue
344
346
CallerTemporal-->>CallerWorker: Workflow Task (NexusOperationCompleted)
@@ -362,6 +364,7 @@ sequenceDiagram
362
364
UserHandler-->>HandlerWorker: Result
363
365
HandlerWorker-->>HandlerTemporal: RespondNexusTaskCompleted(Result)
364
366
HandlerTemporal-->>CallerTemporal: Result
367
+ CallerTemporal->>CallerTemporal: Record NexusOperationCompleted
365
368
end
366
369
CallerWorker->>CallerTemporal: PollWorkflowTaskQueue
367
370
CallerTemporal-->>CallerWorker: Workflow Task (NexusOperationCompleted)
0 commit comments