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
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
- Provision and set up the necessary accounts and services to build and deploy an Asset Compute worker
- Create and configure an Asset Compute project
- Develop an Asset Compute worker that generates a custom rendition
- Write tests for, and learn how to debug the custom Asset Compute worker
- 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.
- Develop a Asset Compute metadata worker that can write metadata back to the
Codebase on Github
The tutorial’s codebase is available on Github at:
- adobe/aem-guides-wknd-asset-compute @ master branch
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.