8

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

1 Answer 1

10

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

1
  • 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. Apr 22, 2014 at 1:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .