func (wh *WorkflowHandler) RequestCancelWorkflowExecution(
	ctx context.Context,
	cancelRequest *types.RequestCancelWorkflowExecutionRequest,
) (retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)

	scope, sw := wh.startRequestProfileWithDomain(ctx, metrics.FrontendRequestCancelWorkflowExecutionScope, cancelRequest)
	defer sw.Stop()

	if wh.isShuttingDown() {
		return errShuttingDown
	}

	if err := wh.versionChecker.ClientSupported(ctx, wh.config.EnableClientVersionCheck()); err != nil {
		return wh.error(err, scope)
	}

	if cancelRequest == nil {
		return wh.error(errRequestNotSet, scope)
	}

	domainName := cancelRequest.GetDomain()
	wfExecution := cancelRequest.GetWorkflowExecution()
	tags := getDomainWfIDRunIDTags(domainName, wfExecution)

	if domainName == "" {
		return wh.error(errDomainNotSet, scope, tags...)
	}

	if ok := wh.allow(true, cancelRequest); !ok {
		return wh.error(createServiceBusyError(), scope, tags...)
	}

	if err := validateExecution(wfExecution); err != nil {
		return wh.error(err, scope, tags...)
	}

	domainID, err := wh.GetDomainCache().GetDomainID(cancelRequest.GetDomain())
	if err != nil {
		return wh.error(err, scope, tags...)
	}

	err = wh.GetHistoryClient().RequestCancelWorkflowExecution(ctx, &types.HistoryRequestCancelWorkflowExecutionRequest{
		DomainUUID:    domainID,
		CancelRequest: cancelRequest,
	})
	if err != nil {
		return wh.normalizeVersionedErrors(ctx, wh.error(err, scope, tags...))
	}

	return nil
}
// RequestCancelWorkflowExecution - requests to cancel a workflow execution
requests to cancel a workflow execution
// RequestCancelWorkflowExecution - requests to cancel a workflow execution
func (wh *WorkflowHandler) RequestCancelWorkflowExecution(
	ctx context.Context,
	cancelRequest *types.RequestCancelWorkflowExecutionRequest,
) (retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)
	scope, sw := wh.startRequestProfileWithDomain(ctx, metrics.FrontendRequestCancelWorkflowExecutionScope, cancelRequest)
	defer sw.Stop()
	if wh.isShuttingDown() {
		return errShuttingDown
	}
	if err := wh.versionChecker.ClientSupported(ctx, wh.config.EnableClientVersionCheck()); err != nil {
		return wh.error(err, scope)
	}
	if cancelRequest == nil {
		return wh.error(errRequestNotSet, scope)
	}
	domainName := cancelRequest.GetDomain()
	wfExecution := cancelRequest.GetWorkflowExecution()
	tags := getDomainWfIDRunIDTags(domainName, wfExecution)
	if domainName == "" {
		return wh.error(errDomainNotSet, scope, tags...)
	}
	if ok := wh.allow(true, cancelRequest); !ok {
		return wh.error(createServiceBusyError(), scope, tags...)
	}
	if err := validateExecution(wfExecution); err != nil {
		return wh.error(err, scope, tags...)
	}
	domainID, err := wh.GetDomainCache().GetDomainID(cancelRequest.GetDomain())
	if err != nil {
		return wh.error(err, scope, tags...)
	}
	err = wh.GetHistoryClient().RequestCancelWorkflowExecution(ctx, &types.HistoryRequestCancelWorkflowExecutionRequest{
		DomainUUID:    domainID,
		CancelRequest: cancelRequest,
	})
	if err != nil {
		return wh.normalizeVersionedErrors(ctx, wh.error(err, scope, tags...))
	}
	return nil
}
func ( wh * WorkflowHandler ) RequestCancelWorkflowExecution ( ctx context . Context , cancelRequest * types . RequestCancelWorkflowExecutionRequest , ) ( retError error ) { defer log . CapturePanic ( wh . GetLogger ( ) , & retError ) scope , sw := wh . startRequestProfileWithDomain ( ctx , metrics . FrontendRequestCancelWorkflowExecutionScope , cancelRequest ) defer sw . Stop ( ) if wh . isShuttingDown ( ) { return errShuttingDown } if err := wh . versionChecker . ClientSupported ( ctx , wh . config . EnableClientVersionCheck ( ) ) ; err != nil { return wh . error ( err , scope ) } if cancelRequest == nil { return wh . error ( errRequestNotSet , scope ) } domainName := cancelRequest . GetDomain ( ) wfExecution := cancelRequest . GetWorkflowExecution ( ) tags := getDomainWfIDRunIDTags ( domainName , wfExecution ) if domainName == " " { return wh . error ( errDomainNotSet , scope , tags ... ) } if ok := wh . allow ( true , cancelRequest ) ; ! ok { return wh . error ( createServiceBusyError ( ) , scope , tags ... ) } if err := validateExecution ( wfExecution ) ; err != nil { return wh . error ( err , scope , tags ... ) } domainID , err := wh . GetDomainCache ( ) . GetDomainID ( cancelRequest . GetDomain ( ) ) if err != nil { return wh . error ( err , scope , tags ... ) } err = wh . GetHistoryClient ( ) . RequestCancelWorkflowExecution ( ctx , & types . HistoryRequestCancelWorkflowExecutionRequest { DomainUUID : domainID , CancelRequest : cancelRequest , } ) if err != nil { return wh . normalizeVersionedErrors ( ctx , wh . error ( err , scope , tags ... ) ) } return nil }
requests to cancel a workflow execution
requests to cancel a workflow execution