任何人都可以解释下面wso2 esb synapse.xml文件的语法和功能。消息中介发生了

问题描述 投票:0回答:1

任何人都可以在下面的XML代码中解释消息中介是如何发生的吗?像主要序列一样,代理服务顺序是什么,头部调解员在这里做什么等等。为什么在某些情况下endpoint在代理服务中按顺序定义?

什么是代理服务的参数以及如何使用developer Studio调用序列?

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
<parameter name="localRegistry">/</parameter>
<parameter name="cachableDuration">15000</parameter>
</registry>
<proxy name="CreditCardPaymentService"
      transports="https http"
      startOnLoad="true"
      trace="disable">
  <description/>
  <target>
     <inSequence>
        <property xmlns:xsd="http://ccps.services.esb.wso2.packt.com/xsd"
                  xmlns:m0="http://ccps.services.esb.wso2.packt.com"
                  name="symbol"
                  expression="//m0:doPayment/m0:paymentInfo/xsd:cardType"
                  scope="default"
                  type="STRING"/>
        <property xmlns:xsd="http://ccps.services.esb.wso2.packt.com/xsd"
                  xmlns:m0="http://ccps.services.esb.wso2.packt.com"
                  name="filepath"
                  expression="fn:concat('file:./repository/', //m0:doPayment/m0:paymentInfo/xsd:cardType)"/>
        <property name="EPR"
                  expression="get-property('registry',$ctx:filepath)"
                  type="STRING"
                  pattern="&lt;value&gt;(.+?)&lt;/value&gt;"
                  group="1"/>
        <header name="To" expression="get-property('EPR')"/>
        <sequence key="{$ctx:symbol}"/>
        <send/>
     </inSequence>
     <outSequence>
        <send/>
     </outSequence>
  </target>
  <publishWSDL>
     ...............................
  </publishWSDL>
</proxy>
<sequence name="VISA">
    <payloadFactory>
        <format>
            .....
        </format>
        <args>
            .....
        </args>
    </payloadFactory>
    </sequence>
    <sequence name="fault">
    <log level="full">
        <property name="MESSAGE" value="Executing default 'fault' sequence"/>
        <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
        <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
    </log>
    <drop/>
    </sequence>
    <sequence name="AMEX">
    <payloadFactory>
        <format>
            .....
        </format>
        <args>
            ......
        </args>
    </payloadFactory>
    </sequence>
    <sequence name="main">
    <in>
        <log level="full"/>
        <filter source="get-property('To')" regex="http://localhost:9000.*">
        <send/>
        </filter>
    </in>
    <out>
        <send/>
    </out>
    <description>The main sequence for the message mediation</description>
    </sequence>
    </definitions>
wso2 wso2esb
1个回答
0
投票

如果有人调用您的CreditCardPaymentService代理服务,代理中的消息流命中inSequence,则:

  1. 在symbol属性中,您将获得在传入消息中应用的xpath = // m0:doPayment / m0:paymentInfo / xsd:cardType结果的值。
  2. 在filepath属性中,您将获得concat字符串“file:./ repository /”的结果,其xpath结果为// m0:doPayment / m0:paymentInfo / xsd:cardType
  3. 在EPR属性中,您可以在ESB或EI内部注册表中获取文件路径的内容值。
  4. To标头设置为ERP值。
  5. 使用符号属性值调用动态序列。例如,如果符号值等于“A”,则调用名称等于“A”的序列。在此代理中,您具有VISA序列和AMEX序列。
  6. 两个序列都使用payloadfactory介体创建新的有效负载消息。
  7. 在调用正确的序列之后,发送中介将消息发送到标题“To”值目标。
  8. 响应消息命中outSequence并将其发送到代理客户端。
© www.soinside.com 2019 - 2024. All rights reserved.