Enable the event-driven feature to automatically trigger workflows

更新时间:
复制 MD 格式

A workflow cluster supports the event-driven feature, which lets you build event-driven automation systems by monitoring events to trigger workflows. This feature supports a variety of event sources, including OSS, Message Service (MNS), Git repositories, and EventBridge.

Background

The event-driven feature is built on the open source Argo Events project and fully complies with the open source event-driven standard. You can easily migrate your open source event-driven applications to a workflow cluster.

image

Key components:

  • Event Source

    An Event Source is a custom resource in Argo Events. You create different Event Source resources for different event sources. This action triggers the creation of Event Source pods to fetch events.

    Currently, a workflow cluster supports Git, OSS, and Message Service (MNS) as event sources. If you need other event sources, please submit a ticket.

  • Event Bus

    After an Event Source fetches events, the events are cached in an Event Bus. The Event Bus supports the following two types:

    • NATS: A local messaging system built on the open source NATS project that runs on ECI instances.

    • Message Service (MNS): Caches events using the cloud-based Message Service (MNS). If you already use Message Service (MNS), you can use a Message Service (MNS) queue as the Event Bus.

  • Event Sensor

    The Event Sensor reads events from the Event Bus, filters them according to defined rules, and triggers workflow executions. You can refer to the open source Argo Events documentation to configure Sensor triggers, transformations, and filters.

    The Event Sensor can only trigger Argo workflows. If you have other requirements, please submit a ticket.

Billing

Creating the following resources incurs charges for ECI instances. For detailed billing information, see ECI billing overview.

  • After you create an Event Source, an Event Source pod is created and runs as an ECI instance.

  • When you create an Event Bus that uses NATS, an Event Bus pod is created and runs as an ECI instance.

  • After you create an Event Sensor, an Event Sensor pod is created and runs as an ECI instance.

Prerequisites

Procedure

  1. Obtain the workflow cluster ID.

    • Obtain the cluster ID using the CLI.

    aliyun adcp DescribeHubClusters --Profile=XFlow
    • Obtain the cluster ID from the console.

      Log on to the workflow cluster console. On the Workflow Cluster page, find the cluster ID on the Basic Information tab.

  2. Run the following command to enable the event-driven feature.

    aliyun adcp UpdateHubClusterFeature --ArgoEventsEnabled true --ClusterId ***
    Important

    Replace *** with the cluster ID from Step 1.

  3. After a few moments, run the following command to view the cluster details.

    aliyun adcp DescribeHubClusterDetails --ClusterId ***
  4. In the command output, check that the Status of the Condition with the Type EnabledArgoEvents is True. This indicates that the event-driven feature is enabled.

    The expected output is as follows:

     {
                                    "Message": "",
                                    "Reason": "",
                                    "Status": "True",
                                    "Type": "EnabledArgoEvents"
                            }

Next steps

After you enable the event-driven feature, you can trigger a workflow using an OSS event or a Message Service (MNS) message. For more information, see the following topics: