+1 for this approach. BTW are we planning to write the data from two
streams to the same table?

On Mon, Feb 8, 2016 at 8:59 PM, Lakmini Chathurika <[email protected]> wrote:

> Hi All,
>
> I wrote a proxy service to get development support hours from salesforce .
> In here I got the data from two tables Line_Item__c  and Opportunity.
> Because in salesforce Line_Item__c table keeps the records before January
> and Opportunity table keeps the records January onwards.
> In the proxy first I wrote a SOQL query to get the data from Line_Item__c
> table and published to DAS through the data stream
> "SALESFORCE_DATA_STREAM_1".
> Then I wrote another SOQL query to get the data from Opportunity table and
> published to DAS through the same datastream.
>
> The Proxy is as shown below.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <proxy xmlns="http://ws.apache.org/ns/synapse";
>        name="SalesForceProxy"
>        transports="https,http"
>        statistics="disable"
>        trace="disable"
>        startOnLoad="true">
>    <target>
>       <inSequence>
>          <!--SOQL query to get data from the table Line_Item__c-->
>          <salesforce.query configKey="SF">
>             <batchSize>200</batchSize>
>             <queryString>SELECT  LastModifiedDate, Support_Account_ID__c,
> Dev_Support_Hours__c FROM
>             Line_Item__c WHERE Support_Account_ID__c != 'NULL' AND
> Support_Account_ID__c != '' AND Support_Account_ID__c
>             LIKE '%DEV' ORDER BY LastModifiedDate DESC NULLS
> FIRST</queryString>
>          </salesforce.query>
>          <log level="full" separator=","/>
>          <iterate xmlns:sfn="urn:partner.soap.sforce.com"
>                   continueParent="true"
>                   id="Iterator_line_item"
>                   expression="//sfn:records"
>                   sequential="true">
>             <target>
>                <sequence>
>                   <publishEvent>
>                      <eventSink>UD_DAS</eventSink>
>                      <streamName>SALESFORCE_DATA_STREAM_1</streamName>
>                      <streamVersion>1.0.1</streamVersion>
>                      <attributes>
>                         <meta/>
>                         <correlation/>
>                         <payload>
>                            <attribute xmlns:sf="urn:
> sobject.partner.soap.sforce.com"
>                                       name="SupportAccountKey"
>                                       type="STRING"
>                                       defaultValue=""
>
> expression="//sf:Support_Account_ID__c"/>
>                            <attribute xmlns:sf="urn:
> sobject.partner.soap.sforce.com"
>                                       name="DevelopmentSupportHours"
>                                       type="STRING"
>                                       defaultValue=""
>
> expression="//sf:Dev_Support_Hours__c"/>
>                            <attribute xmlns:sf="urn:
> sobject.partner.soap.sforce.com"
>                                       name="LastModifiedDate"
>                                       type="STRING"
>                                       defaultValue=""
>                                       expression="//sf:LastModifiedDate"/>
>                         </payload>
>                         <arbitrary/>
>                      </attributes>
>                   </publishEvent>
>                </sequence>
>             </target>
>          </iterate>
>
>   <!--SOQL query to get data from the table Opportunity-->
>   <salesforce.query configKey="SF">
>             <batchSize>200</batchSize>
>             <queryString>SELECT
> Development_Support_Account_Key__c,Development_Support_Hours__c,LastModifiedDate
> from Opportunity
>             WHERE Development_Support_Account_Key__c !='NULL' AND
> Development_Support_Account_Key__c !=''AND
>             Development_Support_Account_Key__c
>             LIKE '%DEV' ORDER BY LastModifiedDate DESC NULLS
> FIRST</queryString>
>          </salesforce.query>
>          <log level="full" separator=",">
>             <property xmlns:sf="urn:sobject.partner.soap.sforce.com"
>                       name="valueyy"
>                       expression="//sf:Development_Support_Hours__c"/>
>          </log>
>          <iterate xmlns:sfn="urn:partner.soap.sforce.com"
>                   id="RecordsIterator"
>                   expression="//sfn:records"
>                   sequential="true">
>             <target>
>                <sequence>
>                   <publishEvent>
>                      <eventSink>UD_DAS</eventSink>
>                      <streamName>SALESFORCE_DATA_STREAM_1</streamName>
>                      <streamVersion>1.0.1</streamVersion>
>                      <attributes>
>                         <meta/>
>                         <correlation/>
>                         <payload>
>                            <attribute xmlns:sf="urn:
> sobject.partner.soap.sforce.com"
>                                       name="SupportAccountKey"
>                                       type="STRING"
>                                       defaultValue=""
>
> expression="//sf:Development_Support_Account_Key__c"/>
>                            <attribute xmlns:sf="urn:
> sobject.partner.soap.sforce.com"
>                                       name="DevelopmentSupportHours"
>                                       type="STRING"
>                                       defaultValue=""
>
> expression="//sf:Development_Support_Hours__c"/>
>                            <attribute xmlns:sf="urn:
> sobject.partner.soap.sforce.com"
>                                       name="LastModifiedDate"
>                                       type="STRING"
>                                       defaultValue=""
>                                       expression="//sf:LastModifiedDate"/>
>                         </payload>
>                         <arbitrary/>
>                      </attributes>
>                   </publishEvent>
>                </sequence>
>             </target>
>          </iterate>
>       </inSequence>
>    </target>
>    <description/>
> </proxy>
>
>
> Is it ok to get data from these two tables like this or are there any
> better solutions to do this?
> Any suggestions are highly appreciated.
>
> Thanks & Regards.
> Lakmini.
>
>
>
>
>


-- 

*Nirodha Gallage*
Associate Technical Lead, QA.
WSO2 Inc.: http://wso2.com/
Mobile: +94716429078
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to