简体   繁体   English

入站端点的WSO2 ESB动态配置

[英]WSO2 ESB Dynamic Configuration for Inbound Endpoint

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. 我配置了入站端点,但我想在WSO2中config目录下的conf.xml文件中管理java.naming.provider.url值。

In each environment I have a conf.xml file which includes the URL values for that environment like: 在每个环境中,我都有一个conf.xml文件,其中包含该环境的URL值,如:

<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. 我只想先读一下这个例子中测试的JNPU的环境值。 Then, I want to change the java.naming.provider.url value in inbound endpoint with this value. 然后,我想用此值更改入站端点中的java.naming.provider.url值。

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. 我在入站端点中将它们用作参数,但我无法在conf.xml文件中获取java.naming.provider.url的值。

Thanks for any idea. 谢谢你的想法。

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. 例如,在您的情况下,应将值“failover:tcp:// localhost:61616”保存在文件中。 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 . 请参阅https://docs.wso2.com/display/EI650/WSO2+EI+Inbound+Endpoints上的将 入站端点参数指定为注册表值一节。

如果您可以将URL保留在注册表中,则可以从注册表中使用它,如下所示。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM