Class Reference
IRIS for UNIX 2019.2
InterSystems: The power behind what matters   
Documentation  Search
  [ENSLIB] >  [Ens] >  [BusinessProcess]
Private  Storage   

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
%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
%AddToSaveSet %AddToSyncSet %BMEBuilt %CheckConstraints
%CheckConstraintsForExtent %ClassIsLatestVersion %ClassName %ComposeOid
%ConstructClone %Delete %DeleteExtent %DeleteId
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Exists
%ExistsId %Extends %GUID %GUIDSet
%GetLock %GetParameter %GetSwizzleObject %Id
%InsertBatch %IsA %IsModified %IsNull
%KillExtent %KillExtentData %LoadFromMemory %LockExtent
%LockId %New %NormalizeObject %ObjectIsNull
%ObjectModified %Oid %OnBeforeAddToSync %OnClose
%OnDetermineClass %OnNew %Open %OpenId
%OriginalNamespace %PackageName %PhysicalAddress %PurgeIndices
%Reload %RemoveFromSaveSet %ResolveConcurrencyConflict %RollBack
%Save %SaveDirect %SaveIndices %SerializeObject
%SetModified %SortBegin %SortEnd %SuperSessionSet
%SyncObjectIn %SyncTransport %UnlockExtent %UnlockId
%ValidateIndices %ValidateObject AdapterName AssignOneSetting
ClearAllPendingResponses DeferResponse EnumerateSettingsClose EnumerateSettingsExecute
EnumerateSettingsFetch GenerateSuperSession GetDeferredResponseToken GetProductionSettingValue
GetProductionSettings GetPropertyConnections GetSettings GetShadowInstance
IsResponsePending OnComplete OnError OnFailureTimeout
OnGenerateSuperSession OnGetConnections OnGetReplyAction OnInit
OnKeepalive OnMonitor OnProductionStart OnProductionStop
OnRequest OnResponse OnTearDown OnTimeout
QueueName RemovePendingResponse Reply ReplyError
SendAlert SendDeferredResponse SendRequestAsync SendRequestSync
SetTimer

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 %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

• 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 a 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 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

Indices

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


Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.