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
  • 🍋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
      • Rules file based - active refresh
      • Rules file based - passive refresh
      • Build-Refresh from Dynamic Code
    • 🍪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文档
  • 🎨Advanced features
铂赛东
2022-07-03
Contents

🍖Smooth hot refresh

LiteFlow supports the feature of smooth hot refresh.

You can reload rules without restarting the service. And when refreshing under high concurrency, the thread that is executing the process is completely smooth, and there will be no interruption due to the refreshing process.

When refreshing, the process being executed is still the old process. After the refresh, the request will automatically switch to the new process.

The zookeeper configuration source natively supported by LiteFlow does not require you to do anything. As long as the rules on zk are changed, it will be refreshed automatically and smoothly.

But for custom configuration sources, LiteFlow provides two interfaces: active refresh and passive refresh, which can be selected according to your needs.

# Rules file based - active refresh

You can call the following interface after getting the FlowExecutor object in the spring container:

flowExecutor.reloadRule();

This method will pull your latest process configuration information according to the method at startup, and perform smooth hot refresh.

# Rules file based - passive refresh

Passive refresh is suitable for using custom configuration sources such as configuration center, nacos, etcd, which can push the latest data in reverse. For the java client side, there must be a listener listen for data changes.

If the listener listens for changes, you can achieve smooth hot refresh by calling this method:

FlowBus.refreshFlowMetaData(FlowParserTypeEnum.TYPE_EL_XML, newContent);

The first parameter refers to the file format. It supports xml/json/yml. Note here that under the EL expression, it is in the form of TYPE_EL_XXX. The one without EL is the old form, please do not use it wrong!

The second parameter refers to the latest configuration text data

# Build-Refresh from Dynamic Code

If based on dynamic rules, it means that there is no rule file, and the above two methods are based on rule files.

In fact, based on dynamic rules, it is recommended that you encapsulate the code into a method. When there are changes, just re-execute the build again. rules will be overwritten. And this process is also smooth.

Help us improve this document (opens new window)
last update: 2022/10/13, 00:02:27
🍣Component retry
🍪Component aspect

← 🍣Component retry 🍪Component aspect→

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