We have an external application where few records gets updated or created on daily basis. We already implemented inbound calls to salesforce but it is scheduled for once a month. We need to schedule a class on daily basis from Salesforce to our application and get all updated/newly created records and sync them properly.
I tried to run in a single call but it will be a huge XML which crosses heap limit. So, I am making GET requests by offset 25 and getting 25 records (which are updated or created only) at a time and trying to validate. This is causing DML limit exception. I tried to use @future method and sending XML string to it. in this case, I will be calling same future class multiple times and tried to make DML operations asynchronously. 0-25 records it's fine. But while making callout for 25-50 I am getting System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out. Same error for equable apex controller.
I was planning to use a batch apex after storing XML parse values in a variable but CPU time exceed exception is hitting. Records count that I am getting can be a overall of 500-5000. I request an expert advice to approach this situation. Thank you.