WO2022252068A1 - 应用程序构建方法、执行方法、计算设备以及存储介质 - Google Patents

应用程序构建方法、执行方法、计算设备以及存储介质 Download PDF

Info

Publication number
WO2022252068A1
WO2022252068A1 PCT/CN2021/097457 CN2021097457W WO2022252068A1 WO 2022252068 A1 WO2022252068 A1 WO 2022252068A1 CN 2021097457 W CN2021097457 W CN 2021097457W WO 2022252068 A1 WO2022252068 A1 WO 2022252068A1
Authority
WO
WIPO (PCT)
Prior art keywords
application program
execution
module
function module
functional modules
Prior art date
Application number
PCT/CN2021/097457
Other languages
English (en)
French (fr)
Inventor
李冬
杨晓波
张健勇
王同舟
张传雨
康尧磊
Original Assignee
西门子股份公司
西门子(中国)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 西门子股份公司, 西门子(中国)有限公司 filed Critical 西门子股份公司
Priority to CN202180096155.8A priority Critical patent/CN117063152A/zh
Priority to JP2023573584A priority patent/JP2024521203A/ja
Priority to KR1020237045260A priority patent/KR102667931B1/ko
Priority to EP21943444.6A priority patent/EP4318210A1/en
Priority to PCT/CN2021/097457 priority patent/WO2022252068A1/zh
Publication of WO2022252068A1 publication Critical patent/WO2022252068A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30076Arrangements for executing specific machine instructions to perform miscellaneous control operations, e.g. NOP
    • G06F9/3009Thread control instructions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44568Immediately runnable code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements

Definitions

  • the present disclosure generally relates to the technical field of the industrial Internet of Things, and more specifically, relates to an application program construction method, an execution method, a computing device, and a storage medium.
  • ROS Robot Operating System
  • Node-RED is a programming tool that connects hardware devices, APIs and online services in the prior art. Applications can be easily composed by using existing nodes in Node-RED. But developing a new node requires a large workload. (The development of limited application functions can only use javascript language, and the development of core functions requires a large amount of work, such as understanding module API, storage API, HTTP API and context API, etc.)
  • the present invention proposes a lightweight distributed application program construction method, which can integrate functional modules into an application program and realize communication between functional modules
  • a method for building an application program including: determining a plurality of functional modules constituting the application program; adding a pre-configured communication component to each functional module; using the communication component to establish the function connection relationship between modules, and store the connection relationship in the configuration file.
  • the functional modules are threads or processes that implement independent functions.
  • the communication component includes at least one of an input communication interface and an output communication interface.
  • the communication component further includes: at least one of a monitoring module, a caching module, and a load balancing module.
  • the method further includes: modifying the execution logic of the application program by modifying the configuration file.
  • an application program execution method is provided, the application program is constructed by using the above-mentioned application program construction method, and the application program execution method includes: initializing the application program, loading the application program program configuration file; when the first function module of the application program receives data, trigger the execution of the first function module; The configured port sends data to trigger the execution of the second function module bound to the port, and the second function module sends data to the pre-configured port in the output communication interface of the second function module according to its execution result to trigger The third function module bound to the port is executed, and so on, until the execution of the application program ends.
  • a computing device including: at least one processor; and a memory coupled to the at least one processor, the memory is used to store instructions, when the instructions are executed by the at least one When the processor executes, the processor is made to execute the above method.
  • a non-transitory machine-readable storage medium storing executable instructions which, when executed, cause the machine to perform the method as described above.
  • a computer program comprising computer-executable instructions which, when executed, cause at least one processor to perform the method as described above.
  • a computer program product tangibly stored on a computer-readable medium and comprising computer-executable instructions which, when executed, cause at least A processor executes the method as described above.
  • the application building method and execution method according to the present invention have at least one of the following advantages.
  • Developers can use any programming language to develop functional modules in parallel, which reduces the dependencies between functional modules. Developers only need to pay attention to the functions to be realized by functional modules, and do not need to care about the details of communication.
  • Functional modules can be deployed on one machine or multiple different machines without changing any code.
  • Developers can modify the execution logic of the application program by modifying the configuration file, and can dynamically adjust the communication method between functional modules, such as shared memory, IPC or socket (socket), etc. by modifying the configuration file.
  • FIG. 1 is a flowchart of an exemplary process of a method for building an application program according to an embodiment of the present invention
  • Fig. 2 is a schematic diagram of a specific example of a gateway application program constructed by the method of the embodiment of the present invention
  • FIG. 3 is a flow chart of an exemplary process of an execution method of an application program constructed according to the method of the present invention
  • FIG. 4 shows a block diagram of a computing device for executing applications according to an embodiment of the disclosure.
  • Gateway application M1, M2, M3, M4, M5, M6, and M7 Gateway application M1, M2, M3, M4, M5, M6, and M7:
  • OCI Output Communication Interface
  • ICI Input Communication Interface
  • the term “comprising” and its variants represent open terms meaning “including but not limited to”.
  • the term “based on” means “based at least in part on”.
  • the terms “one embodiment” and “an embodiment” mean “at least one embodiment.”
  • the term “another embodiment” means “at least one other embodiment.”
  • the terms “first”, “second”, etc. may refer to different or the same object. The following may include other definitions, either express or implied. Unless the context clearly indicates otherwise, the definition of a term is consistent throughout the specification.
  • a lightweight distributed application program construction method which can integrate functional modules into an application program and realize communication between functional modules.
  • FIG. 1 is a flow chart of an exemplary process of an application building method 100 according to an embodiment of the present invention.
  • step S102 a plurality of functional modules constituting the application program are determined.
  • the method of the present invention firstly, it is divided into multiple independent function modules according to the functions of the application program, so that different function modules can be developed in parallel by multiple developers, and the reusability of each developed module is also better. it is good.
  • Each module implements an independent function, which can be a process running alone or a thread running together with other modules.
  • step S104 a pre-configured communication component is added to each functional module.
  • a connection is established between one functional module and other functional modules through a communication component, and data is exchanged.
  • the communication component is a pre-configured communication library, which can include multiple functions to achieve different functions.
  • the communication library can support function modules using different programming languages, so there is no restriction on the programming languages used by developers when developing function modules.
  • the communication component can be pre-configured by those skilled in the art, and multiple versions can be provided for functional modules in different programming languages.
  • the present invention does not limit the specific implementation of the communication component, which will not be described in detail here.
  • the communication component added to the functional modules at least includes at least one of an input communication interface and an output communication interface.
  • the module only the input communication interface or the output communication interface can be added, or both can be added.
  • the functional module that obtains data from the external device may only have an output communication interface, through which the output communication interface communicates with other functions of the application program Modules are connected; as a functional module of a data pool, only one input communication interface can be added, and data from other functional modules can be received and stored through the input communication interface.
  • step S106 using the communication components of the function modules, establish a connection relationship between the function modules, and store the connection relationship in a configuration file.
  • multiple functional modules can be constructed as an application program, and the functional modules can establish connections through communication components and exchange data.
  • the communication component may further include at least one of a monitoring module, a caching module, a load balancing module and the like.
  • the monitoring module is used to monitor whether the connection between two functional modules is normal; the cache module can cache the data to be sent or received, and use the cache to realize the hot switching of the functional modules. When replacing a functional module , no messages will be lost, and other functional modules can still run; the load balancing module is used to balance the load among functional modules. Work.
  • the monitoring module, cache module, and load balancing module can be respectively set in the input communication interface and the output communication interface.
  • the application building method 100 further includes step S108: modifying the execution logic of the application by modifying the configuration file.
  • modifying the port for receiving data of the function module modifying the calling relationship of the function module, etc., all can be realized by modifying the configuration file.
  • FIG. 2 is a schematic diagram of a specific example of a gateway application program 200 constructed by the method of the present invention. The specific process of building an application program will be further described below with reference to the specific example in FIG. 2 .
  • the gateway application 200 includes seven functional modules: M1, M2, M3, M4, M5, M6 and M7.
  • M1, M2, M3, and M6 are data sources of applications that obtain data from external devices;
  • M7 is a data pool, which receives and stores data;
  • M4 and M5 are data filters that process data according to a certain logic.
  • Each functional module is attached with a communication component, wherein the reference symbol OCI represents the output communication interface, and ICI represents the input communication interface.
  • OCI represents the output communication interface
  • ICI represents the input communication interface.
  • M1, M2, and M3 only add the output communication interface OCI
  • M7 only adds the input communication interface ICI
  • M4, M5, and M6 add both the output communication interface OCI and the input communication interface ICI.
  • c indicates that M1 is a client, and its output interface parameter is 'tcp://localhost:5557', which indicates that M1 will connect to the service provided by port "5557", according to the configuration file
  • M1 is connected to M4.
  • b means binding 'tcp://*:5557', that is, M4 provides services through port 5557, and M4 connects to the services provided by port 5558, that is, M4 connects to M5.
  • Configuration information about other functional modules will not be detailed here.
  • the function modules M4-M7 can be reused without any change, even without restarting the application program. If a data filtering module such as M5 needs to be replaced, M4 and M7 will not stop working when M5 stops working. The data of M4 will be temporarily stored in the cache module of the communication component. When the newly replaced functional module M5 starts to work, the connection between M4 and M5 will be automatically established according to the connection relationship in the configuration file. At this time, the cached The data will be resent to the new M5. When M5 stops working, M7 continues to receive data from other functional modules without being affected.
  • the application program constructed by the application program construction method according to the embodiment of the present invention is an event-triggered data flow, that is, the execution of the application program can be triggered when a functional module receives data.
  • FIG. 3 is a flowchart of an exemplary process of an execution method 300 of an application program constructed according to the method of the present invention.
  • step S302 the application program is initialized, and the configuration file of the application program is loaded.
  • the configuration file of the application program is also loaded.
  • the configuration file mentioned here is the configuration file for configuring the connection relationship between the various functional modules described above.
  • module configuration file can also be loaded during the initialization phase, and the module configuration file is a file for configuring the internal parameters of the module.
  • the same function module can have multiple instances, and each instance can have the same or different module configuration files.
  • step S304 when the first function module of the application program receives data, the execution of the first function module is triggered.
  • the first functional module here does not refer to a specific functional module.
  • a certain functional module of the application program receives data, it triggers the execution of the functional module, which in turn triggers the execution of the application program.
  • This functional module is called The first functional module.
  • the first function module, the second function module and the third function module in the following are only for distinguishing different function modules, and do not specifically refer to a certain function module, and there is no specific sequence for execution of each function module.
  • the application program constructed according to the method of the present invention also supports the subscription/publishing (Pub/Sub) mechanism.
  • Pub/Sub subscription/publishing
  • step S306 the first functional module sends data to a port pre-configured in the output communication interface of the first functional module according to the execution result to trigger the execution of the second functional module bound to the port, and the first functional module
  • the second function module sends data to the port pre-configured in the output communication interface of the second function module according to the execution result, to trigger the execution of the third function module bound to the port, and so on until the execution of the application program ends .
  • the function module M1 receives alarm data from an external sensor
  • the execution of M1 is triggered, and the execution result of M1 is sent to the port '5557' through its output communication interface, which is sent to the input communication interface of the function module M4, and then triggers
  • the execution of M4 is executed, and the execution result of M4 is sent to the port '5558' through its output communication interface, which is sent to the input communication interface of the function module M5, which then triggers the execution of M5, and then the execution result of M5 is sent through its output communication interface
  • To port '5559' which is sent to the input communication interface of the function module M7.
  • M7 stores the received data and does not send it to other functional modules, and the execution of the gateway application program ends. After a period of time, it is possible that the function module M2 receives the data, which triggers a new execution process of the application program.
  • the application program built according to the application program construction method of the present invention is triggered based on data or events, and there is no sequence of startup among functional modules, and they can also be executed in parallel.
  • the application building method and execution method according to the present invention have at least one of the following advantages.
  • Functional modules can be deployed on one machine or multiple different machines without changing any code.
  • Developers can modify the execution logic of the application program by modifying the configuration file, and can dynamically adjust the communication method between functional modules, such as shared memory, IPC or socket (socket), etc. by modifying the configuration file.
  • the application program building method and the application program execution method according to the embodiments of the present disclosure have been described.
  • the above-mentioned method for executing an application program may be implemented by using software or a combination of hardware and software.
  • FIG. 4 shows a block diagram of a computing device 400 for executing applications according to an embodiment of the disclosure.
  • the computing device 400 may include at least one processor 402 that executes at least one computer-readable instruction (i.e., the above-described in software form) stored or encoded in a computer-readable storage medium (i.e., the memory 404). implemented elements).
  • a non-transitory machine-readable medium may have machine-executable instructions (that is, the above-mentioned elements implemented in software), which, when executed by a machine, cause the machine to perform the above-described functions described in conjunction with FIG. 3 in various embodiments of the present disclosure.
  • machine-executable instructions that is, the above-mentioned elements implemented in software
  • a computer program comprising computer-executable instructions which, when executed, cause at least one processor to perform the various operations described above in connection with FIG. 3 in various embodiments of the present disclosure and function.
  • a computer program product comprising computer-executable instructions which, when executed, cause at least one processor to perform the various functions described above in connection with FIG. 3 in various embodiments of the present disclosure. operation and function.
  • the device structures described in the above embodiments may be physical structures or logical structures, that is, some units may be implemented by the same physical entity, or some units may be respectively implemented by multiple physical entities, or may be implemented by multiple physical entities. Certain components in individual devices are implemented together.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

一种分布式应用程序构建方法、执行方法、计算设备以及存储介质。其中,应用程序构建方法包括:确定构成应用程序的多个功能模块(S102);为每一个功能模块附加预先配置的通信组件(S104);利用所述通信组件,建立所述功能模块之间的连接关系,并将所述连接关系存储在配置文件中(S108)。

Description

应用程序构建方法、执行方法、计算设备以及存储介质 技术领域
本公开通常涉及工业物联网技术领域,更具体地,涉及应用程序构建方法、执行方法、计算设备以及存储介质。
背景技术
随着软件规模变得越来越大,上市时间变得更短,模块化编程已经成为软件设计和实现技术的一个重要方式。其目的在于将程序的功能划分为独立的、可以更换的模块。通过这样的方式,开发人员可以并行开发应用程序,并且提高了各个模块的复用性,从而减少应用程序的上市时间。
机器人操作系统(Robot Operating System,ROS)是用于编写机器人软件的灵活的框架。ROS是工具、库以及事件的集合,其目的在于简化跨各种机器人平台来产生复杂并且鲁棒的机器人行为的任务。但是如果不是用于机器人的应用,存在操作系统和编程语言的限制。
Node-RED是现有技术中将硬件设备、API和在线服务连接在一起的编程工具。通过使用Node-RED中现有的节点可以简单地合成应用程序。但是开发一个新的节点需要较大的工作量。(开发有限的应用功能只能使用javascript语言,开发核心功能需要较大工作量,例如理解模块API、存储API,HTTP API和上下文API等)
发明内容
在下文中给出关于本发明的简要概述,以便提供关于本发明的某些方面的基本理解。应当理解,这个概述并不是关于本发明的穷举性概述。它并不是意图确定本发明的关键或重要部分,也不是意图限定本发明的范围。其目的仅仅是以简化的形式给出某些概念,以此作为稍后论述的更详细描述的前序。
有鉴于此,本发明提出了一种轻量分布式的应用程序构建方法,能够将功能模块集成为一个应用程序并且实现功能模块之间的通信
根据本公开的一个方面,提供了一种应用程序构建方法,包括:确定构成应用程序的多个功能模块;为每一个功能模块附加预先配置的通信组件;利用所述通信组件,建 立所述功能模块之间的连接关系,并将所述连接关系存储在配置文件中。
可选地,在上述方面的一个示例中,所述功能模块是实现独立功能的线程或者进程。
可选地,在上述方面的一个示例中,所述通信组件包括输入通信接口和输出通信接口中的至少一项。
可选地,在上述方面的一个示例中,所述通信组件进一步包括:监测模块、缓存模块、负载平衡模块中的至少一项。
可选地,在上述方面的一个示例中,所述方法还包括:通过对配置文件进行修改来修改所述应用程序的执行逻辑。
根据本公开的另一方面,提供了应用程序执行方法,所述应用程序是采用如以上所述的应用程序构建方法所构建的,所述应用程序执行方法包括:对应用程序进行初始化,加载应用程序配置文件;当所述应用程序的第一功能模块接收到数据时,触发该第一功能模块的执行;所述第一功能模块根据其执行结果向该第一功能模块的输出通信接口中预先配置的端口发送数据,来触发绑定该端口的第二功能模块的执行,所述第二功能模块根据其执行结果向该第二功能模块的输出通信接口中预先配置的端口发送数据,来触发绑定该端口的第三功能模块的执行,以此类推,直至所述应用程序执行结束。
根据本公开的另一方面,提供了计算设备,包括:至少一个处理器;以及与所述至少一个处理器耦合的一个存储器,所述存储器用于存储指令,当所述指令被所述至少一个处理器执行时,使得所述处理器执行如上所述的方法。
根据本公开的另一方面,提供了一种非暂时性机器可读存储介质,其存储有可执行指令,所述指令当被执行时使得所述机器执行如上所述的方法。
根据本公开的另一方面,提供了一种计算机程序,包括计算机可执行指令,所述计算机可执行指令在被执行时使至少一个处理器执行如上所述的方法。
根据本公开的另一方面,提供了一种计算机程序产品,所述计算机程序产品被有形地存储在计算机可读介质上并且包括计算机可执行指令,所述计算机可执行指令在被执行时使至少一个处理器执行如上所述的方法。
根据本发明的应用程序构建方法和执行方法具有以下优势中的至少一项。
开发人员可以使用任何编程语言来并行开发功能模块,减少了功能模块之间的依赖关系,开发人员只需要关注功能模块所要实现的功能,而无需关心通信的细节。
功能模块可以部署在一个机器上或者多个不同机器上,而无需改变任何代码。
开发人员通过修改配置文件可以修改应用程序的执行逻辑,并且可以通过修改配置文件动态调整功能模块之间的通信方法,例如共享内存、IPC或者socket(套接字)等。
可以方便地增加新的设备的功能模块,而对应用程序的执行没有影响。
利用缓存模块,即使某个功能模块出现故障也不会中断应用程序的其它功能模块的执行,并且不会丢失数据。
附图说明
参照下面结合附图对本发明实施例的说明,会更加容易地理解本发明的以上和其它目的、特点和优点。附图中的部件只是为了示出本发明的原理。在附图中,相同的或类似的技术特征或部件将采用相同或类似的附图标记来表示。附图中:
图1为根据本发明实施例的应用程序构建方法的示例性过程的流程图;
图2是利用本发明实施例的方法所构建的一个网关应用程序的具体示例的示意图;
图3是根据本发明的方法所构建的应用程序的执行方法的示例性过程的流程图;
图4示出了根据本公开的实施例用于执行应用程序的计算设备的方框图。
其中,附图标记如下:
100:应用程序构建方法     S102、S104、S106、S108:步骤
200:网关应用程序         M1、M2、M3、M4、M5、M6和M7:
                          功能模块
OCI:输出通信接口         ICI:输入通信接口
300:应用程序的执行方法   S302、S304、S306:步骤
400:计算设备             402:处理器
404:存储器
具体实施方式
现在将参考示例实施方式讨论本文描述的主题。应该理解,讨论这些实施方式只是为了使得本领域技术人员能够更好地理解从而实现本文描述的主题,并非是对权利要求书中所阐述的保护范围、适用性或者示例的限制。可以在不脱离本公开内容的保护范围的情况下,对所讨论的元素的功能和排列进行改变。各个示例可以根据需要,省略、替 代或者添加各种过程或组件。例如,所描述的方法可以按照与所描述的顺序不同的顺序来执行,以及各个步骤可以被添加、省略或者组合。另外,相对一些示例所描述的特征在其它例子中也可以进行组合。
如本文中使用的,术语“包括”及其变型表示开放的术语,含义是“包括但不限于”。术语“基于”表示“至少部分地基于”。术语“一个实施例”和“一实施例”表示“至少一个实施例”。术语“另一个实施例”表示“至少一个其他实施例”。术语“第一”、“第二”等可以指代不同的或相同的对象。下面可以包括其他的定义,无论是明确的还是隐含的。除非上下文中明确地指明,否则一个术语的定义在整个说明书中是一致的。
根据本发明的实施例,提出了一种轻量分布式的应用程序构建方法,能够将功能模块集成为一个应用程序并且实现功能模块之间的通信。
下面将结合附图来具体描述根据本公开的实施例的应用程序构建方法和执行方法。图1为根据本发明实施例的应用程序构建方法100的示例性过程的流程图。
首先,在步骤S102中,确定构成应用程序的多个功能模块。
根据本发明的方法,首先根据应用程序的功能将其划分为多个独立的功能模块,这样可以由多个开发人员并行开发不同的功能模块,并且开发出来的每一个模块的复用性也更好。
每一个模块实现一个独立功能,可以是单独运行的进程,也可以是与其它模块一起运行的线程。
接着,在步骤S104中,为每一个功能模块附加预先配置的通信组件。
在根据本公开的方法中,一个功能模块与其它功能模块之间通过通信组件来建立连接,并且交换数据。通信组件是一个预先配置好的通信库,其中可以包括多个函数,分别实现不同功能。并且该通信库可以支持采用不同编程语言的功能模块,因此,对于开发人员开发功能模块时所采用的编程语言没有限制。
通信组件可以由本领域人员预先配置好,并且可以针对不同编程语言的功能模块分别提供多个版本,本发明对于通信组件的具体实现方式不做限定,在此不在详述。
为了实现功能模块之间的调度,为所述功能模块附加的通信组件至少包括输入通信接口和输出通信接口中的至少一项。根据模块要实现的功能,可以只附加输入通信接口或者输出通信接口,也可以附加二者。例如,在下面图2所示的网关应用程序的示例中,作为应用程序的数据源、从外部设备获得数据的功能模块可以只附加一个输出通信接口,通过该输出通信接口与应用程序的其它功能模块建立连接;而作为数据池的功能模块, 则可以只附加一个输入通信接口,通过该输入通信接口接收来自其它功能模块的数据进行存储。
在步骤S106中,利用所述功能模块的所述通信组件,建立所述功能模块之间的连接关系,并将所述连接关系存储在配置文件中。
通过以上所述的步骤,可以将多个功能模块构建为一个应用程序,功能模块之间通过通信组件来建立连接,并且交换数据。
在一个示例中,通信组件还可以包括监测模块、缓存模块、负载平衡模块等中的至少一项。其中监测模块用于监测两个功能模块之间的连接是否正常;缓存模块可以对待发送出去的数据或者接收到的数据进行缓存,利用缓存,可以实现功能模块的热切换,在替换一个功能模块时,不会丢失消息,并且其他功能模块仍然可以运行;负载平衡模块,用于平衡功能模块之间的负载,在业务量较大的情况下,可以采用多个相同的功能模块来处理耗时的工作。监测模块、缓存模块、负载平衡模块可以分别设置在输入通信接口和输出通信接口中。
在一个示例中,应用程序构建方法100还包括步骤S108:通过对配置文件进行修改来修改所述应用程序的执行逻辑。
例如在增加一个功能模块、修改功能模块接收数据的端口、修改功能模块的调用关系等情况下,都可以通过修改配置文件来实现。
图2是利用本发明的方法所构建的一个网关应用程序200的具体示例的示意图。下面参照图2的具体示例来进一步说明构建应用程序的具体过程。
假设该网关应用程序200包括七个功能模块:M1、M2、M3、M4、M5、M6和M7。其中,M1、M2、M3和M6是从外部设备获得数据的应用程序的数据源;M7是数据池,其接收并且存储数据;M4和M5是按照一定的逻辑对数据进行处理的数据过滤器。每个功能模块都附加了通信组件,其中附图标记OCI表示输出通信接口,ICI表示输入通信接口,可以理解,针对不同的功能模块,OCI和ICI包括的具体内容可能不同,但是实现的是类似的功能,因此本文在附图标记上不进行区分。根据功能模块实现的不同功能,M1、M2、M3只附加了输出通信接口OCI,M7只附加了输入通信接口ICI,M4、M5和M6附加了输出通信接口OCI和输入通信接口ICI二者。
在下面所示的配置文件中,分别针对每个功能模块进行配置。其中,在M1的配置信息中,c表示M1作为客户端,其输出接口参数为'tcp://localhost:5557',这个参数表示M1要连接至端口“5557”所提供的服务,根据配置文件可知,M1连接至M4。在M4 的配置信息中,b表示绑定'tcp://*:5557',即M4通过端口5557提供服务,并且M4连接至端口5558所提供的服务,即M4连接至M5。关于其他功能模块的配置信息在此不再一一详述。通过这个配置文件,可以得到如图2所示的功能模块之间的连接关系。
网关应用程序的配置文件:
Figure PCTCN2021097457-appb-000001
如果有新的设备要连接至该网关,在新的功能模块中,开发人员只需要实现与新的设备的硬件有关的代码,然后给其附加通信组件,并且在应用程序的配置文件中对该新设备的功能模块进行配置。在增加新的功能模块时,功能模块M4-M7可以复用,而无需任何改变,甚至都不需要重新启动应用程序。如果数据过滤模块,例如M5需要被替换,在M5停止工作时,M4和M7不会停止工作。M4的数据将被临时存储在通信组件的缓存模块中,当新替换的功能模块M5开始工作之后,将根据配置文件中的连接关系,自动建立M4和M5之间的连接,此时,缓存的数据将重新发送给新的M5。在M5停止工作的情况下,M7继续接收来自其它功能模块的数据,而不会受到影响。
根据本发明实施例的应用程序构建方法所构建的应用程序是由事件触发数据流,即在有功能模块接收到数据时可以触发应用程序的执行。
下面参照图3说明根据本发明方法构建的应用程序的执行过程。
图3是根据本发明的方法所构建的应用程序的执行方法300的示例性过程的流程图。
首先,在步骤S302中,进行应用程序的初始化,加载应用程序的配置文件。
具体地,根据本发明的方法所构建的应用程序在初始化阶段,除了执行应用程序的初始化函数以外,还要加载应用程序的配置文件。这里所述配置文件即为上文所述的配置各个功能模块之间的连接关系的配置文件。
此外,在初始化阶段还可以加载模块配置文件,模块配置文件是配置模块内部参数的文件。相同的功能模块可以具有多个实例,每个实例可以具有相同或不同的模块配置文件。
接着,在步骤S304中,当所述应用程序的第一功能模块接收到数据时,触发该第一功能模块的执行。
这里的第一功能模块不是指某个特定功能模块,当应用程序的某一个功能模块接收到数据,就触发了该功能模块的执行,进而触发了应用程序的执行,则将该功能模块称为第一功能模块。在下文中的第一功能模块、第二功能模块以及第三功能模块只是为了区分不同的功能模块,并不特指某个功能模块,各个功能模块的执行并没有特定的顺序。
根据本发明的方法构建的应用程序除了支持客户端/服务器(C/S)机制以外,也支持订阅/发布(Pub/Sub)机制,在这种情况下,是接收到关于某个特定话题的事件时,会触发功能模块的执行。
最后,在步骤S306中,第一功能模块根据其执行结果向该第一功能模块的输出通信接口中预先配置的端口发送数据,来触发绑定该端口的第二功能模块的执行,所述第二功能模块根据其执行结果向该第二功能模块的输出通信接口中预先配置的端口发送数据,来触发绑定该端口的第三功能模块的执行,以此类推,直至所述应用程序执行结束。
下面再次参照图2来说明网关应用程序的执行过程的一个具体示例。
首先,假设功能模块M1从外部传感器接收到告警数据,则触发了M1的执行,M1的执行结果通过其输出通信接口发送至端口‘5557’,即发送至功能模块M4的输入通信接口,进而触发了M4的执行,M4的执行结果通过其输出通信接口发送至端口‘5558’,即发送至功能模块M5的输入通信接口,进而触发了M5的执行,接着M5的执行结果通过其输出通信接口发送至端口‘5559’,即发送至功能模块M7的输入通信接口。M7对接收到的数据进行存储,而不再发给其它功能模块,网关应用程序执行结束。经过一段时间之后,有可能功能模块M2接收到了数据,则触发了应用程序新的一次执行过程。
可以看到,根据本发明的应用程序构建方法所构建的应用程序,是基于数据或者事 件而触发,功能模块之间没有启动的先后顺序,也可以并行执行。
根据本发明的应用程序构建方法和执行方法具有以下优势中的至少一项。
减少了模块之间的依赖关系,开发人员可以并行开发,可以使用任何编程语言来开发功能模块,并且只需要关注与功能模块所要实现的功能,而无需关心通信的细节。
功能模块可以部署在一个机器上或者多个不同机器上,而无需改变任何代码。
开发人员通过修改配置文件可以修改应用程序的执行逻辑,并且可以通过修改配置文件动态调整功能模块之间的通信方法,例如共享内存、IPC或者socket(套接字)等。
可以方便地增加新的设备的功能模块,而对应用程序的执行没有影响。
利用缓存模块,即使某个功能模块出现故障也不会中断应用程序的其它功能模块的执行,并且不会丢失数据。
如上参照图1至图3,对根据本公开的实施例的应用程序构建方法和应用程序执行方法进行了描述。以上所述的应用程序执行方法可以采用软件或者硬件和软件的组合来实现。
图4示出了根据本公开的实施例用于执行应用程序的计算设备400的方框图。根据一个实施例,计算设备400可以包括至少一个处理器402,处理器402执行在计算机可读存储介质(即,存储器404)中存储或编码的至少一个计算机可读指令(即,上述以软件形式实现的元素)。
应该理解,在存储器404中存储的计算机可执行指令当执行时使得至少一个处理器402进行本公开的各个实施例中以上结合图3描述的各种操作和功能。
根据一个实施例,提供了一种非暂时性机器可读介质。该非暂时性机器可读介质可以具有机器可执行指令(即,上述以软件形式实现的元素),该指令当被机器执行时,使得机器执行本公开的各个实施例中以上结合图3描述的各种操作和功能。
根据一个实施例,提供了一种计算机程序,包括计算机可执行指令,所述计算机可执行指令在被执行时使至少一个处理器执行本公开的各个实施例中以上结合图3描述的各种操作和功能。
根据一个实施例,提供了一种计算机程序产品,包括计算机可执行指令,所述计算机可执行指令在被执行时使至少一个处理器执行本公开的各个实施例中以上结合图3描述的各种操作和功能。
应当理解的是,本说明书中的各个实施例均采用递进的方式来描述,各个实施例之 间相同或相似的部分相互参见即可,每个实施例重点说明的都是与其它实施例的不同之处。例如,对于上述关于装置的实施例、关于计算设备的实施例以及关于机器可读存储介质的实施例而言,由于它们基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
上文对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
上述各流程和各系统结构图中不是所有的步骤和单元都是必须的,可以根据实际的需要忽略某些步骤或单元。上述各实施例中描述的装置结构可以是物理结构,也可以是逻辑结构,即,有些单元可能由同一物理实体实现,或者,有些单元可能分别由多个物理实体实现,或者,可以由多个独立设备中的某些部件共同实现。
上面结合附图阐述的具体实施方式描述了示例性实施例,但并不表示可以实现的或者落入权利要求书的保护范围的所有实施例。在整个本说明书中使用的术语“示例性”意味着“用作示例、实例或例示”,并不意味着比其它实施例“优选”或“具有优势”。出于提供对所描述技术的理解的目的,具体实施方式包括具体细节。然而,可以在没有这些具体细节的情况下实施这些技术。在一些实例中,为了避免对所描述的实施例的概念造成难以理解,公知的结构和装置以框图形式示出。
本公开内容的上述描述被提供来使得本领域任何普通技术人员能够实现或者使用本公开内容。对于本领域普通技术人员来说,对本公开内容进行的各种修改是显而易见的,并且,也可以在不脱离本公开内容的保护范围的情况下,将本文所定义的一般性原理应用于其它变型。因此,本公开内容并不限于本文所描述的示例和设计,而是与符合本文公开的原理和新颖性特征的最广范围相一致。
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (9)

  1. 应用程序构建方法,包括:
    确定构成应用程序的多个功能模块;
    为每一个功能模块附加预先配置的通信组件;以及
    利用所述通信组件,建立所述功能模块之间的连接关系,并将所述连接关系存储在配置文件中。
  2. 如权利要求1所述的方法,其中,所述功能模块是实现独立功能的线程或者进程。
  3. 如权利要求1所述的方法,其中,所述通信组件包括输入通信接口和输出通信接口中的至少一项。
  4. 如权利要求3所述的方法,其中,所述通信组件进一步包括:监测模块、缓存模块、负载平衡模块中的至少一项。
  5. 如权利要求1-4中任意一项所述的方法,还包括:通过对配置文件进行修改来修改所述应用程序的执行逻辑。
  6. 应用程序执行方法,所述应用程序是采用根据权利要求1-5中任意一项所述的方法所构建的,所述应用程序执行方法包括:
    对应用程序进行初始化,加载应用程序配置文件;
    当所述应用程序的第一功能模块接收到数据时,触发该第一功能模块的执行;以及
    所述第一功能模块根据其执行结果向该第一功能模块的输出通信接口中预先配置的端口发送数据,来触发绑定该端口的第二功能模块的执行,所述第二功能模块根据其执行结果向该第二功能模块的输出通信接口中预先配置的端口发送数据,来触发绑定该端口的第三功能模块的执行,以此类推,直至所述应用程序执行结束。
  7. 计算设备(400),包括:
    至少一个处理器(402);以及
    与所述至少一个处理器(402)耦合的一个存储器(404),所述存储器用于存储指令,当所述指令被所述至少一个处理器(402)执行时,使得所述处理器(402)执行如权利要求6所述的方法。
  8. 一种非暂时性机器可读存储介质,其存储有可执行指令,所述指令当被执行时使得所述机器执行如权利要求6所述的方法。
  9. 一种计算机程序产品,所述计算机程序产品被有形地存储在计算机可读介质上并且包括计算机可执行指令,所述计算机可执行指令在被执行时使至少一个处理器执行根据权利要求6所述的方法。
PCT/CN2021/097457 2021-05-31 2021-05-31 应用程序构建方法、执行方法、计算设备以及存储介质 WO2022252068A1 (zh)

Priority Applications (5)

Application Number Priority Date Filing Date Title
CN202180096155.8A CN117063152A (zh) 2021-05-31 2021-05-31 应用程序构建方法、执行方法、计算设备以及存储介质
JP2023573584A JP2024521203A (ja) 2021-05-31 2021-05-31 アプリケーションプログラムを構築する方法、アプリケーションプログラムを実行する方法、コンピューティング装置および記憶媒体
KR1020237045260A KR102667931B1 (ko) 2021-05-31 2021-05-31 애플리케이션 프로그램 구성 방법, 실행 방법, 컴퓨팅 디바이스, 및 저장 매체
EP21943444.6A EP4318210A1 (en) 2021-05-31 2021-05-31 Application program construction method, execution method, computing device, and storage medium
PCT/CN2021/097457 WO2022252068A1 (zh) 2021-05-31 2021-05-31 应用程序构建方法、执行方法、计算设备以及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/097457 WO2022252068A1 (zh) 2021-05-31 2021-05-31 应用程序构建方法、执行方法、计算设备以及存储介质

Publications (1)

Publication Number Publication Date
WO2022252068A1 true WO2022252068A1 (zh) 2022-12-08

Family

ID=84322634

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/097457 WO2022252068A1 (zh) 2021-05-31 2021-05-31 应用程序构建方法、执行方法、计算设备以及存储介质

Country Status (5)

Country Link
EP (1) EP4318210A1 (zh)
JP (1) JP2024521203A (zh)
KR (1) KR102667931B1 (zh)
CN (1) CN117063152A (zh)
WO (1) WO2022252068A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104834555A (zh) * 2015-03-30 2015-08-12 百度在线网络技术(北京)有限公司 调用功能模块的方法、相关装置及装置修复方法
US20160124782A1 (en) * 2014-10-31 2016-05-05 Scott Gruby Systems and methods for communication between independent component blocks in mobile application modules
CN109460250A (zh) * 2018-09-25 2019-03-12 平安科技(深圳)有限公司 一种应用程序的生成方法及设备
US20200293383A1 (en) * 2019-03-13 2020-09-17 Michael Changcheng Chen System and Method for Developing Modularized Application
CN111722841A (zh) * 2020-04-29 2020-09-29 北京网聘咨询有限公司 Ios平台下软件的组件化实现方法
CN112558949A (zh) * 2020-12-21 2021-03-26 长沙树根互联技术有限公司 程序构造方法、装置、电子设备及存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7590988B2 (en) * 2005-03-08 2009-09-15 Microsoft Corporation Dynamic service generation for legacy components
US20170054767A1 (en) * 2015-08-17 2017-02-23 Google Inc. Transferring application state between devices

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160124782A1 (en) * 2014-10-31 2016-05-05 Scott Gruby Systems and methods for communication between independent component blocks in mobile application modules
CN104834555A (zh) * 2015-03-30 2015-08-12 百度在线网络技术(北京)有限公司 调用功能模块的方法、相关装置及装置修复方法
CN109460250A (zh) * 2018-09-25 2019-03-12 平安科技(深圳)有限公司 一种应用程序的生成方法及设备
US20200293383A1 (en) * 2019-03-13 2020-09-17 Michael Changcheng Chen System and Method for Developing Modularized Application
CN111722841A (zh) * 2020-04-29 2020-09-29 北京网聘咨询有限公司 Ios平台下软件的组件化实现方法
CN112558949A (zh) * 2020-12-21 2021-03-26 长沙树根互联技术有限公司 程序构造方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN117063152A (zh) 2023-11-14
KR102667931B1 (ko) 2024-05-23
EP4318210A1 (en) 2024-02-07
KR20240011200A (ko) 2024-01-25
JP2024521203A (ja) 2024-05-28

Similar Documents

Publication Publication Date Title
JP7138150B2 (ja) 分散型トレーニング方法、システム、デバイス、記憶媒体、及びプログラム
US9602380B2 (en) Context-aware dynamic policy selection for load balancing behavior
Pyarali et al. Design and Performance of an Object-Oriented Framework for High-Performance Electronic Medical Imaging.
US8713096B2 (en) State control of remote hosts for management of distributed applications
US7984448B2 (en) Mechanism to support generic collective communication across a variety of programming models
KR101076910B1 (ko) 객체 지향 언어로의 병행 프로그램 구현
US9830135B2 (en) Declarative and pluggable business logic for systems management
US9722870B2 (en) Locality and time based dependency relationships in clusters
JP5969610B2 (ja) ポータブルコンピューティングデバイスにおける分散リソース管理
US10656971B2 (en) Agile framework for vertical application development and delivery
WO2022134233A1 (zh) 一种区块链的共识方法、装置、服务器及存储介质
US8433746B2 (en) Aspect oriented programming for an enterprise service bus
Kahani et al. Evaluation of UML-RT and Papyrus-RT for modelling self-adaptive systems
CN112559143A (zh) 任务调度方法、系统及计算设备
US20150220404A1 (en) Undo configuration transactional compensation
WO2022252068A1 (zh) 应用程序构建方法、执行方法、计算设备以及存储介质
US9253286B2 (en) Computer program composed from tabular storage structures that includes data and code
JP5209058B2 (ja) ソフトウェア・コンポーネントを作成するための方法
US9489215B2 (en) Managing an expression-based DFA construction process
JP5716469B2 (ja) ラッパープログラム及び集積回路装置
Schweigler et al. pony-The occam-pi Network Environment.
KR20190104997A (ko) 무상태 메시지 프로토콜을 위한 트랜잭션 자원
JP2003316590A (ja) マルチスレッドプログラム
Ries et al. Model-based Generation of Workunits, Computation Sequences, Series and Service Interfaces for BOINC based Projects
US9207987B2 (en) Dispersion dependency in oracle clusterware

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21943444

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 202180096155.8

Country of ref document: CN

WWE Wipo information: entry into national phase

Ref document number: 2021943444

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2021943444

Country of ref document: EP

Effective date: 20231025

WWE Wipo information: entry into national phase

Ref document number: 2023573584

Country of ref document: JP

ENP Entry into the national phase

Ref document number: 20237045260

Country of ref document: KR

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE