Home > Class Reference > ENSLIB namespace > EnsLib.MsgRouter.RoutingEngine
Private  Storage   

EnsLib.MsgRouter.RoutingEngine


persistent class EnsLib.MsgRouter.RoutingEngine extends Ens.BusinessProcess

Inventory


Parameters Properties Methods Queries Indices ForeignKeys Triggers
1 25 13


Summary


This is a Business Process class.

RequestResponse
%Library.Persistent %Library.Persistent

Properties
%ConfigName %ConfigQueueName %CurrentResponseHeader %ErrorStatus
%IsCompleted %IsTerminated %IsTimerInterrupted %LastActionTime
%LastHandledTime %LastReportedError %MasterPendingResponses %MasterPendingResponsesOld
%MessagesReceived %MessagesReceivedOld %MessagesSent %MessagesSentOld
%PrimaryRequestHeader %PrimaryResponseHeader %QuitTask %RepliedStatus
%ResponseList %SessionId %StatusCode %SuperSession
%TimeCompleted %TimeCreated %TimedOut %WaitAll
%WarnedLatest %isShadow %request %response
%responseClassName %responseId ActOnTransformError ActOnValidationError
ActionTargets Adapter AlertGroups AlertOnBadMessage
AlertOnError AlertRetryGracePeriod BadMessageHandler BusinessPartner
BusinessRuleName Document FailureTimeout ForceSyncSend
InactivityTimeout MsgClass QueueCountAlert QueueWaitAlert
ReplyCodeActions ResponseFrom ResponseTargetConfigNames ResponseTimeout
Retry RetryInterval RuleActionReason RuleActionUserData
RuleActionUserDataArray RuleLogging RuleReason RuleUserData
Source SuspendMessage ThrottleDelay Validation
aRespFrom

Methods
%AddToSaveSet %AddToSyncSet %BMEBuilt %BuildIndicesAsync
%BuildIndicesAsyncResponse %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 GetDelegateConnections GetProductionSettingValue GetProductionSettings
GetPropertyConnections GetSettings GetShadowInstance IsErrorResponse
IsResponsePending OnComplete OnError OnErroredResponse
OnFailureTimeout OnGenerateSuperSession OnGetConnections OnGetReplyAction
OnInit OnKeepalive OnMonitor OnPrepareReply
OnProductionStart OnProductionStop OnRequest OnResponse
OnTearDown OnTimeout OnValidate QueueName
RemovePendingResponse Reply ReplyError RuleLoggingSet
SendAlert SendDeferredResponse SendRequestAsync SendRequestSync
SetTimer WillHandleErroredResponse doOneAction normalizeValSpec

Subclasses
EnsLib.MsgRouter.RoutingEngineST EnsLib.MsgRouter.VDocRoutingEngine

Parameters


• parameter SETTINGS = "BusinessRuleName:Basic:ruleSelector,AlertOnBadMessage,BadMessageHandler::selector?context={Ens.ContextSearch/ProductionItems?targets=1&productionName=@productionId},ResponseFrom::selector?multiSelect=1&context={Ens.ContextSearch/ProductionItems?targets=1&productionName=@productionId},ResponseTargetConfigNames::selector?multiSelect=1&context={Ens.ContextSearch/ProductionItems?targets=1&productionName=@productionId},ResponseTimeout,ForceSyncSend,ActOnTransformError,ActOnValidationError,RuleLogging:Dev";
List of properties can be set as settings in the configuration file format is a comma separated list of property names

Properties


• property %ErrorStatus as %Status [ InitialExpression = $$$OK,Transient ];
Remember the error we return in OnError() so we can use it in OnComplete() if needed
• property %ResponseList as list of %String(MAXLEN="");
List of responses we have gotten that we are going to send back
• property %TimedOut as %Boolean;
Did we time out while waiting for any response(s)?
• property %WaitAll as %String(MAXLEN=1);
Should we wait for all responses?
• property ActOnTransformError as %Boolean [ InitialExpression = 0 ];
Enable this to cause errors returned by a transformation to stop rule evaluation and the error to be handled by Reply Code Actions setting.
• property ActOnValidationError as %Boolean [ InitialExpression = 0 ];
Enable this to cause errors returned by validation to be handled by Reply Code Actions setting.
• property ActionTargets as %String(MAXLEN="") [ Transient ];
• property AlertOnBadMessage as %Boolean [ Transient ];
Send an Alert if validation blocks a message
• property BadMessageHandler as %String(MAXLEN=1000) [ Transient ];
Name of the host that should handle messages that validation blocks
• property BusinessRuleName as %String(MAXLEN=1000) [ Transient ];
Business Rule Name. If this setting is empty, then the ConfigItem name is used as the rule name
• property Document as %RegisteredObject [ Transient ];
• property ForceSyncSend as %Boolean [ Transient ];
Make synchronous calls for 'send' actions. WARNING: this can cause deadlock if another BP is called by something called synchronously from here.

This setting is intended to ensure FIFO ordering when this router and the target Operations have PoolSize=1, and ancillary Operations might get called asynchronously from within a Transform or Operation called from this router.

Note that if there are multiple 'send' targets, this setting means they will be called one after another in serial fashion, with the next being called after the previous call completes.

Also note that synchronous calls are not subject to the ResponseTimeout setting.

• property MsgClass as %String(MAXLEN=128) [ Transient ];
• property ResponseFrom as %String(MAXLEN=1000) [ Transient ];
Names the target(s) from which a response should be forwarded back to the caller, if the caller requested
a response. If this value is empty, no reply will be requested from any target. Otherwise, this value is a
comma-separated list of target config names. The response returned will be the first one that arrives back
from any target in the list. A value of '*' will match any target, so the first response received will be
the one returned.

If none of the listed targets gets called and the caller requested a response, an empty 'OK' response header
will be returned.

If the list of targets begins with a '+' character, the responses from all the targets called will be returned as a list of message header IDs in the response header, or an empty 'OK' response header if no responses appear before the timeout expires.

If the list of targets begins with a '-' character, all error responses only from any of the targets called
will be returned as a list of message header IDs in the response header, or an empty 'OK' response header if no error responses appear before the timeout expires.

• property ResponseTargetConfigNames as %String(MAXLEN=1000);
Names a destination or destinations in addition to the caller to which responses will be forwarded.

If this value is empty, responses are only returned to the caller. If one or more target config names are listed (separated by commas), each response from this router will be forwarded to each target config item listed.

This setting has effect only if ResponseFrom is not empty.

• property ResponseTimeout as %Numeric(MINVAL=-1) [ InitialExpression = -1,Transient ];
Maximum length of time to wait for asynchronous responses before returning a timed-out error response header. A value of -1 means to wait forever; note that a value of 0 is not useful because every response would time out.

This setting has effect only if ResponseFrom is not empty.

• property RuleActionReason as %String(MAXLEN="") [ Transient ];
RuleActionReason is not intended for user assignment.
This property is only valid if the RuleSet being called includes one or more assignments to the context property RuleActionUserData.
If this is the case then the the rule action reason is set at the start of each rule/when or rule/otherwise execution
The system assigned value is of the form rule#1when#1 or rule#1otherwise. (numbers change as appropriate).
If the rule action reason is set in the rule it is returned as part of a send return value allowing the Routing Engine to set RuleActionReason property to the value contained in the send return instruction.
This allows transformations to access aux.RuleActionUserData which will be the value of the RuleActionUserData set during the particular rule/when or rule/otherwise execution that led to the send transformation action.
This property value is reset to empty string at the end of the rule execution.
NOTE: If a send action takes place outside of a rule/when or rule/otherwise any value returned with the send instructions will be the last value set in the rule execution.
NOTE: This property is only valid if the rule being called is assigning one or more values to the routing engine context property RuleActionUserData.
• property RuleActionUserData as %String(MAXLEN="") [ Transient ];
A user defined variable that can be set in a specific rule/when or rule/otherwise action.
The value assigned will be paired with the system assigned RuleActionReason value at the time of assignment (using the internal RuleActionUserDataArray).
The RuleActionReason value is assigned by the system at the start of each rule/when or rule/otherwise execution if RuleActionUserData is used in the rule.
The value of aux.RuleActionUserData accessed in a transformation called from a routing rule as part of a send action will be the value assigned in the routing rule for the particular rule/when or rule/otherwise that led to the send action.
A transformation that is called from a routing rule as part of a send action can set aux.RuleActionUserData. Any subsequent transformations that are executed as part of a send action from the same rule/when or rule/otherwise will then retrieve the transformation modified value if they access aux.RuleActionUserData.
If the RuleActionReason is empty the RuleActionUserData assignment will not take place.
• property RuleActionUserDataArray as %String(MAXLEN="") [ MultiDimensional ];
Direct access to this array property is not intended.
Internal storage for user defined variables at specific rule/when or rule/otherwise states in the ruleset execution.
This property cannot be set directly in the rule.
NOTE: This property is only valid if the rule being called is assigning one or more values to the routing engine context property RuleActionUserData.
• property RuleLogging as %String [ InitialExpression = $$$eRuleLogTypeReturn ];
This set of flags controls the logging performed by the rule engine whenever a routing rule is executed. The following flags are available:
  • 'e' - log errors only. All errors will be logged irrespective of other flags, so setting the value to 'e' or leaving the value empty will only log errors.
  • 'r' - log return values. This is the default value for the setting, and is also automatic whenever the 'd' or 'c' flags are specified.
  • 'd' - log user-defined debug actions in the rule. This will also include 'r'.
  • 'c' - log details of the conditions that are evaluated in the rule. This will also include 'r'.
  • 'a' - log all available information. This is equivalent to 'rcd'.
• property RuleReason as %String(MAXLEN=2000,TRUNCATE=1) [ Transient ];
FullReason for RuleSet action
• property RuleUserData as %String(MAXLEN="") [ Transient ];
User defined variable that applies to the RuleSet.
Only one value of the RuleUserData variable is available and it is the last value it is assigned in the RuleSet before the RuleSet returns.
• property Source as %String(MAXLEN=128) [ Transient ];
• property Validation as %String [ Transient ];
Causes validation to be performed. Default implementation of OnValidate() does nothing; If you override it and want it to be configurable, override this description comment and add Parameter SETTINGS = "Validation"; to your subclass as well.
• property aRespFrom as array of %String(MAXLEN=128);

Methods


• classmethod GetDelegateConnections(Output pArray As %String, pRuleName As %String, pSeen As %List = "")
• method IsErrorResponse(request As %Persistent, ByRef response As %Persistent) as %Boolean
• method OnComplete(request As %Persistent, ByRef response As %Persistent) as %Status
Called when all the Async responses are received, or timeout has occurred
• method OnError(request As %Persistent, ByRef response As %Persistent, callrequest As %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
• classmethod OnGetConnections(Output pArray As %String, pItem As Ens.Config.Item)
This method is called when Portal is drawing the production diagram pArray contains the config names the scanner found. Users can remove or add new names
• method OnPrepareReply(request As %Persistent, ByRef response As %Persistent)
• method OnRequest(request As %Persistent, Output response As %Persistent) as %Status
Handle a 'Request'
• method OnResponse(request As %Persistent, ByRef response As %Persistent, callrequest As %Persistent, callresponse As %Persistent, pCompletionKey As %String) as %Status
Handle a 'Response'
• method OnTimeout(request As %Persistent, ByRef response As %Persistent, callrequest As %Persistent, pCompletionKey As %String) as %Status
• method OnValidate(pDoc As %Persistent, pValSpec As %String, Output pStatus As %Status = $$$OK) as %Boolean
Override this method to implement your own method for validating a Document Return non-zero to prevent default validation of the message (if any); return an error code in pStatus to indicate a validation failure.
• method RuleLoggingSet(pRuleLogging As %String = $$$eRuleLogTypeReturn) as %Status
Ensure that the value of RuleLogging is normalized at the time that it is set.
• method doOneAction(pRequest As %Persistent, pOneAction As %String, Output pQuitProcessing As %Boolean, pLevel As %Integer = 1, Output pSyncResponse As %Persistent) as %Status
• classmethod normalizeValSpec(pValSpec As %String) as %String
Convert to lower case, with inverse spec chars converted to upper case