【问题标题】:wso2 esb mediator is singletonwso2 esb 中介是单例的
【发布时间】:2014-09-17 02:19:27
【问题描述】:

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

对此有什么想法吗?

【问题讨论】:

  • 请发布您的代理服务配置,以便进一步了解问题。另外:您使用的是哪个调解器?它是 ESB 附带的一种还是自定义的?

标签: wso2 wso2esb


【解决方案1】:

我在这里犯了一个错误。在 java 代码中,spring bean 用于包含在 xml 文件中配置的 mediator 属性。但是spring bean是单例的,导致不同的配置不能应用于不同的代理。

<?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>

【讨论】:

    猜你喜欢
    • 2012-08-31
    • 2012-08-31
    • 1970-01-01
    • 1970-01-01
    • 2012-08-06
    • 2012-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多