{"id":15383802,"url":"https://github.com/jamessimone/apex-async-processor","last_synced_at":"2026-02-23T01:04:55.211Z","repository":{"id":104777540,"uuid":"587360567","full_name":"jamessimone/apex-async-processor","owner":"jamessimone","description":"Abstract away which async framework is being used within Salesforce in favor of dynamically using the most appropriate solution for the problem at hand.","archived":false,"fork":false,"pushed_at":"2024-08-19T14:05:42.000Z","size":27,"stargazers_count":35,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-02T00:51:16.561Z","etag":null,"topics":["apex","async","batch","queueable","salesforce"],"latest_commit_sha":null,"homepage":"","language":"Apex","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamessimone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"Contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-10T15:16:15.000Z","updated_at":"2024-12-06T09:49:17.000Z","dependencies_parsed_at":"2024-10-18T16:36:09.974Z","dependency_job_id":"840a09ac-7932-48c8-8931-3c3f9d34db45","html_url":"https://github.com/jamessimone/apex-async-processor","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"89a71a4b1222f374c633b907324d16a4dff9269f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamessimone%2Fapex-async-processor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamessimone%2Fapex-async-processor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamessimone%2Fapex-async-processor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamessimone%2Fapex-async-processor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamessimone","download_url":"https://codeload.github.com/jamessimone/apex-async-processor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245937916,"owners_count":20696987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apex","async","batch","queueable","salesforce"],"created_at":"2024-10-01T14:39:42.236Z","updated_at":"2025-10-14T12:10:18.837Z","avatar_url":"https://github.com/jamessimone.png","language":"Apex","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apex Async Processor\n\nThis repository showcases how to use the `AsyncProcessor` pattern to avoid having to create batch classes and/or queueable classes.\n\nUsing this pattern greatly simplifies how asynchronous code is defined and run on platform. Simply:\n\n- clone the repository or copy/paste the [AsyncProcessor](../../blob/main/core/classes/AsyncProcessor.cls) and [AsyncProcessorTests](../../blob/main/core/classes/AsyncProcessorTests.cls) files to your org\n- extend the `AsyncProcessor`, defining code you'd like to have processed asynchronously:\n\n  - also add any additional interfaces you need, like `Database.Stateful` (as is appropriate)\n\n  ```java\n  public class AsyncContactProcessorExample extends AsyncProcessor {\n    protected override void innerExecute(List\u003cSObject\u003e records) {\n      List\u003cContact\u003e contacts = (List\u003cContact\u003e) records;\n      // do whatever processing here\n    }\n  }\n  ```\n\n  - and then in usage:\n\n  ```java\n  // within some other class:\n  new AsyncContactProcessorExample().get('SELECT Id, Account.Name FROM Contact').kickoff();\n  // or, alternatively, if you have the records already:\n  new AsyncContactProcessorExample().get(contacts).kickoff();\n  ```\n\nFor query-based usages, `AsyncProcessor` will automatically choose whether to batch or enqueue based on the default returned by `Limits.getLimitQueryRows()` - this can also be overridden by providing an alternative implementation of `protected virtual Integer getLimitToBatch()` for subclasses of `AsyncProcessor`.\n\n## Further Examples\n\nHere's an example lowering the `getLimitToBatch()` amount from 50k to 10k records. This could be really useful if the data you're passing in might otherwise blow up the heap size limit.\n\n```java\npublic without sharing class LowerLimitAsyncProcessor {\n\n  public override Integer getLimitToBatch() {\n    return Limits.getLimitDmlRows();\n  }\n}\n```\n\nYou can also look at [ContactAsyncProcessor](../../blob/main/example-app/classes/ContactAsyncProcessor.cls) for a short, complete example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamessimone%2Fapex-async-processor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamessimone%2Fapex-async-processor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamessimone%2Fapex-async-processor/lists"}