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


persistent class EnsLib.MsgRouter.RoutingEngine extends Ens.BusinessProcess


Parameters Properties Methods Queries Indices ForeignKeys Triggers
1 22 13


This is an Ensemble Business Process class.

%Library.Persistent %Library.Persistent

%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 RuleLogging RuleReason
RuleUserData Source SuspendMessage ThrottleDelay
Validation aRespFrom

%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 GetDelegateConnections
GetProductionSettingValue GetProductionSettings GetPropertyConnections GetSettings
GetShadowInstance IsErrorResponse IsResponsePending OnComplete
OnError 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 doOneAction normalizeValSpec

EnsLib.MsgRouter.RoutingEngineST EnsLib.MsgRouter.VDocRoutingEngine


• 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


• 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 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 ];
Reason for Rule action
• property RuleUserData as %String(MAXLEN="") [ Transient ];
User defined variable
• 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);


• 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
• classmethod OnGetConnections(Output pArray As %String, pItem As Ens.Config.Item)
This method is called when Ensemble 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