Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
Huawei Cloud Astro Canvas
Huawei Cloud Astro Zero
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Subscribing to Events Using Flows

Updated on 2025-03-24 GMT+08:00

You can subscribe to events using flows and BPMs. This section describes how to subscribe to events by using flows.

In Creating a Custom Event, an event that records employment status changes has been created. This section describes how to subscribe to the event by using a flow. After subscription, you can use the event sending API to simulate the scenario where the recruitment manager provides the hiring result. In this scenario, the system will automatically send an email to the personnel department based on the hiring result to inform the personnel department whether to handle related procedures.

Subscribing to Events Using Flows

  1. Create a flow by referring to Creating a Flow.

    Figure 1 Adding a flow
    Table 1 Parameters for adding a flow

    Parameter

    Description

    Label

    Flow label, which is displayed on the page.

    Value: 1–64 characters.

    Example: EmployResultNotifySubscription.

    Name

    Unique identifier of the flow in the system, which cannot be changed after being created. The following requirements must be met:

    • The value cannot exceed 64 characters, including the prefix namespace.

      To prevent duplicate data names among different tenants, each tenant must define a unique namespace when first creating an application. A tenant can create only one namespace. After being created, the namespace cannot be modified.

    • Start with a letter and can contain only letters, digits, and underscores (_). It cannot end with an underscore (_).

    Example: EmployResultNotifySubscription.

    Type

    Select a type from the drop-down list. Options:

    • Autolaunched Flow: Automatically starts flow. After an API is called, the logic defined by the flow is executed immediately.
    • Event Trigger: A flow that is triggered by an event. The logic defined in the flow is executed only when the event is triggered.

    Example: Event Trigger.

    Event

    Select the event created in Creating a Custom Event. Ensure that the event is enabled.

    Description

    Enter the description of the flow.

    Value: 1–255 characters.

  2. On the left of the flow design page, choose Logic and drag the Decision diagram element to the canvas.

    Decision: Checks current conditions and determines the operation to be performed based on the check result. The logic is similar to judgment of the if statement. In this example, you need to set three judgment branches: the candidate is hired, the candidate is not hired, and others.

    Figure 2 Dragging the Decision diagram element to the canvas

  3. Select the Decision diagram element, click , and set branch condition parameters.

    Figure 3 Configuring branch conditions
    Figure 4 unpass

    Editable result, that is, all judgment conditions. Default conditions have been preset in the system. That is, when all other conditions are not met, the branch is triggered.

    In this example, the following two judgment conditions need to be added:

    • Pass: The candidate is hired. If the candidate is hired, set Result, which is a parameter of the Boolean type, to the global constant {!$GlobalConstant.True}, indicating that the result is true, that is, the candidate is hired.
    • Unpass: The candidate is not hired. If the candidate fails to be hired, set Result, which is a parameter of the Boolean type, to the global constant {!$GlobalConstant.False}, indicating that the result is false, that is, the candidate is rejected.

  4. Choose Basic on the left of the flow design page and drag the Send Email diagram element to the canvas.

    The Send Email API is used to send emails. In this example, you need to send different emails to the personnel department based on the hiring result.

    • If a candidate is hired, send an email to notify the personnel department, requiring it to handle related procedures.
    • If the candidate is not hired, send an email about the result to the personnel department.
    • If the event times out (default branch), send an email to the recruitment manager to check whether the recruitment manager provides the recruitment result.

  5. The following describes how to set email sending parameters if the candidate is hired.

    1. Select the Send Email diagram element, click , and set basic information.
      Figure 5 Setting basic information about email sending
    2. Click to set email sending parameters.
      Figure 6 Setting email sending parameters
      Table 2 Email sending parameters

      Parameter

      Description

      Email Config

      To manually configure email information, click Manually. To select an email template, click Template.

      Example: Manually.

      Subject

      Enter the email subject.

      Example: Interview Result.

      Body

      Email content. Use the event variable Namespace_EmployResultNotify__e. You can drag the event variable from the variable.

      Address

      Email address of the recipient.

      • Text: Enter text.
      • Collection: Drag a collection variable.

      In this example, enter the address of the email recipient.

  6. Refer 5 to configure the email to be sent if the candidate is rejected or the event times out.
  7. Connect all elements, as shown in Figure 7.

    Figure 7 Connecting all elements and setting the start element of the process

  8. In the upper part of the flow design page, click to save the settings.
  9. After the settings are saved, click to activate the flow.

    After this flow is enabled, the logic defined in the flow is executed when the EmployResultNotify event is triggered.

Verification

After the EmployResultNotify event is subscribed to using the flow, the recruitment manager needs to provide the hiring result. The manager of the personnel department can receive the email containing information about whether the candidate is hired only after the recruitment manager sets a value for Result. That is, you need to configure event sending so that the subscriber can receive the event.

In this section, we can create a flow to set Result for candidate Lily to simulate event sending.

  1. Create a flow by referring to Creating a Flow.

    Figure 8 Creating SendEvent

  2. Choose Basic on the left of the flow design page and drag the Send Event diagram element to the canvas.

    Send Event is provided by the system for sending events.

    Figure 9 Dragging the Send Event diagram element to the canvas

  3. Configure the Send Event diagram element.

    Assume that candidate Lily is hired. In Context, click the plus sign (+) next to Variable, add a variable, and set event sending parameters.

    1. Click . In Context, create variable0.
      Figure 10 Adding a variable
    2. Select the send event diagram element, click , and set basic information.
      Figure 11 Setting basic information about the event to be sent
    3. Click to set the sending event.
      Figure 12 Page for configuring the sending event

      Table 3 Parameters for sending events

      Parameter

      Description

      Event

      Select the event to be sent. In this example, select the event created in Creating a Custom Event.

      Partition Key

      If a custom parameter is selected from the event as the partition key of the Kafka, events will be routed based on this key. Events with the same key will be routed to the same Kafka. If no key is specified, events will be randomly routed to different partitions to enhance concurrent processing performance.

      Send to external

      The system provides a Kafka topic named BINGO_SYS_TOPIC for connections to Huawei Cloud Astro Zero.

      • If this parameter is not selected, event data will be sent to the default topic.
      • If this parameter is selected, event data will be sent to other Kafka topics connected to Huawei Cloud Astro Zero.

      This parameter is deselected by default.

      Delay sending event until transaction ends (committed or rolled back)

      Event sending can be delayed until a transaction ends.

      This parameter is deselected by default.

      Target/Source

      Value of the event custom parameter. Click Add Row to add a parameter and assign a value to it.

  4. Connect the Start and Send Email diagram elements.

    Figure 13 Connecting diagram elements

  5. In the upper part of the flow design page, click to save the settings.
  6. Click to activate the flow.
  7. Set input parameters and click Run. The event can be sent only after the flow is executed.

    The email recipient receives the email, indicating that the verification succeeded.

    Figure 14 Sending an event

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback