Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I need to make asynch call from trigger. Records are comming (1 or 1000 at once) each minute and I need to process them from trigger asynchronously. As I see limits for future and batch jobs are the same except:

future has limitation in 10 call per apex execution. So trigger is not good for future as for example we can have 2200 records and they will be processed in chunks of 200 and we will use 11 call for such case: 2200:200=11 -> we violate limit. Beside this we can't pass complex object types for future and serialization as workaround can bring huge overhead.

batch is not good as it has limit of 5 queued/active jobs. So if we will get 1 records each minute we can hit the limit, even with scheduuled aproach (<=100 scheduled allowed)

What is the best way to apply asynch processing? Thanks

share|improve this question

1 Answer 1

up vote 7 down vote accepted

I would take a look at Dan Appleman's DF13 Presentation here - he talks about these types of scenarios and how you can create Batch/Schedule Managers to achieve the type of continuous processing you are describing without hitting the Batch limits

share|improve this answer
    
Yessir, batch is the way to go. Scope of 1, burn through the queue until it's gone. My robot slaves do it 40,000x per day. –  Shane McLaughlin Apr 22 at 1:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.