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
    • 🌾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
      • Whether the process was executed successfully
      • Get exception information
      • Get execution step details
      • Get data context
      • Get step string info
  • 🍋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文档
  • 🛩Flow executor
铂赛东
2022-07-02
Contents

🎈LiteflowResponse object

In the return of the executor, the most used is to return a LiteFlowResponse object.

This object contains a lot of result data and process data.

# Whether the process was executed successfully

You can determine whether a process is successfully executed by the following methods:

LiteflowResponse response = flowExecutor.execute2Resp("chain1", parameters, CustomContext.class);
boolean isSuccess = response.isSuccess();

# Get exception information

If a process isSuccess is false, there must be exception information. You can get the exception by the following methods:

LiteflowResponse response = flowExecutor.execute2Resp("chain1", parameters, CustomContext.class);
if (!response.isSuccess()){
  Exception e = response.getCause();
}

For the explanation of the exception, please refer to the chapter Exceptions.

# Get execution step details

The result information also encapsulates the details of each step of the process execution, you can get it through this method:

LiteflowResponse response = flowExecutor.execute2Resp("chain1", parameter, CustomContext.class);
Map<String, CmpStep> stepMap = response.getExecuteSteps();

You can also get a queue in this way:

LiteflowResponse response = flowExecutor.execute2Resp("chain1", parameter, CustomContext.class);
Queue<CmpStep> stepQueue = response.getExecuteStepQueue();

Please refer to Step Information for the difference between the above two methods and the details of the step information.

# Get data context

The chain reads and writes context data during execution. The return data of a process should also be included in the context.

After you get the LiteFlowResponse object, you can get the context bean like this:

LiteflowResponse response = flowExecutor.execute2Resp("chain1", parameter, CustomContext.class);
CustomContext context = response.getContextBean(CustomContext.class);
//For a response with only one context, the following sentence is also equivalent
//CustomContext context = response.getFirstContextBean();

The same is true for multiple contexts:

LiteflowResponse response = flowExecutor.execute2Resp("chain1", parameter, OrderContext.class, UserContext.class);
OrderContext orderContext = response.getContextBean(OrderContext.class);
UserContext userContext = response.getContextBean(UserContext.class);

# Get step string info

Get string assembly information for component step:

LiteflowResponse response = flowExecutor.execute2Resp("chain1", parameter, CustomContext.class);
String stepStr = response.getExecuteStepStrWithTime();

This string prints out as follows:

a[CmpA]<201>==>b[CmpB]<300>==>m[CmpM]<1205>

The expression here is component ID[component alias]<time-consuming milliseconds>. For how to set component aliases, please refer to Component Aliases.

The getExecuteStepStrWithoutTime method is also provided in the Response object, which is used to return a step string without time-consuming.

tip

In fact, the framework automatically prints this step string after each process execution, so you don't need to get the print yourself.

Here is just how to get it. If you want to persist it, you can get it like this.

Help us improve this document (opens new window)
last update: 2022/10/13, 00:02:27
🎢Chain input parameter
🍫Choose a script language

← 🎢Chain input parameter 🍫Choose a script language→

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