[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ACMZFW96HWWD0K3CJEBR0H":3,"skill-same:01M6ACMZFW96HWWD0K3CJEBR0H":58},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":17,"categories":18,"keywords":29,"publishedAt":31,"linkOnly":32,"markdownContent":33,"markdownBody":33,"frontMatter":34,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":40,"ownerHtmlUrl":41,"ownerBlogUrl":42,"ownerDescription":7,"updatedAt":43,"install":44,"resources":57},"01M6ACMZFW96HWWD0K3CJEBR0H","manage-async","异步任务管理",null,"","apache\u002Fofbiz-plugins","apache","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F47359?v=4","01M6AC83E6K4FDKK7HZ8WNMQKE","The Apache Software Foundation","01M6ACMJJ1Q4WYATY4GXZ2FAVD",178,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-async\u002FSKILL.md",[19,24],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":25,"categoryName":26,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BSFHC0DJXKNN0QBZDDS4K9","定时任务与自动化编排","SCENARIO","使用场景",[30],"manage async","2026-11-10 10:12:30",false,"\u003C!--\nLicensed to the Apache Software Foundation (ASF) under one\nor more contributor license agreements.  See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership.  The ASF licenses this file\nto you under the Apache License, Version 2.0 (the\n\"License\"); you may not use this file except in compliance\nwith the License.  You may obtain a copy of the License at\n\nhttp:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\n\nUnless required by applicable law or agreed to in writing,\nsoftware distributed under the License is distributed on an\n\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, either express or implied.  See the License for the\nspecific language governing permissions and limitations\nunder the License.\n-->\n\n---\nname: manage-async\ndescription: Manage asynchronous execution, scheduled jobs, and the JobSandbox in OFBiz.\n---\n\n# Skill: Manage Async Workloads in Apache OFBiz\n\n## Goal\nTo properly manage asynchronous execution, scheduled jobs, and the `JobSandbox` in OFBiz, ensuring stability and preventing infinite loops or resource starvation.\n\nAsynchronous logic in OFBiz can be triggered via `dispatcher.runAsync()`, scheduled Quartz jobs, Service ECAs (`mode=\"async\"`), and the `JobSandbox` recurrences. While powerful, async execution is often misunderstood and can lead to severe system instability if misused.\n\n## Triggers\n- When deciding whether a service or ECA should use `mode=\"async\"` or `mode=\"sync\"`.\n- When designing solutions for high-volume background tasks, data imports, or heavy operations.\n- When configuring background jobs through the `JobSandbox`.\n\n## Rules & Procedures\n\n### 1. Async is CONCURRENT, not \"Later\"\n**Critical Clarification**: Async does not mean \"run later\". It means \"run concurrently\".\n- Async runs in a separate thread.\n- It starts a new transaction.\n- It may execute *before* the triggering transaction commits.\n- Reads may see no data or partial data.\n\n*Why this matters*: Agents often falsely assume \"Async = safe follow-up after main work\". In OFBiz, this assumption is false unless commit boundaries are strictly enforced (e.g., using `event=\"commit\"` in a SECA).\n\n### 2. Large Data Imports or Batch Workloads\nFor large data imports or batch workloads:\n- **Prefer batching + synchronous execution.**\n- Process one record per transaction inside a controlled loop.\n- **Avoid** one async service invocation per record.\n\n## Guardrails\n\n### 1. Async is NOT a Scalability Strategy at High Volume\nRunning hundreds or thousands of heavy operations asynchronously does not make them faster.\n- Database contention increases.\n- Throughput drops and commit times increase.\n- The overall system becomes unstable.\n- *Rule*: Volume + DB-heavy work → async makes things worse. Avoid choosing async reflexively when you see \"heavy\" work.\n\n### 2. Persisted Async Jobs Can DOS Your Own System\nA massive number of persisted async operations causes a \"JobSandbox explosion\".\n- **Example**: If processing 500,000 records creates 500,000 persisted async jobs, the `JobSandbox` itself becomes the system bottleneck, not the business logic.\n- An agent or junior dev may think `persist=\"true\"` equals \"safer\". But at scale, DB I\u002FO explodes, and the service engine spends more time managing jobs than executing work.\n- **Rule**: Persisted async services must ONLY be used when the job creation rate is ≤ the job consumption rate.\n\n### 3. Resource Contention Warning\nAsync services share CPU, memory, threads, and DB connections with synchronous services.\n- Excessive async workloads can starve UI and interactive business flows.\n- Async usage must be evaluated in the context of the total system workload.\n\n## Async Decision Checklist\nBefore choosing an async approach, you must answer **YES** where applicable. If these questions cannot be answered clearly, async is likely the wrong choice:\n- [ ] Does this work need to block the user? (If no, async *might* be appropriate, subject to volume).\n- [ ] Does it depend on data created in another transaction?\n- [ ] What is the expected volume per hour\u002Fday? (Volume must be controlled).\n- [ ] Can failures be delayed or retried safely?\n- [ ] Is batching a better alternative?\n- [ ] Should this run only after commit?\n- [ ] Does the infrastructure support the async load?\n\n",{},"trunk","6c6c27710443de03e9247605d33a2e2f5bc3d1e2","ai-agent-skills\u002Fmanage-async",222,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins","https:\u002F\u002Fofbiz.apache.org\u002F","https:\u002F\u002Fgithub.com\u002Fapache","https:\u002F\u002Fwww.apache.org\u002F","2026-11-12 22:04:06",{"source":9,"skillName":5,"commands":45,"prompt":55,"zipAvailable":56},[46,49,52],{"tool":47,"command":48},"npx","npx skills add apache\u002Fofbiz-plugins --skill manage-async",{"tool":50,"command":51},"bunx","bunx skills add apache\u002Fofbiz-plugins --skill manage-async",{"tool":53,"command":54},"pnpm","pnpm dlx skills add apache\u002Fofbiz-plugins --skill manage-async","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-async\u002FSKILL.md",true,[],[59,71,83,97,111,125],{"skillNo":60,"name":61,"nameZh":62,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":63,"categories":64,"keywords":69,"publishedAt":31},"01M6ACQSN90YKJZ92MQ52D9R8H","prepush-readiness","推送前就绪检查","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fprepush-readiness\u002FSKILL.md",[65,66],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":67,"categoryName":68,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BR5V701HCN066VEP7H4812","代码仓库协作管理",[70],"prepush readiness",{"skillNo":72,"name":73,"nameZh":74,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":75,"categories":76,"keywords":81,"publishedAt":31},"01M6ACQPR1WRA751V4DXVC3AHF","manage-webapps","Web 应用管理","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-webapps\u002FSKILL.md",[77,78],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":79,"categoryName":80,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BWKS60NTYJHFE9FQSXGDKS","低代码应用开发",[82],"manage webapps",{"skillNo":84,"name":85,"nameZh":86,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":87,"categories":88,"keywords":95,"publishedAt":31},"01M6ACQMCX8Z7NY2CE08NCV6ND","manage-themes","主题管理","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-themes\u002FSKILL.md",[89,92],{"categoryNo":90,"categoryName":91,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQ6TQMKHSMFVQHR2KYAEVN","界面设计师",{"categoryNo":93,"categoryName":94,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BRASNPVNJVQQJ4KZX8XM5D","前端开发与界面实现",[96],"manage themes",{"skillNo":98,"name":99,"nameZh":100,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":101,"categories":102,"keywords":109,"publishedAt":31},"01M6ACQHYN20AFWF6TKK4RGQ8A","manage-tests","测试管理","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-tests\u002FSKILL.md",[103,106],{"categoryNo":104,"categoryName":105,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师",{"categoryNo":107,"categoryName":108,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障",[110],"manage tests",{"skillNo":112,"name":113,"nameZh":114,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":115,"categories":116,"keywords":123,"publishedAt":31},"01M6ACQFRMW7R45YD3HRAXPGWF","manage-templates","模板管理","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-templates\u002FSKILL.md",[117,120],{"categoryNo":118,"categoryName":119,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BQ6TK1MPB82068236GSXDE","文档处理",{"categoryNo":121,"categoryName":122,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQ6TPH3VQWKQZXV7EPF8VZ","办公行政人员",[124],"manage templates",{"skillNo":126,"name":127,"nameZh":128,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":129,"categories":130,"keywords":137,"publishedAt":31},"01M6ACQCSSDZQMD8VX2K3WRR93","manage-strategies","策略管理","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-strategies\u002FSKILL.md",[131,134],{"categoryNo":132,"categoryName":133,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BTXF8K9DFQC4T4TXVH0NMZ","策略与托管设置管理",{"categoryNo":135,"categoryName":136,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8C6RQ852C9AEJFCBGG1YA7S","IT 管理员",[138],"manage strategies"]