8

I am creating a batch apex job that will send an HTTP request to an external endpoint (URL) that can only take in one record at a time. The batch size is not very large. Maybe 500 records or so. It will grow in the future, but only incrementally. The batch size should never really exceed several thousand records max.

In the execute method, during each iteration of the scope, I'm making a callout. So, if there are 500 records in my scope, I'm making 500 callouts via the HTTP request to the endpoint (URL) passing in the correct parameters for each record. Will that hit callout limits in batch apex?

If I understand correctly, I would just set the batch size to 1?

MyBatchJob batch = new MyBatchJob(); 
Id batchprocessid = Database.executebatch(batch,1);

Can someone please confirm if I'm understanding the batch apex governor limit correctly? I want to make sure that I'm not going to hit governor limits.

Thanks.

9

Depends on the number of callouts you have written in your execute method of the batch .

The upper limit now is 100 callouts ,which means if you have one callout in your execute method you can keep batch size as 100.

Say you have two callouts then your batch size can be 50 .

In general if your execute method has N callouts your batch size will be 100/N

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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