Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

There are two ways to dynamically inject parameter values to integration artifacts deployed in your environments:

Child pages (Children Display)

Excerpt
hiddentrue

When deploying integration artifacts in different environments, it is necessary to change the synapse parameters used in the artifacts according to the environment. For example, the 'endpoint URL' may be different in each environment. Without this feature, you need to create and maintain separate artifacts for each environment. This feature allows you to deploy the same integration solution to multiple environments (DEV, PROD, etc.) and then inject separate parameter values to the different environments.

There are two ways to dynamically inject parameters to your integration solutions: Using environment variables, or a configuration file.

Tip

This feature is particularly useful for container deployments, where we need to dynamically inject the parameter values to the container.

...

See the topics given below.

Table of Contents

Injecting parameters as environment variables

If you want to inject parameter values as environment variables,

...

you need to apply the following.

Configuring the synapse artifacts

Define your synapse artifacts using "$SYSTEM:<place_holder_value>" as the parameter value. Note that <place_holder_value> represents a place holder representing the parameter. For example, shown below is an endpoint artifact, where the endpoint uri configured for this feature:

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteEndPoint">
  <address uri="$SYSTEM:stockQuoteEP"/>
</endpoint>

Export environment variable 

In a VM deployment, you can export the variables as shown below. Here VAR is the url you need to have set as environment property.

Code Block
export VAR=http://localhost:61616/...

Injecting parameters using a configuration file

If you want to inject parameter values using a configuration file

...

, you need to apply the following configurations:

Configuring the synapse artifacts

Define your synapse artifacts using "$FILE:<place_holder_value>" as the parameter value. Note that <place_holder_value> represents a place holder representing the parameter. For example, shown below is an endpoint artifact, where the endpoint uri configured for this feature:

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteEndPoint">
  <address uri="$FILE:stockQuoteEP"/>
</endpoint>

Setting up the configuration file

You can use a configuration file to load the parameter values for each environment. By default, the ESB profile is shipped with the file.properties file (stored in the <EI_HOME>/conf directory), which you can use to store the parameter values that should be injected to your synapse configuration. The parameter values should be specified as a key-value pair as shown below.

Code Block
stockQuoteEP=http://localhost:9000/services/SimpleStockQuoteService

Alternatively, you can use a custom file stored in a file system instead of the default file.properties file. For example, a file named dev.properties can be used to inject parameter values to the development environment and a file named prod.properties can be used to inject parameter values to the production environment. 

It is possible to use a file in an NFS mount as the file path and it is useful for container deployment. We can use the environment specific configuration from the file in NFS mount and inject the parameter values to the docker container.

...

Updating the system property

In the the product startup scripts (integrator.sh and integrator.bat file), which are available in the <EI_HOME>/bin directory, a system variable is defined as follows and the value is set to default.

...

Code Block
-Dproperties.file.path=default 

...

 When the above value set to default, the system reads the parameters from the file.properties file that is available in the <EI_HOME>/conf directory.

...

Using custom property files

...

 

Code Block
-Dproperties.file.path=default 

If you are using a custom configuration file, instead of the file.properties file, you

...

need to configure the particular file path in the integrator.sh or integrator.bat file as shown below.

...


Localtabgroup
Localtab
titleintegrator.sh

...

Code Block
-Dproperties.file.path=/home/user/ei_configs/dev/dev.properties

...

Localtab
titleintegrator.bat

...

Code Block
-Dproperties.file.path="%CONFIG_DIR%\dev\dev.properties

With this feature, it is possible to inject the parameters by using the $FILE: prefix followed by the relevant key used to map the original value.

Supported parameters

Endpoint parameters

...

Supported parameters

Listed below are the synapse artifact parameters to which you can dynamically inject values. Note that there are two ways to inject parameters as discussed above.

Endpoint parameters

Endpoint TypeParameters
Address Endpointuri
HTTP Endpointuri
Loadbalance Endpointhostname and port
RecipientList Endpointhostname and port
Template Endpointuri
WSDL EndpointwsdlURI

Data service parameters

The following data service parameters support this feature.

Warning

Note that you can inject parameter values only using environment variables for the following data service parameters. That is, you cannot use a configuration file for this purpose.

  • Driver
  • URL
  • Username
  • Password

Scheduled Task parameters

The pinned servers parameter can be set as an environment variable for a scheduled task or proxy service.

...

Inbound Endpoint parameters

See the list of

...

parameters available for the following inbound endpoints:

...

Proxy service parameters

The pinned servers parameter as well as all the service-level transport parameters:

...

Message Store parameters

Message Store TypeParameters
JMS Message Store
  • store.jms.username
  • store.jms.password
  • store.jms.connection.factory
WSO2 MB Message Store
RabbitMQ Message Store
JDBC Message Store
  • store.jdbc.drive
  • store.jdbc.connection.url
  • store.jdbc.username
  • store.jdbc.password
Resequence Message Store