func (wh *WorkflowHandler) ResetWorkflowExecution(
	ctx context.Context,
	resetRequest *types.ResetWorkflowExecutionRequest,
) (resp *types.ResetWorkflowExecutionResponse, retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)

	scope, sw := wh.startRequestProfileWithDomain(ctx, metrics.FrontendResetWorkflowExecutionScope, resetRequest)
	defer sw.Stop()

	if wh.isShuttingDown() {
		return nil, errShuttingDown
	}

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

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

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

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

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

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

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

	resp, err = wh.GetHistoryClient().ResetWorkflowExecution(ctx, &types.HistoryResetWorkflowExecutionRequest{
		DomainUUID:   domainID,
		ResetRequest: resetRequest,
	})
	if err != nil {
		return nil, wh.error(err, scope, tags...)
	}

	return resp, nil
}
// ResetWorkflowExecution reset an existing workflow execution to the nextFirstEventID
// in the history and immediately terminating the current execution instance.
ResetWorkflowExecution reset an existing workflow execution to the nextFirstEventID
in the history and immediately terminating the current execution instance.
// ResetWorkflowExecution reset an existing workflow execution to the nextFirstEventID // in the history and immediately terminating the current execution instance .
func (wh *WorkflowHandler) ResetWorkflowExecution(
	ctx context.Context,
	resetRequest *types.ResetWorkflowExecutionRequest,
) (resp *types.ResetWorkflowExecutionResponse, retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)
	scope, sw := wh.startRequestProfileWithDomain(ctx, metrics.FrontendResetWorkflowExecutionScope, resetRequest)
	defer sw.Stop()
	if wh.isShuttingDown() {
		return nil, errShuttingDown
	}
	if err := wh.versionChecker.ClientSupported(ctx, wh.config.EnableClientVersionCheck()); err != nil {
		return nil, wh.error(err, scope)
	}
	if resetRequest == nil {
		return nil, wh.error(errRequestNotSet, scope)
	}
	domainName := resetRequest.GetDomain()
	wfExecution := resetRequest.GetWorkflowExecution()
	tags := getDomainWfIDRunIDTags(domainName, wfExecution)
	if domainName == "" {
		return nil, wh.error(errDomainNotSet, scope, tags...)
	}
	if ok := wh.allow(true, resetRequest); !ok {
		return nil, wh.error(createServiceBusyError(), scope, tags...)
	}
	if err := validateExecution(wfExecution); err != nil {
		return nil, wh.error(err, scope, tags...)
	}
	domainID, err := wh.GetDomainCache().GetDomainID(resetRequest.GetDomain())
	if err != nil {
		return nil, wh.error(err, scope, tags...)
	}
	resp, err = wh.GetHistoryClient().ResetWorkflowExecution(ctx, &types.HistoryResetWorkflowExecutionRequest{
		DomainUUID:   domainID,
		ResetRequest: resetRequest,
	})
	if err != nil {
		return nil, wh.error(err, scope, tags...)
	}
	return resp, nil
}
func ( wh * WorkflowHandler ) ResetWorkflowExecution ( ctx context . Context , resetRequest * types . ResetWorkflowExecutionRequest , ) ( resp * types . ResetWorkflowExecutionResponse , retError error ) { defer log . CapturePanic ( wh . GetLogger ( ) , & retError ) scope , sw := wh . startRequestProfileWithDomain ( ctx , metrics . FrontendResetWorkflowExecutionScope , resetRequest ) defer sw . Stop ( ) if wh . isShuttingDown ( ) { return nil , errShuttingDown } if err := wh . versionChecker . ClientSupported ( ctx , wh . config . EnableClientVersionCheck ( ) ) ; err != nil { return nil , wh . error ( err , scope ) } if resetRequest == nil { return nil , wh . error ( errRequestNotSet , scope ) } domainName := resetRequest . GetDomain ( ) wfExecution := resetRequest . GetWorkflowExecution ( ) tags := getDomainWfIDRunIDTags ( domainName , wfExecution ) if domainName == " " { return nil , wh . error ( errDomainNotSet , scope , tags ... ) } if ok := wh . allow ( true , resetRequest ) ; ! ok { return nil , wh . error ( createServiceBusyError ( ) , scope , tags ... ) } if err := validateExecution ( wfExecution ) ; err != nil { return nil , wh . error ( err , scope , tags ... ) } domainID , err := wh . GetDomainCache ( ) . GetDomainID ( resetRequest . GetDomain ( ) ) if err != nil { return nil , wh . error ( err , scope , tags ... ) } resp , err = wh . GetHistoryClient ( ) . ResetWorkflowExecution ( ctx , & types . HistoryResetWorkflowExecutionRequest { DomainUUID : domainID , ResetRequest : resetRequest , } ) if err != nil { return nil , wh . error ( err , scope , tags ... ) } return resp , nil }
ResetWorkflowExecution reset an existing workflow execution to the nextFirstEventID
in the history and immediately terminating the current execution instance.
ResetWorkflowExecution reset an existing workflow execution to the nextFirstEventID in the history and immediately terminating the current execution instance .