+ Start a Discussion
Nitin ParandeNitin Parande 

Technical Design Question - Best way to real time push data from salesforce to external system using SOAP service calls


As we know the various limitations of service callouts (10 per future call), Triggers bulkification, future calls(10 per apex trnx)  have question on the best approach.
To put the problem in a simple way (though there are other aspects to it)

I have a table AA which is populated with data in batch. At one time you could see data in burst of 1 to 700 or may be more.
I need to push the data in the table to external system through SOAP webservice call and want to do it more or less in a real time.

Within Apex trnx we can only call 10 future calls within which we can call 10 callouts so max 100 callsout in one Apex trnx.  Scheduling the class to process 100 records every hour is not an option to me.

One option is I create another Table BB. The system that populates Table AA will insert a record in Table BB (after populating Table AA). Trigger on Table BB  will fire  to process batch of 100 callout from Table AA.  After submitting the callouts to process records in Table AA it will insert a record in Table BB to retigger another batch of 100. It will keep inserting record in Table BB untill there are no  records in Table AA.   However I am not sure if this option is really feasible from governor limits perspective. Secondly the callouts being future calls you would never know what is in queue to be processed for Table AA.

Any ideas on how we can design this. If this is not possible real time to process ALL  callouts, what could be the best way to process maximum callouts (more then 100 at a time)

Any advise appreciated. 

Shashikant SharmaShashikant Sharma
First Slaesforce is increasing limit of future invocations to 50 and callouts to 100 in a context. Which willhelp you.

To solve this generally according to limit triggers are developed to handle realtime sync. If more records then Scheduled Batch classis used. So in trigger you mark record available for batch and scedule a batch aevery 30 minutes or 1 hour.

I think increase limit will solve it  for you.