4
votes

I configured an inbound endpoint, but I want to manage java.naming.provider.url value in a conf.xml file that under config directory in WSO2.

In each environment I have a conf.xml file which includes the URL values for that environment like:

<environment>
    <JNPU>test</JNPU>
</environment>
<test>
    <JNPU>failover:tcp://localhost:61616</JNPU>
</test>

I just want first read this environment value of the JNPU which is test in this example. Then, I want to change the java.naming.provider.url value in inbound endpoint with this value.

In a sequence, I can read the values with using these properties:

<property name="confFile" expression="get-property('registry','conf:endpoints/conf.xml')" scope="default" type="OM" xmlns:ns="http://org.apache.synapse/xsd"/>
<property name="JNPUEnvValue" expression="evaluate(fn:concat('$confFile//environment//','JNPU'))" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<property name="JNPUValue" expression="evaluate(fn:concat('$ctx:epConfiguration','//',get-property('JNPUEnvValue'),'//','JNPU'))" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>

I used them as parameters in inbound endpoint but I could not get the value of java.naming.provider.url in conf.xml file.

Thanks for any idea.

2

2 Answers

2
votes

We can dynamically configure inbound endpoint parameters, if we save only the respective parameter value as the content of the file saved in registry. For example, in your case, the value "failover:tcp://localhost:61616" should be saved in the file. You can keep separate files for each parameter in a registry location. And, you need to only change file content for each environment.

Please refer the section Specifying inbound endpoint parameters as registry values at https://docs.wso2.com/display/EI650/WSO2+EI+Inbound+Endpoints.

1
votes

If you can keep the url in the registry, then you can use it from the registry as follows.

<parameter name="java.naming.provider.url" key="gov:/Path/javaNamingProviderURL"/>