<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kostiantyn Diachenko on Medium]]></title>
        <description><![CDATA[Stories by Kostiantyn Diachenko on Medium]]></description>
        <link>https://medium.com/@konstantyn.diachenko?source=rss-3aa28187fc51------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0uucF38eYzikbeTxMf8xYA@2x.jpeg</url>
            <title>Stories by Kostiantyn Diachenko on Medium</title>
            <link>https://medium.com/@konstantyn.diachenko?source=rss-3aa28187fc51------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 04:11:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@konstantyn.diachenko/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[OWASP CRS Testing in AEMaaCS Apache Dispatcher]]></title>
            <link>https://medium.com/@konstantyn.diachenko/owasp-crs-testing-in-aemaacs-apache-dispatcher-ab4a04ccf373?source=rss-3aa28187fc51------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab4a04ccf373</guid>
            <category><![CDATA[application-security]]></category>
            <category><![CDATA[adobe-experience-manager]]></category>
            <category><![CDATA[owasp]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[aem]]></category>
            <dc:creator><![CDATA[Kostiantyn Diachenko]]></dc:creator>
            <pubDate>Sun, 01 Feb 2026 03:43:06 GMT</pubDate>
            <atom:updated>2026-02-01T03:43:06.522Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZrDvup0woVIUAMN5sSyB_Q.png" /><figcaption>Docker, Apache, Adobe Experience Manager, and OWASP are trademarks of their respective owners.<br> This article is for educational purposes and is not affiliated with or endorsed by them.</figcaption></figure><p>When deploying <strong>Adobe Experience Manager as a Cloud Service (AEMaaCS)</strong>, security controls are distributed across several layers — the <strong>CDN</strong>, <strong>Dispatcher</strong>, and <strong>Publish tier</strong>. Adobe already provides strong security defaults, but many teams take it a step further by enabling <strong>OWASP ModSecurity Core Rule Set (CRS)</strong> at the Apache Dispatcher layer for additional protection.</p><p>The <strong>Open Web Application Security Project Top 10</strong> highlights the most common web security risks developers face today. Pairing <strong>ModSecurity</strong> with OWASP CRS helps detect and mitigate threats like SQL injection (SQLi), cross-site scripting (XSS), remote code execution (RCE), and other protocol violations — all with minimal false positives.</p><p>👉 This guide <strong>isn’t about configuring CRS</strong> from scratch.<br> 👉 Instead, it focuses on <strong>how to test and validate that CRS is actually working</strong> — both locally and in environments that mirror the cloud — when running AEM Dispatcher through Adobe’s official <strong>Dispatcher Tools</strong>.</p><h3>Why testing OWASP CRS in AEMaaCS isn’t straightforward</h3><p>Running AEMaaCS locally through Docker-based Dispatcher Tools (as Adobe recommends) introduces two main challenges:</p><ol><li><strong>Dispatcher runs in an isolated container</strong>, which hides Apache logs.</li><li><strong>CRS tests depend on those logs</strong> (or HTTP response codes) to confirm whether attacks are detected or blocked.</li></ol><p>Without direct access to logs or a proper test harness, you’re left guessing whether CRS is active. This article <strong>solves</strong> that problem.</p><h3>Setting up the environment</h3><h4>Prerequisites</h4><p>You’ll need the following:</p><ul><li>Local AEMaaCS SDK (Publish service)</li><li>Adobe Dispatcher Tools (from the <a href="https://experienceleague.adobe.com/en/docs/experience-manager-learn/cloud-service/local-development-environment-set-up/dispatcher-tools">official guide</a>)</li><li>Dispatcher configured with ModSecurity + OWASP CRS</li><li>Docker installed</li><li>✅ <em>No Go toolchain required</em></li></ul><h3>Step 1: Run dispatcher locally (baseline setup)</h3><p>You can start your Dispatcher container using the standard command from Adobe’s tutorials:</p><pre>./bin/docker_run_hot_reload.sh &lt;src-folder&gt; &lt;aem-publish-host&gt;:&lt;port&gt; &lt;dispatcher-port&gt;</pre><p>A debug-friendly version might look like this:</p><pre>DISP_LOG_LEVEL=Debug REWRITE_LOG_LEVEL=Debug \<br>./bin/docker_run_hot_reload.sh \<br>~/projects/wknd/dispatcher/src \<br>host.docker.internal:4503 8080</pre><p>Here’s a real-world (that I’m using) example from this setup:</p><pre>MANAGED_REWRITE_MAPS_PROBE_CHECK_SKIP=true \<br>ALLOW_CACHE_INVALIDATION_GLOBALLY=true \<br>~/tools/dispatcher-sdk-2.0.232/bin/docker_run.sh \<br>~/projects/wknd/dispatcher/src \<br>host.docker.internal:4503 80</pre><p>At this point, <strong>Dispatcher and CRS are both running</strong>, but not yet testable.</p><h3>Step 2: Introducing go-ftw — the official CRS testing framework</h3><p>To <a href="https://coreruleset.org/docs/6-development/6-5-testing-the-rule-set/">test CRS properly</a>, we’ll use <a href="https://github.com/coreruleset/go-ftw"><strong>go-ftw</strong></a>, the official testing framework maintained by the OWASP CRS project.</p><h4>Why go-ftw is great</h4><ul><li>It uses <strong>official CRS regression tests</strong></li><li>Works with <strong>log-based</strong> or <strong>cloud (black-box)</strong> validation modes</li><li>Runs entirely inside <strong>Docker — </strong>so no need to install Go or pollute your SDK</li></ul><h3>Step 3: Expose Apache logs from Dispatcher</h3><p>This step is critical. Most CRS tests rely on <strong>ModSecurity audit logs</strong>, but by default, Dispatcher containers hide them (/var/log/apache2).</p><p>Here’s how to expose them:</p><ol><li>Open your docker_run.sh script.</li><li>Find this line: volumes=&quot;-v ${PWD}/${CACHE_FOLDER-cache}:/mnt/var/www&quot;</li><li>Extend it to include the Apache log directory: volumes=&quot;-v ${PWD}/${CACHE_FOLDER-cache}:/mnt/var/www -v ~/projects/wknd/crs-test/logs:/var/logs/apache2&quot;</li></ol><p>You can now view logs locally at: ~/projects/wknd/crs-test/logs</p><h3>Step 4: Configure CRS tests (log-based mode)</h3><h4>Adjust the CRS setup</h4><p>In crs-setup.conf, add the following:</p><pre>SecAction \<br>  &quot;id:900005,\<br>  phase:1,\<br>  nolog,\<br>  pass,\<br>  ctl:ruleEngine=DetectionOnly,\<br>  ctl:ruleRemoveById=910000,\<br>  setvar:tx.blocking_paranoia_level=4,\<br>  setvar:tx.crs_validate_utf8_encoding=1,\<br>  setvar:tx.arg_name_length=100,\<br>  setvar:tx.arg_length=400,\<br>  setvar:tx.total_arg_length=64000,\<br>  setvar:tx.max_num_args=255,\<br>  setvar:tx.max_file_size=64100,\<br>  setvar:tx.combined_file_sizes=65535&quot;<br><br>SecRule REQUEST_HEADERS:X-CRS-Test &quot;@rx ^.*$&quot; \<br>  &quot;id:999999,\<br>  phase:1,\<br>  pass,\<br>  t:none,\<br>  log,\<br>  msg:&#39;%{MATCHED_VAR}&#39;&quot;</pre><p>In modsecurity.conf:</p><pre>SecAuditLog logs/httpd_mod_security_audit.log<br>SecResponseBodyMimeType text/plain text/html text/xml application/json</pre><h3>Create the go-ftw config file</h3><p>~/projects/wknd/crs-test/.ftw.apache.yaml:</p><pre>logfile: /opt/logs/httpd_mod_security_audit.log<br>logmarkerheadername: X-CRS-TEST<br>testoverride:<br>  input:<br>    dest_addr: &quot;local-www.wknd.com&quot;<br>    port: 80</pre><p>Then add this to /etc/hosts:</p><pre>127.0.0.1 local-www.wknd.com</pre><h3>Step 5: Run CRS regression tests</h3><p>Clone the official test suite:<br> <a href="https://github.com/coreruleset/coreruleset/tree/main/tests/regression/tests">https://github.com/coreruleset/coreruleset/tree/main/tests/regression/tests</a></p><p>Place it in: ~/projects/wknd/crs-test/tests</p><p>Run the tests with Docker:</p><pre>docker run \<br>  -v ~/projects/wknd/crs-test:/opt \<br>  --network host \<br>  -t ghcr.io/coreruleset/go-ftw:2.0.0 \<br>  run \<br>  --config /opt/.ftw.apache.yaml \<br>  -d /opt/tests \<br>  -f /opt/results.txt</pre><p>Example output:</p><pre>🛠️ Starting tests!<br>🚀 Running go-ftw!<br>➕ run 4374 total tests in 59.6s<br>⏭ skipped 0 tests<br>👎 2 test(s) failed to run: [&quot;920100-4&quot; &quot;920272-5&quot;]</pre><h3>Step 6: Cloud-mode testing (no logs needed)</h3><p>In real cloud environments — like <strong>Adobe Experience Manager as a Cloud Service production</strong> — you don’t have access to Apache logs.<br>In that case, go-ftw supports <strong>cloud mode</strong>, which evaluates results based on HTTP response codes.</p><p>Create .ftw.cloud-test.yaml:</p><pre>---<br>mode: &#39;cloud&#39;<br>testoverride:<br>  input:<br>    dest_addr: &quot;&lt;your cloud WAF IP&gt;&quot;<br>    port: 80</pre><p>Then run:</p><pre>docker run \<br>  -v ~/projects/wknd/crs-test:/opt \<br>  --network host \<br>  -t ghcr.io/coreruleset/go-ftw:2.0.0 \<br>  run \<br>  --config /opt/.ftw.cloud-test.yaml \<br>  -d /opt/tests \<br>  -f /opt/results-cloud.txt \<br>  --cloud</pre><p>Expected results:</p><ul><li><strong>Blocked attack</strong> → 403</li><li><strong>Benign request</strong> → 2xx</li></ul><h3>Step 7: Understanding test results</h3><p><strong>Symptom</strong>: Tests not triggering</p><ul><li>Likely cause: Dispatcher host mismatch</li></ul><p><strong>Symptom</strong>: Many false negatives</p><ul><li>Likely cause: CRS in DetectionOnly</li></ul><p><strong>Symptom</strong>: Cloud tests all pass</p><ul><li>Likely cause: WAF not blocking</li></ul><p><strong>Symptom</strong>: Isolated failures</p><ul><li>Likely cause: Rule exclusions or PL mismatch</li></ul><h3>Pro tips</h3><ul><li>Always confirm your <strong>Paranoia Level (PL)</strong>.</li><li>Start in <strong>DetectionOnly</strong>, then switch to <strong>Blocking</strong>.</li><li>Make sure your Dispatcher rules align with <strong>Cloud Manager production behavior</strong>.</li><li>Test against <strong>Stage</strong>, not Production, whenever possible.</li></ul><h3>Final thoughts</h3><p>Testing OWASP CRS in <strong>AEM as a Cloud Service</strong> can feel tricky at first, especially when Docker containers hide critical logs. But once you expose those logs and use <strong>go-ftw</strong>, you gain full visibility into how your security rules behave — both locally and in the cloud.</p><p>This process ensures that your AEM deployment isn’t just functional — it’s genuinely secure and ready for production-grade threats.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab4a04ccf373" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Geo-based redirects in AEMaaCS: The one CDN pitfall that can quietly hurt SEO]]></title>
            <link>https://medium.com/@konstantyn.diachenko/geo-based-redirects-in-aemaacs-the-one-cdn-pitfall-that-can-quietly-hurt-seo-67e9422c1dfe?source=rss-3aa28187fc51------2</link>
            <guid isPermaLink="false">https://medium.com/p/67e9422c1dfe</guid>
            <category><![CDATA[aem-developer]]></category>
            <category><![CDATA[aemasacloudservice]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[cdn]]></category>
            <category><![CDATA[aem-architect]]></category>
            <dc:creator><![CDATA[Kostiantyn Diachenko]]></dc:creator>
            <pubDate>Fri, 09 Jan 2026 00:02:06 GMT</pubDate>
            <atom:updated>2026-01-09T00:02:06.539Z</atom:updated>
            <content:encoded><![CDATA[<p>Redirects at the CDN level are one of the most powerful features of <strong>Adobe Experience Manager as a Cloud Service (AEMaaCS)</strong>.</p><p>They are fast, scalable, and executed before requests ever touch AEM publish instances. But that same power comes with risk: <strong>a small oversight in CDN redirect logic can quietly influence search engine behavior without breaking the site or triggering alarms.</strong></p><p>This article focuses on the single most critical consideration when implementing CDN redirects in AEMaaCS:</p><blockquote><strong>Search engine bots must be explicitly accounted for and excluded where appropriate.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dpMPdSFzrQIXqDFac4QpVw.png" /></figure><h3>Understanding CDN redirects in AEMaaCS</h3><p>In AEMaaCS, Adobe manages a CDN layer that sits in front of all customer environments (dev, stage, prod). This CDN is responsible for:</p><ul><li>Geo detection (country, region)</li><li>Request header inspection (e.g., User-Agent)</li><li>Edge-level redirects and rewrites</li><li>Caching and routing decisions</li></ul><p><a href="https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/cdn-configuring-traffic#server-side-redirectors">Redirect rules</a> configured at this layer are evaluated <strong>first</strong> — before:</p><ul><li>Dispatcher filters</li><li>Sling resolution</li><li>AEM rendering logic</li></ul><p>This means:</p><ul><li>Redirects are executed for <em>all traffic</em> — users, crawlers, monitoring tools, and bots alike.</li><li>A mistake here propagates globally and instantly.</li></ul><h3>The most important consideration: search engines are “users” too</h3><p><strong>The single most important factor when implementing CDN redirects in AEMaaCS is ensuring that search engine crawlers are deliberately handled.</strong></p><p>By default, the CDN does <strong>not</strong> distinguish between:</p><ul><li>A real human visitor</li><li>Googlebot or Bingbot</li><li>SEO analysis tools (Ahrefs, Semrush, etc.)</li></ul><p>If your redirect logic is based on:</p><ul><li>clientContinent</li><li>clientCountry</li><li>clientRegion</li><li>path (e.g. /)</li><li>domain</li></ul><p>…it will apply equally to crawlers <strong>unless you explicitly exclude them</strong>.</p><h3>A real-world scenario: when everything “works” but SEO drifts</h3><p>Imagine the following requirement:</p><ul><li>Redirect / → /eu for users located in the Europe</li><li>Redirect / → /na/ca-on for users located in Ontario, Canada</li><li>Redirect / → /na/us for users located in United States</li></ul><p>This works perfectly for real users.</p><h3>The edge case</h3><p>Most major search engine crawlers originate from U.S.-based IP ranges.</p><p>Without bot exclusion:</p><ol><li>Googlebot requests /</li><li>CDN detects clientCountry = US</li><li>Redirect sends the bot to /na/us</li><li>/na/us <strong>becomes the most visible page in search results</strong></li></ol><h3>The impact</h3><ul><li>The site continues to function normally</li><li>No errors are logged</li><li>No pages are broken</li></ul><p>But:</p><ul><li>Regional pages may dominate search results unintentionally</li><li>Analytics data becomes skewed</li><li>SEO signals no longer reflect actual user intent</li></ul><p>This is the most dangerous kind of issue in AEMaaCS: <strong>silent, correct-by-configuration, and slow to detect.</strong></p><h3>Why this happens specifically at the CDN layer</h3><p>CDN redirects are:</p><ul><li>Executed globally</li><li>Cached at the edge</li><li>Independent of AEM content or templates</li></ul><p>Unlike application-level redirects:</p><ul><li>There is no CMS context</li><li>There is no SEO awareness</li><li>There is no “crawler-safe” default behavior</li></ul><p>The CDN will do exactly what the rule says — nothing more, nothing less.</p><h3>Best Practices for Geo-based redirects in AEMaaCS</h3><h4>1. Always exclude well-known search engine bots</h4><p>If a redirect is meant to personalize user experience, <strong>bots should be excluded by default</strong>.</p><p>Use a negative match on the User-Agent header for:</p><ul><li>Googlebot</li><li>Google-InspectionTool</li><li>Bingbot</li><li>DuckDuckBot</li><li>Baidu</li><li>Yandex</li><li>Major SEO and social crawlers</li></ul><h4>2. Prefer temporary redirects (302) for geo logic</h4><p>Geo-based redirects are contextual, not permanent.</p><p>Using 302:</p><ul><li>Signals non-permanent behavior to search engines</li><li>Avoids long-term canonical reassignment</li><li>Keeps indexing flexible</li></ul><h4>3. Treat homepage (/) redirects as high-risk</h4><p>Redirecting / has an outsized effect because:</p><ul><li>It is the primary crawl entry point (usually)</li><li>It carries the strongest SEO signals</li><li>It influences canonical discovery</li></ul><p>Always double-check bot handling when / is involved.</p><h4>4. Test redirects with bot user agents</h4><p>Before promoting CDN rules:</p><ul><li>Test with real crawler User-Agent headers</li><li>Validate behavior in dev and stage</li><li>Confirm bots receive the unredirected homepage</li></ul><h4>Example: bot-aware geo redirects at the CDN</h4><p>Below is a simplified example of a safe, production-ready approach:</p><pre>kind: &quot;CDN&quot;<br>version: &quot;1&quot;<br>metadata:<br>  envTypes: [&quot;dev&quot;, &quot;stage&quot;, &quot;prod&quot;]<br>data:<br>  redirects:<br>    rules:<br>      - name: redirect-users-in-canada-ontario<br>        when:<br>          allOf:<br>            - { reqProperty: clientCountry, equals: &quot;CA&quot; }<br>            - { reqProperty: clientRegion, equals: &quot;CA-ON&quot; }<br>            - { reqProperty: path, equals: &quot;/&quot; }<br>            - { reqProperty: domain, in: [&quot;www.domain.com&quot;] }<br>            - { reqHeader: user-agent, matches: &quot;^(?!.*(Googlebot|googlebot|Google-InspectionTool|bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Yeti|SeznamBot|Qwantify|Sogou|facebookexternalhit|Twitterbot|LinkedInBot|Slackbot|Discordbot|AhrefsBot|SemrushBot|MJ12bot|DotBot)).*$&quot; }<br>        action:<br>          type: redirect<br>          status: 302<br>          location: /na/ca-on<br>      - name: redirect-users-in-usa<br>        when:<br>          allOf:<br>            - { reqProperty: clientCountry, equals: &quot;US&quot; }<br>            - { reqProperty: path, equals: &quot;/&quot; }<br>            - { reqProperty: domain, in: [&quot;www.domain.com&quot;] }<br>            - { reqHeader: user-agent, matches: &quot;^(?!.*(Googlebot|googlebot|Google-InspectionTool|bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Yeti|SeznamBot|Qwantify|Sogou|facebookexternalhit|Twitterbot|LinkedInBot|Slackbot|Discordbot|AhrefsBot|SemrushBot|MJ12bot|DotBot)).*$&quot; }<br>        action:<br>          type: redirect<br>          status: 302<br>          location: /na/us<br>      - name: redirect-users-in-europe<br>        when:<br>          allOf:<br>            - { reqProperty: clientContinent, equals: &quot;EU&quot; }<br>            - { reqProperty: path, equals: &quot;/&quot; }<br>            - { reqProperty: domain, in: [&quot;www.domain.com&quot;] }<br>            - { reqHeader: user-agent, matches: &quot;^(?!.*(Googlebot|googlebot|Google-InspectionTool|bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Yeti|SeznamBot|Qwantify|Sogou|facebookexternalhit|Twitterbot|LinkedInBot|Slackbot|Discordbot|AhrefsBot|SemrushBot|MJ12bot|DotBot)).*$&quot; }<br>        action:<br>          type: redirect<br>          status: 302<br>          location: /eu</pre><p>This pattern ensures:</p><ul><li>Humans get localized content</li><li>Crawlers index the correct canonical entry point</li><li>SEO behavior remains predictable</li></ul><h3>Key takeaways for AEM Developers</h3><ul><li>CDN redirects in AEMaaCS are <strong>extremely powerful</strong></li><li>Geo logic must always account for search crawlers</li><li>SEO issues can occur without breaking the site</li><li>Bot-aware redirect rules are not optional</li><li>Small CDN changes can have global SEO consequences</li></ul><p>When used correctly, CDN redirects are a major performance win. When used carelessly, they can quietly rewrite your search strategy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67e9422c1dfe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Background Jobs in AEM as a Cloud Service — Part 2]]></title>
            <link>https://medium.com/@konstantyn.diachenko/background-jobs-in-aem-as-a-cloud-service-part-2-b5faf40f6166?source=rss-3aa28187fc51------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5faf40f6166</guid>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[aem-architect]]></category>
            <category><![CDATA[aem-features]]></category>
            <category><![CDATA[aemasacloudservice]]></category>
            <category><![CDATA[aem-developer]]></category>
            <dc:creator><![CDATA[Kostiantyn Diachenko]]></dc:creator>
            <pubDate>Sat, 20 Dec 2025 00:00:52 GMT</pubDate>
            <atom:updated>2025-12-20T00:00:52.248Z</atom:updated>
            <content:encoded><![CDATA[<h3>Background Jobs in AEM as a Cloud Service — Part 2</h3><p>This article presents proven, production-ready patterns for background processing in AEM as a Cloud Service. It covers checkpointed Sling Jobs, leader-orchestrated execution on Author, and persistent Scheduled Jobs. Each pattern is illustrated with short code examples and real-world use cases, including leader-only handling of replication events for reliable data synchronization with external systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N4p9PT9Oc_STpPG-veGWhQ.png" /></figure><h3>Pattern A — Sling Job with checkpointing (resumable, medium-length work)</h3><h4>Use when</h4><ul><li>You must read/write JCR (Content Fragments, pages, tags, DAM metadata).</li><li>The job is bigger than “single request work” but can be split into chunks.</li><li>You want AEM-managed persistence and retry semantics.</li></ul><h4>Mechanism that matters</h4><p>Sling Jobs are persisted and delivered with <strong>at-least-once</strong> semantics. Your correctness depends on:</p><ul><li><strong>idempotency</strong></li><li><strong>checkpointing</strong></li><li><strong>small commits</strong></li></ul><pre>@Component(<br>    service = JobConsumer.class,<br>    property = JobConsumer.PROPERTY_TOPICS + &quot;=com/example/asset/process&quot;<br>)<br>public class AssetProcessingJob implements JobConsumer {<br><br>    @Override<br>    public JobResult process(Job job) {<br>        String assetPath = job.getProperty(&quot;assetPath&quot;, String.class);<br><br>        if (alreadyProcessed(assetPath)) {<br>            return JobResult.OK; // idempotent exit<br>        }<br><br>        processAsset(assetPath);<br>        markProcessed(assetPath);<br><br>        return JobResult.OK;<br>    }<br>}</pre><h3>Pattern B — Sling Job orchestrated on the leader author (capture once, process safely)</h3><h4>Use when</h4><ul><li>You must trigger the workflow <strong>once per cluster</strong>.</li><li>The trigger is noisy (replication events, bulk publish, taxonomy changes).</li><li>You need <strong>one orchestration point</strong>, but scalable execution.</li></ul><p>Typical examples:</p><ul><li>Nightly synchronization</li><li>Periodic DAM audits</li><li>External feed ingestion</li></ul><h4>Core rule</h4><p><strong>Leader is for orchestration, not heavy work.</strong></p><p>Leader:</p><ul><li>captures the event once</li><li>deduplicates (optional but recommended)</li><li>enqueues jobs with persisted payload / references</li></ul><h4>Practical scenario: taxonomy/CF/page/asset publish → sync to “Data Lake”</h4><p><strong>Goal</strong></p><p>Whenever CF/page/asset/tag is published:</p><ul><li>read/manipulate JCR to produce the “search/lake” document</li><li>persist “sync intent” and status</li><li>send to Data Lake reliably</li><li>ensure replication event is captured <strong>once</strong> across the author cluster</li></ul><h4>Pattern implementation (mechanisms)</h4><ol><li><strong>Replication event handler</strong> runs on all authors, but only the <strong>leader</strong> schedules.</li><li>Leader writes a <strong>durable “sync request”</strong> (JCR node under /var/...) and enqueues a Sling Job that references it.</li><li>Sling Job executes with retries, checkpointing and idempotent sends.</li></ol><h4>(1) Capture publish events (replication), leader-gated</h4><pre>@Component(<br>  service = EventHandler.class, immediate = true,<br>  property = {<br>    EventConstants.EVENT_TOPIC + &quot;=com/adobe/granite/replication&quot;<br>})<br>public class ReplicationToDatalakeTrigger implements EventHandler {<br><br>  @Reference private DiscoveryService discoveryService;<br>  @Reference private JobManager jobManager;<br>  @Reference private ResourceResolverFactory rrf;<br><br>  @Override<br>  public void handleEvent(Event event) {<br>    if (!discoveryService.getTopology().getLocalInstance().isLeader()) {<br>      return; // only leader orchestrates<br>    }<br><br>    String path = (String) event.getProperty(&quot;replication.path&quot;);<br>    if (path == null || path.isBlank()) return;<br><br>    // Persist request (durable intent) + enqueue job<br>    String requestId = persistSyncRequest(path);<br>    jobManager.addJob(&quot;com/acme/datalake/syncRequest&quot;,<br>        Map.of(&quot;requestId&quot;, requestId));<br>  }<br><br>  private String persistSyncRequest(String path) {<br>    try (ResourceResolver rr = rrf.getServiceResourceResolver(Map.of(<br>        ResourceResolverFactory.SUBSERVICE, &quot;datalake-sync&quot;))) {<br><br>      // Example request node path: /var/sync/datalake/requests/&lt;uuid&gt;<br>      return SyncRequestStore.create(rr, path).getId();<br>    } catch (Exception e) {<br>      // log + swallow: event handlers must be defensive<br>      throw new RuntimeException(e);<br>    }<br>  }<br>}</pre><p>Alternative approach how to run only on leader instance:</p><p>To run a job <em>only once</em> on the AEM Author service, create a new Sling job queue of the type <strong>Ordered</strong>, and associate your job topic (com/acme/datalake/syncRequest) with this queue. With this configuration will only allow the leader AEM Author instance (pod) to process the job.</p><p>In your AEM project’s ui.config module, create an OSGi configuration file (org.apache.sling.event.jobs.QueueConfiguration~wknd.cfg.json) and store it at ui.config/src/main/content/jcr_root/apps/wknd/osgiconfig/config.author folder.</p><pre>{<br>  &quot;queue.name&quot;:&quot;WKND Queue - ORDERED&quot;,<br>  &quot;queue.topics&quot;:[<br>    &quot;com/acme/datalake/syncRequest&quot;<br>  ],<br>  &quot;queue.type&quot;:&quot;ORDERED&quot;,<br>  &quot;queue.retries&quot;:1,<br>  &quot;queue.maxparallel&quot;:1.0<br>}</pre><p>Once you deploy the above configuration, the job will be processed exclusively by the leader instance, ensuring it runs only once across the entire AEM Author service.</p><p>Notes:</p><ul><li>Replication events can be bursty; leader gating avoids multi-author duplication.</li><li>Persisting a “request” is essential. Don’t enqueue jobs with only transient data.</li><li>Your send must be idempotent (same requestId produces same outbound doc).</li></ul><h4>(2) Job consumes request, builds payload from JCR, sends to Data Lake</h4><pre>@Component(<br>  service = JobConsumer.class,<br>  property = JobConsumer.PROPERTY_TOPICS + &quot;=com/acme/datalake/syncRequest&quot;<br>)<br>public class SyncRequestConsumer implements JobConsumer {<br><br>  @Reference private ResourceResolverFactory rrf;<br>  @Reference private DatalakeClient datalakeClient;<br>  @Reference private SyncRequestStore syncRequestStore;<br>  @Reference private DatalakeMapper datalakeMapper;<br><br>  @Override<br>  public JobResult process(Job job) {<br>    String requestId = job.getProperty(&quot;requestId&quot;, String.class);<br><br>    try (ResourceResolver rr = rrf.getServiceResourceResolver(Map.of(<br>        ResourceResolverFactory.SUBSERVICE, &quot;datalake-sync&quot;))) {<br><br>      SyncRequest req = syncRequestStore.load(rr, requestId);<br>      if (req.isDone()) return JobResult.OK; // idempotent guard<br><br>      // Build outbound document using JCR resources<br>      DatalakeDocument doc = datalakeMapper.build(rr, req.getPath());<br><br>      // Idempotent send: include requestId as an idempotency key<br>      datalakeClient.upsert(doc, requestId);<br><br>      req.markDone();<br>      syncRequestStore.save(rr, req);<br><br>      return JobResult.OK;<br><br>    } catch (TransientDatalakeException e) {<br>      return JobResult.FAILED; // retry (design for duplicates)<br>    } catch (Exception e) {<br>      // mark failed + stop retrying if appropriate<br>      return JobResult.CANCEL; // or OK after marking failed<br>    }<br>  }<br>}</pre><p>Why this is the “right” leader-only approach:</p><ul><li><strong>Leader ensures single orchestration</strong> per cluster.</li><li><strong>Sling Jobs provide persistence + retries</strong>.</li></ul><h3>Pattern C— Scheduled Jobs (persistent, cluster-safe scheduling via Sling Jobs)</h3><p>Run a job <strong>daily at midnight</strong>, but ensure it is scheduled <strong>only once</strong>.</p><pre>import org.apache.sling.jobs.JobManager;<br>import org.apache.sling.event.jobs.JobBuilder.ScheduleBuilder;<br>import org.osgi.service.component.annotations.Component;<br>import org.osgi.service.component.annotations.Reference;<br><br>@Component(immediate = true)<br>@Designate(ocd = Config.class)<br>public class MidnightJobScheduler {<br><br>    private static final String TOPIC = &quot;midnight/job/topic&quot;;<br><br>    @Reference<br>    private JobManager jobManager;<br>    private String cronExpression;<br><br>    @Modified<br>    @Activate<br>    protected void activate(final Config config) {<br>        this.cronExpression = config.cronExpression();<br>        startScheduledJob();<br>    }<br><br>    private void unScheduleExistingJobs() {<br>        Optional.ofNullable(jobManager.getScheduledJobs(TOPIC, 0, null))<br>                .orElse(CollectionUtils.emptyCollection())<br>                .forEach(job -&gt; {<br>                    job.unschedule();<br>                });<br>    }<br><br>    private void startScheduledJob() {<br>        unScheduleExistingJobs();<br>        Collection&lt;ScheduledJobInfo&gt; myJobs = jobManager.getScheduledJobs(TOPIC, 0, null);<br>        if (!myJobs.isEmpty()) {<br>            return;<br>        }<br>        JobBuilder.ScheduleBuilder scheduleBuilder = jobManager.createJob(TOPIC).schedule();<br>        scheduleBuilder.cron(cronExpression);<br>        scheduleBuilder.add();<br>    }<br>}</pre><p>Internally the scheduled Jobs use the <a href="https://sling.apache.org/documentation/bundles/scheduler-service-commons-scheduler.html">Commons Scheduler Service</a>. But in addition they are persisted (by default below /var/eventing/scheduled-jobs) and survive therefore even server restarts. When the scheduled time is reached, the job is automatically added as regular Sling Job through the JobManager.</p><p><strong>NOTE</strong>: A scheduled job is only automatically unscheduled, when it’s scheduled for a specific date. Periodic jobs (using a CRON expression) are not automatically unscheduled, but you have to remove it when it’s no longer needed.</p><p>Therefor it is best to check upfront, if the scheduling already exists. Only it does not yet exist you should register it (like shown above).</p><h3>Common pitfalls (Seen in Production)</h3><h4>🚫Long JCR transactions</h4><p>Large commits cause locking and index pressure.<br>Commit frequently.</p><h4>🚫Long-running threads</h4><p>Threads die silently on pod restart.<br>Use Sling Jobs, Runtime, or external workers.</p><h4>🚫Treating leader as “primary author”</h4><p>Leaders are temporary.<br>They schedule, they don’t own work.</p><h4>🚫Assuming Single Execution</h4><p>Schedulers and jobs may run on multiple nodes.<br>Fix with leader gating and idempotency.</p><h3>Key takeaways</h3><ul><li>Avoid long-running in-process threads on AEMaaCS — prefer resumable, checkpointed jobs or offload to serverless/external workers.</li><li>Use Sling Jobs for JCR-centric, medium-length work but design for idempotency and restarts.</li><li>For heavy or parallelizable processing, offload to Adobe I/O Runtime or an external worker fleet and use fan-out/fan-in patterns.</li></ul><h3>Conclusion</h3><p>AEM as a Cloud Service requires cloud-aware designs for background tasks. Favor resumable, idempotent, chunked processing; avoid long, monolithic in-JVM threads; offload heavy work to Adobe I/O Runtime or external workers when appropriate. Sling Jobs remain useful for JCR-centric asynchronous work, but design them to tolerate restarts and to persist progress. Architect your background processing with observability, retry policies, and an eye toward splitting and parallelizing work.</p><p>Key Adobe references to read next:</p><ul><li><a href="https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/developing/development-guidelines">AEM as a Cloud Service — Development Guidelines (background jobs guidance)</a></li><li><a href="https://developer.adobe.com/app-builder/docs/get_started/runtime_getting_started/understanding-runtime">Adobe I/O Runtime developer guide (serverless patterns &amp; fan-out)</a></li><li><a href="https://experienceleague.adobe.com/en/docs/experience-manager-learn/cloud-service/developing/advanced/run-job-on-leader-instance-in-aem-author">How to run a job on leader instance in AEM as a Cloud Service</a></li><li><a href="https://sling.apache.org/documentation/bundles/apache-sling-eventing-and-job-handling.html">Apache Sling Eventing and Job Handling</a></li></ul><p>Read a theory in the <a href="https://medium.com/@konstantyn.diachenko/background-jobs-in-aem-as-a-cloud-service-part-1-dd30628da65f">first part</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5faf40f6166" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Background Jobs in AEM as a Cloud Service — Part 1]]></title>
            <link>https://medium.com/@konstantyn.diachenko/background-jobs-in-aem-as-a-cloud-service-part-1-dd30628da65f?source=rss-3aa28187fc51------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd30628da65f</guid>
            <category><![CDATA[aem-features]]></category>
            <category><![CDATA[aemasacloudservice]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[aem-developer]]></category>
            <category><![CDATA[aem-architect]]></category>
            <dc:creator><![CDATA[Kostiantyn Diachenko]]></dc:creator>
            <pubDate>Fri, 19 Dec 2025 23:58:09 GMT</pubDate>
            <atom:updated>2025-12-20T00:01:15.320Z</atom:updated>
            <content:encoded><![CDATA[<h3>Background Jobs in AEM as a Cloud Service — Part 1</h3><p>AEM as a Cloud Service changes how background work must be designed. This article explains the real constraints of AEMaaCS — ephemeral instances, clustering, and at-least-once execution — and shows how those constraints shape safe job execution models. It focuses on when to use Sling Jobs, leader-only orchestration, Adobe I/O Runtime, or external workers, and why traditional schedulers and long-running threads fail in cloud deployments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WV3N26HnqhAjgqz5q5SDQg.png" /></figure><h3>Background: what problem are we solving?</h3><p>Typical examples of “background work” in AEM:</p><ul><li>Bulk DAM asset ingestion and transcoding.</li><li>Large reindexing or content migration jobs.</li><li>Scheduled feeds/imports from third-party systems.</li><li>Complex, multi-step workflows that take many minutes/hours.</li></ul><p>In classic AEM (on-prem), background jobs were often implemented as:</p><ul><li>long-running threads,</li><li>cron-like schedulers,</li><li>or workflow steps that assumed a stable JVM.</li></ul><p>That model <strong>does not survive</strong> AEM as a Cloud Service.</p><p>In AEMaaCS:</p><ul><li>Author and publish instances are <strong>ephemeral</strong></li><li>Pods can restart at any moment</li><li>Multiple author instances may exist</li><li>Scaling events and deployments interrupt execution</li></ul><p>So the real problem is not <em>how to run a job</em>, but:</p><blockquote><strong><em>How do we run background work that survives restarts, avoids duplication, and does not destabilize the cluster?</em></strong></blockquote><h3>A real example (what usually goes wrong)</h3><blockquote><em>“We scheduled a nightly job to sync 50k DAM assets.</em></blockquote><p>What happens in AEMaaCS:</p><ul><li>Scheduler fires on <strong>multiple authors</strong></li><li>Job starts processing assets in a loop</li><li>Pod restarts mid-way</li><li>Job runs again</li><li>Assets are processed twice</li><li>Repository locks spike</li><li>Authors become slow</li></ul><p>This is not a bug — it’s a <strong>design mismatch</strong>. Any viable solution must tolerate <strong>duplication</strong>, <strong>interruption</strong>, and <strong>failover</strong>.</p><h3>Cloud-native design principles for AEM background jobs</h3><p>Before looking at APIs, align on these principles:</p><ol><li><strong>At-least-once execution is normal</strong></li><li><strong>Duplication must be safe</strong></li><li><strong>Progress must be persisted</strong></li><li><strong>Work must be chunked</strong></li><li><strong>Scheduling ≠ execution</strong></li><li><strong>Heavy work should not live in AEM</strong></li></ol><p>Every example below follows these rules.</p><h3>When to use what</h3><h4>Sling jobs — “Do small things, reliably”</h4><p><strong>Use when</strong></p><ul><li>The task must mutate JCR content or DAM metadata</li><li>Processing time is short to medium (milliseconds to a few seconds per unit)</li><li>Work can be chunked and resumed</li><li>Duplicate execution can be tolerated safely</li></ul><p><strong>Typical examples</strong></p><ul><li>Updating asset metadata</li><li>Post-processing workflow steps</li><li>Small content migrations</li><li>Event-driven async work</li></ul><p><strong>Avoid when</strong></p><ul><li>CPU-heavy transformations</li><li>Large binary processing</li><li>Long blocking operations</li><li>Tight execution time requirements</li></ul><h4>Leader-only execution — “Schedule once, execute safely”</h4><p><strong>Use when</strong></p><ul><li>A job must be <em>scheduled once per cluster</em></li><li>A global operation must not be duplicated</li></ul><p><strong>Important</strong><br>Leader execution is <strong>only for orchestration</strong>, never for heavy processing.</p><p><strong>Correct usage</strong></p><ul><li>Leader enqueues Sling Jobs</li><li>Leader triggers Adobe I/O Runtime</li><li>Leader emits events / messages</li></ul><p>Leader <strong>does not</strong> mean “do all the work on one node”.</p><h4>Adobe I/O runtime — “Get heavy work out of AEM”</h4><p><strong>Use when</strong></p><ul><li>Jobs are long-running or CPU-intensive</li><li>Tasks can be parallelized (fan-out)</li><li>Work does not require direct JCR session access</li><li>Execution must not affect author responsiveness</li></ul><p><strong>Typical examples</strong></p><ul><li>Bulk DAM transformations</li><li>External API integrations</li><li>Scheduled ETL processes</li><li>Webhook processing</li><li>Scheduled ETL jobs</li></ul><h4>External workers + message queues</h4><p><strong>Use when</strong></p><ul><li>Enterprise-scale throughput is required</li><li>Existing cloud infrastructure exists</li><li>Fine-grained retry and observability are mandatory</li></ul><p>In the <a href="https://medium.com/@konstantyn.diachenko/background-jobs-in-aem-as-a-cloud-service-part-2-b5faf40f6166">next part</a> we are going to review common practical patterns you can adopt on AEMaaCS, with short examples.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd30628da65f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making sense of configuration in AEM as a Cloud Service]]></title>
            <link>https://medium.com/@konstantyn.diachenko/making-sense-of-configuration-in-aem-as-a-cloud-service-7f2fc567e58d?source=rss-3aa28187fc51------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f2fc567e58d</guid>
            <category><![CDATA[aemasacloudservice]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[aem-developer]]></category>
            <category><![CDATA[aem-features]]></category>
            <category><![CDATA[aem-architect]]></category>
            <dc:creator><![CDATA[Kostiantyn Diachenko]]></dc:creator>
            <pubDate>Fri, 11 Jul 2025 23:18:11 GMT</pubDate>
            <atom:updated>2025-07-11T23:18:11.697Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lr1EpSv_LiSF2AWlg3T-Dw.png" /></figure><p>If you’ve been working with Adobe Experience Manager as a Cloud Service (AEMaaCS) for a while, you’ve probably noticed that configuration management can get a little… complex. Between OSGi configurations, Cloud Manager environment variables, and Context-Aware Configurations (CAConfig), there’s a lot to navigate. Each approach serves its purpose, but knowing when to use which one — and why — can save you a lot of headaches.</p><p>This article is meant to demystify those options. Whether you’re just getting started or untangling an existing setup, I’ll walk you through the key types of configurations in AEMaaCS, when to use them, and what to watch out for.</p><h3>The Landscape of Configurations</h3><p>Let’s begin by zooming out. AEMaaCS offers a few distinct ways to manage configuration:</p><ol><li><strong>OSGi configurations via the codebase (runmode folders like config.dev, config.stage, config.prod)</strong></li><li><strong>OSGi configurations that pull values from Cloud Manager environment variables</strong></li><li><strong>Context-Aware Configurations (CAConfig), often editable by authors via the UI</strong></li></ol><p>Each of these options is useful in the right context. But they’re not interchangeable — and misusing them can result in bloated environments, hard-to-trace bugs, or deployment bottlenecks.</p><h3>Configuration comparison table</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a02373e90e1de05d2e068efe6871f287/href">https://medium.com/media/a02373e90e1de05d2e068efe6871f287/href</a></iframe><h3>OSGi configurations via code</h3><p>This is the classic approach. You define .config or .cfg.json files in your repository, scoped by runmode.</p><p>When it’s great:</p><ul><li>You’re dealing with values that don’t change between deployments.</li><li>You want everything versioned and peer-reviewed in Git.</li><li>You don’t need to expose the value in the UI.</li></ul><p>When it gets in your way:</p><ul><li>You need to update a value quickly but can’t push a deployment.</li><li>You’re managing dozens of variations manually for tenants or locales.</li></ul><p>A good example: setting the maximum number of search results for an internal API. It’s a safe, non-sensitive number that’s unlikely to change often.</p><h3>OSGi configurations + Cloud Manager environment variables</h3><p>This one’s powerful — but often overused. Cloud Manager lets you define environment-specific variables, which can then be referenced in OSGi configs using the $[env.VAR_NAME] syntax.</p><p>When it shines:</p><ul><li>You’re managing <strong>secrets</strong> (tokens, passwords).</li><li>You need to <strong>tweak values between deployments</strong> without rebuilding.</li><li>You want a dynamic toggle, like switching between endpoints.</li></ul><p>Where it falls apart:</p><ul><li>You’re trying to manage 100+ variables per environment.</li><li>You don’t namespace them clearly (leading to overlap or conflicts).</li><li>You’re using them for things that rarely change.</li></ul><p>And here’s a major gotcha: Cloud Manager has a <strong>hard limit of 200 environment variables per environment</strong>. Once you reach it, you’re forced to refactor.</p><p>A real-world example: I worked with a team maintaining over 150 environment variables — some for secrets, but many for simple toggles or settings that hadn’t changed in years. That’s when we knew it was time to offload most of that into versioned code or CAConfig.</p><h3>Context-Aware configurations (CA Config)</h3><p>This is, in my opinion, one of the most elegant features in modern AEM. CA Config lets you define settings based on the content hierarchy — like site, language, or region. It’s especially useful in multi-tenant or multi-brand setups.</p><h3>Why it’s amazing:</h3><ul><li>You can scope config by tenant, locale, or even page.</li><li>Authors can update settings via the AEM UI (with the CA Config Editor).</li><li>You avoid duplication and hardcoded logic.</li></ul><h3>Where it needs care:</h3><ul><li>It’s not meant for secrets or infrastructure-level settings.</li><li>Without structure or governance, config inheritance can become hard to trace.</li></ul><p>Use CA Config when the business needs flexibility. Things like feature toggles, theming, branding values, or analytics tracking IDs are perfect candidates.</p><h3>So which one should you use?</h3><p>The truth is, you’ll probably need all three. But here’s how I think about it:</p><ul><li><strong>Secrets &amp; runtime toggles?</strong> Cloud Manager env vars.</li><li><strong>Static or environment-specific config?</strong> OSGi via code.</li><li><strong>Tenant-specific, editor-controlled settings?</strong> CA Config.</li></ul><p>If you’re using Cloud Manager variables for everything, step back. See what could be moved to version-controlled OSGi configs or scoped more intelligently using CA Config.</p><h3>Practical Tips</h3><ul><li><strong>Namespace your environment variables.</strong> Use prefixes like TENANT_X_ to avoid collisions.</li><li><strong>Add default values</strong> in OSGi configs to ensure smooth transitions:</li></ul><pre>{<br>   &quot;my.setting&quot;: &quot;$[env.TENANT_X_API_KEY;default=default123]&quot;<br>}</pre><ul><li><strong>Avoid hardcoding tenant logic in services.</strong> Instead, use CA Config so each tenant gets its own context-aware settings.</li><li><strong>Let authors help themselves.</strong> With CA Config and the UI editor, business users can change behavior without dev involvement.</li></ul><h3>Final thoughts</h3><p>AEMaaCS challenges us to think differently about configuration. What used to be handled with a handful of .config or .cfg.json files might now span several systems, each with its strengths. But with the right balance—and a bit of upfront planning—you can make your configurations cleaner, safer, and much easier to maintain.</p><p>And if you’re staring at 150+ environment variables right now… it might be time to reassess.</p><p>Choosing the right configuration strategy in AEMaaCS isn’t just about technical feasibility — it’s about long-term sustainability, security, and operational agility.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f2fc567e58d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Replacing out-of-the-box AEM clientlibraries using the “replaces” property]]></title>
            <link>https://medium.com/@konstantyn.diachenko/replacing-out-of-the-box-aem-clientlibraries-using-the-replaces-property-38a94f2b6689?source=rss-3aa28187fc51------2</link>
            <guid isPermaLink="false">https://medium.com/p/38a94f2b6689</guid>
            <category><![CDATA[jcr]]></category>
            <category><![CDATA[clientlibs]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[aem-clientlibs]]></category>
            <category><![CDATA[aemaacs]]></category>
            <dc:creator><![CDATA[Kostiantyn Diachenko]]></dc:creator>
            <pubDate>Fri, 11 Jul 2025 21:53:38 GMT</pubDate>
            <atom:updated>2025-07-11T21:53:38.826Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BBbC7qk8tsHyEwVChAbKyA.png" /></figure><p>When working with Adobe Experience Manager as a Cloud Service (AEMaaCS), developers often need to customize or secure the front-end code, especially when out-of-the-box (OOTB) Client Libraries (clientlibs) are outdated, insecure, or inflexible. Unfortunately, Adobe’s official documentation doesn’t clearly surface one powerful feature that solves this problem: the replaces property.</p><p>This article uncovers the lesser-known replaces property of AEM Client Libraries and demonstrates how it enables full overrides of existing categories — a key approach for replacing problematic or legacy JavaScript/CSS in OOTB components.</p><h3>⚠️ Example of the problem: Outdated jQuery in OOTB Scene7 Dynamic Media</h3><p>A prime example is the OOTB clientlib at: <em>/libs/dam/components/scene7/dynamicmedia/clientlibs/dynamicmedia</em></p><p>This clientlib has a dependency on granite.utils, which in turn pulls in jquery (v1.12.4-aem — released in May 2016).</p><p>The jQuery version embedded here includes an outdated call to <strong><em>eval</em></strong>, posing security concerns. Since /libs is immutable in AEMaaCS, you can’t modify the original clientlibs directly — but you can replace them with a custom one.</p><h3>✅ Solution and the hidden hero: replaces property</h3><p>While Adobe documents categories and dependencies, the replaces property is not mentioned in the official Clientlibs documentation.</p><p>But it is supported and allows one clientlib to completely replace another by absolute path to the clientlib.</p><p>This pattern is extremely useful when:</p><ul><li>Removing insecure legacy JS (like jquery-1.x)</li><li>Replacing dependencies under immutable location</li><li>Rewriting utility categories (e.g., granite.utils, cq.shared)</li><li>Replacing dependencies from 3rd-party</li></ul><h3>🔧 Step-by-Step: Replacing dependency</h3><ol><li><strong>Create a custom client library folder<br></strong>Create your custom clientlib under /apps, e.g.:<br>/apps/your-project/clientlibs/scene7-override</li><li><strong>Add </strong><strong>replaces property to .content.xml</strong></li></ol><pre>&lt;?xml version=”1.0&quot; encoding=”UTF-8&quot;?&gt;<br>&lt;jcr:root<br>    xmlns:sling=”http://sling.apache.org/jcr/sling/1.0&quot;<br>    xmlns:jcr=”http://www.jcp.org/jcr/1.0&quot;<br>    jcr:primaryType=”cq:ClientLibraryFolder”<br>    categories=”[cq.dam.components.scene7.dynamicmedia]”<br>    dependencies=”[cq.dam.components.scene7.common.viewer,myproject.granite.utils,myproject.jquery]”<br>    replaces=&quot;/libs/dam/components/scene7/dynamicmedia/clientlibs/dynamicmedia&quot;<br>    allowProxy=”{Boolean}true”/&gt;</pre><p><strong>3. Provide custom versions of dependencies</strong></p><p>You now control what gets loaded in place of OOTB client library. For example:</p><ul><li>Replace old <strong>jquery </strong>dependency with a custom clientlibrary <strong>myproject.jquery</strong>. Note: you need to define a <a href="https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/introduction/clientlibs#create-a-client-library-folder">new clientlibrary</a> with category <strong>myproject.jquery</strong>.</li><li>Replace old <strong>granite.utils </strong>dependency with a custom clientlibrary <strong>myproject.granite.utils</strong>. Note: you need to define a <a href="https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/introduction/clientlibs#create-a-client-library-folder">new clientlibrary</a> with category <strong>myproject.granite.utils</strong>.</li></ul><p><strong>4. Embed your custom clientlib in the page</strong></p><p>Make sure your page or component includes your clientlib. This now resolves to your custom version, thanks to the replaces directive.</p><h3>Summary</h3><p>The replaces property is an undocumented gem in AEM’s Client Library system. Instead of hacking around dependencies, use replaces to cleanly swap out OOTB code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38a94f2b6689" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AEM VLT IntelliJ Plugin: Streamlining AEM Development Workflows]]></title>
            <link>https://medium.com/@konstantyn.diachenko/aem-vlt-intellij-plugin-streamlining-aem-development-workflows-d666bf3b472c?source=rss-3aa28187fc51------2</link>
            <guid isPermaLink="false">https://medium.com/p/d666bf3b472c</guid>
            <category><![CDATA[jetbrains]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[plugins]]></category>
            <category><![CDATA[adobe]]></category>
            <category><![CDATA[aem-developer]]></category>
            <dc:creator><![CDATA[Kostiantyn Diachenko]]></dc:creator>
            <pubDate>Tue, 27 May 2025 20:21:32 GMT</pubDate>
            <atom:updated>2025-05-28T13:32:34.946Z</atom:updated>
            <content:encoded><![CDATA[<p><em>An in-depth look at a powerful tool for Adobe Experience Manager developers</em></p><h3>Overview</h3><p>The AEM VLT IntelliJ Plugin is a powerful integration tool designed specifically for developers working with Adobe Experience Manager (AEM). It provides a seamless way to synchronize content between your local development environment and AEM instances, leveraging the Apache Jackrabbit File Vault library for reliable content transfer.</p><p>This plugin bridges the gap between your IDE and AEM repository, allowing developers to push and pull content directly from within IntelliJ IDEA. By eliminating the need to switch between different tools or command-line interfaces, it significantly enhances productivity and streamlines the development workflow.</p><p><a href="https://plugins.jetbrains.com/plugin/27469-aem-vlt-tool">AEM VLT Tool - IntelliJ IDEs Plugin | Marketplace</a></p><h3>Key Features</h3><ul><li><strong>Bidirectional Content Synchronization</strong>: Easily push content from your local file system to the AEM repository and pull content from the AEM repository to your local file system.</li><li><strong>Multiple Server Support</strong>: Configure and manage various AEM server connections for different environments (development, staging, production).</li><li><strong>Visual Progress Tracking</strong>: Monitor your operations with intuitive visual progress indicators.</li><li><strong>Detailed Results Reporting</strong>: Get comprehensive statistics on added, updated, and deleted files after each operation.</li><li><strong>Context Menu Integration</strong>: Access AEM operations directly from the project view context menu with just a few clicks.</li><li><strong>User-Friendly Configuration</strong>: Simple settings interface for managing your AEM server connections.</li></ul><h3>Comparison with Alternative Free Tools</h3><p>When working with AEM, developers have several options for content synchronization. Here’s how the AEM VLT IntelliJ Plugin compares to other popular tools:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3697291a3afffc5b3884e94ee290ec8a/href">https://medium.com/media/3697291a3afffc5b3884e94ee290ec8a/href</a></iframe><h3>VLT Tool</h3><p>The <a href="https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/devtools/ht-vlttool">VLT (Vault) Tool</a> is Adobe’s official command-line tool for AEM content synchronization. While it’s quite powerful, you’ll need to work outside your IDE and learn specific command-line syntax, which can interrupt your development flow.</p><h3>AEM Repo Tool</h3><p>The <a href="https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/devtools/aem-repo-tool">AEM Repo Tool</a> offers similar functionality to VLT but with a more streamlined approach. Though designed to be simpler than VLT, you’ll still need to switch to the command line to use it, taking you away from your coding environment.</p><h3>IntelliVault (Deprecated)</h3><p><a href="https://plugins.jetbrains.com/plugin/7328-intellivault">IntelliVault</a> was an earlier IntelliJ plugin for AEM content synchronization that is now deprecated and no longer maintained. The AEM VLT IntelliJ Plugin serves as a modern replacement with enhanced features and reliability.</p><h3>VSCode AEM Sync</h3><p>For Visual Studio Code users, <a href="https://marketplace.visualstudio.com/items?itemName=yamato-ltd.vscode-aem-sync">VSCode AEM Sync</a> provides an extension that helps you sync your code updates with AEM. It’s a good option if VS Code is your preferred editor, though it lacks some of the advanced features found in the AEM VLT IntelliJ Plugin.</p><h3>Concepts and Architecture</h3><p>See the <a href="https://jackrabbit.apache.org/filevault/overview.html">Filevault Overview</a> and <a href="https://jackrabbit.apache.org/filevault/vaultfs.html">Vault FS</a> page from the official <a href="https://jackrabbit.apache.org/filevault/index.html">Apache Jackrabbit Filevault documentation</a> for a thorough overview of the concepts and structure of the Filevault tool.</p><p>The plugin wraps this powerful technology in a clean, intuitive interface that makes working with AEM content a breeze:</p><ul><li><strong>Plugin Settings</strong>: Configure your AEM server connections with a user-friendly settings panel.</li><li><strong>Context Menu Actions</strong>: Access push and pull operations directly from the project view with just a right-click.</li><li><strong>Operation Results</strong>: View detailed statistics about your content synchronization operations in real-time.</li></ul><h3>Main points</h3><ol><li><strong>Configuration</strong>: The plugin securely stores your AEM server configurations (URL, credentials).</li><li><strong>Content Mapping</strong>: It intelligently maps your local file system paths to corresponding JCR paths in AEM.</li><li><strong>Authentication</strong>: When you initiate an operation, it securely connects to your AEM instances using stored credentials.</li><li><strong>Content Transfer</strong>: Behind the scenes, it leverages Apache Jackrabbit FileVault for reliable content synchronization.</li><li><strong>Result Processing</strong>: After each operation, it analyzes and presents clear, actionable results to you.</li></ol><h3>Getting Started with AEM VLT IntelliJ Plugin</h3><p>Ready to streamline your AEM development workflow? Here’s what you’ll need:</p><ul><li>IntelliJ IDEA (either Community or Ultimate edition will work)</li><li>Access to an AEM instance</li></ul><h3>Installing the Plugin</h3><p>You have three easy ways to install the plugin:</p><h4>Option 1: Using the IDE Built-in Plugin System</h4><ol><li>Open IntelliJ IDEA</li><li>Navigate to Settings/Preferences &gt; Plugins &gt; Marketplace</li><li>Search for “AEM VLT Tool”</li><li>Click Install and restart your IDE when prompted</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RboKAKbAdFsqxKhlvBVP6g.png" /></figure><h4>Option 2: Using JetBrains Marketplace</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplugins.jetbrains.com%2Fembeddable%2Finstall%2F27469&amp;display_name=JetBrains+Marketplace&amp;url=https%3A%2F%2Fplugins.jetbrains.com%2Fembeddable%2Finstall%2F27469&amp;image=https%3A%2F%2Fplugins.jetbrains.com%2Fassets%2Ficons%2Fjetbrains.png&amp;type=text%2Fhtml&amp;schema=jetbrains" width="245" height="48" frameborder="0" scrolling="no"><a href="https://medium.com/media/7505b8fd315d37ba815605e45d6f6007/href">https://medium.com/media/7505b8fd315d37ba815605e45d6f6007/href</a></iframe><h4>Option 3: Manual Installation</h4><ol><li>Download the latest release from <a href="https://github.com/koha26/aem-vlt-intellij-plugin/releases">GitHub</a></li><li>In IntelliJ IDEA, go to Settings/Preferences &gt; Plugins &gt; ⚙️ &gt; Install plugin from disk…</li><li>Select the downloaded plugin file and restart your IDE when prompted</li></ol><h3>Configuring Your AEM Servers</h3><p>Now let’s set up your AEM server connections:</p><ol><li>Go to Settings/Preferences &gt; AEM VLT Settings</li><li>Click the “+” button to add a new server configuration</li><li>Fill in your server details:</li></ol><ul><li>Server Name (something descriptive like “Local Author” or “Production Publisher”)</li><li>URL (e.g., <a href="http://localhost:4502/">http://localhost:4502</a>)</li><li>Username and Password (don’t worry, your credentials are stored securely using IntelliJ’s built-in password protection)</li><li>Check “Set as default” if this will be your primary AEM instance</li><li>Click “Test Connection” to verify everything works</li></ul><p><em>Pro tip: You can still save your configuration even if your AEM instance isn’t currently running</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ajYYGlftQ0jmvksC8ZnsHg.png" /></figure><h3>Using the Plugin</h3><p>Great! Your AEM VLT IntelliJ Plugin is now ready to use. Let’s look at how to sync content between your local environment and AEM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2YOQoVknGbD-_WIB" /></figure><h4>Pushing Content to AEM</h4><p>When you’ve made changes locally that you want to send to AEM:</p><ol><li>Right-click on a file or directory in the Project view under /jcr_root</li><li>Select AEM VLT → Push to AEM (Default)</li><li>If you’ve configured multiple servers, you’ll be prompted to select your target server</li><li>Watch as the plugin transfers your content to the corresponding path in AEM</li><li>Review the operation summary to see what was added, updated, or deleted</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*Itw5gqtr8Ha-3tUaVX8JKw.png" /></figure><h4>Pulling Content from AEM</h4><p>Need to get the latest content from AEM?</p><ol><li>Right-click on a file or directory in the Project view under /jcr_root</li><li>Select AEM VLT → Pull from AEM (Default)</li><li>Choose your source server if you have multiple configurations</li><li>The plugin will retrieve the content and update your local files</li><li>Check the operation summary to see what changed</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*gdFR4AOXwgp55OMyf_ZPug.png" /></figure><h3>Common AEM Development Tasks Made Easier</h3><p>Here are some everyday AEM development tasks that become much simpler with the plugin:</p><ul><li><strong>Component Development</strong>: Iterate quickly by pushing your component changes directly to AEM without leaving your IDE.</li><li><strong>Editable Templates</strong>: Update your template structures and policies with just a few clicks.</li><li><strong>Content Structure Synchronization</strong>: Keep your local environment in sync with the latest content structure from your AEM instance.</li><li><strong>Custom UI Development</strong>: Rapidly prototype and test UI changes by seamlessly pushing and pulling code.</li><li><strong>Multi-Environment Workflow</strong>: Effortlessly switch between different AEM environments (author, publish) as your workflow requires.</li><li><strong>Team Collaboration</strong>: Ensure everyone on your team is working with the same content structure and format, reducing integration headaches.</li></ul><h3>Conclusion</h3><p>The AEM VLT IntelliJ Plugin transforms how you work with AEM by bringing content synchronization directly into your development environment. No more context switching between your IDE and command line tools — everything you need is right where you’re already working.</p><p>This seamless integration not only saves you time but also reduces the cognitive load of remembering command-line parameters or switching between different tools. The result? A more focused, productive development experience that lets you concentrate on creating great AEM solutions rather than wrestling with content synchronization.</p><p>Whether you’re a solo developer building a proof of concept or part of a large team working on an enterprise AEM implementation, this plugin will become an essential part of your AEM development toolkit.</p><p><em>This plugin was developed by Kostiantyn Diachenko, an AEM community enthusiast, Adobe Community Advisor, and Certified AEM Developer. It’s available under the MIT License and actively maintained to support the latest AEM and IntelliJ IDEA versions.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d666bf3b472c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>