我们可以在wso2esb中以相同的顺序发送多个邮件,也可以动态设置邮件

时间:2013-07-02 07:47:35

标签: wso2 wso2esb wso2dss

我从前端获取数据我需要验证数据库中的数据。 现在值介于最小值和最大值之间,如果它是最小值或最大值我需要向数据库中定义的关注人发送邮件,在这种情况下我不知道客户端的邮件ID是什么我需要交叉检查如果定义static.so将来可能会更改我的代理是

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="tReadingMobile_5"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence onError="fault">

         <property name="partybranchid"
                   expression="//partybranchid"
                   scope="default"
                   type="STRING"/>
         <property name="Reading"
                   expression="//ReadingsLiteTaildto"
                   scope="default"
                   type="STRING"/>
         <property name="actiondetailid"
                   expression="//actiondetailid/text()"
                   scope="default"
                   type="STRING"/>
         <property name="actionid"
                   expression="//actionid/text()"
                   scope="default"
                   type="STRING"/>
         <property name="assetid"
                   expression="//assetid/text()"
                   scope="default"
                   type="STRING"/>
         <log level="custom">
            <property name="fff" expression="get-property('Reading')"/>
            <property name="ggggg" expression="get-property('actiondetailid')"/>
            <property name="hhhh" expression="get-property('actionid')"/>
         </log>
         <iterate id="Min_Max" expression="//ReadingsLiteTaildto">
            <target>
               <sequence>
                  <property name="FinalValue" expression="//FinalValue/text()"/>
                  <property name="assetid" expression="get-property('assetid')"/>
                  <property name="parameterid" expression="//ParameterId/text()"/>
                  <payloadFactory>
                     <format>
                        <p:select_Min_Max_Op xmlns:p="http://ws.wso2.org/dataservice">
                           <xs:assetid xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:assetid>
                           <xs:parameterid xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:parameterid>
                        </p:select_Min_Max_Op>
                     </format>
                     <args>
                        <arg expression="get-property('assetid')"/>
                        <arg expression="get-property('parameterid')"/>
                     </args>
                  </payloadFactory>
                  <log level="full"/>
                  <send receive="ReadingsAlertUpdate_Seq">
                     <endpoint>
                        <address uri="http://localhost:9764/services/massetparametersetdetail_DataService/"
                                 format="soap11"/>
                     </endpoint>
                  </send>
               </sequence>
            </target>
         </iterate>
      </inSequence>
      <outSequence onError="fault"/>
   </target>
</proxy>  

我的序列就像这样

<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse"
          name="ReadingsAlertUpdate_Seq"
          onError="fault">
   <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
   <property xmlns:ns="http://org.apache.synapse/xsd"
             name="actiondetailid"
             expression="get-property('actiondetailid')"/>
   <property xmlns:ns="http://org.apache.synapse/xsd"
             xmlns:x="http://ws.wso2.org/dataservice"
             name="maxvalue"
             expression="//x:maxvalue/text()"
             scope="default"
             type="STRING"/>
   <property xmlns:ns="http://org.apache.synapse/xsd"
             xmlns:x="http://ws.wso2.org/dataservice"
             name="minvalue"
             expression="//x:minvalue/text()"
             scope="default"
             type="STRING"/>
   <property xmlns:ns="http://org.apache.synapse/xsd"
             xmlns:x="http://ws.wso2.org/dataservice"
             name="iscritical"
             expression="//x:iscritical/text()"
             scope="default"
             type="STRING"/>
   <property xmlns:ns="http://org.apache.synapse/xsd"
             name="FinalValue"
             expression="get-property('FinalValue')"
             scope="default"
             type="STRING"/>
<filter xmlns:ns="http://org.apache.synapse/xsd"
           xpath="get-property('FinalValue') &lt; get-property('minvalue')">
      <then>
         <property name="Message1" value="1" scope="default" type="STRING"/>
      </then>
      <else>
         <filter xpath="get-property('FinalValue') &gt; get-property('maxvalue')">
            <then>
               <property name="Message1" value="1" scope="default" type="STRING"/>
            </then>
            <else>
               <property name="Message0" value="0" scope="default" type="STRING"/>
            </else>
         </filter>
      </else>
   </filter>
   <property xmlns:ns="http://org.apache.synapse/xsd"
             name="Message1"
             expression="get-property('Message1')"
             scope="default"
             type="STRING"/>
   <property name="Mesage0"
             expression="get-property('Message0')"
             scope="default"
             type="STRING"/>
   <filter xmlns:ns="http://org.apache.synapse/xsd"
           xpath="get-property('Message1')=1=get-property('iscritical')">
      <then>
<payloadfactory>
<format>
 <p:GetUserMail_Op xmlns:p="http://ws.wso2.org/dataservice">
           <xs:partybranchid xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:partybranchid>
   </p:GetUserMail_Op>
</format>
<args>
  <arg expression="get-property('partybranchid')"/>
</args>
<send receive="ReadingsAlertUpdate_Seq2">
                     <endpoint>
                        <address uri="http://localhost:9764/services/taciondetailmail_DataService/"
                                 format="soap11"/>
                     </endpoint>
                  </send>
      <else>
<property name="Alert2" value="Nothing has been Updated"/>
</else>
   </filter>
</sequence>

我按此顺序收到邮件,以便如何在端点

中定义此邮件
<sequence xmlns="http://ws.apache.org/ns/synapse"
          name="ReadingsAlertUpdate_Seq2"
          onError="fault">
  <property xmlns:ns="http://org.apache.synapse/xsd"
                xmlns:v="http://ws.wso2.org/dataservice"
                name="Mail"
                expression="//v:Mail/text()"/>
<log level="full"/>
         <property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
         <property name="Subject"
                   value="Alert Genrated"
                   scope="transport"
                   type="STRING"/>
         <property name="messageType"
                   value="text/html"
                   scope="axis2"
                   type="STRING"/>
         <property name="ContentType"
                   value="text/html"
                   scope="axis2"
                   type="STRING"/>
         <send>
            <endpoint>
               <address uri="$Mail"/>
            </endpoint>
         </send>

</sequence>

是否有可能在wso2esb中定义动态邮件,我们需要再次使用其他方式请...我知道

1 个答案:

答案 0 :(得分:0)

您可以参考[1]中的代理配置,该配置在从数据库中检索电子邮件地址后发送电子邮件。

[1] http://wso2.com/library/articles/2012/01/integrating-different-systems-with-wso2-esb