To configure connection details of systems which are different for different environments, event processes can be configured for different environments. Named Configurations serve the purpose when the configuration is purely design time. But some Resource URLs like URL in HTTPAdapters can be dynamic and are configured in mapper. The same usage is applicable in case the option "Get connection details from input" is enabled in adapters such as DB, FTP and JMS.
To make changes to URLs based on environment in such scenarios, the environment value is provided as a JMS property in the message. It can be used in scripts/if-then-else funclets to adapt to the URL based on the environment.
Usage in Mapper
The JMS property 'ESBX__SYSTEM__EVENT_PROCESS_ENVIRONMENT' holds the value of environment. Possible values are:
ESBX__SYSTEM__EVENT_PROCESS_ENVIRONMENT property holds the value of Environment. By passing this property to the the JMS function "getStringProperty", the value (testing/development/staging/production) associated with it can be retrieved.
Following scenarios explain how the property can be used in a funclet to assign a value to a property/element based on the environment.
In this case, it reads the value of the property 'ESBX__SYSTEM__EVENT_PROCESS_ENVIRONMENT' and passes it to the function. Based on the value passed, it retrieves different database details as defined in the function.
Using If-Then-Else funclet
If-Then-Else control function can be used to assign a value to an element based on the value of ESBX__SYSTEM__EVENT_PROCESS_ENVIRONMENT property.
In the figure below, the value assigned to the 'filename' element will be based on ESBX__SYSTEM__EVENT_PROCESS_ENVIRONMENT property value, which flows in the following sequence:
- If the value of the property is 'testing', 'test.txt' is assigned to filename.
- Else, if the value is 'development', 'dev.txt' is assigned.
- Else, prod.txt is assigned.