Asset Compute microservices extensibility

AEM as Cloud Service’s Asset Compute microservices support the development and deployment of custom workers that are used to read, and manipulate binary data of assets stored in AEM, most commonly, to create custom asset renditions.

Whereas in AEM 6.x custom AEM Workflow processes were used to read, transform, and write back asset renditions, in AEM as a Cloud Service Asset Compute workers satisfy this need.

What you will do

Transcript
In this tutorial we explore stenting Asset Compute for AEM Cloud Service. We look at how to set up everything needed to work with Custom Asset Compute Workers from Adobe I/O Command Line Tool to Adobe Project Firefly. Next, we generate a new Asset Compute project, configure it and develop a Custom Worker that creates a new custom as a rendition. The rendition itself is basic. It adjusts the images contrast and brightness and applies a circular cutout for a final more dramatic transformation. While this worker itself isn’t particularly complicated, it’s intended to provide a simple and visually obvious example of how Asset Compute Workers can be used to read and manipulate the original assets binary data to generate customer renditions. Once a Custom Asset Compute Worker’s developed we run it in the local Asset Compute Development Tool and try it out using sample assets and parameters.
Then we define and execute tests against the Asset Compute Worker to validate our code and help ensure it’s bug free. We also explore debugging the worker code to understand how to most efficiently troubleshoot issues with the Custom worker and finally, we deploy the worker to Adobe I/O Runtime and evoke it via AEM as a cloud service processing profiles so that assets and AEM can have our customer renditions generated for them. -

This tutorial walks through the creation of a simple Asset Compute worker that creates an asset rendition by cropping the original asset to a circle, and applies configurable contrast and brightness. While the worker itself is basic, this tutorial uses it to explore creating, developing, and deploying a custom Asset Compute worker for use with AEM as a Cloud Service.

Objectives objective

  1. Provision and set up the necessary accounts and services to build and deploy an Asset Compute worker
  2. Create and configure an Asset Compute project
  3. Develop an Asset Compute worker that generates a custom rendition
  4. Write tests for, and learn how to debug the custom Asset Compute worker
  5. Deploy the Asset Compute worker, and integrate it AEM as a Cloud Service Author service via Processing Profiles

Set up

Learn how to properly prepare for extending Asset Compute workers, and understand what services and accounts must be provisioned and configured, and software installed locally for development.

Account and service provisioning accounts-and-services

The following accounts and services require provisioning and access to in order to complete the tutorial, AEM as a Cloud Service Dev environment or Sandbox program, access to App Builder and Microsoft Azure Blob Storage.

Local development environment

Local development of Asset Compute projects requires a specific developer tool set, different from traditional AEM development, including: Microsoft Visual Studio Code, Docker Desktop, Node.js and supporting npm modules.

App Builder

Asset Compute projects are specially defined App Builder projects, and as such, require access to App Builder in the Adobe Developer Console in order to set up and deploy them.

Develop

Learn how to create and configure an Asset Compute project and then develop a custom worker that generates a bespoke asset rendition.

Create a new Asset Compute project

Asset Compute projects, which contain one or more Asset Compute workers, are generated using the the interactive Adobe I/O CLI. Asset Compute projects are specially structured App Builder projects, which are in turn Node.js projects.

Configure environment variables

Environment variables are maintained in the .env file for local development, and are used to provide Adobe I/O credentials and cloud storage credentials required for local development.

Configure the manifest.yml

Asset Compute projects contain manifests which define all the Asset Compute workers contained within the project, as well as what resources they have available when deployed to Adobe I/O Runtime for execution.

Develop a worker

Developing an Asset Compute worker is the core of extending Asset Compute microservices, as the worker contains the custom code that generates, or orchestrates, the generation of the resultant asset rendition.

Use the Asset Compute Development Tool

The Asset Compute Development Tool provides a local Web harness for deploying, executing and previewing worker-generated renditions, supporting rapid and iterative Asset Compute worker development.

Test and Debug

Learn how to test custom Asset Compute workers to be confident in their operation, and debug Asset Compute workers to understand and troubleshoot how the custom code is executed.

Test a worker

Asset Compute provides a test framework for creating test suites for workers, making defining tests that ensure proper behavior is easy.

Debug a worker

Asset Compute workers provide various levels of debugging from traditional console.log(..) output, to integrations with VS Code and wskdebug, allowing developers step through worker code as it executes in real time.

Deploy

Learn how to integrate custom Asset Compute workers with AEM as a Cloud Service, by first deploying them to Adobe I/O Runtime and then invoking from AEM as a Cloud Service Author via AEM Assets’ Processing Profiles.

Deploy to Adobe I/O Runtime

Asset Compute workers must be deployed to Adobe I/O Runtime to be used with AEM as a Cloud Service.

Integrate workers via AEM Processing Profiles

Once deployed to Adobe I/O Runtime, Asset Compute workers can be registered in AEM as a Cloud Service via Assets Processing Profiles. Processing Profiles are, in turn, applied to asset folders applying to the assets therein.

Advanced

These abridged tutorials tackle more advanced use cases building upon foundational learnings established in the prior chapters.

Codebase on Github

The tutorial’s codebase is available on Github at:

The source code does not contain the required .env or config.json files. These must be added and configured using your accounts and services information.

Additional resources

The following are various Adobe resources that provide further information and useful APIs and SDKs for developing Asset Compute workers.

Documentation

APIs and SDKs

recommendation-more-help
4859a77c-7971-4ac9-8f5c-4260823c6f69