com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

Injecting Parameters as Environment Variables

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 value for the 'endpoint URL' given in your integration artifacts should be specific 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. This is particularly useful for container deployments, where we need to dynamically inject the parameter values to a container. Without this feature, you need to create and maintain separate artifacts for each environment.

In this document, we will discuss how to inject parameters as environment variables to your environments. If you want to inject parameters using a file, see Injecting Parameters as Configuration Files.

See the following topics for instructions:

Using 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:<parameter_key>" as the parameter value. Note that <parameter_key> represents a place holder representing the parameter. For example, shown below is an endpoint artifact, where the endpoint uri configured for this feature:

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

Exporting the environment variable 

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

export stockQuoteEP=http://localhost:61616/...

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

Configure the Endpoint parameters in your synapse configuration as shown below.


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

In the following example, the endpoint URL is configured for an environment variable.

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

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.

export stockQuoteEP=http://localhost:61616/...

Data service parameters

  • Driver
  • URL
  • Username
  • Password
Example

In the following example, the data service parameters are configured for an 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.

export uname=username
export pass=password
export url1=jdbc:mysql://localhost:3306/Employees
export driver1=com.mysql.jdbc.Driver

Scheduled Task parameters

The pinned servers parameter can be set as an environment variable for a scheduled task or proxy service. See the examples given below.

The pinned server parameter is applicable only for tasks with co-ordination disabled

Example
<?xml version="1.0" encoding="UTF-8"?>
<task class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz" name="ProxytestInject" pinnedServers="$SYSTEM:pinned" xmlns="http://ws.apache.org/ns/synapse">
    <trigger count="5" interval="10"/>
    <property name="injectTo" value="proxy" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
    <property name="proxyName" value="testProxy" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
    <property name="soapAction" value="mediate" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
    <property name="message" xmlns:task="http://www.wso2.org/products/wso2commons/tasks">
        ----------
    </property>
</task>

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.

export pinned=mi_server

Inbound Endpoint parameters

See the list of properties that can be defined as environment variables:

Example
<?xml version="1.0" encoding="UTF-8"?>
<inboundEndpoint name="jms" onError="fault" protocol="jms" sequence="LogMsgSeq" suspend="false" xmlns="http://ws.apache.org/ns/synapse">
    <parameters>
        <parameter name="interval">15000</parameter>
        <parameter name="sequential">true</parameter>
        <parameter name="coordination">true</parameter>
        <parameter name="transport.jms.Destination">myq</parameter>
        <parameter name="transport.jms.CacheLevel">3</parameter>
        <parameter name="transport.jms.ConnectionFactoryJNDIName">$SYSTEM:jmsconfac</parameter>
        <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
        <parameter name="java.naming.provider.url">$SYSTEM:jmsurl</parameter>
        <parameter name="transport.jms.UserName">$SYSTEM:jmsuname</parameter>
        <parameter name="transport.jms.SessionAcknowledgement">AUTO_ACKNOWLEDGE</parameter>
        <parameter name="transport.jms.Password">$SYSTEM:jmspass</parameter>
        <parameter name="transport.jms.SessionTransacted">false</parameter>
        <parameter name="transport.jms.ConnectionFactoryType">queue</parameter>
        <parameter name="transport.jms.ContentType">application/xml</parameter>
        <parameter name="transport.jms.SharedSubscription">false</parameter>
        <parameter name="pinnedServers">$SYSTEM:pinned</parameter>
        <parameter name="transport.jms.ResetConnectionOnPollingSuspension">false</parameter>
    </parameters>
</inboundEndpoint>

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.

export jmsconfac=QueueConnectionFactory 
export jmsurl=tcp://localhost:61616
export jmsuname=admin
export jmspass=admin
export pinned=mi_server

Proxy service parameters

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

Example
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="JmsListner" pinnedServers="localhost" startOnLoad="true" transports="http https jms" xmlns="http://ws.apache.org/ns/synapse">
    <target>
        <inSequence>
            -------------
            <drop/>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </target>
    <parameter name="transport.jms.SessionAcknowledgement">AUTO_ACKNOWLEDGE</parameter>
    <parameter name="transport.jms.Destination">myq</parameter>
    <parameter name="transport.jms.ConnectionFactoryType">queue</parameter>
    <parameter name="transport.jms.ContentType">application/xml</parameter>
    <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
    <parameter name="java.naming.provider.url">$SYSTEM:jmsurl</parameter>
    <parameter name="transport.jms.SessionTransacted">false</parameter>
    <parameter name="transport.jms.ConnectionFactoryJNDIName">$SYSTEM:jmsconfac</parameter>
    <parameter name="transport.jms.UserName">$SYSTEM:jmsuname</parameter>
    <parameter name="transport.jms.Password">$SYSTEM:jmspass</parameter>
</proxy>

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.

export jmsconfac=QueueConnectionFactory 
export jmsurl=tcp://localhost:61616
export jmsuname=admin
export jmspass=admin

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
Example
<?xml version="1.0" encoding="UTF-8"?>
<messageStore class="org.apache.synapse.message.store.impl.rabbitmq.RabbitMQStore" name="InboundStore" xmlns="http://ws.apache.org/ns/synapse">
    <parameter name="store.rabbitmq.host.name">$SYSTEM:rabbithost</parameter>
    <parameter name="store.producer.guaranteed.delivery.enable">false</parameter>
    <parameter name="store.rabbitmq.host.port">$SYSTEM:rabbitport</parameter>
    <parameter name="store.rabbitmq.route.key"/>
    <parameter name="store.rabbitmq.username">$SYSTEM:rabbitname</parameter>
    <parameter name="store.rabbitmq.virtual.host"/>
    <parameter name="rabbitmq.connection.ssl.enabled">false</parameter>
    <parameter name="store.rabbitmq.exchange.name">exchange3</parameter>
    <parameter name="store.rabbitmq.queue.name">queue3</parameter>
    <parameter name="store.rabbitmq.password">$SYSTEM:rabbitpass</parameter>
</messageStore>

In a VM deployment, you can export the variables as shown below.

export rabbithost=localhost 
export rabbitport=5671
export rabbitname=admin
export rabbitpass=admin
com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.