Learning
Documentation
Community
Open Exchange
Global Masters
Home > Class Reference > ENSLIB namespace > Ens.BusinessProcess
Private  Storage   

Ens.BusinessProcess


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

Inventory


Parameters Properties Methods Queries Indices ForeignKeys Triggers
2 30 36 2


Summary


This is a Business Process class.

RequestResponse
%Library.Persistent %Library.Persistent

Properties
%ActionHint %Concurrency %ConfigName %ConfigQueueName
%CurrentResponseHeader %IsCompleted %IsTerminated %IsTimerInterrupted
%LastActionTime %LastHandledTime %LastReportedError %MasterPendingResponses
%MasterPendingResponsesOld %MessagesReceived %MessagesReceivedOld %MessagesSent
%MessagesSentOld %PrimaryRequestHeader %PrimaryResponseHeader %QuitTask
%RepliedStatus %SessionId %StatusCode %SuperSession
%TimeCompleted %TimeCreated %WarnedLatest %isShadow
%request %response %responseClassName %responseId
Adapter AlertGroups AlertOnError AlertRetryGracePeriod
BusinessPartner FailureTimeout InactivityTimeout QueueCountAlert
QueueWaitAlert ReplyCodeActions Retry RetryInterval
SuspendMessage ThrottleDelay

Methods
%%OIDGet %1Check %AddJrnObjToSyncSet %AddToSaveSet
%AddToSyncSet %BMEBuilt %BindExport %BuildIndices
%BuildIndicesAsync %BuildIndicesAsyncResponse %BuildIndicesSegment %BuildObjectGraph
%CheckConstraints %CheckConstraintsForExtent %ClassIsLatestVersion %ClassName
%Close %ComposeOid %ConstructClone %Delete
%DeleteExtent %DeleteId %DispatchClassMethod %DispatchGetModified
%DispatchGetProperty %DispatchMethod %DispatchSetModified %DispatchSetMultidimProperty
%DispatchSetProperty %DowngradeConcurrency %ExecuteAfterTriggers %ExecuteBeforeTriggers
%Exists %ExistsId %Extends %FileIndices
%FileIndicesBuffered %GUID %GUIDSet %GetLock
%GetParameter %GetSwizzleObject %Id %IncrementCount
%InsertBatch %IsA %IsModified %IsNull
%JournalObject %KillExtent %KillExtentData %LoadFromMemory
%LockExtent %LockId %New %NormalizeObject
%ObjectIsNull %ObjectModified %Oid %OnBeforeAddToSync
%OnClose %OnDetermineClass %OnNew %Open
%OpenId %OriginalNamespace %PackageName %PhysicalAddress
%PurgeIndices %Reload %RemoveFromSaveSet %ResolveConcurrencyConflict
%RollBack %SQLAcquireLock %SQLAcquireTableLock %SQLAfterTriggers
%SQLBeforeTriggers %SQLBuildIndices %SQLBuildPurgeIndexForRow %SQLBuildPurgeIndices
%SQLCheckUnique %SQLCheckUniqueIndices %SQLCheckUniqueKeys %SQLCopyIcolIntoName
%SQLCopyNameIntoIcol %SQLCreateInsDelTables %SQLDefineiDjVars %SQLDelete
%SQLDeleteChildren %SQLDeleteTempStreams %SQLEExit %SQLExists
%SQLFKeyDelLock %SQLFastInsert %SQLFieldValidate %SQLGetLock
%SQLGetOld %SQLGetOldAll %SQLGetOldIndex %SQLInsert
%SQLInsertComputes %SQLInsertStreams %SQLInvalid %SQLInvalid2
%SQLMVDelete %SQLMVIndexDelete %SQLMVIndexInsert %SQLMVIndexUpdate
%SQLMVInsert %SQLMVUpdate %SQLMissing %SQLNormalizeCompFields
%SQLNormalizeFields %SQLPurgeIndices %SQLQuickBulkInsert %SQLQuickBulkLoad
%SQLQuickBulkSave %SQLQuickBulkUpdate %SQLQuickDelete %SQLQuickDeleteChildren
%SQLQuickFindPKeyByRowID %SQLQuickFindRowIDByPKey %SQLQuickInsert %SQLQuickLoad
%SQLQuickLoadChildren %SQLQuickLogicalToOdbc %SQLQuickOdbcToLogical %SQLQuickUpdate
%SQLReleaseLock %SQLReleaseTableLock %SQLStorageValidation %SQLTrigDelTab
%SQLTrigInsTab %SQLUnlock %SQLUnlock2 %SQLUnlockError
%SQLUnlockRef %SQLUpdate %SQLUpdateComputes %SQLUpdateStreams
%SQLValidateCompFields %SQLValidateFields %SQLicompView %SQLnBuild
%Save %SaveDirect %SaveIndices %SerializeObject
%SetModified %SortBegin %SortEnd %SuperSessionSet
%SyncObjectIn %SyncTransport %UnlockExtent %UnlockId
%UpgradeConcurrency %ValidateIndices %ValidateObject %requestGet
%responseGet %responseSet AdapterName AssignOneSetting
ClearAllPendingResponses DeferResponse EnumerateSettingsClose EnumerateSettingsExecute
EnumerateSettingsFetch EvalInitialExpression GenerateSuperSession GetDeferredResponseToken
GetMessageList GetProductionSettingValue GetProductionSettings GetPropertyConnections
GetRequestClassList GetResponseClassList GetSettings GetShadowInstance
IsResponsePending MessageHeaderHandler OnComplete OnError
OnErroredResponse OnFailureTimeout OnGenerateSuperSession OnGetConnections
OnGetReplyAction OnInit OnKeepalive OnMonitor
OnProductionStart OnProductionStop OnRequest OnResponse
OnTask OnTearDown OnTimeout Purge
QueueName RemovePendingResponse Reply ReplyError
SendAlert SendDeferredResponse SendRequestAsync SendRequestAsyncInternal
SendRequestSync SendRequestSyncMultiple SetTimer WillHandleErroredResponse
acceptRequestAsync acceptRequestSync doReplyAction finalReplyAction
findCachedObject getId initConfig inprocRequest
makeConnections queueRequestAsync queueRequestSync

Subclasses
Ens.Alerting.BaseProcess Ens.BusinessProcessBPL Ens.ScheduleHandler
EnsLib.MsgRouter.RoutingEngine EnsLib.PEX.BusinessProcess EnsLib.PrivateSession.Process
EnsLib.Testing.Process EnsLib.ebXML.Process.MessageService

Parameters


• parameter SETTINGS = "-ThrottleDelay,ReplyCodeActions,RetryInterval,AlertRetryGracePeriod:Alerting,FailureTimeout,QueueCountAlert:Alerting,QueueWaitAlert:Alerting";
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 %ActionHint  [ MultiDimensional,Transient ];
Subclasses can store hint values here for use in determining what ReplyCodeAction to apply
• property %CurrentResponseHeader as Ens.MessageHeader [ Transient ];
• property %IsCompleted as %Boolean [ InitialExpression = 0 ];
• property %IsTerminated as %Boolean [ InitialExpression = 0 ];
• property %IsTimerInterrupted as %Boolean [ InitialExpression = 0 ];
• property %MasterPendingResponses as list of %String(MAXLEN="") [ SqlFieldName = MasterPendingResponses ];
• property %MasterPendingResponsesOld as list of %String(MAXLEN="");
This property maps to the old storage location of %MasterPendingResponses
• property %MessagesReceived as list of %String(MAXLEN="") [ SqlFieldName = MessagesReceived ];
• property %MessagesReceivedOld as list of %String(MAXLEN="");
This property maps to the old storage location of %MessagesReceived
• property %MessagesSent as list of %String(MAXLEN="") [ SqlFieldName = MessagesSent ];
• property %MessagesSentOld as list of %String(MAXLEN="");
This property maps to the old storage location of %MessagesSent
• property %PrimaryRequestHeader as Ens.MessageHeader;
protected properties
• property %PrimaryResponseHeader as Ens.MessageHeader;
• property %RepliedStatus as %Integer [ InitialExpression = $$$eRepliedStatusNotCalled ];
• property %StatusCode as %Status [ InitialExpression = $$$OK ];
• property %TimeCompleted as Ens.DataType.UTC;
• property %TimeCreated as Ens.DataType.UTC;
• 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 %responseId as %String(COLLATION="EXACT",MAXLEN="");
• 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 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 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 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 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 Retry as %Boolean [ InitialExpression = 0 ];
Set this property to 1 if you want to retry the current message again
• property RetryInterval as %Numeric(MINVAL=0) [ InitialExpression = 5 ];
How frequently to retry access to the output system
• property SuspendMessage as %Boolean [ InitialExpression = 0 ];
Set this property to 1 if you want to mark the current message as "Suspended"
• property ThrottleDelay as %Numeric [ InitialExpression = 0,Transient ];
Duration of forced idleness before processing the next message, in milliseconds

Methods


• private method %OnAddToSaveSet(depth As %Integer = 3, insert As %Integer = 0, callcount As %Integer = 0) as %Status
This callback method is invoked by the %AddToSaveSet method to provide notification that the current object is being included in a SaveSet, either because %Save() was invoked on this object or an object that references this object.

If this method returns an error status then %Save() will fail and the transaction will be rolled back.

• private method %OnOpen() as %Status
This callback method is invoked by the %Open method to provide notification that the object specified by oid is being opened.

If this method returns an error then the object will not be opened.

• method %requestGet()
This is a Get accessor method for the %request property.
• method %responseGet()
This is a Get accessor method for the %response property.
• method %responseSet(pResponse As %Library.Persistent) as %Status
This is a Set accessor method for the %response property.
• 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
• classmethod GetMessageList() as %String
• classmethod GetRequestClassList() as %String
• classmethod GetResponseClassList(pRequest As %String = "") as %String
• method IsResponsePending(pCompletionKey As %String) as %Boolean
Determine if a CompletionKey exists in the %MasterPendingResponses
• method MessageHeaderHandler(pRequestHeader As Ens.MessageHeader, Output pResponseHeader As Ens.MessageHeader, Output pResponseIsError) as %Status
This method is for internal use - called for InProc from inprocRequest() or for Queued BPs from the Actor's MessageHeaderHandler()
• 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
For custom coded Business Processes that do not sub class Ens.BusinessProcessBPL it is also possible to use WillHandleErroredResponse and OnErroredResponse
• method OnErroredResponse(pErroredResponseStatus As %Status, request As %Library.Persistent, ByRef response As %Library.Persistent, pCompletionKey As %String) as %Status
Handle an errored 'Response'.
Do not implement this method in custom code if sub classing Ens.BusinessProcessBPL since BPLs implement this method using automatic code generation.
If WillHandleErroredResponse returns true then the response will be given to this method and not OnResponse.
OnError is called before WillHandleErroredResponse is checked.
• 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 OnTask() as %Status
Event loop for Actor and BusinessOperation. This is called only when INVOCATION is Queue.
• method OnTimeout(request As %Library.Persistent, ByRef response As %Library.Persistent, callrequest As %Library.Persistent, pCompletionKey As %String) as %Status
• classmethod Purge(Output pDeletedCount As %Integer, pDaysToKeep As %Integer = 7, pKeepIntegrity As %Boolean = 0) 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 a business invocation asynchronously
• method SendRequestAsyncInternal(pTargetDispatchName As %String, pRequest As Request, pResponseRequired As %Boolean = 1, pCompletionKey As %String = "", pIsTimer As %Boolean, pControlledCompletionKeys As %String = "", pDescription As %String = "", pSimSync As %Boolean = 0) as %Status
• 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 a 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
• method WillHandleErroredResponse() as %Boolean
If the response has IsError set to true and this method returns true the response will be handed to OnErroredResponse and not OnResponse.
OnError is called before this return is checked.
Do not implement this method in custom code if sub classing Ens.BusinessProcessBPL since BPLs implement this to always return true.
• method doReplyAction(pAction As %String, pRequest As %Library.Persistent, pResponse As %Library.Persistent, ByRef pSC As %Status) as %Status
Do the specified action for taking care of the message currently being processed
• method finalReplyAction(pAction As %String, pSC As %Status, pFixError As %Boolean) as %String
Do the action specified for when all configured retries have been exhausted
• classmethod findCachedObject(pTargetDispatchName As %String, pInstance As Ens.Host) as %Status
Override to ensure that each time the BusinessProcess is invoked inproc, a new business process object is created.
• method getId() as %String
The same as %Id(), but allocates the Id even if the object hasn't been saved already
• classmethod inprocRequest(pSourceConfigName As %String, pTargetConfigName As %String, pRequest As %Library.Persistent, ByRef pResponse As %Library.Persistent, pReturnQueueName As %String, ByRef pSessionId As %String, pBusinessProcessId As %String, ByRef pRequestHeader As Ens.MessageHeader, pDescription As %String = "", pPriority As Ens.DataType.MessagePriority = $$$eMessagePrioritySync) as %Status
This method is for internal use.

Indices


•index (SessionId on %SessionId);
•index (TimeCreated on %TimeCreated);