A method for processing inter-component communication based on a low-code development platform

By using singleton mode and broker objects for inter-component communication on a low-code development platform, the problem of inter-component communication relying on the observer mode is solved, efficient and flexible inter-component communication is achieved, and the maintainability and reliability of the system are improved. sex.

CN114201230BActive Publication Date: 2024-09-24ZHEJIANG ZHENSHU TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111324165.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-10
Publication Date
2024-09-24
Estimated Expiration
2041-11-10

AI Technical Summary

Technical Problem

In existing low-code development platforms, communication between components relies on the observer pattern, which makes it difficult to decouple publishers and subscribers, resulting in low communication efficiency and poor maintainability. Frequently updating methods or adding interfaces is required when iterating requirements.

Method used

Use singleton mode and broker objects for inter-component communication. Through the emit and on methods of publishing events and subscribing events, the binding of published values ​​​​and variable ids is achieved to ensure that publishers and subscribers are decoupled, and the variable idmap is used to improve communication. Flexibility and testability.

Benefits of technology

It enables publishers and subscribers to communicate efficiently without knowing the details of each other's components, enhances the maintainability of linkage between components, reduces the need to repeatedly write similar methods, and improves the flexibility and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114201230B
    Figure CN114201230B
Patent Text Reader

Abstract

The present invention relates to the field of low-code development, and in particular to the following: a publisher receives a publication object, triggers publication through a publication event, and causes the publication object to enter a broker object; a broker object extracts a publication value of the publication object; the broker object determines whether there is a subscription event at present, and if so, passes the publication value to the subscriber corresponding to the subscription event; the variable id of the publication object is unique, and when the subscription trigger condition is met, the subscription event is triggered, and the subscriber obtains the publication value through the variable id. The beneficial effects of the present invention are: publishers and subscribers are decoupled, and can still communicate with each other without knowing the details of the other component; the maintainability of publishing events and subscription events is enhanced; the linkage between components no longer depends on the components, and similar methods do not need to be rewritten.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of low-code development, and in particular to a method for processing inter-component communication based on a low-code development platform. Background Art

[0002] With the development of the Internet, many tasks in enterprises and government affairs have gradually become paperless, and the efficiency of existing processes has been improved by using online services to serve offline. Therefore, the demand for management systems in various industries has become increasingly widespread. Low / no-code development has flourished with this opportunity. In order to lower the threshold for use and improve efficiency, the common low / no-code development platforms on the market can be divided into form-driven and model-driven according to technology.

[0003] Form-driven is data-centric, runs business processes in the software system through workflows, designs data tables and fields according to requirements, and adds relevant workflow implementations. For this type of product, components on the page can only have simple preset interactions or even no interactions, such as triggering the display / hide / assignment of other components through clicks or value changes.

[0004] Model-driven is to achieve software design and generation through visual modeling, converting objective entities into software objects. Each object consists of two parts: attributes and behaviors. Through visual configuration, the generated model is compiled and all relevant source code is generated, or the generated model is directly parsed and run using the model parsing execution engine. If the components in the page need to interact, the former is to write relevant codes according to the normal development process after the source code is generated. The disadvantage is that during iteration, all modifications can only be made through code editing, and visual modeling cannot be continued because the process of generating source code is irreversible; the latter is to set behaviors through open interfaces, and trigger other components to perform specified behaviors according to a certain component.

[0005] Whether form-driven or model-driven, the inter-component communication used by products on the market all adopts the observer pattern, that is, when an object is modified, it will automatically notify the objects that depend on it. However, when an observed object has many direct or indirect observers, it takes a lot of time to notify all observers. At the same time, this is a process in which an object calls the interface of another object. Therefore, observer objects are difficult to reuse. When new requirements arise, methods need to be updated or even re-implemented.

[0006] System visual development through a low-code development platform has the advantages of low learning cost, simple and fast implementation, and high iteration efficiency. It can save a lot of work for the development of conventional add, query, delete and modify pages. However, if the observer mode is used for communication between components, different observers need to encapsulate related methods when they need to perform the same behavior, which will cause the low-code development platform itself to have a large number of preset interfaces. When the preset methods are not sufficient to meet the iteration requirements, it is necessary to continue to update the methods or add interfaces. Summary of the invention

[0007] In order to overcome the above-mentioned shortcomings, the present invention aims to provide a method for processing inter-component communication based on a low-code development platform, which can decouple publishers and subscribers, improve the corresponding capabilities of publishers, and have high reliability, flexibility, and testability.

[0008] The present application discloses a method for processing inter-component communication based on a low-code development platform, including: a publisher receives a published object, triggers publishing through a publishing event, and allows the published object to enter a broker object; the broker object extracts the published value of the published object; the broker object determines whether there is a subscription event at present, and if so, passes the published value to the subscriber corresponding to the subscription event; the variable id of the published object is unique, and when the subscription trigger condition is met, the subscription event is triggered, and the subscriber obtains the published value through the variable id.

[0009] Furthermore, the published object adopts a singleton mode to ensure that the variable id of the published object is unique.

[0010] Furthermore, the subscription trigger condition adopts a singleton design pattern to determine to find the corresponding unique variable id to obtain the published value.

[0011] Furthermore, the broker object has an emit method and an on method. When the broker object calls the emit method, it provides the variable id and the published value. There is a variable idmap inside the broker object, which is used to implement the binding of the published value and the variable id. When the broker object calls the on method, it provides the variable id. When the variable id provided by the on method exists in the broker object idmap, a method will be returned, and the return value of the method is the published value.

[0012] Furthermore, it also includes configuring a publishing event for the publisher. When the publishing event is triggered, the publisher obtains the current and only one publishing object based on the publishing object singleton, and publishes the current unique publishing value through the broker object. If there is a subscriber who subscribes to the current value, the broker object will pass the publishing value to the subscriber. The subscriber determines whether to trigger the subscription event through the subscription trigger condition singleton.

[0013] Furthermore, the publishing event is a change in a publishing object or a receipt of a publishing signal.

[0014] The beneficial effects of the present invention are: publishers and subscribers are decoupled and can still communicate with each other without knowing the details of each other's components; the maintainability of publishing events and subscribing events is enhanced; the linkage between components is no longer dependent on the components, and similar methods do not need to be rewritten. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 It is a diagram of the composition of the event dispatch center;

[0016] Figure 2 It is a communication flow chart in event scheduling. DETAILED DESCRIPTION

[0017] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0018] The present invention is further described below in conjunction with specific implementation examples, but the protection scope of the present invention is not limited thereto.

[0019] A method for processing inter-component communication based on a low-code development platform, including: a publisher receives a published object, triggers publishing through a publishing event, and allows the published object to enter a broker object; the broker object extracts the published value of the published object; the broker object determines whether there is a subscription event at present, and if so, passes the published value to the subscriber corresponding to the subscription event; the variable id of the published object is unique, and the subscription event is triggered when the subscription trigger condition is met, and the subscriber obtains the published value through the variable id.

[0020] For example: an information entry page is implemented through drag and drop configuration, which requires registering a person's name, ID number, age, and gender.

[0021] Drag 4 text boxes into the page and bind these properties respectively. The name is relatively independent. The ID number input box is the publisher, and the age and gender are the subscribers. The ID number box can trigger the publishing action when it loses focus (or the value changes). The published content is an object (including gender and age information). The singleton mode is used to ensure that the id of the published object is unique. The published object enters the broker object.

[0022] The subscriber subscribes to the message through this unique ID. If the message content changes and meets the defined conditions (non-empty), the assignment action is triggered. That is, the gender box and the age box subscribe to the message respectively. The subscription is triggered when the ID number changes. They get the message through the on method respectively, obtain the relevant attributes in the object, and assign them to their own boxes, thereby realizing the communication between the ID number and the gender and age controls, and writing the gender and age effectively and accurately.

[0023] Specific implementation includes:

[0024] 1) Write an event dispatch center, such as Figure 1 As shown in the figure, this event dispatch center includes publishing event enumeration, publishing object singleton, broker object, subscription trigger singleton, and subscription event enumeration. Among them, the broker object has emit method and on method. When the emit method is called, the variable id and publishing value are provided. There will be a variable id map inside the broker object to realize the binding of publishing value and variable id. When the broker object calls the on method, the variable id is provided. When the variable id provided by the on method exists in the broker object id map, a method will be returned. The return value of this method is the publishing value.

[0025] 2) Enumerate the published events owned by each component element. Take the text box as an example, including change event, blur event, and click event. The blur event is published as follows:

[0026] async blurEmitEvent(){

[0027] await this.emitEvent('blur')

[0028] }

[0029] 3) The published object adopts the singleton mode to ensure that only one value is published each time. The published value can be the current value, constant, interface return value, JS, object. Taking the publication of constants as an example, the implementation is as follows:

[0030] constant: {

[0031] transformEmitValue: (obj, nodeList) => {

[0032] const{emitValue}=obj

[0033] return new Promise(resolve=>{

[0034] resolve(emitValue)

[0035] })

[0036] }

[0037] }

[0038] 4) Subscription trigger adopts singleton design mode to ensure that there is only one trigger result each time. The trigger conditions include contain, not contain, equal, not equal, between, greater than, less than, greater than or equal to, less than or equal to. Taking the trigger mode of not equal to as an example, the implementation is as follows:

[0039] notEquals: {

[0040] value: 'notEquals',

[0041] label: 'not equal',

[0042] allowDataType: ['number', 'string'],

[0043] operate: (onValue, rightValue) => {

[0044] return String(onValue)! ==String(rightValue)

[0045] }

[0046] }

[0047] 5) The subscription event consists of the actions owned by the component elements. Taking the text box as an example, it includes assignment, refresh, display, and hide. Taking the hide action as an example, the implementation is as follows:

[0048] hiddenOnEvent(item){

[0049] const{componentName,uuid}=this.$props.attrs

[0050] if(componentName==='dialog-node'){

[0051] this.visible = false

[0052] }else if(componentName==='table-chart-node'){

[0053] if(uuid===item.controlUuid){

[0054] this.$set(this.$props.attrs,'isHide',true)

[0055] }else{

[0056] const{manyBtns}=this.$props.attrs.tableObj

[0057] manyBtns&&manyBtns.map((val,index)=>{

[0058] if(val.uuid===item.controlUuid){

[0059] this.$set(manyBtns[index],'isHide',true)

[0060] }

[0061] })

[0062] }

[0063] }else{

[0064] this.$set(this.$props.attrs,'isHide',true)

[0065] }

[0066] }

[0067] 6) Configure publishing events for component elements. When the publishing event is triggered, the publisher obtains the current and only one publishing object based on the publishing object singleton, and publishes the current unique publishing value through the broker. If there is a subscriber who subscribes to the current value, the broker will pass the value to the subscriber. The subscriber determines whether to trigger the subscription event through the subscription trigger condition singleton.

[0068] The above description is a specific embodiment of the present invention and the technical principles used. If the changes made according to the concept of the present invention do not exceed the spirit covered by the description and drawings, they should still fall within the scope of protection of the present invention.

Claims

1. A method for processing inter-component communication based on a low-code development platform, characterized in that: include: The publisher receives the published object and triggers the publication through the publishing event, so that the published object enters the broker object; The broker object extracts the published value of the published object; The broker object determines whether there is a subscription event currently. If so, it passes the published value to the subscriber corresponding to the subscription event; The variable id of the published object is unique. When the subscription trigger condition is met, the subscription event is triggered, and the subscriber obtains the published value through the variable id; The published object adopts a singleton mode to ensure that the variable id of the published object is unique; The subscription trigger condition adopts a singleton design pattern to determine the corresponding unique variable id to obtain the published value; The broker object has an emit method and an on method. When the broker object calls the emit method, it provides a variable id and a published value. There is a variable id map inside the broker object, which is used to implement the binding of the published value and the variable id. When the broker object calls the on method, it provides the variable id. When the variable id provided by the on method exists in the broker object id map, it returns a method with a return value of the published value. The method for processing inter-component communication based on a low-code development platform also includes configuring a publishing event for the publisher. When the publishing event is triggered, the publisher obtains the current and only one publishing object based on the publishing object singleton, and publishes the current unique publishing value through the broker object. If there is a subscriber who subscribes to the current value, the broker object will pass the publishing value to the subscriber, and the subscriber determines whether to trigger the subscription event through the subscription trigger condition singleton.

2. According to claim 1, a method for processing inter-component communication based on a low-code development platform is characterized in that: The publishing event is that the publishing object changes or receives a publishing signal.

Citation Information

Patent Citations

  • Release / subscription method and device

    CN107360082A

  • Remote instruction issuing method based on MQTT protocol

    CN112104620A

  • System and method for event driven publish-subscribe communications

    US20070067409A1