_Asynchronous Apex Interview Questions(Q&A)_
_Asynchronous Apex Interview Questions(Q&A)_
Key Considerations:
Callout Limits: Each execution of the start, execute, and finish methods
can perform up to 100 callouts.
Scope Size: If your batch job processes a large number of records, be
mindful of the scope size to avoid exceeding callout limits. For instance,
if your scope size is 200, only the first 100 records will successfully
make callouts. Adjusting the scope size can help manage this.
BatchApexErrorEvent:
Yes, you can change batch jobs in Salesforce. You can reschedule,
cancel, or delete batch jobs. You can also share batch jobs with other
Salesforce organizations.
Explanation
Batch job limit: Salesforce limits the number of concurrent Apex batch jobs
to five.
Batch size: Each batch can have up to 2,000 records.
Total records processed: Salesforce limits the total number of records
processed to 50 million per 24 hours.
Batch job starts: Salesforce limits the number of batch job starts to 250,000
per 24 hours.
What happens if a batch job fails?
1. If a record in a batch fails, the entire batch rolls back.
2. The batch job is marked as Failed and immediately terminated if more
than 50 million records are returned.
Limits: The Flex Queue can hold up to 100 batch jobs in the Holding
status. Attempting to add more will result in an error
Yes, in Salesforce, you can "queue" a future method, meaning you can
initiate a future method which will be added to an asynchronous queue and
executed when system resources are available, effectively allowing it to
run in the background without blocking the current user's
interaction; however, you cannot directly chain future methods together as
they are not designed for complex job dependencies, and for that, you
should use Queueable Apex instead.
Recommended Alternatives:
Parameter Support:
Job Monitoring:
Chaining Capabilities:
Use Cases:
Therefore, the failure of the second transaction does not affect the
successful processing and committed changes of the first and third
transactions. Each batch operates independently, ensuring that a failure
in one batch does not impact the others.