![]() | Vishnu parameter substitution |
Vishnu offers a global parameter substitution. This means that all parameter names contained in passed parameters are replaced by their runtime values if possible. This chapter describes how this works in detail.
In general, Vishnu tries to replace every parameter enclosed in %-characters
with its runtime value.
Parameters are all strings enclosed in the XML delimiters <Parameters>
</Parameters> in a JobDescription.xml.
In the following code example from the demo-Job CheckWildcardParameters you can see such a wildcard variable: %ApplicationName%.
<?xml version="1.0" encoding="utf-8"?> <JobDescription> <LogicalName>Check WildcardParameters</LogicalName> <LogicalExpression> <![CDATA[IS WildcardParameterChecker]]> </LogicalExpression> <BreakWithResult>false</BreakWithResult> <ThreadLocked>false</ThreadLocked> <StartCollapsed>false</StartCollapsed> <IsVolatile>false</IsVolatile> <Checkers type="array"> <Checker> <LogicalName>WildcardParameterChecker</LogicalName> <PhysicalPath>TrueFalseExceptionChecker.dll</PhysicalPath> <Parameters>True||This application is called %ApplicationName%.</Parameters> </Checker> </Checkers> </JobDescription>
In the following screenshot of the job CheckWildcardParameters you can then see that the variable %ApplicationName% has been replaced by its runtime value Vishnu.
![]() |
---|
Parameter substitution works for all Vishnu-parameters. A complete list of all Vishnu-parameters can be found under Vishnu.InterchangeAppSettings, further explanations on Vishnu-parameters on the page Configuration and parameters. |
As already mentioned in the chapter Vishnu actors, SubWorkers can only be given command line parameters (plain text) by Vishnu. However, Vishnu extends the globally replacable parameters by some essential current runtime values:
"%Event%" = Name of the event that led to the worker being called
"%Source%" = Source of the event (node in which the event first occurred)
"%Sender%" = Node that currently calls the worker due to the event
"%TreePath%" = complete path in the tree to the event source
"%Timestamp%" = current date with current time in the format "dd.MM.yyyy HH.mm.ss"
"%Logical%" = current logical value of the transmitter
"%Exception%" = Exception.Message, if %Event% is "Exception", otherwise ""
The following XML excerpt provides an example of the use of the extended runtime values for SubWorkers.
... <Workers type="array"> <Worker> <LogicalExpression>Heise:False|Exception</LogicalExpression> <SubWorkers type="array"> <SubWorker> <PhysicalPath>VishnuMessageBox.exe</PhysicalPath> <Parameters>-Message="%Timestamp%: CheckServers %Event% from %Source% in %Sender%#%Exception%" -Caption="Server Error" -MessageNewLine=#</Parameters> </SubWorker> <SubWorker> <PhysicalPath>MicroMailer.exe</PhysicalPath> <Parameters><![CDATA[-Message="%Timestamp%: CheckServers %Event% from %Source% in %Sender%#%Exception%." -Caption="Server error!" -MailHostPort=%MailHostPort% -MailPassword=%MailPassword% -MailSender="Sender" -MailRecipients="Recipient1[,Recipient2,...]"]]></Parameters> <!-- Trigger> <LogicalName></LogicalName> <PhysicalPath>TimerTrigger.dll</PhysicalPath> <Parameters>M:20</Parameters> </Trigger --> </SubWorker> </SubWorkers> </Worker> ... </Workers> ...
Own ParameterReaders offer the possibility of passing additional, business-specific parameters to Vishnu. These parameters are then treated as normal Vishnu-parameters, which means, that they can also be subject of the Vishnu-parameter substitution.
Three components are required for this,
Your own <UserParameter-Name>.dll. This DLL must implement the Vishnu.InterchangeIParameterReader interface.
![]() |
---|
Vishnu already provides a DemoParameterReader and a Demo job CheckParameterReader. This will be discussed further below. |
Via the parameter UserAssemblyDirectory a directory can be set in which Vishnu will search for your Custom Checker DLLs, Custom UserControls or also Custom parameter reader, in addition to the respective Job-directories. The default is already set to UserAssemblies.
Specification of the path to your own ParameterReader. As already mentioned above Vishnu already provides a DemoParameterReader and a Demo job CheckParameterReader. The path can be found in the supplied Vishnu.exe.config.user at "%UserAssemblyDirectory%\DemoParameterProvider.dll".
Below you can see excerpts and screenshots illustrating the concept with the help of the Demo job CheckParameterReader:
<?xml version="1.0"?> <configuration> <appSettings> ... <add key="UserParameterReaderPath" value="%UserAssemblyDirectory%\DemoParameterProvider.dll" /> ... </appSettings> </configuration>
<?xml version="1.0" encoding="utf-8"?> <JobDescription> <LogicalName>Check ParameterReader</LogicalName> <LogicalExpression> <![CDATA[IS ParameterReaderChecker]]> </LogicalExpression> <StartCollapsed>false</StartCollapsed> <Checkers type="array"> <Checker> <LogicalName>ParameterReaderChecker</LogicalName> <PhysicalPath>TrueFalseExceptionChecker.dll</PhysicalPath> <Parameters>True||Parameter value is %SearchedParameter%</Parameters> </Checker> </Checkers> </JobDescription>
![]() |
---|
Further information on custom parameter readers can be found at Custom Parameter Reader. |