Global Navigation

  • Products
  • Overview
  • Getting Started
  • Guides
  • Resources
  • Console

Table of Contents

  • Introduction
    • App Builder Overview
    • What is App Builder
    • Business Case
    • FAQ
    • Community
  • Quick Start
    • App Builder Getting Started
      • Setting Up
      • Creating your First App
      • Publishing Your App
      • Troubleshooting
    • Runtime Getting Started
      • Overview
      • Activations
      • Deploy
      • Entities
      • How Runtime Works
      • Resources
      • Setup
      • Understanding Runtime
  • Develop
    • References
    • App Builder Guides
      • Architecture Overview
        • App Hooks
        • Introduction to React Spectrum
        • Using SDKs
      • Application State
      • Application Logging
        • Azure Log Analytics
        • New Relic
        • Splunk Cloud
        • Splunk Enterprise
      • Configuration
        • Webpack Configuration
      • Deployment
        • CI/CD for App Builder Apps
        • Credential Rotation
        • Setting Response Headers
      • Development
      • Distribution
      • Events
        • Webhooks
      • Exc App
        • Interfaces
          • Modules
          • Page ObjectWithHref
          • Page ObjectWithPath
          • Page PageAPI
          • Page PageAPIProperties
          • Runtime
          • TopBar Callback
          • TopBar CustomFeedbackConfig
          • TopBar CustomSearchConfig
          • TopBar ExternalFeedbackConfig
          • TopBar HelpCenterFeedbackConfig
          • TopBar Solution
          • TopBar TopBarAPI
          • TopBar TopBarAPIProperties
          • User UserAPI
          • User UserInfo
        • Migrate App to Exp Cloud SPA
        • Modules
          • Page
          • TopBar
          • User
      • Extensions
        • Extension Migration Guide
      • Optimization
      • Security
        • Understanding Authentication
      • Telemetry
    • Runtime Guides
      • Contribution Guide
      • Asynchronous Calls
      • Creating Actions
      • Creating REST APIs
      • CI/CD Pipeline
      • Debugging
      • Logging & Monitoring
      • Reference Docs
        • API Reference
        • CLI Usage
        • Configuring Proxy
        • Environment Variables
        • Feeds
        • Multiple Regions
        • Packages
        • Prepackages
        • Runtimes
        • Sequences & Compositions
        • Triggers & Rules
        • WSK Usage
      • Security General
      • Securing Web Actions
      • System Settings
      • Throughput Tuning
      • Tools
        • CLI Install
      • Troubleshooting
      • Using Packages
      • Using Runtime
    • Contribution Guide
  • Learning
    • Asset Compute Worker PS API
      • Requirements
      • Lesson 1: Create an app from Asset Compute template
      • Lesson 2: Configure the app
      • Lesson 3: Develop worker calling Photoshop API
      • Lesson 4: Integrate worker in AEMaaCS
      • Well done
    • Barcode Reader
      • Requirements
      • Lesson 1: Bootstrap a Headless App
      • Lesson 2: Writing a Serverless Action
      • Lesson 3: Unit and E2E Tests
      • Well done
    • Blog Articles
      • Blog Articles
    • CI/CD
      • Requirements
      • Lesson 1: Setup CI/CD
      • Lesson 2: Monitoring CI/CD
      • Lesson 3: Custom CI/CD workflow
      • Well done
    • Cron Jobs
      • Requirements
      • Lesson 1: Bootstrap a Headless App
      • Lesson 2: Set up Alarm Feed with Trigger and Rule
      • Lesson 3: Types of Alarm Feed
      • Well done
    • Custom Asset Compute Worker
      • Requirements
      • How AEM as Cloud assets works
      • Architecture of our worker
      • Configure services
      • Local environment setup
      • Implement the worker
      • Test the worker
      • Setup AEM to use the worker
      • Well Done
    • Customer Dashboard
      • Requirements
      • Lesson 1: Create a New App Builder App from Campaign Standard Template
      • Lesson 2: Explore the App Builder App
      • Lesson 3: Run the App Builder App Locally
      • Lesson 4: List All Customer Profiles on the UI
      • Lesson 5: Add Personalized Promotion Emails Triggering
      • Well Done
    • Debugging
      • Requirements
      • Lesson 1: Getting familiar with Debugger
      • Lesson 2: Debugging Application Code
      • Lesson 3: Managing Application Logs
      • Well Done
    • Event Driven
      • Requirements
      • Lesson 1: Create a New App Builder App from Template
      • Lesson 2: Register the App as Event Provider
      • Lesson 3: Fire an Event
      • Lesson 4: Consume Events
      • Well Done
    • Events Runtime
      • Requirements
      • Lesson 1: Step by Step Guide
      • Lesson 2: Verify the result
      • Well done
    • Journaling Events
      • Requirements
      • Lesson 1: Create an Event Provider using App Builder
      • Lesson 2: Create the Event Consumer using Journaling API
      • Lesson 3: End to end test
      • Well done
    • Sample Apps
      • Code Snippets
        • Caching HTTP responses
        • App Builder Files SDK
        • App Builder State SDK
        • I/O Events handler
        • Real-time data from Adobe Analytics API 1.4
    • Spectrum Introduction
      • Lesson 1: What is Spectrum ?
      • Lesson 2: Using Spectrum CSS
      • Lesson 3: Using React Spectrum
      • Lesson 4: Using React Spectrum in App Builder
      • Well done
    • Todo App
      • Requirements
      • Lesson 1: Create a New App Builder App with the React Spectrum template
      • Lesson 2: Setup Runtime actions
      • Lesson 3: Setup the CreateTodoList component
      • Lesson 4: Setup the Todo component
      • Lesson 5: Setup the TodoList component
      • Lesson 6: Bringing the pieces together to build the App
      • Well done
    • Videos
      • Overview
        • Introducing App Builder
        • Getting Started
        • Architecture
        • A Full Security Overview
        • User Journey
      • Exploring
        • Projects and Workspaces
        • React Spectrum
        • Custom Events
        • CI/CD
        • Debugging
        • Learning Resources
        • Dashboard Case Study
        • ODE Case Study
        • Deep Dive Use Cases
        • Live Wired Sneak
        • Softcrylic Partner Showcase
      • Developers Live
        • App Builder Deep Dive
        • Asset Compute Service Extensibility
        • Extend Adobe Experience Cloud
  1. Products
  2. Overview
  3. Guides
  4. Develop
  5. Runtime Guides
  6. Reference Docs
  7. Sequences & Compositions

Sequences and Compositions

There are two ways to orchestrate a series of action calls into a flow: sequences and compositions.

Sequences are strings of actions invoked one after another. At each step the result of the preceding action feeds into the arguments of the next one. There is no support for skipping actions.

Compositions execute a tree of actions or use the result of one action to determine the next, as in an if/then/else control structure.

Sequences


Assuming two actions created in a package called my-package:

/my-package/actionA
/my-package/actionB

Create a sequence using the --sequence flag in addition to the usual command for creating an action. Be sure to add the namespace to the action name or you'll receive an unauthorized access error: aio rt:action:create mySequence --sequence /[your-namespace]/my-package/actionA,/[your-namespace]/my-package/actionB

Invoke this as you would any other action, for example: aio rt:action:invoke --result mySequence

Sequences and timeout

When invoking a sequence in a blocking manner, there is a 60-second timeout limit that can't be changed: the sum of the execution times of all actions in the sequence must be 60 seconds or less.

If we apply this limitation to the example above, then actionA and actionB have a total budget of 60 seconds. Although the system allows you to set a higher timeout value for mySequence, it will ignore the value and enforce the 60-second limit.

If one of your actions needs more than 60 seconds (therefore putting the sequence over the limit), the only solution is to invoke it as a non-blocking action using the OpenWhisk npm module. So, using the same example, you could have actionA calling another action in a non-blocking manner. You can see an example of how to do this here.

Read more about sequences on the OpenWhisk documentation page.

Compositions

To orchestrate a more complex flow without having to jam all the code into a single action, use Apache OpenWhisk Composer. Composer lets you assemble actions, including other compositions, together and control the executions using control-flow structure: if, while, repeat. The result of a composition gives you a single entry point and behaves like an action: it supports default parameters, can be placed into a package, or used as web action.

Install Composer

To use this featuren, install the Composer Node.js package:

npm install -g openwhisk-composer

Use it to create the JSON file you need to deploy a composition. The flow for creating a composition is:

  1. Define the composition using JavaScript
  2. Run the compose command to generate the JSON file out of this JavaScript file
  3. Run deploy to deploy the composition using the JSON file you generated in the previous step

For, example, assume you have actions deployed called a, b, and c and want to create a composition that executes a and, in case of success, b; and if not; c. Use the Composer package to define this composition in a JavaScript file myComp.js:

const composer = require('openwhisk-composer') module.exports = composer.if(‘a’, ‘b’, ‘c’)

With the composition defined, generate the JSON definition needed for deployment:

compose myComp.js > myComp.json

To deploy:

deploy compositionA myComp.json

This creates a composition called compositionA. Invoke it like any other action - aio rt:action:invoke compositionA. When you do this, action a is invoked first. Then, if a is successful, action b is invoked; if not, action c is invoked.

More information is available at:

  • Apache OpenWhisk Composer home page
  • Combinators, with a complete list of the control-flow structure.

Parallel compositions

I/O Runtime does not support parallel compositions.

Next steps

Return to the Runtime Reference Documentation Index.

Return to the Guides Index.