Question 1
Q1A financial services company uses an AEM Forms workflow to process loan applications. The workflow includes a custom step that invokes the Document Services API to merge user data with an XDP template, generating a final contract PDF. During peak hours, the workflow engine becomes sluggish, and logs indicate high CPU usage. Analysis reveals that the Document Services API call is synchronous and resource-intensive. Which approach is the most effective for mitigating the performance impact of this step on the main workflow thread?
Show answer & explanation
Correct answer: B
Using an AEM Sling Job is the best practice for offloading long-running or resource-intensive tasks from synchronous threads like a workflow process. This prevents the PDF generation from blocking the main workflow engine, allowing it to remain responsive. Increasing heap size might help prevent OutOfMemoryErrors but doesn't solve the core issue of CPU contention and thread blocking. Caching and using the ECMA Script step are not suitable for this kind of backend processing.