Salesforce needs a queue for processing Apex. The @future annotation, scheduling classes and Batch Apex are all fine but we really need a standard queue.
Quese are not rocketsurgery and have been around for quite a long time. Let’s embrace them for Force.com development. See my blog post for more info and ideas on why this should be implemented.
Here's what a queue would solve:
- Async processing. Apex invocations are simply passed to the queue and processed sequentially when resources are available. I typically don’t care when a process is kicked off but just that it did run and in a certain sequence. Would be great to have some sort of history similar to batch jobs.
- Higher limits for callouts would be awesome but there is a tipping point here. You can’t allow unlimited callouts but perhaps 200 callouts per invocation would be awesome to accomidate triggers.
- Ability to pass complex objects, sObjects and primitives as method parameters to methods in the queue.
- Bulk processing with ability to call Batch Apex. I would love to push a call to the queue that in turn kicks off a batch process in the same thread.
- No more issues with calling a @future method from a @future method as each call would be replaced by sending the Apex invocation to the queue.
- Much easier to test as you don’t have to worry about startTest() and stopTest().