<?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 John Mitchell on Medium]]></title>
        <description><![CDATA[Stories by John Mitchell on Medium]]></description>
        <link>https://medium.com/@jomitche?source=rss-d1103d49cc29------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*O6XAmYEUAAi3DCV0w1w7fA@2x.jpeg</url>
            <title>Stories by John Mitchell on Medium</title>
            <link>https://medium.com/@jomitche?source=rss-d1103d49cc29------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 05:20:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jomitche/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[Personalisation at the Edge with Adobe Target and AEM]]></title>
            <link>https://medium.com/@jomitche/personalisation-at-the-edge-with-adobe-target-and-aem-30bd702c65c5?source=rss-d1103d49cc29------2</link>
            <guid isPermaLink="false">https://medium.com/p/30bd702c65c5</guid>
            <category><![CDATA[aem-developer]]></category>
            <category><![CDATA[adobe-target]]></category>
            <category><![CDATA[aem-architect]]></category>
            <category><![CDATA[customer-experience]]></category>
            <category><![CDATA[user-experience]]></category>
            <dc:creator><![CDATA[John Mitchell]]></dc:creator>
            <pubDate>Fri, 06 Nov 2026 21:28:47 GMT</pubDate>
            <atom:updated>2026-11-06T21:38:42.622Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nIDeeRTyZiPq7bQAcgvE4A@2x.jpeg" /></figure><p>Every visitor to a homepage asks for the same URL, but they are rarely all after the same thing.</p><p>A first-time visitor wants to know what you do. A customer with a booking next week wants their booking. Someone halfway through an application wants to finish it. Showing all three the same hero banner doesn’t really help any of them.</p><p>The usual first attempt is to add conditions to the homepage component. That works for a while, until the conditions start coming from everywhere: identity, booking data, profile attributes, campaigns and consent. Before long the homepage component knows far more about the business than any component should.</p><p>I recently worked on an implementation that took a different route, using Adobe Target as the decision engine, a Cloudflare Worker as the edge integration layer, and AEM Experience Fragments for the content. None of the three needs to know much about the others. They just need to agree on a small contract.</p><h3>Decide before the page renders</h3><p>The obvious option is to do it in the browser. Render the standard homepage, call a Adobe Target, and swap out the component when the answer comes back.</p><p>The problem is the visitor sees it happen. The default content flashes up before the replacement arrives, and you end up maintaining two versions of the page: the server response and the client-side result. The flash of unpersonalised content is better these days that it used to be, but still doesn’t work for replacing almost the entirety of it the page.</p><p>Instead, the decision is made before the request ever reaches AEM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a5Gry437S5-lq5F4NEfE-A@2x.jpeg" /></figure><p>The Cloudflare Worker sits in front of the AEM origin. It gathers the context Target needs, calls Target, and gets a JSON offer back. It then turns that offer into request headers, and AEM uses those headers to pick the Experience Fragment.</p><p>Each piece has one job:</p><ul><li>The Worker prepares the context</li><li>Adobe Target decides which experience applies</li><li>AEM maps the decision to content</li><li>Sling and HTL render it</li></ul><p>AEM never calls Target, and Target has no idea how the Experience Fragments are structured in the repository.</p><h3>Keep the edge contract small</h3><p>By the time the Worker calls Target it can know quite a lot: a verified identity, the URL, browser and geo data, consent status, the Adobe visitor ID, and profile data such as an upcoming booking.</p><p>The Worker’s job is to shape that into what Target expects. It is tempting to pass everything downstream because it’s there. Don’t.</p><p>The offer coming back from Target can be tiny:</p><pre>{<br>  &quot;X-Visitor-State&quot;: &quot;active-customer&quot;,<br>  &quot;X-Visitor-Location&quot;: &quot;location-a&quot;<br>}</pre><p>The header names are just examples. Target picks a state and, optionally, a secondary variation, and nothing else.</p><p>That keeps the AEM side simple. The component doesn’t care whether the state came from a booking, a loyalty tier, a behavioural audience or a campaign. Target has already made that call.</p><h3>Target owns the decision</h3><p>Target isn’t just reporting on an A/B test here while AEM quietly decides what to show. Target evaluates the audiences and returns the experience.</p><p>So Target can use everything it has, profile attributes and behavioural audiences included, without any of those rules ending up in an AEM component.</p><p>A single activity could separate out:</p><ul><li>general visitors</li><li>existing customers</li><li>visitors approaching a renewal or arrival date</li><li>visitors tied to a particular location</li><li>visitors eligible for a campaign</li></ul><p>AEM only maps the resulting state to a fragment. As long as the output contract stays the same, the audience definitions can change in Target without a new AEM release.</p><h3>AEM stays the content system</h3><p>The component is configured with a mapping from state to Experience Fragment path:</p><pre>experienceMappings<br>  - visitorState: master<br>    fragmentPath: /content/experience-fragments/homepage/master<br>  - visitorState: active-customer<br>    fragmentPath: /content/experience-fragments/homepage/customer<br>  - visitorState: renewal-window<br>    fragmentPath: /content/experience-fragments/homepage/renewal</pre><p>The master experience is the default, and it lives in the component configuration rather than as a hard-coded path in Java. Authors can see the baseline next to the targeted variants, and developers don’t add another if-statement every time a new state appears.</p><p>The homepage itself ends up fairly boring. It holds one reusable component, not a pile of rules about identity, bookings and campaigns. Boring is good here.</p><h3>Let Target set the priority</h3><p>Visitors often match more than one condition. An active customer can also be inside a renewal window. Someone in a campaign audience may also have a location on their profile.</p><p>Target can return the states in priority order:</p><pre>X-Visitor-State: renewal-window, active-customer, general</pre><p>The component walks the list left to right and uses the first state it has a mapping for:</p><pre>List&lt;String&gt; states = parseHeader(request, &quot;X-Visitor-State&quot;);<br>for (String state : states) {<br>    Mapping mapping = mappings.findByState(state);<br>    if (mapping != null) {<br>        return mapping.fragmentPath();<br>    }<br>}<br>return mappings.findByState(&quot;master&quot;).fragmentPath();</pre><p>AEM isn’t making a second decision. It is just following the order Target gave it.</p><p>The alternative is one priority model in Target and another in AEM, and the first time an unexpected fragment shows up in production nobody will be able to explain why.</p><p>If authors genuinely need to reorder priorities without touching Target, that’s a fair requirement. Design for it properly with author-configured priorities, rather than ending up with a bit of both by accident.</p><h3>Variations without a content matrix</h3><p>The selected fragment can have optional secondary variations:</p><pre>/content/experience-fragments/homepage/customer<br>  /master<br>  /location-a<br>  /location-b</pre><p>The component picks the state fragment first, then looks for the location or market variation. If it exists, it’s rendered. If not, it falls back to the fragment’s master variation.</p><p>So a good customer experience doesn’t disappear just because nobody has authored the location B version yet.</p><p>It also avoids the classic trap of authoring every audience against every location before anyone knows whether the differences make any difference. Start with a strong master and only add variations where there is a clear editorial or commercial reason.</p><h3>Edge doesn’t always mean local</h3><p>The Worker can use Target decisioning in a couple of ways. Some activities can be resolved locally from a downloaded rules artifact. Others need a live call to the Target Delivery API because they rely on profile or behavioural data.</p><p>A hybrid approach uses local decisioning where it can and a server-side call where it has to. Running at the edge shortens the distance to the decision, but it doesn’t mean every decision avoids a network hop.</p><p>So plan for failure. If identity validation fails, the rules artifact can’t be loaded, or the Delivery API doesn’t respond, the Worker should pass the request through without the personalisation headers.</p><p>The homepage still renders, just with the master experience. Personalisation should never be the reason the site goes down.</p><h3>Render the fragment normally</h3><p>The component doesn’t copy Experience Fragment markup into Java. The Sling Model resolves the resource and HTL renders it through the normal pipeline:</p><pre>&lt;sly data-sly-test=&quot;${properties.fragmentRoot}&quot;<br>     data-sly-resource=&quot;${properties.fragmentRoot<br>       @ resourceType=&#39;cq/experience-fragments/components/experiencefragment&#39;}&quot;&gt;<br>&lt;/sly&gt;</pre><p>The implementation stays small and Experience Fragments behave exactly as they do anywhere else. In author mode the component can just show a placeholder. Nobody is realistically going to preview every Target audience inside the AEM editor.</p><h3>Where this fits</h3><p>The pattern works when:</p><ol><li>The visitor context is known before rendering</li><li>Target can make a useful decision from that context</li><li>The number of variants is small enough for authors to keep on top of</li></ol><p>Some examples:</p><ul><li><strong>Travel and hospitality</strong>: booking stage, arrival date, loyalty tier or destination.</li><li><strong>Retail</strong>: campaign or category messaging, with pricing and stock still served live.</li><li><strong>Financial services</strong>: prospects, existing account holders and customers near renewal. Eligibility rules belong in the proper policy system, not in an Experience Fragment component.</li><li><strong>Higher education</strong>: prospective students, applicants, offer holders and current students.</li></ul><p>It’s a poor fit when every visitor needs unique content, when the decision keeps changing mid-request, or when the number of combinations is more than authors can realistically maintain.</p><h3>Don’t leave caching until the end</h3><p>If Target’s decision changes the AEM response, the cache has to know about it. Otherwise one visitor’s experience gets served to the next.</p><p>Cloudflare, the Dispatcher and the origin all need the same understanding of which headers change the response. Those headers may need to be part of the cache key, or the personalised section may need a different caching strategy altogether.</p><p>The Sling Model can’t solve this on its own. Edge routing, Target, AEM rendering and caching need to be designed as one request path from the start.</p><h3>Wrapping up</h3><p>Not every homepage needs to be unique. What this gives you is a handful of meaningful experiences, chosen before the page renders, with each platform doing one job:</p><ul><li>Cloudflare gathers and validates the visitor context</li><li>Adobe Target decides which experience applies</li><li>AEM maps the decision to author-managed content</li><li>Sling and HTL render it</li><li>The cache keeps the variants apart</li></ul><p>Keep the contract small, let Target own the decision, make the fallback predictable, and only add variations where they pay for themselves.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30bd702c65c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Opening the hood on GraphQL in Adobe Experience Manager]]></title>
            <link>https://medium.com/@jomitche/opening-the-hood-on-graphql-in-adobe-experience-manager-a2700bbfb02a?source=rss-d1103d49cc29------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2700bbfb02a</guid>
            <category><![CDATA[aem-developer]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[sling]]></category>
            <category><![CDATA[aem-architect]]></category>
            <dc:creator><![CDATA[John Mitchell]]></dc:creator>
            <pubDate>Sat, 27 Jul 2024 14:14:27 GMT</pubDate>
            <atom:updated>2024-07-27T14:15:29.713Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*78D_V2rK3AzMjmjrjZy10A.jpeg" /></figure><p>In the last 3 years, Adobe Experience Manager Content Fragments have developed from static templates with clunky APIs, to zero code, marketing managed models with GraphQL endpoints.</p><p>What it provides is an incredibly powerful democratisation of content to the widest ever range of delivery channels at an unrivalled speed of execution.</p><p>In fact, I have found several occasions over the last few months where I’ve been able to say to customers that what they want requires absolutely no development effort at all; save for some assistance with creating GraphQL queries.</p><p>Yet, sometimes this out of the box functionality doesn’t meet all the use cases that are required. Sometimes there are mix of legacy content models, that while very much worthwhile updating in the longer term, slowing doing the velocity of other channels isn’t possible. Sometimes, content models need to be augmented with additional content or data points from backend services.</p><p>At this point the powerful Content Fragment GraphQL endpoints are simply not enough, and architects start the hunt for other solutions.</p><blockquote><strong>Sling GraphQL Core to the rescue.</strong></blockquote><p>Dig far enough under the hood of the Adobe Experience Manager Sites GraphQL implementation, and you find the incredible flexible Sling GraphQL Core module.</p><h3>How does it work?</h3><p>The starting point for using Sling GraphQL Core, is to create an endpoint for your clients to interface with. With this module, you can either opt for a traditional GraphQL endpoint – with a single schema, and clients direct all the their requests to one place; or alternatively you can turn any Sling Resource into a GraphQL endpoint, with their own selectors, extensions and schemas.</p><p>In the example detailed out in this article, we will explain the creation of the latter as a viewpoint onto a website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qeI7KTFXpK7W_rr1CzkFSQ.png" /><figcaption>Sample endpoint structure</figcaption></figure><p>Since these endpoints are normal Sling Resources, they have all the same capabilities, such as Context Aware Configuration.</p><h3>Schemas</h3><p>Once you have your endpoints setup, the next thing to configure is the schema for them. Schemas are provided by SchemaProvider services, with the default provider issuing a request for the current resource with a <em>.GQLschema</em> extension</p><pre>@ProviderType<br>public interface SchemaProvider {<br>  <br>    /** Get a GraphQL Schema definition for the given resource and optional selectors<br>     *<br>     *  @param r The Resource to which the schema applies<br>     *  @param selectors Optional set of Request Selectors that can influence the schema selection<br>     *  @return a GraphQL schema that can be annotated to define the data fetchers to use, see<br>     *      this module&#39;s documentation. Can return null if a schema cannot be provided, in which<br>     *      case a different provider should be used.<br>     *  @throws java.io.IOException if the schema cannot be retrieved<br>     */<br>    @Nullable<br>    String getSchema(@NotNull Resource r, @Nullable String [] selectors) throws IOException;<br>}</pre><p>Typically speaking, you shouldn’t need to implement your own SchemaProvider, and you can use the normal Sling selector and extension based component file resolution to serve up a schema.</p><p>What I would recommend however is a resource type based servlet that will retrieve the schema from a bundle resource.</p><pre>@Component(<br>    service = Servlet.class,<br>    property = {<br>        &quot;sling.servlet.extensions=GQLschema&quot;,<br>        &quot;sling.servlet.methods=&quot; + HttpConstants.METHOD_GET,<br>        &quot;sling.servlet.resourceTypes=&quot; + SchemaProviderServlet.RESOURCE_TYPE<br>    }<br>)<br>@Getter<br>public class SchemaProviderServlet extends SlingSafeMethodsServlet {<br><br> private static final long serialVersionUID = 1L;<br><br> public static final String RESOURCE_TYPE = &quot;api/application-name/v1/content&quot;;<br><br>    String schema;<br><br>    @Activate<br>    public void setup(BundleContext bundleContext) {<br>        PropertyDataFetcherHelper.clearReflectionCache();<br>        try (BufferedReader reader = new BufferedReader(<br>                new InputStreamReader(bundleContext.getBundle().getResource(&quot;/schemas/schema.gql&quot;).openStream(), StandardCharsets.UTF_8))) {<br>            this.schema = reader.lines().collect(Collectors.joining(&quot;\n&quot;));<br>        } catch (IOException e) {<br>            // Ignore the error and return blank<br>        }<br>    }<br><br>    @Override<br>    protected void doGet(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws IOException {<br>        response.getWriter().write(getSchema());<br>    }<br>}</pre><h3>Sling Data Fetchers</h3><p>Data fetchers are where the magic happens. These are simple services that are referenced by your schema to fetch and process whatever content you want to:</p><pre>@Component(service = SlingDataFetcher.class, property = { &quot;name=application/content&quot; })<br>@Slf4j<br>public class ContentDataFetcher implements SlingDataFetcher&lt;List&lt;Content&gt;&gt; {<br><br>    <br>    @Override<br>    public List&lt;Content&gt; get(@NotNull SlingDataFetcherEnvironment env) throws Exception {<br>        return null;<br>    }<br><br>}</pre><p>Data fetchers should register themselves as a SlingDataFetcher service, give themselves a name that can be referenced from the schema, and implement the get function. This is a generic function that allows you to specify the data type of the return, which allows the serialization of the object to be controlled by normal @JsonIgnore annotations.</p><p>Within the schema, they can be referenced like this:</p><pre>type Query {<br>    content: [Content] @fetcher(name:&quot;application/content&quot;)<br>}</pre><p>The SlingDataFetcherEnvironment parameter to the get function allows you to get access to numerous useful aspects — including options for the fetcher:</p><pre> articles(withCode: String): [Article] @fetcher(name:&quot;application/content&quot; options:&quot;withArticle&quot;)</pre><p>And the ability to access the object that the fetcher is embedded in, using env.getParentObject()</p><p>The combination of all these features allows Data Fetchers to be incredibly powerful.</p><h3>Persistent Queries</h3><p>The Sling GraphQL core module does support persistent queries, but they’re a bit more inconvenient to use than the OOTB content fragment persistent queries, as they have a number of drawbacks.</p><p>For the persistent queries that are implemented with the Sling GraphQL Core module, using them is a two stage process. Firstly, you have to persistent the query. This happens by POSTing the query to the endpoint that is created for executing the queries. This will persist the query in memory, and return the location of the URI that can retrieve the result along with a 201 Created response.</p><p>The key for retrieving a persistent query is a hash based on the query that is being persisted. This means it can be predicted ahead of time, and an optimistic client can simply try and retrieve the result as GET request, and only create the persisted query if the it returns a 404 Not Found status.</p><pre>curl --location &#39;http://api.application.co.uk/api/v1/content.json/persisted&#39; \<br>--header &#39;Content-Type: application/json&#39; \<br>--data &#39;{&quot;query&quot;:&quot;query getContent { content { title image } }&quot; }&#39;<br><br>Status: 201 Created<br>Location: https://api.application.co.uk/api/v1/content.json/persisted/a130231570213a358c3be7b81f6291b5b852a103512dbe76fb6b0226065bdbf7.json</pre><pre>curl --location \<br>  &#39;https://api.application.co.uk/api/v1/content.json/persisted/a130231570213a358c3be7b81f6291b5b852a103512dbe76fb6b0226065bdbf7.json&#39;<br><br>Status: 200</pre><p>The algorithm used for calculating the cache key is:</p><pre>MessageDigest digest = MessageDigest.getInstance(&quot;SHA-256&quot;);<br>byte[] hash = digest.digest(query.getBytes(StandardCharsets.UTF_8));</pre><p>This leads me on to the pitfalls of this particular approach. With a multi server setup, unless you’re using sticky sessions, you can’t guarantee that the POST request to persist the query will hit the same server as the GET request to retrieve it, so you may end up going round a number of times before getting a successful response. Additionally, since it a memory based cache, the persisted queries do not survive a server restart. Finally, you need a authenticated endpoint available to protect the POST request against bad actors.</p><p>This approach also doesn’t allow for parameters in persisted queries — although this is less of a concern, as you could manage parameterised queries in your own client, and make the re-use at that layer. There is nothing stopping you using parameterised queries, and persisting everything including the parameters. It’s not efficient in terms of memory management, but certainly better than a templated approach.</p><p>A much better approach is to implement a PersistedQueryService similar to the one that is available out of the box to allow for queries to be persisted in the repository, and deployed at build time. This can follow any structure / url structure you want to have, but having one that matches the OOTB format, will allow you to use all the SDKs available to clients unchanged.</p><p>Unfortunately, it isn’t possible for GraphiQL Editor to be customised to allow for these queries to be authored at run time, but the REST interface that is available to persist nodes in the content repository could be utilised alongside token based authentication.</p><h3>Conclusion</h3><p>The Sling GraphQL Core module allows developers to expose significantly more content as a graph from AEM. It always them to apply logic to content before exposing it. It is a incredibly powerful feature that you consider as part of your headless strategy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2700bbfb02a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Sling Feature Flags to Manage Continuous Releases]]></title>
            <link>https://medium.com/adobetech/using-sling-feature-flags-to-manage-continuous-releases-b9d3f153cae6?source=rss-d1103d49cc29------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9d3f153cae6</guid>
            <category><![CDATA[adobe-target]]></category>
            <category><![CDATA[adobe-experience-cloud]]></category>
            <category><![CDATA[adobe-experience-manager]]></category>
            <category><![CDATA[feature-flags]]></category>
            <category><![CDATA[sling]]></category>
            <dc:creator><![CDATA[John Mitchell]]></dc:creator>
            <pubDate>Fri, 18 Nov 2022 16:08:34 GMT</pubDate>
            <atom:updated>2022-11-21T21:06:44.952Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HQvHDcNvttR-d8ni-Fe2WA.jpeg" /></figure><p>A large number of Adobe Experience Manager (AEM) projects use an agile methodology to deliver value for their stakeholders. There are a variety of benefits to this methodology, which are discussed at length in many places, but one of the main ones is to deliver that value at regular intervals.</p><p>This value can take the form of a new feature for customers, but frequently, it’s not necessarily possible to complete a brand-new feature that is usable by customers in a single iteration. When the project is using a continuous delivery model, partially completed merged features can cause headaches when delivered to production.</p><p>Previously, the main strategies for managing this were fairly manual. Strategies may have involved authoring options to switch features on or off. Developing the feature as a new version of a component was also a strategy. Both resulted in a variety of methodologies involving checkboxes, if-then conditions, and ultimately no real control or governance of what features were enabled in which environments and when.</p><p><a href="https://sling.apache.org/documentation/the-sling-engine/featureflags.html">Sling Feature Flags</a> to the rescue.</p><h3>Static flags</h3><p>At the most basic level, Sling Features can be created by simply adding a factory OSGI configuration with the factory PID org.apache.sling.featureflags.Feature. The properties that can be added to this configuration are:</p><ul><li><strong>Name</strong> — This is a required property. This is the identifier that is used to reference the feature in your applications.</li><li><strong>Description</strong> — This is an optional property, but it’s recommended to include, since otherwise the name will be used. It is used to describe the intent of the Feature.</li><li><strong>Enabled</strong> — This one indicates whether the feature is not.</li></ul><p>This comes with the added benefit of being able to enable some Features in some run modes, and disable them in others. This allows for the ability to have a feature enabled for test environments, and switched off in production until it is ready to launch.</p><h3>Dynamic flags</h3><p>Sometimes, a simple run-mode-based flag won’t be enough to determine whether a feature flag should be enabled or not. For this, custom services can be developed against the Feature interface.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b24395744aa578668a5b0daeee830f80/href">https://medium.com/media/b24395744aa578668a5b0daeee830f80/href</a></iframe><p>The isEnabled function can use anything found within the ExecutionContext object passed to it. From the ExecutionContext object, you get the current request, a ResourceResolver for the current request, and reference to all the other features that are configured for that container.</p><p>This allows you to use Context-Aware Configuration, Request Headers and Parameters, Cookies, and even the current resource to configure logic to determine whether that feature is enabled or not.</p><p>By extension, if the request has the context of a user session — whether that’s in the context of an authorization token that can be used to reference data from back-end services or another deployed OSGI service that you have to look up specific or segmented customer data.</p><p>In addition, you can use any system-level information — like time of day — to drive the logic behind your feature.</p><h3>Using Feature flags</h3><p>Once you have a Feature — configured or custom — the method of using them is common for both. Sling Features can be used in a number of different ways in your application.</p><p><strong>Author dialogs<br></strong>Perhaps your new feature includes some additional authoring options, which you don’t want to surface until the Feature is enabled.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c4f7e70926949a880b84173d7a21590/href">https://medium.com/media/6c4f7e70926949a880b84173d7a21590/href</a></iframe><p>This is achieved using the granite/ui/components/coral/foundation/renderconditions/feature resource type as part of the granite:rendercondition attribute on the author dialog field that is associated with your feature. This has the effect of hiding the field if your feature is disabled, and showing it when enabled.</p><p><strong>Sling Models &amp; servlets</strong></p><p>Functionality inside Sling Models, servlets, and other OSGI services can also be controlled by Sling Feature Flags. This is done by way of the Features factory service. Referencing or injecting these services allows you to use the following code in any way you prefer.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a4292db4c3695bf2c5b1a5c3c3eea31f/href">https://medium.com/media/a4292db4c3695bf2c5b1a5c3c3eea31f/href</a></iframe><h3>Configuration Management</h3><p>By far the simplest way to introduce feature flags in your application is to use the org.apache.sling.featureflags.Feature factory OSGI configuration option. In modern versions of Adobe Experience Manager, it is recommended to leave the legacy XML and flat file formats and use the cfg.json format that uses JSON to configure the properties.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0aa1f0a79e33fa164a4e5e6b0d0a32c/href">https://medium.com/media/d0aa1f0a79e33fa164a4e5e6b0d0a32c/href</a></iframe><p>The downside of configuring the Feature Flag in this way is that it’s tied into your build, and you have no way of managing it without deploying a new version of your packages.</p><p>However, in Cloud Manager for Adobe Experience Manager as a Cloud Service, it is possible to configure environment variables and then use them in the OSGI configurations. This way you can update your feature flags without redeploying the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*srYduvlsFtwltebipDtJtA.png" /><figcaption>Configuration of environment variables in AEMaaCS Cloud Manager</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7dda2e629c2f33fb1ec23200d9d8e792/href">https://medium.com/media/7dda2e629c2f33fb1ec23200d9d8e792/href</a></iframe><h3>What now?</h3><p>As you can see, Sling Feature Flags are an incredibly powerful and flexible feature that can be used in a number of places and ways.</p><p>What other use cases could you see for this functionality?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9d3f153cae6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adobetech/using-sling-feature-flags-to-manage-continuous-releases-b9d3f153cae6">Using Sling Feature Flags to Manage Continuous Releases</a> was originally published in <a href="https://medium.com/adobetech">Adobe Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Headless Chrome Inside Adobe Cloud Manager Builds]]></title>
            <link>https://medium.com/adobetech/running-headless-chrome-inside-adobe-cloud-manager-builds-7e556a97dce4?source=rss-d1103d49cc29------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e556a97dce4</guid>
            <category><![CDATA[adobe-experience-manager]]></category>
            <category><![CDATA[adobe-experience-cloud]]></category>
            <category><![CDATA[headless-chrome]]></category>
            <category><![CDATA[critical-css]]></category>
            <dc:creator><![CDATA[John Mitchell]]></dc:creator>
            <pubDate>Tue, 15 Dec 2020 23:57:27 GMT</pubDate>
            <atom:updated>2020-12-15T23:57:27.299Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j2RdD7IxkDJEUYz3zyjJ7A.jpeg" /></figure><p>I found myself creating critical CSS client libraries for an Adobe Experience Manager project as part of a series of performance improvements recently.</p><h3><strong>What is Critical CSS?</strong></h3><p>Historically, web site performance has been mainly focussed on server rendering and database query optimisation; but in 2020, front end performance is critical to the success of any website. SEO optimisation is no longer simply focussed on getting the right content and links in place — speed of rendering is a key metric to track and improve.</p><p>Some of these KPIs are met by prioritising the rendering of aspects of a page that the user will see first. This typically is the top part of the page, also known as “above the fold”. Since the whole stylesheet isn’t needed to display this part of the page, it is wasteful to synchronously load the whole set of rules. This is especially key, since loading CSS is a render block action, and prevents anything else happening.</p><p>Identifying the specific rules that are necessary to render the above the fold content is not a trivial task. These specific rules are known as critical CSS, and best practice is to load this small subset of rules synchronously and then load the remaining rules (non-critical) asynchronously.</p><h3>Auto Generating the Critical CSS</h3><p>Fortunately, browsers are pretty good at working out which rules are critical, and the <a href="https://github.com/pocketjoso/penthouse">Penthouse</a> npm module can be incorporated into build processes.</p><p>The problem is that the underlying technology, <a href="https://github.com/puppeteer/puppeteer">Puppeteer</a> uses headless Chromium to generate the critical CSS, which was running just fine locally as part of the Maven project build, and on the self managed Jenkins instance, but was failing inside the Adobe Cloud Manager build environment:</p><pre>[emitted]         (node:2509) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!<br>10:36:24,006 [Exec Stream Pumper] [INFO] /build_root/build/project/ui.frontend/src/main/frontend/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory</pre><p>This was because the build environment was lacking the dependencies for the local chromium install to run.</p><p>Fortunately, Adobe Cloud Manager allows <a href="https://docs.adobe.com/content/help/en/experience-manager-cloud-manager/using/getting-started/create-an-application-project.html#installing-additional-system-packages">additional system dependencies</a> to be installed, and adding a specific profile to install these dependencies in the maven pom file, resolved the issue:</p><pre>&lt;profile&gt;<br>    &lt;id&gt;cmBuild&lt;/id&gt;<br>    &lt;activation&gt;<br>        &lt;property&gt;<br>            &lt;name&gt;env.CM_BUILD&lt;/name&gt;<br>        &lt;/property&gt;<br>    &lt;/activation&gt;<br>    &lt;build&gt;<br>        &lt;plugins&gt;<br>            &lt;plugin&gt;<br>                &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;<br>                &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;<br>                &lt;version&gt;1.6.0&lt;/version&gt;<br>                &lt;executions&gt;<br>                    &lt;execution&gt;<br>                        &lt;id&gt;apt-get-update&lt;/id&gt;<br>                        &lt;phase&gt;validate&lt;/phase&gt;<br>                        &lt;goals&gt;<br>                            &lt;goal&gt;exec&lt;/goal&gt;<br>                        &lt;/goals&gt;<br>                        &lt;configuration&gt;<br>                            &lt;executable&gt;apt-get&lt;/executable&gt;<br>                            &lt;arguments&gt;<br>                                &lt;argument&gt;update&lt;/argument&gt;<br>                            &lt;/arguments&gt;<br>                        &lt;/configuration&gt;<br>                    &lt;/execution&gt;<br>                    &lt;execution&gt;<br>                        &lt;id&gt;install-puppeteer-dependencies&lt;/id&gt;<br>                        &lt;phase&gt;validate&lt;/phase&gt;<br>                        &lt;goals&gt;<br>                            &lt;goal&gt;exec&lt;/goal&gt;<br>                        &lt;/goals&gt;<br>                        &lt;configuration&gt;<br>                            &lt;executable&gt;apt-get&lt;/executable&gt;<br>                            &lt;arguments&gt;<br>                                &lt;argument&gt;install&lt;/argument&gt;<br>                                &lt;argument&gt;-y&lt;/argument&gt;<br>                                &lt;argument&gt;--no-install-recommends&lt;/argument&gt;<br>                                &lt;argument&gt;gconf-service&lt;/argument&gt;<br>                                &lt;argument&gt;libxext6&lt;/argument&gt;<br>                                &lt;argument&gt;libxfixes3&lt;/argument&gt;<br>                                &lt;argument&gt;libxi6&lt;/argument&gt;<br>                                &lt;argument&gt;libxrandr2&lt;/argument&gt;<br>                                &lt;argument&gt;libxrender1&lt;/argument&gt;<br>                                &lt;argument&gt;libcairo2&lt;/argument&gt;<br>                                &lt;argument&gt;libcups2&lt;/argument&gt;<br>                                &lt;argument&gt;libdbus-1-3&lt;/argument&gt;<br>                                &lt;argument&gt;libexpat1&lt;/argument&gt;<br>                                &lt;argument&gt;libfontconfig1&lt;/argument&gt;<br>                                &lt;argument&gt;libgcc1&lt;/argument&gt;<br>                                &lt;argument&gt;libgconf-2-4&lt;/argument&gt;<br>                                &lt;argument&gt;libgdk-pixbuf2.0-0&lt;/argument&gt;<br>                                &lt;argument&gt;libglib2.0-0&lt;/argument&gt;<br>                                &lt;argument&gt;libgtk-3-0&lt;/argument&gt;<br>                                &lt;argument&gt;libnspr4&lt;/argument&gt;<br>                                &lt;argument&gt;libpango-1.0-0&lt;/argument&gt;<br>                                &lt;argument&gt;libpangocairo-1.0-0&lt;/argument&gt;<br>                                &lt;argument&gt;libstdc++6&lt;/argument&gt;<br>                                &lt;argument&gt;libx11-6&lt;/argument&gt;<br>                                &lt;argument&gt;libx11-xcb1&lt;/argument&gt;<br>                                &lt;argument&gt;libxcb1&lt;/argument&gt;<br>                                &lt;argument&gt;libxcomposite1&lt;/argument&gt;<br>                                &lt;argument&gt;libxcursor1&lt;/argument&gt;<br>                                &lt;argument&gt;libxdamage1&lt;/argument&gt;<br>                                &lt;argument&gt;libxss1&lt;/argument&gt;<br>                                &lt;argument&gt;libxtst6&lt;/argument&gt;<br>                                &lt;argument&gt;libappindicator1&lt;/argument&gt;<br>                                &lt;argument&gt;libnss3&lt;/argument&gt;<br>                                &lt;argument&gt;libasound2&lt;/argument&gt;<br>                                &lt;argument&gt;libatk1.0-0&lt;/argument&gt;<br>                                &lt;argument&gt;libc6&lt;/argument&gt;<br>                                &lt;argument&gt;ca-certificates&lt;/argument&gt;<br>                                &lt;argument&gt;fonts-liberation&lt;/argument&gt;<br>                                &lt;argument&gt;lsb-release&lt;/argument&gt;<br>                                &lt;argument&gt;xdg-utils&lt;/argument&gt;<br>                                &lt;argument&gt;wget&lt;/argument&gt;<br>                            &lt;/arguments&gt;<br>                        &lt;/configuration&gt;<br>                    &lt;/execution&gt;<br>                &lt;/executions&gt;<br>            &lt;/plugin&gt;<br>        &lt;/plugins&gt;<br>    &lt;/build&gt;<br>&lt;/profile&gt;</pre><p>This uses the exec-maven-plugin to execute shell commands, in this case the apt-get package manager command, to install additional system packages to allow the headless Chromium instance to run.</p><p>The profile is activated using the CM_BUILD environment variable, which ensures it will only run this profile as part of Cloud Manager build.</p><h3>What Other Uses Cases?</h3><p>Since, this technique is simply a means by which you can get additional system packages installed on your Cloud Manager build instance, the sky is the limit for this.</p><p>Perhaps you have Selenium based integration tests that need a headless Chrome instance to run.</p><p>Perhaps you need to generate test data or dispatcher configuration with Perl or Python scripts.</p><p>Try it out, and see what you can imagine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e556a97dce4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adobetech/running-headless-chrome-inside-adobe-cloud-manager-builds-7e556a97dce4">Running Headless Chrome Inside Adobe Cloud Manager Builds</a> was originally published in <a href="https://medium.com/adobetech">Adobe Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>