365
req *workflowservice.StartActivityExecutionRequest,
366
namespaceID namespace.ID,
367
>
) (*workflowservice.StartActivityExecutionRequest, error) {
frontend.go
368
>
// Since validation mutates the request, clone it first so that retries use the original
369
>
// request. However if the client did not set a request ID then set that before cloning so that
370
>
// retries use the same request ID.
371
>
if req.GetRequestId() == "" {
372
req.RequestId = uuid.NewString()
373
}
375
>
activityType := req.ActivityType.GetName()
376
>
377
>
if req.RetryPolicy == nil {
378
req.RetryPolicy = &commonpb.RetryPolicy{}
379
}
380
381
>
if err := validateStartDelay(req.GetStartDelay()); err != nil {
frontend.go
382
return nil, err
383
}
384
>
if req.GetStartDelay().AsDuration() > 0 && !h.config.StartDelayEnabled(req.GetNamespace()) {
frontend.go
385
return nil, serviceerror.NewInvalidArgument("start_delay is not enabled for this namespace")
386
}
387
// TODO(saa): when eager start is supported, deny it if start delay > 0 (same as workflow behavior).
388
389
>
opts := activityOptionsFromStartRequest(req)
frontend.go
390
>
err := ValidateAndNormalizeStandaloneActivity(
391
>
req.ActivityId,
392
>
activityType,
393
>
h.config.DefaultActivityRetryPolicy,
394
>
h.config.MaxIDLengthLimit(),
395
>
namespace.Name(req.GetNamespace()),
396
>
opts,
397
>
req.Priority,
398
>
)
399
>
if err != nil {
400
return nil, err
401
}
402
>
applyActivityOptionsToStartRequest(opts, req)
frontend.go
403
>
404
>
err = validateAndNormalizeStartRequest(
405
>
req,
406
>
h.config.MaxIDLengthLimit(),
407
>
h.config.BlobSizeLimitError,
408
>
h.config.BlobSizeLimitWarn,
409
>
h.logger,
410
>
h.saMapperProvider,
411
>
h.saValidator,
412
>
)
413
>
if err != nil {
414
return nil, err
415
}
416
417
>
if cbs := req.GetCompletionCallbacks(); len(cbs) > 0 {
frontend.go
418
if !h.config.EnableCallbacks(req.GetNamespace()) {
419
return nil, serviceerror.NewInvalidArgument("completion callbacks are not enabled for this namespace")