This example shows how to create different workflows that use different values from the runtime configuration. Specifically, this example shows how to create two workflows that call an EJB on a schedule. The first workflow uses an EJB “provider URL” configuration property of “t3://localhost:9001”, and the second workflow 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.
Navigate to the Designer. Two similarly configured workflows are pre-built. They are named “/AppServer1/EjbX” and “/AppServer2/EjbY” and can be found in the <flux_home>/examples/end_users/runtime_configuration directory. Each workflow 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 workflow is defined. The actual value for this Provider URL property comes from the runtime configuration. In the first workflow, “/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 workflow, “/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 workflow scheduler engine and exporting these two workflows to that engine.
You can export the workflows from the 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 workflows are designed and configured.