-
Notifications
You must be signed in to change notification settings - Fork 298
Expand file tree
/
Copy pathinterceptor.go
More file actions
741 lines (619 loc) · 26.6 KB
/
interceptor.go
File metadata and controls
741 lines (619 loc) · 26.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
package internal
import (
"context"
"time"
"github.com/nexus-rpc/sdk-go/nexus"
commonpb "go.temporal.io/api/common/v1"
enumspb "go.temporal.io/api/enums/v1"
updatepb "go.temporal.io/api/update/v1"
"go.temporal.io/sdk/converter"
"go.temporal.io/sdk/internal/common/metrics"
"go.temporal.io/sdk/log"
)
// Interceptor is a common interface for all interceptors. See documentation in
// the interceptor package for more details.
//
// Exposed as: [go.temporal.io/sdk/interceptor.Interceptor]
type Interceptor interface {
ClientInterceptor
WorkerInterceptor
}
// WorkerInterceptor is a common interface for all interceptors. See
// documentation in the interceptor package for more details.
//
// Exposed as: [go.temporal.io/sdk/interceptor.WorkerInterceptor]
type WorkerInterceptor interface {
// InterceptActivity is called before each activity interception needed with
// the next interceptor in the chain.
InterceptActivity(ctx context.Context, next ActivityInboundInterceptor) ActivityInboundInterceptor
// InterceptWorkflow is called before each workflow interception needed with
// the next interceptor in the chain.
InterceptWorkflow(ctx Context, next WorkflowInboundInterceptor) WorkflowInboundInterceptor
InterceptNexusOperation(ctx context.Context, next NexusOperationInboundInterceptor) NexusOperationInboundInterceptor
mustEmbedWorkerInterceptorBase()
}
// ActivityInboundInterceptor is an interface for all activity calls originating
// from the server. See documentation in the interceptor package for more
// details.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ActivityInboundInterceptor]
type ActivityInboundInterceptor interface {
// Init is the first call of this interceptor. Implementations can change/wrap
// the outbound interceptor before calling Init on the next interceptor.
Init(outbound ActivityOutboundInterceptor) error
// ExecuteActivity is called when an activity is to be run on this worker.
// interceptor.Header will return a non-nil map for this context.
ExecuteActivity(ctx context.Context, in *ExecuteActivityInput) (interface{}, error)
mustEmbedActivityInboundInterceptorBase()
}
// ExecuteActivityInput is the input to ActivityInboundInterceptor.ExecuteActivity.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ExecuteActivityInput]
type ExecuteActivityInput struct {
Args []interface{}
}
// ActivityOutboundInterceptor is an interface for all activity calls
// originating from the SDK. See documentation in the interceptor package for
// more details.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ActivityOutboundInterceptor]
type ActivityOutboundInterceptor interface {
// GetInfo intercepts activity.GetInfo.
GetInfo(ctx context.Context) ActivityInfo
// GetLogger intercepts activity.GetLogger.
GetLogger(ctx context.Context) log.Logger
// GetMetricsHandler intercepts activity.GetMetricsHandler.
GetMetricsHandler(ctx context.Context) metrics.Handler
// RecordHeartbeat intercepts activity.RecordHeartbeat.
RecordHeartbeat(ctx context.Context, details ...interface{})
// HasHeartbeatDetails intercepts activity.HasHeartbeatDetails.
HasHeartbeatDetails(ctx context.Context) bool
// GetHeartbeatDetails intercepts activity.GetHeartbeatDetails.
GetHeartbeatDetails(ctx context.Context, d ...interface{}) error
// GetWorkerStopChannel intercepts activity.GetWorkerStopChannel.
GetWorkerStopChannel(ctx context.Context) <-chan struct{}
// GetClient intercepts activity.GetClient.
GetClient(ctx context.Context) Client
mustEmbedActivityOutboundInterceptorBase()
}
// WorkflowInboundInterceptor is an interface for all workflow calls originating
// from the server. See documentation in the interceptor package for more
// details.
//
// Exposed as: [go.temporal.io/sdk/interceptor.WorkflowInboundInterceptor]
type WorkflowInboundInterceptor interface {
// Init is the first call of this interceptor. Implementations can change/wrap
// the outbound interceptor before calling Init on the next interceptor.
Init(outbound WorkflowOutboundInterceptor) error
// ExecuteWorkflow is called when a workflow is to be run on this worker.
// interceptor.WorkflowHeader will return a non-nil map for this context.
ExecuteWorkflow(ctx Context, in *ExecuteWorkflowInput) (interface{}, error)
// HandleSignal is called when a signal is sent to a workflow on this worker.
// interceptor.WorkflowHeader will return a non-nil map for this context.
HandleSignal(ctx Context, in *HandleSignalInput) error
// HandleQuery is called when a query is sent to a workflow on this worker.
// interceptor.WorkflowHeader will return a non-nil map for this context.
HandleQuery(ctx Context, in *HandleQueryInput) (interface{}, error)
// ValidateUpdate is always called prior to executing an update, even if the
// update handler for in.Name was not registered with a validation function
// as part of its optional configuration. The same prohibition against
// mutating workflow state that is demanded of UpdateOptions.Validator
// functions also applies to this function.
ValidateUpdate(ctx Context, in *UpdateInput) error
// ExecuteUpdate is called after ValidateUpdate if and only if the latter
// returns nil. interceptor.WorkflowHeader will return a non-nil map for
// this context. ExecuteUpdate is allowed to mutate workflow state and
// perform workflow actions such as scheduling activities, timers, etc.
ExecuteUpdate(ctx Context, in *UpdateInput) (interface{}, error)
mustEmbedWorkflowInboundInterceptorBase()
}
// ExecuteWorkflowInput is the input to
// WorkflowInboundInterceptor.ExecuteWorkflow.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ExecuteWorkflowInput]
type ExecuteWorkflowInput struct {
Args []interface{}
}
// HandleSignalInput is the input to WorkflowInboundInterceptor.HandleSignal.
//
// Exposed as: [go.temporal.io/sdk/interceptor.HandleSignalInput]
type HandleSignalInput struct {
SignalName string
// Arg is the signal argument. It is presented as a primitive payload since
// the type needed for decode is not available at the time of interception.
Arg *commonpb.Payloads
}
// UpdateInput carries the name and arguments of a workflow update invocation.
//
// Exposed as: [go.temporal.io/sdk/interceptor.UpdateInput]
type UpdateInput struct {
Name string
Args []interface{}
}
// HandleQueryInput is the input to WorkflowInboundInterceptor.HandleQuery.
//
// Exposed as: [go.temporal.io/sdk/interceptor.HandleQueryInput]
type HandleQueryInput struct {
QueryType string
Args []interface{}
}
// ExecuteNexusOperationInput is the input to WorkflowOutboundInterceptor.ExecuteNexusOperation.
//
// NOTE: Experimental
//
// Exposed as: [go.temporal.io/sdk/interceptor.ExecuteNexusOperationInput]
type ExecuteNexusOperationInput struct {
// Client to start the operation with.
Client NexusClient
// Operation name or OperationReference from the Nexus SDK.
Operation any
// Operation input.
Input any
// Options for starting the operation.
Options NexusOperationOptions
// Header to attach to the request.
NexusHeader nexus.Header
}
// RequestCancelNexusOperationInput is the input to WorkflowOutboundInterceptor.RequestCancelNexusOperation.
//
// NOTE: Experimental
//
// Exposed as: [go.temporal.io/sdk/interceptor.RequestCancelNexusOperationInput]
type RequestCancelNexusOperationInput struct {
// Client that was used to start the operation.
Client NexusClient
// Operation name or OperationReference from the Nexus SDK.
Operation any
// Operation Token. May be empty if the operation is synchronous or has not started yet.
Token string
// seq number. For internal use only.
seq int64
}
// WorkflowOutboundInterceptor is an interface for all workflow calls
// originating from the SDK. See documentation in the interceptor package for
// more details.
//
// Exposed as: [go.temporal.io/sdk/interceptor.WorkflowOutboundInterceptor]
type WorkflowOutboundInterceptor interface {
// Go intercepts workflow.Go.
Go(ctx Context, name string, f func(ctx Context)) Context
// Await intercepts workflow.Await.
Await(ctx Context, condition func() bool) error
// AwaitWithTimeout intercepts workflow.AwaitWithTimeout.
AwaitWithTimeout(ctx Context, timeout time.Duration, condition func() bool) (bool, error)
// AwaitWithOptions intercepts workflow.AwaitWithOptions.
//
// NOTE: Experimental
AwaitWithOptions(ctx Context, options AwaitOptions, condition func() bool) (bool, error)
// ExecuteActivity intercepts workflow.ExecuteActivity.
// interceptor.WorkflowHeader will return a non-nil map for this context.
ExecuteActivity(ctx Context, activityType string, args ...interface{}) Future
// ExecuteLocalActivity intercepts workflow.ExecuteLocalActivity.
// interceptor.WorkflowHeader will return a non-nil map for this context.
ExecuteLocalActivity(ctx Context, activityType string, args ...interface{}) Future
// ExecuteChildWorkflow intercepts workflow.ExecuteChildWorkflow.
// interceptor.WorkflowHeader will return a non-nil map for this context.
ExecuteChildWorkflow(ctx Context, childWorkflowType string, args ...interface{}) ChildWorkflowFuture
// GetInfo intercepts workflow.GetInfo.
GetInfo(ctx Context) *WorkflowInfo
// GetTypedSearchAttributes intercepts workflow.GetTypedSearchAttributes.
GetTypedSearchAttributes(ctx Context) SearchAttributes
// GetCurrentUpdateInfo intercepts workflow.GetCurrentUpdateInfo.
GetCurrentUpdateInfo(ctx Context) *UpdateInfo
// GetLogger intercepts workflow.GetLogger.
GetLogger(ctx Context) log.Logger
// GetMetricsHandler intercepts workflow.GetMetricsHandler.
GetMetricsHandler(ctx Context) metrics.Handler
// Now intercepts workflow.Now.
Now(ctx Context) time.Time
// NewTimer intercepts workflow.NewTimer.
NewTimer(ctx Context, d time.Duration) Future
// NewTimer intercepts workflow.NewTimerWithOptions.
//
// NOTE: Experimental
NewTimerWithOptions(ctx Context, d time.Duration, options TimerOptions) Future
// Sleep intercepts workflow.Sleep.
Sleep(ctx Context, d time.Duration) (err error)
// RequestCancelExternalWorkflow intercepts
// workflow.RequestCancelExternalWorkflow.
RequestCancelExternalWorkflow(ctx Context, workflowID, runID string) Future
// SignalExternalWorkflow intercepts workflow.SignalExternalWorkflow.
// interceptor.WorkflowHeader will return a non-nil map for this context.
SignalExternalWorkflow(ctx Context, workflowID, runID, signalName string, arg interface{}) Future
// SignalWithStartWorkflow intercepts workflow.SignalWithStartWorkflow.
// interceptor.WorkflowHeader will return a non-nil map for this context.
SignalWithStartWorkflow(
ctx Context,
workflowID string,
signalName string,
signalArg interface{},
options StartWorkflowOptions,
workflowType string,
workflowArgs ...interface{},
) Future
// SignalChildWorkflow intercepts
// workflow.ChildWorkflowFuture.SignalChildWorkflow.
// interceptor.WorkflowHeader will return a non-nil map for this context.
SignalChildWorkflow(ctx Context, workflowID, signalName string, arg interface{}) Future
// UpsertSearchAttributes intercepts workflow.UpsertSearchAttributes.
UpsertSearchAttributes(ctx Context, attributes map[string]interface{}) error
// UpsertTypedSearchAttributes intercepts workflow.UpsertTypedSearchAttributes.
UpsertTypedSearchAttributes(ctx Context, attributes ...SearchAttributeUpdate) error
// UpsertMemo intercepts workflow.UpsertMemo.
UpsertMemo(ctx Context, memo map[string]interface{}) error
// GetSignalChannel intercepts workflow.GetSignalChannel.
GetSignalChannel(ctx Context, signalName string) ReceiveChannel
// GetSignalChannelWithOptions intercepts workflow.GetSignalChannelWithOptions.
//
// NOTE: Experimental
GetSignalChannelWithOptions(ctx Context, signalName string, options SignalChannelOptions) ReceiveChannel
// SideEffect intercepts workflow.SideEffect.
SideEffect(ctx Context, f func(ctx Context) interface{}) converter.EncodedValue
// SideEffectWithOptions intercepts workflow.SideEffectWithOptions.
SideEffectWithOptions(ctx Context, options SideEffectOptions, f func(ctx Context) interface{}) converter.EncodedValue
// MutableSideEffect intercepts workflow.MutableSideEffect.
MutableSideEffect(
ctx Context,
id string,
f func(ctx Context) interface{},
equals func(a, b interface{}) bool,
) converter.EncodedValue
// MutableSideEffectWithOptions intercepts workflow.MutableSideEffectWithOptions.
MutableSideEffectWithOptions(
ctx Context,
id string,
options MutableSideEffectOptions,
f func(ctx Context) interface{},
equals func(a, b interface{}) bool,
) converter.EncodedValue
// GetVersion intercepts workflow.GetVersion.
GetVersion(ctx Context, changeID string, minSupported, maxSupported Version) Version
// SetQueryHandler intercepts workflow.SetQueryHandler.
SetQueryHandler(ctx Context, queryType string, handler interface{}) error
// SetQueryHandlerWithOptions intercepts workflow.SetQueryHandlerWithOptions.
//
// NOTE: Experimental
SetQueryHandlerWithOptions(ctx Context, queryType string, handler interface{}, options QueryHandlerOptions) error
// SetUpdateHandler intercepts workflow.SetUpdateHandler.
SetUpdateHandler(ctx Context, updateName string, handler interface{}, opts UpdateHandlerOptions) error
// IsReplaying intercepts workflow.IsReplaying.
IsReplaying(ctx Context) bool
// HasLastCompletionResult intercepts workflow.HasLastCompletionResult.
HasLastCompletionResult(ctx Context) bool
// GetLastCompletionResult intercepts workflow.GetLastCompletionResult.
GetLastCompletionResult(ctx Context, d ...interface{}) error
// GetLastError intercepts workflow.GetLastError.
GetLastError(ctx Context) error
// NewContinueAsNewError intercepts workflow.NewContinueAsNewError.
// interceptor.WorkflowHeader will return a non-nil map for this context.
NewContinueAsNewError(ctx Context, wfn interface{}, args ...interface{}) error
// ExecuteNexusOperation intercepts NexusClient.ExecuteOperation.
//
// NOTE: Experimental
ExecuteNexusOperation(ctx Context, input ExecuteNexusOperationInput) NexusOperationFuture
// RequestCancelNexusOperation intercepts Nexus Operation cancellation via context.
//
// NOTE: Experimental
RequestCancelNexusOperation(ctx Context, input RequestCancelNexusOperationInput)
mustEmbedWorkflowOutboundInterceptorBase()
}
// ClientInterceptor for providing a ClientOutboundInterceptor to intercept
// certain workflow-specific client calls from the SDK. See documentation in the
// interceptor package for more details.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientInterceptor]
type ClientInterceptor interface {
// This is called on client creation if set via client options
InterceptClient(next ClientOutboundInterceptor) ClientOutboundInterceptor
mustEmbedClientInterceptorBase()
}
// ClientOutboundInterceptor is an interface for certain workflow-specific calls
// originating from the SDK. See documentation in the interceptor package for
// more details.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientOutboundInterceptor]
type ClientOutboundInterceptor interface {
// ExecuteWorkflow intercepts client.Client.ExecuteWorkflow.
// interceptor.Header will return a non-nil map for this context.
ExecuteWorkflow(context.Context, *ClientExecuteWorkflowInput) (WorkflowRun, error)
// CreateSchedule - Intercept a service call to CreateSchedule
CreateSchedule(ctx context.Context, options *ScheduleClientCreateInput) (ScheduleHandle, error)
// SignalWorkflow intercepts client.Client.SignalWorkflow.
// interceptor.Header will return a non-nil map for this context.
SignalWorkflow(context.Context, *ClientSignalWorkflowInput) error
// SignalWithStartWorkflow intercepts client.Client.SignalWithStartWorkflow.
// interceptor.Header will return a non-nil map for this context.
SignalWithStartWorkflow(context.Context, *ClientSignalWithStartWorkflowInput) (WorkflowRun, error)
// CancelWorkflow intercepts client.Client.CancelWorkflow.
CancelWorkflow(context.Context, *ClientCancelWorkflowInput) error
// TerminateWorkflow intercepts client.Client.TerminateWorkflow.
TerminateWorkflow(context.Context, *ClientTerminateWorkflowInput) error
// QueryWorkflow intercepts client.Client.QueryWorkflow.
// If the query is rejected, QueryWorkflow will return an QueryRejectedError
// interceptor.Header will return a non-nil map for this context.
QueryWorkflow(context.Context, *ClientQueryWorkflowInput) (converter.EncodedValue, error)
// UpdateWorkflow intercepts client.Client.UpdateWorkflow
// interceptor.Header will return a non-nil map for this context.
UpdateWorkflow(context.Context, *ClientUpdateWorkflowInput) (WorkflowUpdateHandle, error)
// UpdateWithStartWorkflow intercepts client.Client.UpdateWithStartWorkflow.
UpdateWithStartWorkflow(context.Context, *ClientUpdateWithStartWorkflowInput) (WorkflowUpdateHandle, error)
// PollWorkflowUpdate requests the outcome of a specific update from the
// server.
PollWorkflowUpdate(context.Context, *ClientPollWorkflowUpdateInput) (*ClientPollWorkflowUpdateOutput, error)
// DescribeWorkflow intercepts client.Client.DescribeWorkflow.
DescribeWorkflow(context.Context, *ClientDescribeWorkflowInput) (*ClientDescribeWorkflowOutput, error)
// ExecuteActivity intercepts client.Client.ExecuteActivity.
//
// NOTE: Experimental
ExecuteActivity(context.Context, *ClientExecuteActivityInput) (ClientActivityHandle, error)
// GetActivityHandle intercepts client.Client.GetActivityHandle.
// While the interceptor is allowed to make network calls here, note that the base implementation does not - it only constructs
// the handle which is then used to make network calls. There is no context object provided and errors cannot be returned.
//
// NOTE: Experimental
GetActivityHandle(*ClientGetActivityHandleInput) ClientActivityHandle
// CancelActivity intercepts client.ActivityHandle.Cancel.
//
// NOTE: Experimental
CancelActivity(context.Context, *ClientCancelActivityInput) error
// TerminateActivity intercepts client.ActivityHandle.Terminate.
//
// NOTE: Experimental
TerminateActivity(context.Context, *ClientTerminateActivityInput) error
// DescribeActivity intercepts client.ActivityHandle.Describe.
//
// NOTE: Experimental
DescribeActivity(context.Context, *ClientDescribeActivityInput) (*ClientDescribeActivityOutput, error)
// PollActivityResult intercepts client.ActivityHandle.Get.
//
// NOTE: Experimental
PollActivityResult(context.Context, *ClientPollActivityResultInput) (*ClientPollActivityResultOutput, error)
mustEmbedClientOutboundInterceptorBase()
}
// ClientUpdateWorkflowInput is the input to
// ClientOutboundInterceptor.UpdateWorkflow
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientUpdateWorkflowInput]
type ClientUpdateWorkflowInput struct {
UpdateID string
WorkflowID string
UpdateName string
Args []interface{}
RunID string
FirstExecutionRunID string
WaitForStage WorkflowUpdateStage
}
// Exposed as: [go.temporal.io/sdk/interceptor.ClientUpdateWithStartWorkflowInput]
type ClientUpdateWithStartWorkflowInput struct {
UpdateOptions *UpdateWorkflowOptions
StartWorkflowOperation WithStartWorkflowOperation
}
// ClientPollWorkflowUpdateInput is the input to
// ClientOutboundInterceptor.PollWorkflowUpdate.
type ClientPollWorkflowUpdateInput struct {
UpdateRef *updatepb.UpdateRef
}
// ClientPollWorkflowUpdateOutput is the output to
// ClientOutboundInterceptor.PollWorkflowUpdate.
type ClientPollWorkflowUpdateOutput struct {
// Result is the result of the update, if it has completed successfully.
Result converter.EncodedValue
// Error is the result of a failed update.
Error error
}
// ScheduleClientCreateInput is the input to
// ClientOutboundInterceptor.CreateSchedule.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ScheduleClientCreateInput]
type ScheduleClientCreateInput struct {
Options *ScheduleOptions
}
// ClientExecuteWorkflowInput is the input to
// ClientOutboundInterceptor.ExecuteWorkflow.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientExecuteWorkflowInput]
type ClientExecuteWorkflowInput struct {
Options *StartWorkflowOptions
WorkflowType string
Args []interface{}
}
// ClientSignalWorkflowInput is the input to
// ClientOutboundInterceptor.SignalWorkflow.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientSignalWorkflowInput]
type ClientSignalWorkflowInput struct {
WorkflowID string
RunID string
SignalName string
Arg interface{}
}
// ClientSignalWithStartWorkflowInput is the input to
// ClientOutboundInterceptor.SignalWithStartWorkflow.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientSignalWithStartWorkflowInput]
type ClientSignalWithStartWorkflowInput struct {
SignalName string
SignalArg interface{}
Options *StartWorkflowOptions
WorkflowType string
Args []interface{}
}
// ClientCancelWorkflowInput is the input to
// ClientOutboundInterceptor.CancelWorkflow.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientCancelWorkflowInput]
type ClientCancelWorkflowInput struct {
WorkflowID string
RunID string
}
// ClientTerminateWorkflowInput is the input to
// ClientOutboundInterceptor.TerminateWorkflow.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientTerminateWorkflowInput]
type ClientTerminateWorkflowInput struct {
WorkflowID string
RunID string
Reason string
Details []interface{}
}
// ClientQueryWorkflowInput is the input to
// ClientOutboundInterceptor.QueryWorkflow.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientQueryWorkflowInput]
type ClientQueryWorkflowInput struct {
WorkflowID string
RunID string
QueryType string
Args []interface{}
QueryRejectCondition enumspb.QueryRejectCondition
}
// ClientDescribeWorkflowInput is the input to
// ClientOutboundInterceptor.DescribeWorkflow.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientDescribeWorkflowInput]
type ClientDescribeWorkflowInput struct {
WorkflowID string
RunID string
}
// ClientDescribeWorkflowOutput is the output to
// ClientOutboundInterceptor.DescribeWorkflow.
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientDescribeWorkflowOutput]
type ClientDescribeWorkflowOutput struct {
Response *WorkflowExecutionDescription
}
// ClientExecuteActivityInput is the input to
// ClientOutboundInterceptor.ExecuteActivity.
//
// NOTE: Experimental
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientExecuteActivityInput]
type ClientExecuteActivityInput struct {
Options *ClientStartActivityOptions
ActivityType string
Args []interface{}
}
// ClientGetActivityHandleInput is the input to
// ClientOutboundInterceptor.GetActivityHandle.
//
// NOTE: Experimental
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientGetActivityHandleInput]
type ClientGetActivityHandleInput struct {
ActivityID string
RunID string
}
// ClientCancelActivityInput is the input to
// ClientOutboundInterceptor.CancelActivity.
//
// NOTE: Experimental
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientCancelActivityInput]
type ClientCancelActivityInput struct {
ActivityID string
RunID string
Reason string
}
// ClientTerminateActivityInput is the input to
// ClientOutboundInterceptor.TerminateActivity.
//
// NOTE: Experimental
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientTerminateActivityInput]
type ClientTerminateActivityInput struct {
ActivityID string
RunID string
Reason string
}
// ClientDescribeActivityInput is the input to
// ClientOutboundInterceptor.DescribeActivity.
//
// NOTE: Experimental
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientDescribeActivityInput]
type ClientDescribeActivityInput struct {
ActivityID string
RunID string
}
// ClientDescribeActivityOutput is the output of
// ClientOutboundInterceptor.DescribeActivity.
//
// NOTE: Experimental
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientDescribeActivityOutput]
type ClientDescribeActivityOutput struct {
Description *ClientActivityExecutionDescription
}
// ClientPollActivityResultInput is the input to
// ClientOutboundInterceptor.PollActivityResult.
//
// NOTE: Experimental
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientPollActivityResultInput]
type ClientPollActivityResultInput struct {
ActivityID string
RunID string
}
// ClientPollActivityResultOutput is the output of
// ClientOutboundInterceptor.PollActivityResult.
//
// NOTE: Experimental
//
// Exposed as: [go.temporal.io/sdk/interceptor.ClientPollActivityResultOutput]
type ClientPollActivityResultOutput struct {
// Result is the result of the update, if it has completed successfully.
Result converter.EncodedValue
// Error is the result of a failed update.
Error error
}
// NexusOutboundInterceptor intercepts Nexus operation method invocations. See documentation in the interceptor package
// for more details.
//
// Exposed as: [go.temporal.io/sdk/interceptor.NexusOperationInboundInterceptor]
//
// NOTE: Experimental
type NexusOperationInboundInterceptor interface {
// Init is the first call of this interceptor. Implementations can change/wrap
// the outbound interceptor before calling Init on the next interceptor.
Init(ctx context.Context, outbound NexusOperationOutboundInterceptor) error
// StartOperation intercepts inbound Nexus StartOperation calls.
StartOperation(ctx context.Context, input NexusStartOperationInput) (nexus.HandlerStartOperationResult[any], error)
// StartOperation intercepts inbound Nexus CancelOperation calls.
CancelOperation(ctx context.Context, input NexusCancelOperationInput) error
mustEmbedNexusOperationInboundInterceptorBase()
}
// NexusOperationOutboundInterceptor intercepts methods exposed in the temporalnexus package. See documentation in the
// interceptor package for more details.
//
// Exposed as: [go.temporal.io/sdk/interceptor.NexusOperationOutboundInterceptor]
//
// Note: Experimental
type NexusOperationOutboundInterceptor interface {
// GetOperationInfo intercepts temporalnexus.GetOperationInfo.
GetOperationInfo(ctx context.Context) NexusOperationInfo
// GetClient intercepts temporalnexus.GetClient.
GetClient(ctx context.Context) Client
// GetLogger intercepts temporalnexus.GetLogger.
GetLogger(ctx context.Context) log.Logger
// GetMetricsHandler intercepts temporalnexus.GetMetricsHandler.
GetMetricsHandler(ctx context.Context) metrics.Handler
mustEmbedNexusOperationOutboundInterceptorBase()
}
// NexusStartOperationInput is the input to NexusOperationInboundInterceptor.StartOperation.
//
// Exposed as: [go.temporal.io/sdk/interceptor.NexusStartOperationInput]
//
// Note: Experimental
type NexusStartOperationInput struct {
Input any
Options nexus.StartOperationOptions
}
// NexusCancelOperationInput is the input to NexusOperationInboundInterceptor.CancelOperation.
//
// Exposed as: [go.temporal.io/sdk/interceptor.NexusCancelOperationInput]
//
// Note: Experimental
type NexusCancelOperationInput struct {
Token string
Options nexus.CancelOperationOptions
}