Skip to main content

Ens.BusinessProcess

persistent class Ens.BusinessProcess extends %Library.Persistent, Ens.Host, Ens.Settings

SQL Table Name: Ens.BusinessProcess

Property Inventory

Method Inventory

Parameters

parameter SETTINGS = -ThrottleDelay,ReplyCodeActions,RetryInterval,AlertRetryGracePeriod:Alerting,FailureTimeout,QueueCountAlert:Alerting,QueueWaitAlert:Alerting;
Inherited description: List of properties can be set as settings in the configuration file format is a comma separated list of property names
parameter SKIPMESSAGEHISTORY = 0;
If this parameter is TRUE, then arrays %MessagesSent and %MessagesReceived will not be populated.

Properties

property %CurrentResponseHeader as Ens.MessageHeader [ Transient ];
Property methods: %CurrentResponseHeaderGet(), %CurrentResponseHeaderGetObject(), %CurrentResponseHeaderGetObjectId(), %CurrentResponseHeaderGetSwizzled(), %CurrentResponseHeaderIsValid(), %CurrentResponseHeaderNewObject(), %CurrentResponseHeaderSet(), %CurrentResponseHeaderSetObject(), %CurrentResponseHeaderSetObjectId(), %CurrentResponseHeaderUnSwizzle()
property %IsCompleted as %Boolean [ InitialExpression = 0 ];
Property methods: %IsCompletedDisplayToLogical(), %IsCompletedGet(), %IsCompletedGetStored(), %IsCompletedIsValid(), %IsCompletedLogicalToDisplay(), %IsCompletedNormalize(), %IsCompletedSet()
property %IsTerminated as %Boolean [ InitialExpression = 0 ];
Property methods: %IsTerminatedDisplayToLogical(), %IsTerminatedGet(), %IsTerminatedGetStored(), %IsTerminatedIsValid(), %IsTerminatedLogicalToDisplay(), %IsTerminatedNormalize(), %IsTerminatedSet()
property %IsTimerInterrupted as %Boolean [ InitialExpression = 0 ];
Property methods: %IsTimerInterruptedDisplayToLogical(), %IsTimerInterruptedGet(), %IsTimerInterruptedGetStored(), %IsTimerInterruptedIsValid(), %IsTimerInterruptedLogicalToDisplay(), %IsTimerInterruptedNormalize(), %IsTimerInterruptedSet()
property %MasterPendingResponses as list of %String) [ SqlFieldName = MasterPendingResponses ];
Property methods: %MasterPendingResponsesBuildValueArray(), %MasterPendingResponsesCollectionToDisplay(), %MasterPendingResponsesCollectionToOdbc(), %MasterPendingResponsesDisplayToCollection(), %MasterPendingResponsesDisplayToLogical(), %MasterPendingResponsesGet(), %MasterPendingResponsesGetObject(), %MasterPendingResponsesGetObjectId(), %MasterPendingResponsesGetStored(), %MasterPendingResponsesGetSwizzled(), %MasterPendingResponsesIsValid(), %MasterPendingResponsesLogicalToDisplay(), %MasterPendingResponsesLogicalToOdbc(), %MasterPendingResponsesNormalize(), %MasterPendingResponsesOdbcToCollection(), %MasterPendingResponsesSet(), %MasterPendingResponsesSetObject(), %MasterPendingResponsesSetObjectId()
property %MasterPendingResponsesOld as list of %String);
This property maps to the old storage location of %MasterPendingResponses
Property methods: %MasterPendingResponsesOldBuildValueArray(), %MasterPendingResponsesOldCollectionToDisplay(), %MasterPendingResponsesOldCollectionToOdbc(), %MasterPendingResponsesOldDisplayToCollection(), %MasterPendingResponsesOldDisplayToLogical(), %MasterPendingResponsesOldGet(), %MasterPendingResponsesOldGetObject(), %MasterPendingResponsesOldGetObjectId(), %MasterPendingResponsesOldGetStored(), %MasterPendingResponsesOldGetSwizzled(), %MasterPendingResponsesOldIsValid(), %MasterPendingResponsesOldLogicalToDisplay(), %MasterPendingResponsesOldLogicalToOdbc(), %MasterPendingResponsesOldNormalize(), %MasterPendingResponsesOldOdbcToCollection(), %MasterPendingResponsesOldSet(), %MasterPendingResponsesOldSetObject(), %MasterPendingResponsesOldSetObjectId()
property %MessagesReceived as list of %String) [ SqlFieldName = MessagesReceived ];
Property methods: %MessagesReceivedBuildValueArray(), %MessagesReceivedCollectionToDisplay(), %MessagesReceivedCollectionToOdbc(), %MessagesReceivedDisplayToCollection(), %MessagesReceivedDisplayToLogical(), %MessagesReceivedGet(), %MessagesReceivedGetObject(), %MessagesReceivedGetObjectId(), %MessagesReceivedGetStored(), %MessagesReceivedGetSwizzled(), %MessagesReceivedIsValid(), %MessagesReceivedLogicalToDisplay(), %MessagesReceivedLogicalToOdbc(), %MessagesReceivedNormalize(), %MessagesReceivedOdbcToCollection(), %MessagesReceivedSet(), %MessagesReceivedSetObject(), %MessagesReceivedSetObjectId()
property %MessagesReceivedOld as list of %String);
This property maps to the old storage location of %MessagesReceived
Property methods: %MessagesReceivedOldBuildValueArray(), %MessagesReceivedOldCollectionToDisplay(), %MessagesReceivedOldCollectionToOdbc(), %MessagesReceivedOldDisplayToCollection(), %MessagesReceivedOldDisplayToLogical(), %MessagesReceivedOldGet(), %MessagesReceivedOldGetObject(), %MessagesReceivedOldGetObjectId(), %MessagesReceivedOldGetStored(), %MessagesReceivedOldGetSwizzled(), %MessagesReceivedOldIsValid(), %MessagesReceivedOldLogicalToDisplay(), %MessagesReceivedOldLogicalToOdbc(), %MessagesReceivedOldNormalize(), %MessagesReceivedOldOdbcToCollection(), %MessagesReceivedOldSet(), %MessagesReceivedOldSetObject(), %MessagesReceivedOldSetObjectId()
property %MessagesSent as list of %String) [ SqlFieldName = MessagesSent ];
Property methods: %MessagesSentBuildValueArray(), %MessagesSentCollectionToDisplay(), %MessagesSentCollectionToOdbc(), %MessagesSentDisplayToCollection(), %MessagesSentDisplayToLogical(), %MessagesSentGet(), %MessagesSentGetObject(), %MessagesSentGetObjectId(), %MessagesSentGetStored(), %MessagesSentGetSwizzled(), %MessagesSentIsValid(), %MessagesSentLogicalToDisplay(), %MessagesSentLogicalToOdbc(), %MessagesSentNormalize(), %MessagesSentOdbcToCollection(), %MessagesSentSet(), %MessagesSentSetObject(), %MessagesSentSetObjectId()
property %MessagesSentOld as list of %String);
This property maps to the old storage location of %MessagesSent
Property methods: %MessagesSentOldBuildValueArray(), %MessagesSentOldCollectionToDisplay(), %MessagesSentOldCollectionToOdbc(), %MessagesSentOldDisplayToCollection(), %MessagesSentOldDisplayToLogical(), %MessagesSentOldGet(), %MessagesSentOldGetObject(), %MessagesSentOldGetObjectId(), %MessagesSentOldGetStored(), %MessagesSentOldGetSwizzled(), %MessagesSentOldIsValid(), %MessagesSentOldLogicalToDisplay(), %MessagesSentOldLogicalToOdbc(), %MessagesSentOldNormalize(), %MessagesSentOldOdbcToCollection(), %MessagesSentOldSet(), %MessagesSentOldSetObject(), %MessagesSentOldSetObjectId()
property %PrimaryRequestHeader as Ens.MessageHeader;
protected properties
Property methods: %PrimaryRequestHeaderGet(), %PrimaryRequestHeaderGetObject(), %PrimaryRequestHeaderGetObjectId(), %PrimaryRequestHeaderGetStored(), %PrimaryRequestHeaderGetSwizzled(), %PrimaryRequestHeaderIsValid(), %PrimaryRequestHeaderNewObject(), %PrimaryRequestHeaderSet(), %PrimaryRequestHeaderSetObject(), %PrimaryRequestHeaderSetObjectId(), %PrimaryRequestHeaderUnSwizzle()
property %PrimaryResponseHeader as Ens.MessageHeader;
Property methods: %PrimaryResponseHeaderGet(), %PrimaryResponseHeaderGetObject(), %PrimaryResponseHeaderGetObjectId(), %PrimaryResponseHeaderGetStored(), %PrimaryResponseHeaderGetSwizzled(), %PrimaryResponseHeaderIsValid(), %PrimaryResponseHeaderNewObject(), %PrimaryResponseHeaderSet(), %PrimaryResponseHeaderSetObject(), %PrimaryResponseHeaderSetObjectId(), %PrimaryResponseHeaderUnSwizzle()
property %RepliedStatus as %Integer [ InitialExpression = $$$eRepliedStatusNotCalled ];
Property methods: %RepliedStatusDisplayToLogical(), %RepliedStatusGet(), %RepliedStatusGetStored(), %RepliedStatusIsValid(), %RepliedStatusLogicalToDisplay(), %RepliedStatusNormalize(), %RepliedStatusSet()
property %StatusCode as %Status [ InitialExpression = $$$OK ];
Property methods: %StatusCodeGet(), %StatusCodeGetStored(), %StatusCodeIsValid(), %StatusCodeLogicalToOdbc(), %StatusCodeSet()
property %TimeCompleted as Ens.DataType.UTC;
Property methods: %TimeCompletedDisplayToLogical(), %TimeCompletedGet(), %TimeCompletedGetStored(), %TimeCompletedIsValid(), %TimeCompletedLogicalToDisplay(), %TimeCompletedLogicalToOdbc(), %TimeCompletedNormalize(), %TimeCompletedOdbcToLogical(), %TimeCompletedSet(), %TimeCompletedStorageToLogical(), %TimeCompletedtimeCmp(), %TimeCompletedtimeDiff(), %TimeCompletedtimeLocal(), %TimeCompletedtimeLocaltoUTC(), %TimeCompletedtimeUTC(), %TimeCompletedtimeUTCH(), %TimeCompletedtimeUTCHtoUTC(), %TimeCompletedtimeUTCtoLocal(), %TimeCompletedtimeUTCtoUTCH()
property %TimeCreated as Ens.DataType.UTC;
Property methods: %TimeCreatedDisplayToLogical(), %TimeCreatedGet(), %TimeCreatedGetStored(), %TimeCreatedIsValid(), %TimeCreatedLogicalToDisplay(), %TimeCreatedLogicalToOdbc(), %TimeCreatedNormalize(), %TimeCreatedOdbcToLogical(), %TimeCreatedSet(), %TimeCreatedStorageToLogical(), %TimeCreatedtimeCmp(), %TimeCreatedtimeDiff(), %TimeCreatedtimeLocal(), %TimeCreatedtimeLocaltoUTC(), %TimeCreatedtimeUTC(), %TimeCreatedtimeUTCH(), %TimeCreatedtimeUTCHtoUTC(), %TimeCreatedtimeUTCtoLocal(), %TimeCreatedtimeUTCtoUTCH()
property %request as %Library.Persistent [ Calculated ];
non-protected properties to be used by subclass methods
property %response as %Library.Persistent [ Calculated ];
non-protected properties to be used by subclass methods
property %responseClassName as %String (MAXLEN = 128);
Property methods: %responseClassNameDisplayToLogical(), %responseClassNameGet(), %responseClassNameGetStored(), %responseClassNameIsValid(), %responseClassNameLogicalToDisplay(), %responseClassNameLogicalToOdbc(), %responseClassNameNormalize(), %responseClassNameSet()
property %responseId as %String (COLLATION = "EXACT");
Property methods: %responseIdDisplayToLogical(), %responseIdGet(), %responseIdGetStored(), %responseIdIsValid(), %responseIdLogicalToDisplay(), %responseIdLogicalToOdbc(), %responseIdNormalize(), %responseIdSet()
property AlertRetryGracePeriod as %Numeric (MINVAL = 0) [ InitialExpression = 0 ];
When AlertOnError is True and the Process is retrying, refrain from alerting if the Process succeeds within this number of seconds after an error
Property methods: AlertRetryGracePeriodDisplayToLogical(), AlertRetryGracePeriodGet(), AlertRetryGracePeriodGetStored(), AlertRetryGracePeriodIsValid(), AlertRetryGracePeriodLogicalToDisplay(), AlertRetryGracePeriodNormalize(), AlertRetryGracePeriodSet()
property FailureTimeout as %Numeric (MINVAL = -1) [ InitialExpression = 15 ];
How long to keep retrying before giving up and returning an error code.
-1 means never give up.
Property methods: FailureTimeoutDisplayToLogical(), FailureTimeoutGet(), FailureTimeoutGetStored(), FailureTimeoutIsValid(), FailureTimeoutLogicalToDisplay(), FailureTimeoutNormalize(), FailureTimeoutSet()
property QueueCountAlert as %Numeric (MINVAL = 0) [ InitialExpression = 0 ];
Number of messages on this item's queue needed to trigger an Alert message to be sent. Note that no further alerts will be sent unless the number of messages on the queue drops below 80% of this number and then rises again to this number.
Note that this alert will be sent even if AlertOnError is False.
Zero means no alerts of this type will be sent.
Property methods: QueueCountAlertDisplayToLogical(), QueueCountAlertGet(), QueueCountAlertGetStored(), QueueCountAlertIsValid(), QueueCountAlertLogicalToDisplay(), QueueCountAlertNormalize(), QueueCountAlertSet()
property QueueWaitAlert as %Numeric (MINVAL = 0) [ InitialExpression = 0 ];
The number of seconds a message at the front of the queue may have waited since being queued before an alert is triggered.
Only one alert will be raised per host item per sequential trigger of the queue wait threshold.
Note that this alert will be sent even if AlertOnError is False.
Zero means no alerts of this type will be sent.
Property methods: QueueWaitAlertDisplayToLogical(), QueueWaitAlertGet(), QueueWaitAlertGetStored(), QueueWaitAlertIsValid(), QueueWaitAlertLogicalToDisplay(), QueueWaitAlertNormalize(), QueueWaitAlertSet()
property ReplyCodeActions as %String (MAXLEN = 1000);

A comma-separated list of codes specifying what action this Process will take on various reply status conditions. The format of the list is:
<code>=<actions>,(<code>,<code>)=<actions>,...
Types of reply status condition are identified by a specification code:

  • E - Error status returned from message handler
  • E#<statuscode> - Error status returned from message handler has status code equal to <statuscode>
  • E*<text> - Error status returned from message handler contains text string <text>
  • X - there is no reply message at all

The following values for <actions> may be used alone or in combinations:

  • C - Treat the message as Completed OK.
  • W - Log a warning. If no other non-warning <actions> are triggered, the message will be treated as Completed OK.
  • R - Retry the message according to the configured RetryInterval and FailureTimeout; finally Fail unless a different action is also specified.
  • S - Suspend the message, log an error, and move on to try the next message.
  • D - Disable the Process, log an error and restore the original incoming message to the front of the Process's queue.
  • F - Fail with an error and move on to try the next message from the Process's queue.
NOTE: the D action can only immediately stop all instances of a Business Process if the BP is configured with PoolSize=1. If PoolSize=0 this action will disable all Business Processes that share the Actor pool.

An example of a valid ReplyCodeActions specification is 'E#6301=R,E#<Ens>ErrGeneral=RD,E=F'. This specification will result in a retry when error code 6301 is encountered. When error code <Ens>ErrGeneral is encountered, the Operation first retries to send the message until FailureTimeout and then, if the error continues, it disables the Operation instead of failing. Any other errors will cause the Operation to fail processing of the current message and return the error status to the caller, without retrying first.

The default behavior is 'E=F'. Thus any error status will result in the error being logged and returned to the caller, no retries will be attempted, and the Process will move on to try the next message from its queue.

All codes where <actions> consists of only 'W' (for 'log a Warning') will be evaluated, and a warning will be generated for each matching <code>. Other <code> values will be evaluated in left-to-right order, executing the first matching <code> that has a non-warning <actions> value. As noted in the details for the 'W' flag, an error that only triggers 'W' <actions> will be treated as Completed OK.

Property methods: ReplyCodeActionsDisplayToLogical(), ReplyCodeActionsGet(), ReplyCodeActionsGetStored(), ReplyCodeActionsIsValid(), ReplyCodeActionsLogicalToDisplay(), ReplyCodeActionsLogicalToOdbc(), ReplyCodeActionsNormalize(), ReplyCodeActionsSet()
property Retry as %Boolean [ InitialExpression = 0 ];
Set this property to 1 if you want to retry the current message again
Property methods: RetryDisplayToLogical(), RetryGet(), RetryGetStored(), RetryIsValid(), RetryLogicalToDisplay(), RetryNormalize(), RetrySet()
property RetryInterval as %Numeric (MINVAL = 0) [ InitialExpression = 5 ];
How frequently to retry access to the output system
Property methods: RetryIntervalDisplayToLogical(), RetryIntervalGet(), RetryIntervalGetStored(), RetryIntervalIsValid(), RetryIntervalLogicalToDisplay(), RetryIntervalNormalize(), RetryIntervalSet()
property SuspendMessage as %Boolean [ InitialExpression = 0 ];
Set this property to 1 if you want to mark the current message as "Suspended"
Property methods: SuspendMessageDisplayToLogical(), SuspendMessageGet(), SuspendMessageGetStored(), SuspendMessageIsValid(), SuspendMessageLogicalToDisplay(), SuspendMessageNormalize(), SuspendMessageSet()
property ThrottleDelay as %Numeric [ InitialExpression = 0 , Transient ];
Inherited description: Duration of forced idleness before processing the next message, in milliseconds
Property methods: ThrottleDelayDisplayToLogical(), ThrottleDelayGet(), ThrottleDelayIsValid(), ThrottleDelayLogicalToDisplay(), ThrottleDelayNormalize(), ThrottleDelaySet()

Methods

method ClearAllPendingResponses()
clear %MasterPendingResponses
method DeferResponse(ByRef pToken As %String) as %Status
This method returns the deferred response token, and marks the current message handling to be deferred After the message is deferred, the current BS will become complete even without the response to be sent
method IsResponsePending(pCompletionKey As %String) as %Boolean
Determine if a CompletionKey exists in the %MasterPendingResponses
method OnComplete(request As %Library.Persistent, ByRef response As %Library.Persistent) as %Status
Called when all the Async responses are received, or timeout has occurred
method OnError(request As %Library.Persistent, ByRef response As %Library.Persistent, callrequest As %Library.Persistent, pErrorStatus As %Status, pCompletionKey As %String) as %Status
This method is called when an error response is received Returning the same error will cause the BusinessProcess to set its status to error and close down Returning $$$OK from this method causes the BusinessProcess to recover from this error
method OnFailureTimeout(pRequest As %Library.Persistent, Output pResponse As %Library.Persistent, ByRef pSC As %Status) as %Boolean
Override this method to provide custom handling of retry / failure timeout.

Set ..Retry=1 to override normal error return and re-evaluate flag properties.

Return 0 to skip further (default) FailureTimeout processing, 1 to perform default processing.

method OnGetReplyAction(pRequest As %Library.Persistent, ByRef pResponse As %Library.Persistent, ByRef pSC As %Status) as %String
Construct and return an Action string consisting of supported action code letters, based on criteria in the ReplyCodeActions setting value and qualities of the current Request, Response, and Error Status.
method OnRequest(request As %Library.Persistent, Output response As %Library.Persistent) as %Status
Handle a 'Request'
method OnResponse(request As %Library.Persistent, ByRef response As %Library.Persistent, callrequest As %Library.Persistent, callresponse As %Library.Persistent, pCompletionKey As %String) as %Status
Handle a 'Response'
method OnTimeout(request As %Library.Persistent, ByRef response As %Library.Persistent, callrequest As %Library.Persistent, pCompletionKey As %String) as %Status
method RemovePendingResponse(pCompletionKey As %String)
remove from %MasterPendingResponses with a CompletionKey
method Reply(response As %Library.Persistent) as %Status
Call this method to send the response to the primary request before the process is finished
method ReplyError(pStatus As %Status) as %Status
Call this method to send an error status to the primary request before the process is finished
method SendAlert(pAlertRequest As Ens.AlertRequest) as %Status
Use this method to send an alert message
method SendRequestAsync(pTargetDispatchName As %String, pRequest As Request, pResponseRequired As %Boolean = 1, pCompletionKey As %String = "", pDescription As %String = "") as %Status
Use this method to dispatch an Ensemble business invocation asynchronously
method SendRequestSync(pTargetDispatchName As %String, pRequest As %Library.Persistent, ByRef pResponse As %Library.Persistent, pTimeout As %Numeric = -1, pDescription As %String = "") as %Status
Use this method to dispatch an Ensemble business invocation synchronously WARNING: Using this method can make your Business Process subject to deadlock if you use this method to invoke another BP and both BPs share the production's common Actor Pool. To avoid such a deadlock, structure your code to use SendRequestAsync() instead of this method, and handle response messages in the OnResponse() callback method. Alternatively, configure the called BP(s) with their own PoolSize > 0 so the main BP won't compete with them for Pool jobs.
method SetTimer(pTimeout As %String, pCompletionKey As %String = "", pControlledCompletionKeys As %String = "*", Output pAlarmHandle As %String, pDescription As %String = "", pIsTimer=1) as %Status
This method set up a timer for how long to wait for pending asynchronous responses

Indexes

index (IDKEY on ) [IdKey, Type = key];
Index methods: IDKEYCheck(), IDKEYDelete(), IDKEYExists(), IDKEYOpen(), IDKEYSQLCheckUnique(), IDKEYSQLExists(), IDKEYSQLFindPKeyByConstraint(), IDKEYSQLFindRowIDByConstraint()
index (SessionId on %SessionId);
Index methods: SessionIdExists()
index (TimeCreated on %TimeCreated);
Index methods: TimeCreatedExists()

Inherited Members

Inherited Properties

Inherited Methods

Storage

Storage Model: CacheStorage (Ens.BusinessProcess)

^Ens.BusinessProcessD(ID,"pending",n)
=
%MasterPendingResponses(n)

Storage Model: CacheStorage (Ens.BusinessProcess)

^Ens.BusinessProcessD(ID,"received",n)
=
%MessagesReceived(n)

Storage Model: CacheStorage (Ens.BusinessProcess)

^Ens.BusinessProcessD(ID,"sent",n)
=
%MessagesSent(n)

Storage Model: CacheStorage (Ens.BusinessProcess)

^Ens.BusinessProcessD(ID)
=
%%CLASSNAME
%ConfigQueueName
%IsCompleted
%MasterPendingResponsesOld
%PrimaryRequestHeader
%PrimaryResponseHeader
%RepliedStatus
%responseId
Adapter
%SessionId
%TimeCompleted
%TimeCreated
%ConfigName
%QuitTask
AlertOnError
%responseClassName
%IsTimerInterrupted
%IsTerminated
%StatusCode
%MessagesReceivedOld
%MessagesSentOld
ReplyCodeActions
RetryInterval
AlertRetryGracePeriod
FailureTimeout
Retry
SuspendMessage
QueueCountAlert
QueueWaitAlert
InactivityTimeout
BusinessPartner
AlertGroups
%SuperSession

Subclasses

FeedbackOpens in a new tab