Server Wide Variables
No edit summary
(Automatically adding template at the end of the page.)
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
In the MDrivenServer you can set Server Wide Variables :
In the MDrivenServer, you can declare Server Wide Variables. This is useful if you want access to global variables in your ServerSide ViewModels for a different purpose. Remember to click <code>Submit</code> to save your Server Wide Variables.
 
[[File:2020-11-20 10h53 19.png|none|thumb|536x536px]]
[[File:2020-11-20 10h53 19.png|none|thumb|536x536px]]
If we find a matching variable name in your ServerSideViewModel the Server Wide Pre EAL will execute before the rest of your job actions.


This is a practical way to give your jobs information that are environment specific.
When you want to access your Server Wide Variables, add the variables, with the same name as Server Wide Variables, to your ServerSide ViewModel. When the ServerSide ViewModel runs the server, you will find the matching variable on the name. In your ServerSide ViewModel, the Server Wide Pre EAL will execute before the rest of your job actions.
 
This is a practical way to give your jobs information that is environment specific.


The normal use case is to clearly give information to jobs that this is a Production environment and every action can be executed, or this is NOT a production environment and thus you may want hold of exporting data och maybe export data to a different external system than what you use in production.
The normal use case is to give information to jobs that this is a Production environment and every action can be executed, or this is NOT a production environment and, thus, you may want to hold off on exporting data or maybe export data to a different external system than what you use in production.


=== New 2020-11-27 vServerRestartedTime and vSkipQueryAndSkipJob ===
=== Special Variables - vServerRestartedTime and vSkipQueryAndSkipJob ===
If you declare a variable '''vServerRestartedTime:DateTime''' this will be set to the time where the system was most recently restarted - because of a model evolve or some external event that killed the application. Use this as flag to execute a job depending on if this value is new to what you saw before - or log restarts of your system.
If you declare a variable <code>vServerRestartedTime:DateTime</code>''',''' this will be set to the time when the system was most recently restarted because of a model evolution or some external event that killed the application. Use this as a flag to execute a job depending on whether this value is new to what you saw before - or log restarts of your system.


If you declare a Serverside ViewModel variabel named '''vSkipQueryAndSkipJob:Boolean''' - and this happen to evaluate to true - the PS-query for the job is skipped.
If you declare a Serverside ViewModel variable named <code>vSkipQueryAndSkipJob:Boolean</code> - and this happens to evaluate to true - the PS-query for the job is skipped.
[[File:2020-11-26 14h17 51.png|none|thumb|654x654px]]
[[File:2020-11-26 14h17 51.png|none|thumb|654x654px]]
This new variables would make it possible to execute a job only 1 time after system start - consider this for Job EAL code:
This new variable would make it possible to execute a job only 1 time after the system starts - consider this for Job EAL code:
  vSkipQueryAndSkipJob:=SysSingleton.oclSingleton.LastTimeTheInitJobWasExecuted>vServerRestartedTime  -- remember to set SysSingleton.oclSingleton.LastTimeTheInitJobWasExecuted in the initjobb to DateTime.Now
  vSkipQueryAndSkipJob:=SysSingleton.oclSingleton.LastTimeTheInitJobWasExecuted>vServerRestartedTime  -- remember to set SysSingleton.oclSingleton.LastTimeTheInitJobWasExecuted in the initjobb to DateTime.Now
  [[Category:MDriven Server]]
{{Edited|July|12|2024}}

Latest revision as of 15:46, 10 February 2024

In the MDrivenServer, you can declare Server Wide Variables. This is useful if you want access to global variables in your ServerSide ViewModels for a different purpose. Remember to click Submit to save your Server Wide Variables.

2020-11-20 10h53 19.png

When you want to access your Server Wide Variables, add the variables, with the same name as Server Wide Variables, to your ServerSide ViewModel. When the ServerSide ViewModel runs the server, you will find the matching variable on the name. In your ServerSide ViewModel, the Server Wide Pre EAL will execute before the rest of your job actions.

This is a practical way to give your jobs information that is environment specific.

The normal use case is to give information to jobs that this is a Production environment and every action can be executed, or this is NOT a production environment and, thus, you may want to hold off on exporting data or maybe export data to a different external system than what you use in production.

Special Variables - vServerRestartedTime and vSkipQueryAndSkipJob

If you declare a variable vServerRestartedTime:DateTime, this will be set to the time when the system was most recently restarted because of a model evolution or some external event that killed the application. Use this as a flag to execute a job depending on whether this value is new to what you saw before - or log restarts of your system.

If you declare a Serverside ViewModel variable named vSkipQueryAndSkipJob:Boolean - and this happens to evaluate to true - the PS-query for the job is skipped.

2020-11-26 14h17 51.png

This new variable would make it possible to execute a job only 1 time after the system starts - consider this for Job EAL code:

vSkipQueryAndSkipJob:=SysSingleton.oclSingleton.LastTimeTheInitJobWasExecuted>vServerRestartedTime  -- remember to set SysSingleton.oclSingleton.LastTimeTheInitJobWasExecuted in the initjobb to DateTime.Now
This page was edited 98 days ago on 02/10/2024. What links here