Can we send Multiple Mail in wso2esb in same seque

2019-08-04 02:12发布

问题:

i am getting data from front end i need to verify the data across database. present value is between the min value and max if it is min or max i need to send a mail to concern person which has been defined in database,in that case i don,t know what is the mail id of client i need cross check against database in future it might be change if define static.so how can i do this my proxy is

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

and my sequence is like this

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

and i am reciving mail in this sequence so how can i define this mail in endpoint

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

Is it possible to define dynamic mail in wso2esb r we need again use some other way please ..let me know

回答1:

You can refer Proxy configuration in [1], which sends an email after retrieveing the email address from the database.

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