Skip to content

Commit 6db78a0

Browse files
authored
Minor fixes for Nexus Go SDK proposal (#90)
1 parent 76cf9cb commit 6db78a0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

nexus/sdk-go.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,8 @@ type NexusClient interface {
267267
ExecuteOperation(ctx Context, operation any, input any, options NexusOperationOptions) NexusOperationFuture
268268
}
269269

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
272272
```
273273

274274
**Usage**:
@@ -282,7 +282,7 @@ import (
282282
)
283283

284284
func MyCallerWorkflow(ctx workflow.Context) (MyOutput, error) {
285-
client := workflow.NewNexusClient("payments", "prod-payments")
285+
client := workflow.NewNexusClient(ctx, "prod-payments", "payments")
286286
fut := client.ExecuteOperation(ctx, "start-transaction", MyInput{ID: "tx-deadbeef"}, workflow.NexusOperationOptions{
287287
ScheduleToCloseTimeout: time.Hour,
288288
})
@@ -303,8 +303,8 @@ More interceptors are likely to come later.
303303

304304
```go
305305
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
308308
}
309309
```
310310

@@ -327,6 +327,7 @@ sequenceDiagram
327327
UserHandler-->>HandlerWorker: OperationID
328328
HandlerWorker-->>HandlerTemporal: RespondNexusTaskCompleted(OperationID)
329329
HandlerTemporal-->>CallerTemporal: OperationID
330+
CallerTemporal->>CallerTemporal: Record NexusOperationStarted(OperationID)
330331
end
331332
CallerWorker->>CallerTemporal: PollWorkflowTaskQueue
332333
CallerTemporal-->>CallerWorker: Workflow Task (NexusOperationStarted)
@@ -339,6 +340,7 @@ sequenceDiagram
339340
ArbitraryHandlerWorker->>HandlerTemporal: RespondWorkflowTaskCompleted<br>(WorkflowExecutionCompleted)
340341
HandlerTemporal-->>ArbitraryHandlerWorker: OK
341342
HandlerTemporal->>CallerTemporal: POST callback with operation (workflow) result
343+
CallerTemporal->>CallerTemporal: Record NexusOperationCompleted
342344
CallerTemporal-->>HandlerTemporal: OK
343345
CallerWorker->>CallerTemporal: PollWorkflowTaskQueue
344346
CallerTemporal-->>CallerWorker: Workflow Task (NexusOperationCompleted)
@@ -362,6 +364,7 @@ sequenceDiagram
362364
UserHandler-->>HandlerWorker: Result
363365
HandlerWorker-->>HandlerTemporal: RespondNexusTaskCompleted(Result)
364366
HandlerTemporal-->>CallerTemporal: Result
367+
CallerTemporal->>CallerTemporal: Record NexusOperationCompleted
365368
end
366369
CallerWorker->>CallerTemporal: PollWorkflowTaskQueue
367370
CallerTemporal-->>CallerWorker: Workflow Task (NexusOperationCompleted)

0 commit comments

Comments
 (0)