[SalesForce] Future vs batch

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

Best Answer

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

Related Topic