relationship %MasterPendingResponses as array of Ens.BP.MasterPendingResponse [ SqlFieldName = MasterPendingResponses , InitialExpression = $listbuild("Ens.BP.MasterPendingResponse","%BusinessProcess",+$this,"children",1,1) , Transient , Inverse = %BusinessProcess , Cardinality = children ];
When an async request is made that requires a response the BP
records the request header Id, Completion key, whether the request
is a timer and optional list of completion keys needed for synchronizing
calls.
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.
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. Note this setting is separate from the Retry property.
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 subject to the Retry
property value set in the code. If the Retry property is set in the code then moving on to try the next message will be subject to
the configured RetryInterval and FailureTimeout.
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 Process first retries to send
the message until FailureTimeout and then, if the error continues, it disables the Process instead of failing. Any other errors will
cause the Process to fail processing of the current message and return the error status to the caller, without retrying first
unless the property Retry has been set to true by the Process code.
The default behavior is equivalent to 'E=F'. If the Retry property has been set by the Process code then retrying will be subject to
the configured RetryInterval and FailureTimeout.
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.
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
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()
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.
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.
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 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
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
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.
Indexes
index (IDKEY on ) [IdKey, Type = key];
Index methods: IDKEYCheck(), IDKEYDelete(), IDKEYExists(), IDKEYOpen(), IDKEYSQLCheckUnique(), IDKEYSQLExists(), IDKEYSQLFindPKeyByConstraint(), IDKEYSQLFindRowIDByConstraint()