What are Schedulers in AEM
AEM for Better Web Performance
How can AEM simplify managing JavaScript and CSS files for faster website performance?
Imagine you must include multiple JavaScript files in your project; individually including each would result in numerous network calls, slowing your site significantly.
With AEM, you can streamline this process to speed things up significantly while improving efficiency.
But AEM makes this easier. Client libraries in AEM provide essential management of assets like JavaScript and CSS files by bundling them together, thus decreasing the number of network calls required.
Bundling improves page load time and enhances website performance, and using AEM client libraries is genuinely revolutionary.
For instance, consider three JavaScript files, such as one.js, two.js, and three.js, which would typically require three distinct network calls each time each was included separately.
Instead, AEM client libraries could transform these processes.
However, with AEM’s client library management feature, you can condense these files into one client library that requires only one network call for faster website performance.
AEM organises client libraries by folder with JSON configuration files for easier management.
These configurations make managing and maintaining your project’s assets simpler.
Optimising Asset Management with AEM
AEM encourages creating individual JavaScript files for different components while bundling them as client libraries.
This approach ensures modularity and better management without compromising performance. Each JavaScript file performs its unique function without disrupting AEM’s operation.
One major drawback of legacy systems is their performance drop due to multiple network calls; using AEM client libraries, you can effectively overcome this problem, and your website will load faster with fewer network calls.
Client libraries within AEM support combining CSS and JavaScript files into bundles that can then be effectively managed as assets within the platform.
By optimising asset management through AEM, users will experience smoother workflows and an increase in website speed.
Reducing network call counts helps AEM minimise delays to website performance by minimising the number of network calls required to run it effectively.
Optimising Performance in AEM
AEM simplifies managing assets such as JS and CSS files, eliminating multiple network calls with each page load. This results in quicker load times and improved modularity.
AEM introduces client libraries as an effective solution. Client libraries help manage both JS and CSS assets seamlessly across components.
We organise these assets in specific client library folders within AEM to give your code an organised workspace.
The Role of Client Libraries in AEM
Client libraries in AEM aren’t just folders—they are powerful tools for optimising performance and saving time and effort by consolidating network calls into one call, which increases efficiency.
Doesn’t that describe us all perfectly for our projects?
Each client library in AEM comes equipped with properties designed to make management easy—for instance, AEM allows us to name our libraries uniquely using its “category” property.
Remote Control Files in AEM Client Libraries
Each library includes files such as “js.txt” and “css.txt,” which provide remote controls for managing its assets (JS and CSS files, respectively).
Imagine specifying exactly which assets load when. AEM makes this simple with its remote controls for loading assets that load dynamically based on three JS or multiple CSS files, for optimal implementation efficiency.
How to Use Client Libraries in AEM
Integrating client libraries into an AEM project is straightforward. Start by creating a folder, assigning its primary type, and configuring properties such as category for easy naming.
The next step should be placing all relevant JS and CSS files inside this folder.
Once assets have been assembled, use AEM’s template code to initiate client libraries within HTML or Svelte code for easy management and improved website performance.
Taking this route will streamline management while simultaneously increasing website efficiency.
Understanding AEM Methods
AEM plays an essential part in efficiently managing client libraries. When we define methods, we need to know how AEM interacts with various templates to understand its interaction.
As I walk you through this process so that you can see it clearly, each CSS or JS method exists within an AEM client library.
When calling these methods, we specify their category parameter, which indicates their library name in AEM.
How AEM Loads Client Libraries
AEM client libraries are loaded based on category properties to ensure CSS files appear at the top while JS files load at the bottom for optimised performance.
Imagine this: you want to dynamically load a specific JS file using AEM’s remote controls.
They determine which files, such as CSS and JS, should be executed. For instance, calling “Js. exit” will load its associated file, while “Css.exit” triggers its CSS counterpart.
Managing AEM Templates Efficiently
AEM makes template management effortless for developers. When opening any folder, they immediately recognise its structure as client libraries in AEM.
Remote controls to define the loading order of multiple JS files are an added benefit.
Instead of manually deleting a JS file from your code, AEM provides an easier option: updating its remote-control configuration.
Optimising Performance with AEM
AEM dramatically cuts network calls. Instead of loading each file individually, AEM consolidates them into a single request to boost performance and save bandwidth usage.
Before AEM, three JS files were loaded separately over multiple network calls. Now, with AEM, all three can be combined into one request to reduce latency and streamline operations.
AEM’s Transition from ETC to Apps
Before AEM 6.3 was released, client libraries were organised within the ETC hierarchy; after AEM 6.3, all custom code had to migrate into the app’s hierarchy instead.
Although client libraries now reside within apps, they may still load from ETC due to legacy configurations.
Understanding AEM’s transition process ensures correct code placement to promote improved modularity and organisation.
Understanding AEM Schedulers
Schedulers are indispensable in automating daily tasks within AEM. They serve as the “silent worker,” ensuring nightly jobs run without fail.
Connecting third-party services, retrieving data from external sources, and saving it to AEM for later use are just some of the tasks the task schedulers perform seamlessly.
Schedulers are essential in supporting backend operations that run independently from frontend applications.
They provide a vital function within AEM: scheduling jobs at specific intervals or times using Cron Expressions.
Cron expressions provide the key to scheduling events on any scheduler; to achieve this result, I set an event every 30 seconds using such an expression.
Provide an expression within the scheduler configuration. Once you understand this concept, creating effective schedules in AEM will become second nature.
Leveraging Cron Expressions in AEM
These incredible timers allow us to specify seconds, minutes, hours or even months.
When configuring an inner class for scheduling purposes, use inner classes when setting up scheduler logic with AEM.
Delightedly watching my scheduler perform exactly as planned every 30 seconds felt satisfying.
Implement schedulers in AEM using the Runnable interface and its run method.
This approach ensures that the scheduler operates as its thread while leaving the main thread free to fulfil client requests seamlessly.
It has proven highly successful for backend asynchronous jobs.
Concurrent Execution in AEM Schedulers
Schedulers in AEM feature concurrent execution properties. Imagine running your scheduler every 30 seconds, but the current thread hasn’t finished its work, until that thread completes itself before starting another.
So, the scheduler waits until all other threads complete before initiating new threads.
Setting the concurrent property to false helps avoid resource conflicts.
However, you can set it to true if multiple threads need to execute concurrently.
What matters is finding what best meets your unique requirements, which AEM makes possible through customisable scheduler configurations tailored specifically for use cases with particular use scenarios.
Business Logic in AEM Scheduler Run Method
AEM scheduler’s run method is where all the magic lies – this is where business logic lives! Whether connecting third-party services or performing backend operations is in question, the run method is always your source.
Configuring schedulers to print logs and carry out tasks is always thrilling to see come to fruition as planned, and I am always delighted that they run according to plan.
Schedulers in AEM are services; you can instantly initiate them using the activate method and set your scheduler up to execute tasks according to its configurations effortlessly.
Understanding AEM Scheduler
Have you ever needed to configure an AEM scheduler?
Instead of configuring directly through the console, let’s create the required XML files that define scheduled tasks within AEM and reside within its UI apps package.
At AEM, we utilise simple tasks to ensure services and configurations are entered accurately while keeping AEM efficient and organised.
Managing Page Publishing with AEM
Work within AEM can sometimes involve pages being published from different sides. We must ensure that newly uploaded media files, like images, are promptly placed within the DAM folder.
AEM allows us to easily incorporate images into components, saving and publishing pages.
It is then necessary for authors of AEM pages to activate these images on the publisher instances.
This activation ensures content synchronises across author and publisher instances without additional code or schedulers.
Nightly Jobs and Resource Optimisation in AEM
AEM schedulers simplify nightly tasks by automating them at specific times during low-traffic periods to reduce resource waste and efficiently complete large operations.
By taking advantage of AEM schedulers’ execution of these tasks at specific intervals, your site’s downtime can be maximised effectively for greater ROI.
This approach to scheduling can help manage resource-heavy processes during peak consumption.
Adaptive Frameworks in AEM Sling Models
AEM’s adaptive Frameworks in detail. Utilising the Sling Model allows us to adapt components efficiently.
Property nodes of content hierarchies are automatically imported into this model for easy development.
Child node properties can be easily retrieved using annotations like @SlingObject to make tasks seamless in AEM.
The adaptive framework within AEM enhances developers’ interaction with its resources and components.
AEM Adaptation to Framework
Working with AEM requires us to add properties to models quickly and efficiently.
Instead of manually retrieving each property from its respective child resource, the Adapt To framework offers an effective way to automate this process.
Imagine you have a child resource linked to your current source, and would like its properties injected automatically – AEM’s Adapt To framework makes this easy.
Injecting Child Resource Properties in AEM
creates a child resource model in AEM to inject properties like first, second, and third into the model tree.
Instead of writing logic manually for every property, we will use Adapt To speed up this process.
AEM automatically assigns values by invoking Adapt To on child resources, eliminating redundant code.
Optimising AEM Sling Model for Child Resources
AEM provides us with additional opportunities to optimise this approach further. When working with multiple child nodes, manually iterating over each node may not be optimal.
So instead, we utilise the AEM Sling Model’s Adapt To feature to help it manage property injection.
Without AEM and its ability to adapt quickly and seamlessly manage resources for children, we would need to hire getters and setters to transport each resource manually.
Using AEM Sling API for CRUD Operations
Working within AEM often necessitates efficiently reading, updating, modifying, and deleting repository data.
AEM offers powerful APIs to accomplish these CRUD operations quickly while allowing developers to manipulate repository nodes dynamically for smooth integration with frontend components.
Efficiently Handling AEM Navigation Components
Handling navigation components is an everyday necessity in AEM. If a parent node contains multiple child nodes with similar properties, manually iterating through each node would likely not be optimal.
Utilising AEM’s Adapt To feature, child node properties are automatically added into Sling models without using getters and setters, providing a more straightforward approach than traditional getter/setter combinations.

Sai Susmitha
Author