Runtime Configuration Example Flow Chart
This example shows how to create different jobs that use different values from the runtime configuration. Specifically, this example shows how to create two jobs that call an EJB on a schedule. The first job uses an EJB "provider URL" configuration property of "t3://localhost:9001", and the second job uses an EJB "provider URL" configuration property of "t3://another_machine:7001". These configuration properties are set at runtime in the runtime configuration file and can be changed on the fly.
Running the Example
- Run the Flux Job Designer. Two similarly configured jobs are pre-built. They are named "/AppServer1/EjbX" and "/AppServer2/EjbY".
Each job consists of a Timer Trigger that flows into an EJB Session Action, with a loop from the EJB Session Action back to the Timer Trigger.
- EJB Session Actions have a property called "Provider URL". The goal of this example is to set this property at runtime, not at the time that the job is defined.
The actual value for this Provider URL property comes from the runtime configuration.
In the first job, "/AppServer1/EjbX, on the flow from the Timer Trigger to the EJB Session Action, edit the Runtime Data Map. Verify a map entry source of type Runtime Configuration with the value "/AppServer1/PROVIDER_URL". The corresponding map entry target target must be of type Action with the value Provider URL.This Runtime Data Map entry specifies that at runtime, the EJB Session Action's property called Provider URL should be set to the value in the runtime data map called "/AppServer1/PROVIDER_URL".
Verify a similar value on the second job, "/AppServer2/EjbY".
- Now you are ready to edit the runtime configuration to specify these Provider URLs values. Note that these values can be changed on the fly simply by editing the runtime configuration file.
Edit the file flux-runtime-configuration.properties. Notice the entries for AppServer1 and AppServer2. These entries correspond to the Provider URL property in the EJB Session Action. By editing these values, different Provider URL values will be used at runtime, on the fly.
- Finally, edit the Flux engine configuration file. Note the runtime configuration entries. They specify the location of the runtime configuration file and how frequently it is reloaded.
If the EJB Session Action property values are correct for your application servers, you can run this example by starting a Flux job scheduler engine and exporting these two jobs to that engine.
To start an unsecured job scheduler engine, run the start-unsecured-flux-engine.bat file located within your Flux installation directory.
You can export the jobs from the Flux Designer.
Note that for this example to work correctly, you need to make sure your application servers are running, you have specified the correct Provider URL properties, and the remaining EJB Session Action properties are all specified correctly. These remaining properties can be specified in the Flux Designer at the time the jobs are designed and configured.