func (wh *WorkflowHandler) SignalWorkflowExecution(
	ctx context.Context,
	signalRequest *types.SignalWorkflowExecutionRequest,
) (retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)

	ctx = wh.withSignalName(ctx, signalRequest.GetDomain(), signalRequest.GetSignalName())
	scope, sw := wh.startRequestProfileWithDomain(ctx, metrics.FrontendSignalWorkflowExecutionScope, signalRequest)
	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 signalRequest == nil {
		return wh.error(errRequestNotSet, scope)
	}

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

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

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

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

	idLengthWarnLimit := wh.config.MaxIDLengthWarnLimit()
	if !common.ValidIDLength(
		domainName,
		scope,
		idLengthWarnLimit,
		wh.config.DomainNameMaxLength(domainName),
		metrics.CadenceErrDomainNameExceededWarnLimit,
		domainName,
		wh.GetLogger(),
		tag.IDTypeDomainName) {
		return wh.error(errDomainTooLong, scope, tags...)
	}

	if signalRequest.GetSignalName() == "" {
		return wh.error(errSignalNameNotSet, scope, tags...)
	}

	if !common.ValidIDLength(
		signalRequest.GetSignalName(),
		scope,
		idLengthWarnLimit,
		wh.config.SignalNameMaxLength(domainName),
		metrics.CadenceErrSignalNameExceededWarnLimit,
		domainName,
		wh.GetLogger(),
		tag.IDTypeSignalName) {
		return wh.error(errSignalNameTooLong, scope, tags...)
	}

	if !common.ValidIDLength(
		signalRequest.GetRequestID(),
		scope,
		idLengthWarnLimit,
		wh.config.RequestIDMaxLength(domainName),
		metrics.CadenceErrRequestIDExceededWarnLimit,
		domainName,
		wh.GetLogger(),
		tag.IDTypeRequestID) {
		return wh.error(errRequestIDTooLong, scope, tags...)
	}

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

	sizeLimitError := wh.config.BlobSizeLimitError(domainName)
	sizeLimitWarn := wh.config.BlobSizeLimitWarn(domainName)
	if err := common.CheckEventBlobSizeLimit(
		len(signalRequest.Input),
		sizeLimitWarn,
		sizeLimitError,
		domainID,
		signalRequest.GetWorkflowExecution().GetWorkflowID(),
		signalRequest.GetWorkflowExecution().GetRunID(),
		scope,
		wh.GetThrottledLogger(),
		tag.BlobSizeViolationOperation("SignalWorkflowExecution"),
	); err != nil {
		return wh.error(err, scope, tags...)
	}

	err = wh.GetHistoryClient().SignalWorkflowExecution(ctx, &types.HistorySignalWorkflowExecutionRequest{
		DomainUUID:    domainID,
		SignalRequest: signalRequest,
	})
	if err != nil {
		return wh.normalizeVersionedErrors(ctx, wh.error(err, scope, tags...))
	}

	return nil
}
// SignalWorkflowExecution is used to send a signal event to running workflow execution.  This results in
// WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.
SignalWorkflowExecution is used to send a signal event to running workflow execution.  This results in
WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.
// SignalWorkflowExecution is used to send a signal event to running workflow execution . This results in // WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution .
func (wh *WorkflowHandler) SignalWorkflowExecution(
	ctx context.Context,
	signalRequest *types.SignalWorkflowExecutionRequest,
) (retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)
	ctx = wh.withSignalName(ctx, signalRequest.GetDomain(), signalRequest.GetSignalName())
	scope, sw := wh.startRequestProfileWithDomain(ctx, metrics.FrontendSignalWorkflowExecutionScope, signalRequest)
	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 signalRequest == nil {
		return wh.error(errRequestNotSet, scope)
	}
	domainName := signalRequest.GetDomain()
	wfExecution := signalRequest.GetWorkflowExecution()
	tags := getDomainWfIDRunIDTags(domainName, wfExecution)
	if domainName == "" {
		return wh.error(errDomainNotSet, scope, tags...)
	}
	if ok := wh.allow(true, signalRequest); !ok {
		return wh.error(createServiceBusyError(), scope, tags...)
	}
	if err := validateExecution(wfExecution); err != nil {
		return wh.error(err, scope, tags...)
	}
	idLengthWarnLimit := wh.config.MaxIDLengthWarnLimit()
	if !common.ValidIDLength(
		domainName,
		scope,
		idLengthWarnLimit,
		wh.config.DomainNameMaxLength(domainName),
		metrics.CadenceErrDomainNameExceededWarnLimit,
		domainName,
		wh.GetLogger(),
		tag.IDTypeDomainName) {
		return wh.error(errDomainTooLong, scope, tags...)
	}
	if signalRequest.GetSignalName() == "" {
		return wh.error(errSignalNameNotSet, scope, tags...)
	}
	if !common.ValidIDLength(
		signalRequest.GetSignalName(),
		scope,
		idLengthWarnLimit,
		wh.config.SignalNameMaxLength(domainName),
		metrics.CadenceErrSignalNameExceededWarnLimit,
		domainName,
		wh.GetLogger(),
		tag.IDTypeSignalName) {
		return wh.error(errSignalNameTooLong, scope, tags...)
	}
	if !common.ValidIDLength(
		signalRequest.GetRequestID(),
		scope,
		idLengthWarnLimit,
		wh.config.RequestIDMaxLength(domainName),
		metrics.CadenceErrRequestIDExceededWarnLimit,
		domainName,
		wh.GetLogger(),
		tag.IDTypeRequestID) {
		return wh.error(errRequestIDTooLong, scope, tags...)
	}
	domainID, err := wh.GetDomainCache().GetDomainID(domainName)
	if err != nil {
		return wh.error(err, scope, tags...)
	}
	sizeLimitError := wh.config.BlobSizeLimitError(domainName)
	sizeLimitWarn := wh.config.BlobSizeLimitWarn(domainName)
	if err := common.CheckEventBlobSizeLimit(
		len(signalRequest.Input),
		sizeLimitWarn,
		sizeLimitError,
		domainID,
		signalRequest.GetWorkflowExecution().GetWorkflowID(),
		signalRequest.GetWorkflowExecution().GetRunID(),
		scope,
		wh.GetThrottledLogger(),
		tag.BlobSizeViolationOperation("SignalWorkflowExecution"),
	); err != nil {
		return wh.error(err, scope, tags...)
	}
	err = wh.GetHistoryClient().SignalWorkflowExecution(ctx, &types.HistorySignalWorkflowExecutionRequest{
		DomainUUID:    domainID,
		SignalRequest: signalRequest,
	})
	if err != nil {
		return wh.normalizeVersionedErrors(ctx, wh.error(err, scope, tags...))
	}
	return nil
}
func ( wh * WorkflowHandler ) SignalWorkflowExecution ( ctx context . Context , signalRequest * types . SignalWorkflowExecutionRequest , ) ( retError error ) { defer log . CapturePanic ( wh . GetLogger ( ) , & retError ) ctx = wh . withSignalName ( ctx , signalRequest . GetDomain ( ) , signalRequest . GetSignalName ( ) ) scope , sw := wh . startRequestProfileWithDomain ( ctx , metrics . FrontendSignalWorkflowExecutionScope , signalRequest ) 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 signalRequest == nil { return wh . error ( errRequestNotSet , scope ) } domainName := signalRequest . GetDomain ( ) wfExecution := signalRequest . GetWorkflowExecution ( ) tags := getDomainWfIDRunIDTags ( domainName , wfExecution ) if domainName == " " { return wh . error ( errDomainNotSet , scope , tags ... ) } if ok := wh . allow ( true , signalRequest ) ; ! ok { return wh . error ( createServiceBusyError ( ) , scope , tags ... ) } if err := validateExecution ( wfExecution ) ; err != nil { return wh . error ( err , scope , tags ... ) } idLengthWarnLimit := wh . config . MaxIDLengthWarnLimit ( ) if ! common . ValidIDLength ( domainName , scope , idLengthWarnLimit , wh . config . DomainNameMaxLength ( domainName ) , metrics . CadenceErrDomainNameExceededWarnLimit , domainName , wh . GetLogger ( ) , tag . IDTypeDomainName ) { return wh . error ( errDomainTooLong , scope , tags ... ) } if signalRequest . GetSignalName ( ) == " " { return wh . error ( errSignalNameNotSet , scope , tags ... ) } if ! common . ValidIDLength ( signalRequest . GetSignalName ( ) , scope , idLengthWarnLimit , wh . config . SignalNameMaxLength ( domainName ) , metrics . CadenceErrSignalNameExceededWarnLimit , domainName , wh . GetLogger ( ) , tag . IDTypeSignalName ) { return wh . error ( errSignalNameTooLong , scope , tags ... ) } if ! common . ValidIDLength ( signalRequest . GetRequestID ( ) , scope , idLengthWarnLimit , wh . config . RequestIDMaxLength ( domainName ) , metrics . CadenceErrRequestIDExceededWarnLimit , domainName , wh . GetLogger ( ) , tag . IDTypeRequestID ) { return wh . error ( errRequestIDTooLong , scope , tags ... ) } domainID , err := wh . GetDomainCache ( ) . GetDomainID ( domainName ) if err != nil { return wh . error ( err , scope , tags ... ) } sizeLimitError := wh . config . BlobSizeLimitError ( domainName ) sizeLimitWarn := wh . config . BlobSizeLimitWarn ( domainName ) if err := common . CheckEventBlobSizeLimit ( len ( signalRequest . Input ) , sizeLimitWarn , sizeLimitError , domainID , signalRequest . GetWorkflowExecution ( ) . GetWorkflowID ( ) , signalRequest . GetWorkflowExecution ( ) . GetRunID ( ) , scope , wh . GetThrottledLogger ( ) , tag . BlobSizeViolationOperation ( " " ) , ) ; err != nil { return wh . error ( err , scope , tags ... ) } err = wh . GetHistoryClient ( ) . SignalWorkflowExecution ( ctx , & types . HistorySignalWorkflowExecutionRequest { DomainUUID : domainID , SignalRequest : signalRequest , } ) if err != nil { return wh . normalizeVersionedErrors ( ctx , wh . error ( err , scope , tags ... ) ) } return nil }
SignalWorkflowExecution is used to send a signal event to running workflow execution.
SignalWorkflowExecution is used to send a signal event to running workflow execution .