Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Function and event orchestration with OpenShift serverless logic

Now generally available in OpenShift Serverless 1.33

October 9, 2024
Kris Verlaenen Ricardo Zanini
Related topics:
Developer toolsEvent-drivenMicroservicesServerless
Related products:
Red Hat OpenShift Serverless

    Cloud-native applications are often composed of different services and can communicate in an event-driven manner. Red Hat OpenShift Serverless already enables developers to easily create and deploy stateless functions, and supports event-driven communication through eventing. 

    With serverless logic, you can now also define and deploy workflows to orchestrate functions, events, and other services. Not only does this give developers a declarative way to build applications using workflows (YAML or JSON format), it also provides the necessary features, services, and tools to simplify development, deployment, and runtime management. Serverless logic has now reached general availability in OpenShift Serverless 1.33.

    A first look

    If you're wondering what this looks like: Imagine you want to build a small application that automatically processes subscription events by invoking the subscription service to register the user. A workflow to automatically do this would only contain two steps:

    • One to listen for the event (3).
    • Followed by an invocation of the function to register the subscription (4) with the right arguments from the event (5).

    Events (1) and functions (2) are defined upfront by referencing their definition (for example, using OpenAPI), so that the framework can know where to find them and generate code to invoke them:

    {
      "id": "SubscriptionWorkflow",
      "version": "1.0",
      "specVersion": "0.8",
      "name": "Subscription Workflow",
      "description": "Registering subscriptions upon an event",
      "start": "Receive Subscription",
      "events": [ (1)
        {
          "type": "newSubscription",
          "name": "NewSubscriptionEvent"
        }
      ],
      "functions": [ (2)
        {
          "name": "registerSubscriptionFunction",
          "operation": "subscription.openapi.json#register"
        }
      ],
      "states": [
        {
          "name": "Receive Subscription", (3)
          "type": "event",
          "onEvents": [
            {
              "eventRefs": ["NewSubscriptionEvent"]
            }
          ],
          "transition": "Register Subscription"
        },
        {
          "name": "Register Subscription", (4)
          "type": "operation",
          "actions": [
            {
              "name": "registerSubscription",
              "functionRef": {
                "refName": "registerSubscriptionFunction",
                "arguments": { (5)
                  "name": "$.event.name",
                  "email": "$.event.email"
                }
              }
            }
          ],
          "end": true
        }
      ]
    } 

    Figure 1 depicts this workflow.

    Graphical visualization of the workflow
    Graphical visualization
    Created by Kris Verlaenen,
    Figure 1: Graphical visualization of the workflow.

    Note that this is a very simple example to get you started. A more elaborate example could, for instance, include email verification by waiting for a confirmation email with a specified timeout. (You should configure your Maven project to Red Hat build of Quarkus and OpenShift serverless logic first, as explained in this chapter.)

    Serverless workflow specification

    Serverless logic uses the Serverless Workflow Specification to define these orchestrations. Serverless Workflow is a vendor-neutral, open-source standard for defining workflows, at the Cloud Native Computing Foundation (CNCF).

    The specification not only provides building blocks for events (incoming and outgoing) and function invocations (either synchronously or with a callback) as already seen to some extent in the previous example, but it also offers easy to use constructs for a lot of common patterns. This includes switches or parallel branches, input and output mapping, timeouts, error management and compensation for each, and more. All these constructs allow developers to build workflows that orchestrate any number of functions, services and/or events. 

    Focus on developer efficiency and insights

    To be able to execute these workflows, serverless logic leverages SonataFlow, an open source serverless workflow runtime, upstream part of the Apache KIE incubator project.

    SonataFlow is a serverless workflow implementation based on a generic cloud-native workflow engine. As a result, it offers the ability to automatically generate a lightweight workflow service for your workflow(s), with fast startup time and integration with many other cloud-native technologies. This runtime supports stable, scalable execution of your workflow(s) using generated remote REST interfaces, with (optional) support for persistence, timers, monitoring, auditing, and many more capabilities (leveraging the underlying Quarkus platform for their implementation). 

    To empower developers, serverless logic offers more than just a runtime:

    • The OpenShift serverless logic Operator, in combination with the kn-workflow command line interface (CLI), allows you to create a workflow project, run it, and deploy the workflow into your cloud environment. Through a simple CLI command you can submit a Custom Resource (CR) containing the workflow (and potentially some supporting files) and the Operator will deploy a workflow runtime for you (supporting both a developer profile using a prebuilt image or a production profile building a custom immutable image).
    • Creating workflows is a lot easier with the right tooling support, in this case by offering a VSCode extension that offers validation, code completion, graphical visualization, and more.
    • Workflows can become complex, and developers need help and insights (based on audit information collected by the runtime), both during the development cycle or when monitoring workflows at runtime. The runtime console gives a detailed view of the status of all your workflow instances.

    Benefits

    By extending the developer’s toolbox with workflows, developers can spend less time writing code hooking services together, but instead can leverage higher-level workflow building blocks to build applications. The simplified experience hides a lot of the underlying complexity (related to state persistence, audit, timers, and etc.) and instead focuses on providing domain-level insights into the status of your application workflows.

    How to get started with serverless logic

    Head to the OpenShift documentation for instructions on how to get started. After installing the kn-workflow CLI, you can use it to create and run your workflows. Typically developers can implement and test their workflows locally, on their laptop, before deploying them in the cloud using the Operator.

    To get your first workflow running locally, all you need is the following commands:

    kn-workflow create --name my-project
    kn-workflow run

    The second command (to be executed in your project folder in the first step) will start a workflow service (using Podman/Docker) for the workflow in your project. You can immediately access the runtime tools on this service to start your workflow or look at the status of running instances. The following video shows the getting started experience.

    Figure 2: Video showing the Serverless Logic getting started experience.

    Conclusion

    If you made it this far, congratulations! You are now ready to update the workflow according to your own needs, using all the building blocks at your disposal to orchestrate your services and/or events. Not finding what you’re looking for? There are a lot more guides and examples available.

    If you want to take a quick look, you can also access our online playground start.kubesmarts.org (running completely in your browser) for a quick first look at the tooling and some examples (Figure 3).

    Online playground at start.kubesmarts.org
    Online playground at start.kubesmarts.org
    Figure 3: Online playground at start.kubesmarts.org.

    Related Posts

    • Deploying serverless Node.js applications on Red Hat OpenShift, Part 1

    • Serverless applications made faster and simpler with OpenShift Serverless GA

    • How OpenShift Serverless Logic evolved to improve workflows

    • Create your first serverless function with Red Hat OpenShift Serverless Functions

    • How OpenShift Serverless Logic evolved to improve workflows

    Recent Posts

    • A day in the life of an NVIDIA H100 on Red Hat OpenShift 5

    • Migrate BuildConfigs to builds for Red Hat OpenShift with one plug-in install

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    • What's new for developers in Red Hat Enterprise Linux 10.3 and 9.9

    What’s up next?

     Learn how to implement a back-end function and a front-end web application, then use a Function as a Service (FaaS) object to process data.

    Start the activity
    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    Red Hat Developer

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI