wso2 esb mediator是单身人士

时间:2014-09-17 02:19:28

标签: wso2 wso2esb

我在ESB中配置了两个代理,这两个代理桥接到一个实例中介。我在代理配置中为中介设置了不同的属性。 我希望两个mediators实例在ESB中运行,具有不同的属性。 但事实上,似乎只有中介实例在ESB中。

对此有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我在这里搞错了。在java代码中,spring bean用于包含在xml文件中配置的mediator属性。但是spring bean是singleton并且导致不同的配置不能应用于不同的代理。

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="abc"
       transports="http"
       startOnLoad="true"
       trace="enable"
       statistics="enable">
   <description/>
   <target>
      <inSequence>
         <log level="full"/>
         <property name="address"
                 scope="transport"
                  expression="fn:substring-after(get-property('To'),'/services/crownperth')"/>
         <class name="com.abc.customerintegration.mediator.CustomerInfoMediator">
          <property name="pmServerAddress" value="http://192.168.112.243:3509/MobileConnectService"></property>
           <property name="property" value="P"/>
          <property name="languageCode" value="en-US"></property>
         </class>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
</proxy>


<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="def"
       transports="http"
       startOnLoad="true"
       trace="enable"
       statistics="enable">
   <description/>
   <target>
      <inSequence>
         <log level="full"/>
         <property name="address"
                 scope="transport"
                  expression="fn:substring-after(get-property('To'),'/services/crownperth')"/>
         <class name="com.abc.customerintegration.mediator.CustomerInfoMediator">
          <property name="pmServerAddress" value="http://192.168.112.243:3509/MobileConnectService"></property>
           <property name="property" value="P"/>
          <property name="languageCode" value="en-US"></property>
         </class>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
</proxy>