LiteFlow LiteFlow
💒Home
📚Documents
💖Donation
🚀Plugin
  • About LiteFlow
  • Update Record
Community
Users
Gitee (opens new window)
Github (opens new window)
  • 简体中文 (opens new window)
  • English (opens new window)
💒Home
📚Documents
💖Donation
🚀Plugin
  • About LiteFlow
  • Update Record
Community
Users
Gitee (opens new window)
Github (opens new window)
  • 简体中文 (opens new window)
  • English (opens new window)
  • 🍤Introduction
  • 🍓Features
  • 🍟Quick Start(Hello world)

    • 🍄Notice
    • 🌿Springboot environment

      • 🧬Dependency
      • ⚙️Config
      • 🛫Execute
    • 🌱Spring environment

      • 🧬Dependency
      • ⚙️Config
      • 🛫Execute
    • 🌵Other environment

      • 🍄Notice
      • 🧬Dependency
      • ⚙️Config
      • 🛫Execute
  • 🍢Configuration item

    • 🍄Notice
    • 🌿Springboot environment
    • 🌱Spring environment
    • 🌵Other environment
  • 🗂Rules file

    • 📔Rules file format
    • 📕Local rule file
    • 📗Zookeeper source
    • 📘SQL database source
    • 📋Nacos source
    • 🗄Etcd source
    • 📙Custom source
  • 🔗General components

    • 📎Common component
    • ✂️Switch component
    • 📌If component
    • 🧬For component
    • ⛓While component
    • 🧿Break component
  • 🧩How to write EL rules

    • 🍄Notice
    • 🌴Serial mode
    • 🎋Parallel mode
      • The basic example
      • Nested with serial (1)
      • Nested with serial (2)
      • Ignore errors
      • Any node is executed first and other nodes are ignored
      • The concept of groups
    • 🌾Switch mode
    • 🌵If mode
    • 🌳Loop mode
    • 🍁Use sub chain
    • 🍂Use sub variables
    • 💐Complex example
    • 🌻About semicolons
    • 🌰About comments
    • 🐚Component Name Package
  • 🌮Data context

    • 🍄Notice
    • 🌯Definition and use
    • 🪶Pass initialized context
  • 🛩Flow executor

    • 🍄Notice
    • 🎡Executor method
    • 🎢Chain input parameter
    • 🎈LiteflowResponse object
  • 🍋Script component

    • 🍫Choose a script language
    • 🍕Define script component
    • 🌯Define file script
    • 🍣Interact with java
    • 🍘Dynamic refresh script
  • 🍇Declarative component

    • 🥭What is a declarative component
    • 🧅Class level declaration
    • 🥥Method level declaration
  • 🎲Dynamic rules

    • 🍄Notice
    • 🎯How to build
  • 🎨Advanced features

    • 🍒Pre & Finally components
    • 🥠Substitute component
    • 🍉Component Parameters
    • 🍑Component alias
    • 🍍Component tag
    • 🥝Component event
    • 🥑Implicit chain
    • 🍕Private delivery
    • 🍣Component retry
    • 🍖Smooth hot refresh
    • 🍪Component aspect
    • 🍡Step information
    • 🧊Exceptions
    • 🧇Printing details
    • 🧁Custom request id
    • 🌭Multiple type rules
    • 🥗Asynchronous thread pool
    • 🍿Custom component executor
    • 🍥Simple monitor
    • 🧉DTD in Xml
  • ⛱Test cases and demo

    • 🪁Test cases
    • 🪀Demo
  • 🪂Performance
  • v2.9.X文档
  • 🧩How to write EL rules
铂赛东
2022-06-29
Contents

🎋Parallel mode

# The basic example

If you want to execute the three components a, b, c in parallel, you can use the WHEN keyword. It should be noted that WHEN must be capitalized.

<chain name="chain1">
    WHEN(a, b, c);
</chain>

# Nested with serial (1)

Let's combine THEN and WHEN to see an example:

<chain name="chain1">
    THEN(
        a,
        WHEN(b, c, d),
        e
    );
</chain>

Flow chart

In the above example, e will be executed only after b, c, and d.

# Nested with serial (2)

The above example should be well understood, so let's look at another example:

<chain name="chain1">
    THEN(
        a,
        WHEN(b, THEN(c, d)),
        e
    );
</chain>

Flow chart

# Ignore errors

The WHEN keyword provides a subkeyword ignoreError (defaults to false) to provide the feature of ignoring errors. The usage is as follows:

<chain name="chain1">
    THEN(
        a,
        WHEN(b, c, d).ignoreError(true),
        e
    );
</chain>

Flow chart

The above assumes that any node in b, c, and d has an exception, then eventually e will still be executed.

# Any node is executed first and other nodes are ignored

The WHEN keyword provides a sub-keyword any (default is false) to provide the feature that in the parallel process, any node is executed first, ignoring other node and continuing to execute. The usage is as follows:

<chain name="chain1">
    THEN(
        a,
        WHEN(b, THEN(c, d), e).any(true),
        f
    );
</chain>

Flow chart

In the above process, if node e is executed first, then node f will be executed immediately regardless of whether other nodes are executed.

# The concept of groups

In previous versions, parallel mode had the concept of groups, and in version 2.8.X, we removed the concept of groups.

With EL expressions, you actually write 2 different WHENs as 2 groups. for example:

<chain name="chain1">
    THEN(
        WHEN(a, b, c, d)
    );
</chain>

The above abcd are all in the same parallel group.

<chain name="chain1">
    THEN(
        WHEN(a, b),
        WHEN(c, d)
    );
</chain>

In the above example, ab is a parallel group and cd is another parallel group.

Help us improve this document (opens new window)
last update: 2022/10/13, 00:02:27
🌴Serial mode
🌾Switch mode

← 🌴Serial mode 🌾Switch mode→

Theme by Vdoing | Copyright © 2020-2022 铂赛东 | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式