Defining Named Configuration and utilize EPLCM
Event Process Life Cycle Managementrefers to the deployment of an Event Process in various environments such as Development, Testing, Staging, and Production. Instead of creating different Event Processes for different environments, you can simply specify the properties for service instances comprising Event Processes for various environments in a single Event Process. Moreover, it is not required to configure on each instance of environment change, while you can load the existing configuration by just selecting the required environment.
Setting Properties of Service Instances for Different Environments
The default environment for a new Event Process will be 'development'. To configure a different environment, select the Target Environment in the Environment Properties tab of the Event Process comprising the service instance. Hereafter, the environment dependent service properties will be written to the corresponding env.xml file and will be picked up from that file when Event Process is launched in that particular environment. You can specify these properties for more than one environment by switching the Target Environment (property present in the Properties pane) of an event process.
Configuring service instances for different environments is made easy, since the configuration properties of the service instance in a new environment will be picked up from the previously configured environment when the CPS is opened. In this manner, service instances can have different set of properties while running on different environments.
Setting up the Event Process
A FileReader instance can be configured to read from a dev.txt file in a Development environment and from a prod.txt file in a Production environment.
To enable this, perform the following initial actions:
Create an Event Process with name 'EPLCM_Example'. Then add a FileReader component from File category in Micro Service Palette and Display component from Util category. Now, connect the FileReader output port to Display input port.
Display component is to view the contents read by the FileReader component in different environments.
Figure 1: EPLCM_Example event process with FileReader and Display components
- Create two text files in a preferred location (D:\EnvTest\data in this example) in your system with the following text (change the text as you need) in it:
- dev.txt with text "Development content" for Development environment
- prd.txt with text "Production content" for Production environment
Figure 2: Text files dev.txt and prd.txt saved for different environments
Configuring Service Instance for Development Environment
To configure the FileReader component to read from dev.txt file in development environment, perform the following actions in the EPLCM_Example orchestrator:
- Double-click the FileReader component in the orchestrator to open its Configuration Property Sheet (CPS).
- In the Interaction Configurations panel, click the FileReader Configuration Ellipsis button.
- In the FileReaderConfig dialog box, provide the following details and then click OK:
- Compute Paths relative to Directory: Provide the absolute path for the files to be read from. By default, it points to the FIORANO_HOME directory. Change it to the path where you prefer to pick the files from ('D:\EnvTest' in this example) and give relative path in the Source, Working and Error Directories.
- File name: Name of the file from the data needs to be read from, that is, dev.txt (for the development environment).
- Source Directory: Name of the folder from which the files are to be read from, data folder in this example.
- Working Directory: Name of the directory/folder where intermediate processing needs to happen. (This property is visible only when Use Working Directory option is selected and hence it is optional).
Error Directory: Name of the directory which should hold the files whose processing has not been successful.
- Provide absolute path in Source Directory, Working Directory and Error Directory, if Compute Paths relative to Directory does not carry the absolute path to the dev.txt file location.
- Working Directory and Error Directory folders need not be created manually. FileReader creates it while processing the input message.
- Select Is configured for different machine? checkbox if the Peer Server on which the component is to be launched and Fiorano Studio are running on different machines
- Configuration set in this instance can be saved with a name by providing a name under Named Configuration and can be used to read from the same file in a future instance. Refer the "From CPS of the component" section to understand how to save a Named Configuration in the CPS.
Figure 3: FileReader configuration
- Click Next in the Interaction Configurations panel to navigate to Scheduler Configurations panel and perform the following actions:
Select Enable Scheduling checkbox to fetch the data automatically (without the help of Feeder component) on every 10 seconds interval.
Data in the file can be amended on run time and the updated data will be fetched accordingly.
- Click Finish in the Interaction Configurations panel to close the CPS saving the FileReader configuration.
Figure 4: Enabling Scheduling
- The input port will be eliminated from the FileReader component as scheduling is enabled.
Figure 5: FileReader without input port after enabling scheduling
- By default, the configuration will be saved for development environment; Target Environment in the Environment Properties will be 'Development'. To check this, perform the following actions:
- Right-click anywhere (not on the components) in the Fiorano Orchestrator and click Properties from the right-click menu.
Figure 6: Opening Properties panel
- In the Properties panel, click Environment Properties tab. You can see that the Target Environment is 'Development'.
Figure 7: Navigating to Environment Properties tab Click the Click … to View value next to FileReaderConfiguration property and then click the ellipsis button to find the configuration set by following the above steps. Click Close to close the FileReaderConfiguration dialog box.
These properties cannot be edited from this view, but can only be edited from the CPS of the specific service instance and form the deployment tab of the service instance in the properties view.
Figure 8: Checking FileReaderConfiguration in Environment Properties view
- Right-click anywhere (not on the components) in the Fiorano Orchestrator and click Properties from the right-click menu.
Configuring Service Instance for Production Environment
To configure the EPLCM_Example event process in Production environment, perform the following actions:
- In the Properties panel, select 'Production' from the Target Environment drop-down.
Figure 9: Changing the environment to 'Production'
- Click Yes in Copy Missing configurations dialog box to copy the configurations set in Development environment previously.
Figure 10: Option to copy or ignore the configuration set in the previous environment
- Configure the FileReader in production environment in the same manner as explained in "Configuring Service Instance for Development Environment" section above, but with the below change:
Provide File Name as 'prod.txt' in FileReaderConfig dialog box in CPS. After closing the CPS, cross-check the configuration in Environment Properties and click Close to close the FileReaderConfiguration dialog box.
Figure 11: Checking the configuration in Environment Properties view
Running the Event Process and Verifying Output
To run the EPLCM_Example event process, perform the following actions in the Orchestrator:
- In the Environment Properties tab in Properties panel, choose 'Development' option from the Target Environment drop-down.
- In the Copy missing configurations dialog box, click NO because the configurations need not be copied at this instance.
- Click Check Resource and Connectivity icon (or press ALT+SHIFT+C) to check resource and connectivity.
- Click Run Event Process icon (ALT+SHIFT+R) to run the event process; Display window gets opened.
- Display window shows the data read by the FileReader component from the dev.txt file, that is, the text "Development content" (as explained in the "Setting up the Event Process" section).
Figure 12: FileReader Output in Development environment
- Click Stop Event Process icon to stop the execution happening in Development environment.
- Change the Target Environment to 'production' in Environment Properties tab.
- In the Copy missing configurations dialog box, click NO.
- Check resource and connectivity and run the process again.
- Display window shows the data read by the FileReader component from the prod.txt file, that is, the text "Production content".
Figure 13: FileReader Output in Production environment
Likewise, you can manage to switch between the Testing and Staging environments as well and switch between them to assume different configurations for a similar scenario.
In the above example, you can change the content during runtime where the changed data will be fetched by the component and displayed in the Display window.
In scenarios where the environment specific configuration is defined in mapper, the environment value is available as a JMS property in the message and can be used to change resources based on Environment property.
Defining Named Configurations for different environments
Named configurations can be defined in two ways.
- Using Configuration Property Sheet (CPS) of the component.
- From Configuration Repository.
Setting up the Event Process
The two ways of saving named configurations are explained in the following sections using DB configuration as example. Two databases, Oracle and MySQL, are configured using two different methods and used alternatively while running the event process.
To do this, create an event process with name 'EPLCM_Naming' and add a DB component from DB category in Micro Service Palette to the Orchestrator.
Figure 14: Adding a DB component to EPLCM_Naming event process
From Configuration Repository
To save Named Configuration for MySQL database from Configuration Repository, perform the following actions:
- Open Configuration Repository panel by navigating through Window > Show View.
- In the Configuration Repository panel, right-click Resource and click Add Configuration.
Figure 15: Navigating to add Naming Configuration
- In the Add New Configuration dialog box, provide the following values:
- Name: Provide a logical name. Provide the name 'MySQL_ConfigRepo' to represent the configuration done from Configuration Repository.
- Environment: Select your preferred environment from the options: Development, Testing, Staging, and Production. Select 'Development' for this example.
- Type: Choose the type of configuration from the Type drop-down list. Select DBConfigurations.
Figure 16: Providing name for SQL configuration under Development environment
- Click Next to configure the details specific to the type of configuration (DBConfigurations in this case). After entering the details, click Finish to close the dialog box and thereby to save the Named Configuration 'MySQL_ConfigRepo'.
Figure 17: Setting up SQL Configuration
- Check the presence of newly added Named Configuration in the Configuration Repository under Resource folder within the chosen environment, that is, 'Development'.
Figure 18: MySQL database configuration named under Development environment
From CPS of the component
To define Named configuration from the Configuration Property Sheet of the component, perform the following actions:
- Double-click the DB component in the EPLCM_Naming orchestrator to open its CPS.
- Click the Database Configuration ellipsis button to open DbConfigurations Panel.
- In the DBConfigurations dialog box, provide values for Oracle DB Configuration under Component Configuration section and provide a name in the Named Configuration field to save it as a named configuration. For this example, provide the name 'Oracle_CPS' to represent the named configuration added using CPS.
Figure 19: Naming Oracle Connection configuration
- Click OK in the DBConfigurations dialog box and click Save and Close in the Managed Connection Factory panel.
- Check the presence of newly added Named Configuration (Oracle_CPS) in the Configuration Repository under Resource folder within the chosen environment, that is, 'Development'.
Figure 20: Oracle database configuration named under Development environment
- By default, the environment of the named configuration created will be same as the Event Process Target Environment, that is, 'Development'. When the environment of the Event Process is changed, named configurations will be automatically copied to the new target environment. So, change the Target Environment to 'Production'.
- In the Copy Missing Configuration dialog box that pops up, click Yes to copy the configurations from the previous environment, that is, copy the DBconfigurations named configuration from Development environment to Production environment.
Figure 21: Changing the environment to 'Production'
- In the Configuration Repository panel, expand Production under Resource section to verify that the configurations from the previous environment are copied to the new environment. The configuration can be seen in Environment Properties under Properties panel.
Figure 22: Oracle Named Configuration copied to Production environment
Using Named Configuration to work with DB component
Configure the DB component with Oracle database using Oracle_CPS in Production Environment and configure it with SQL database using MySQL_ConfigRepo in Development Environment by performing the following actions:
- In the Production environment, open DB CPS and go to Database Configurations section.
- 'Oracle_CPS' will be available in the Named Configurations drop-down as it is configured in the above section. Choose this Named Configuration.
- Click OK, go to the next screen by clicking Next and configure your preferred query (Configure select query named SelectQueryOracle in Scheduler mode to fetch data automatically) in SQL Configuration section, and then click Finish.
Figure 23: Configuring Select query in Oracle database under Production Environment
- Click Finish in the Interaction Configurations panel to close the CPS and save the configuration.
- Verify the Database Configuration in the DB component under Production environment by going to DBConfigurations under Environment Properties in Properties panel.
You can see that the input port is disappeared from the DB component as Scheduler mode is selected during SQL Configuration and hence external input is not required.
Figure 24: Verifying Oracle DB configuration in Environment Properties view
- Change the Target Environment to 'Development'. In the Copy missing configurations dialog box, click NO because the configurations need not be copied at this instance.
- In the Development environment, open the DB CPS and go to Database Configurations section.
- 'MySQL_ConfigRepo' will be available in Named Configurations drop-down as it is configured in the "From Configuration Repository" section. Choose this Named Configuration.
Figure 25: Selecting the Named Configuration for MySQL configured from Configuration Repository
- Click OK, go to the next screen by clicking Next and configure your preferred query in SQL Configuration section (Configure select query named SelectQuerySQL in Scheduler mode to fetch data automatically), and then click Finish.
Figure 26: Configuring Select query in MySQL database under Development Environment
- Click Finish in the Interaction Configurations panel to close the CPS and save the configuration.
- Go to Environment Properties and cross-check the configuration present under Development environment by opening DBConfigurations dialog box.
Figure 27: Verifying MySQL DB configuration in Environment Properties view
Running Event Process and Verifying Output
While the event Process is running in the Development environment, it connects to MySQL DB and while running in a Production environment, it connects to Oracle DB.
To run the EPLCM_Naming event process, perform the following actions in the Orchestrator:
- In the Environment Properties tab in Properties panel, choose the 'Development' option from the Target Environment drop-down.
- In the Copy missing configurations dialog box, click NO because the configurations need not be copied at this instance.
- Click Check Resource and Connectivity icon (or press ALT+SHIFT+C) to check resource and connectivity.
- Click Run Event Process icon (ALT+SHIFT+R) to run the event process; Display window gets opened.
- Display window shows the data selected from the SQL database with the help of 'SelectQuerySQL' query configured in the Development environment.
Figure 28: Output from MySQL DB in Development environment
- Click Stop Event Process icon to stop the execution happening in Development environment.
- Change the Target Environment to 'production' in Environment Properties tab.
- In the Copy missing configurations dialog box, click NO.
- Check resource and connectivity and run the process again.
- Display window shows the data selected from the Oracle database by the help of 'SelectQueryOracle' query configured in the Development environment.
Figure 29: Output from Oracle DB in Production environment
Likewise, you can manage Naming Configuration for Testing and Staging environments as well and switch between them to assume different configurations for similar scenario.
In the above example, you can amend the table contents during runtime where the amended data will be fetched by the component and displayed in the Display window.