[ISSUE #5108] Abstracting and transforming EventMeshFunction, and implementing FunctionRuntime. #5109
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 #5108
Motivation
To adapt to the V2 architecture, the EventMeshFunction section needs to be upgraded and transformed. This includes redefining EventMeshFunction, making adaptive modifications to the existing filter and transformer functionalities, and reserving a unified interface for potential new Function features in the future. Based on this, the code for FunctionRuntime will be completed.
Modifications
For the Function module:
eventmesh-function
module has been added, consolidating theapi
module and the originalfilter
andtransformer
modules for easier management.EventMeshFunction
interface has been defined with reference tojava.util.function.Function
. The data in Eventmesh is processed through theapply
method of the function.AbstractEventMeshFunctionChain
subclass has been abstracted fromEventMeshFunction
, defining additional methods for chain processing, such asaddFirst
,addLast
, etc.Transformer
interface now inherits from and implements theEventMeshFunction
interface, including theapply
method for compatibility.For the FunctionRuntime module:
ConnectorRuntime
, it implements connecting toadminServer
, reporting heartbeat and current status to theadminServer
, obtaining configuration information from theadminServer
, and initializing theconnectorService
.FunctionConfigs
in the configuration and is used to process data inConnectRecord
.Supplement:
Regarding FunctionConfigs in FunctionRuntime, the related configurations and functionalities are as follows:
Users can configure any number of
EventMeshFunction
inFunctionConfigs
according to their needs:In the above
EventMeshFunction
, besides specifying thefunctionType
, other fields are the same as those required by the originalFunction
. For example, thefilter
requirescondition
information, which only needs to be added in the YAML file format.The
EventMeshFunction
inFunctionConfigs
will be built into a function processing chain in sequence:The data entering the
FunctionRuntime
will flow along the route above. If the data is filtered, the processing will exit directly.Documentation