[ISSUE #4781]management life cycle #4783
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #4781
########
UnMergeable!!! its demo
########
Motivation
I found that Events have a large number of components that need to be collectively converted to a certain life cycle at a certain time,
Starting from the top level EventMeshServer, it needs to manage a series of internal related components, such as Acl MetaStorage, while its own life cycle changes, so I want to design an interface that allows these components to have the same method to be invoked at different times of life cycle states. In a way similar to the observer, I managed and bound components at the time of their own life cycle changes, so I implemented this PR, and now the implementation is the top-level, as well as the internal management of components, For example, ACLs are SPI loaded and cannot be modified, but other fixed implementations such as ProducerTopicManager also have many internal lifecycle components that should be modified later and associated with the topmost component
我发现Event有大量需要在某一特定时间共同转换到某一生命周期的组件,从最上层的 EventMeshServer 开始,他需要在自己生命周期变化的同时管理内部关联的一系列组件,如 Acl MetaStorage等,所以我想设计一个接口,让这些组件在不同的生命周期状态的时刻有同样的方法可以被调用,在通过类似观察者的方式,在自己生命周期变化的时刻管理和自己绑定的组件,所以我实现了这个PR,目前实现的是最顶层的,还有组件内部的管理,如 Acl 之类是 SPI 加载的,这种不能修改,但是像其他ProducerTopicManager之类的固定实现,内部也有很多同生命周期的组件,这些后续也应该被修改,并且能关联到最顶层的组件
Modifications
New org/apache/eventmesh/runtime/lifecircle EventMeshLifeCycle. Java is responsible for defining the eventmesh state transition method
New org/apache/eventmesh/runtime/lifecircle AbstractEventMeshComponent. Java implementation EventMeshLifeCycle define life cycle changes involved in the state and the binding of other components
New org/apache/eventmesh/runtime/lifecircle EventMeshComponent. Java eventmesh without switch control components, the implementation of state transition method, state huan rear method
New org/apache/eventmesh/runtime/lifecircle EventMeshSwitchableComponent. Java eventmesh with switch components, in EventMeshComponent increased switch function
Top-level component modification
EventMeshServer
-Acl Components with switches
-MetaStorage Components with switches
-Trace Components with switches
-StorageResource component
-ProducerTopicManager component
-EventMeshAdminBootstrap Component with a switch
-EventMeshGrpcBootstrap component
新增 org/apache/eventmesh/runtime/lifecircle/EventMeshLifeCycle.java 负责定义EventMesh中状态转换方法
新增 org/apache/eventmesh/runtime/lifecircle/AbstractEventMeshComponent.java 实现 EventMeshLifeCycle 定义生命周期变化中涉及的状态和绑定的其他组件
新增 org/apache/eventmesh/runtime/lifecircle/EventMeshComponent.java 没有开关控制的EventMesh组件,具体实现状态转换时的方法,状态装欢后置方法
新增 org/apache/eventmesh/runtime/lifecircle/EventMeshSwitchableComponent.java 带有开关的EventMesh组件,在EventMeshComponent增加了开关功能
顶层组件修改
EventMeshServer
-Acl 带有开关的组件
-MetaStorage 带有开关的组件
-Trace 带有开关的组件
-StorageResource 组件
-ProducerTopicManager 组件
-EventMeshAdminBootstrap 带有开关的组件
-EventMeshGrpcBootstrap 组件