Middleware system, service request processing method, electronic device and storage medium
Through the middleware system's plug-in manager and service main program, the basic business functions are modularly encapsulated, the differences in equipment and protocols are blocked, and the plug-in is realized, and the problems of business deployment are solved and the lack of flexibility are improved. Development efficiency and reusability enhance deployment flexibility.
Patent Information
- Application Number
- CN202210067799.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-20
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2042-01-20
AI Technical Summary
In the existing technology, business deployment is difficult and lack of flexibility, resulting in poor reusability of code modules and large upgrade and development work, and it is impossible to effectively deal with the differences and iterative nature of smart devices and systems.
It provides a middleware system, adopts the plug-in manager and the middleware service main program, modularly encapsulates basic business functions through plug-in, blocks differences in device type and connection protocols, uses Socket to provide a unified interface, and supports dynamic configuration and uninstallation of plug-ins. Implement cross-network service functions.
It improves development efficiency and reusability of plug-in modules, greatly improves deployment and configuration flexibility, and solves the problem of insufficient flexibility in business deployment.
Smart Images

Figure CN114466070B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a middleware system, a service request processing method, an electronic device and a storage medium. Background Art
[0002] With the rapid development of smart devices and systems in conjunction with IoT technology and application scenarios, compared to traditional software system development, developers need to deal with challenges such as increasing differences in device types, connection protocols, smart systems, development languages, and deployment methods in addition to business processes, and more frequent iterations. This directly leads to poor code module reusability, heavy workload for upgrade development, and lack of flexibility in deployment and configuration.
[0003] Therefore, how to better improve the development and management of business modules has become an urgent problem to be solved in the industry. Summary of the invention
[0004] The present invention provides a middleware system, a service request processing method, an electronic device and a storage medium, which are used to solve the defects of the prior art in that the service deployment is difficult and the flexibility is lacking.
[0005] The present invention provides a middleware system, comprising: a middleware service main program, a plug-in manager and N plug-ins, where N is a positive integer;
[0006] The middleware service main program is used to receive application service requests from various application programs, and each of the plug-ins corresponds to one or more business functions;
[0007] The plug-in manager is used to call one or more plug-ins based on the application service request to execute the application service request.
[0008] According to a middleware system provided by the present invention, the middleware service main program is also used to send initialization plug-in management information to the plug-in manager when the middleware system is initialized and runs;
[0009] The plug-in manager loads M first target plug-ins among the N plug-ins based on the initialization plug-in management information, and each of the first target plug-ins feeds back first target plug-in information to the middleware service main program.
[0010] According to a middleware system provided by the present invention, the first target plug-in is further used for:
[0011] When executing the application service request, dividing the application service request into a first application service sub-request and a second application service sub-request, and determining a second target plug-in corresponding to the second application service sub-request;
[0012] The first target plug-in processes the first application service sub-request and sends an internal service request to the plug-in manager. In response to the internal service request, the plug-in manager calls the second target plug-in to process the second application service sub-request. The second target plug-in directly feeds back the processing result of the second application service sub-request to the first target plug-in.
[0013] The first target plug-in feeds back the processing results of the first application service sub-request and the second application service sub-request to the middleware server main program.
[0014] According to a middleware system provided by the present invention, when a new third target plug-in is added to the middleware system, the third target plug-in sends plug-in registration information to the plug-in manager, and the plug-in manager writes the third target plug-in into a plug-in function list in response to the plug-in registration information, and synchronizes the plug-in function list to the middleware service main program.
[0015] According to a middleware system provided by the present invention, each of the plug-ins can be dynamically configured to be inserted into the middleware system or uninstalled from the middleware system, and each of the plug-ins runs in a separate thread.
[0016] According to a middleware system provided by the present invention, any of the plug-ins can call existing functions of other plug-ins to implement more complex functions.
[0017] The present invention also provides a service request processing method based on any of the above middleware systems, comprising:
[0018] The middleware service main program receives each application service request and sends the application service request to the plug-in manager;
[0019] The plug-in manager calls one or more plug-ins based on the application service request to execute the application service request.
[0020] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned service request processing methods are implemented.
[0021] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the service request processing methods described above are implemented.
[0022] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of any one of the service request processing methods described above are implemented.
[0023] The middleware system, service request processing method, electronic device and storage medium provided by the present invention provide a middleware system, which modularly encapsulates basic business functions in the form of plug-ins, shields differences in device types, connection protocols, etc., and provides a unified interface. The plug-in framework uses the Socket method to provide basic business services, eliminates differences caused by intelligent systems, development languages, etc., and improves development efficiency and plug-in module reusability. The plug-in module can be dynamically configured for insertion and uninstallation, and can further provide cross-network service functions when using TCP Socket, which greatly improves the flexibility in deployment and configuration. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 A schematic diagram of the structure of a middleware system provided in an embodiment of the present application;
[0026] Figure 2 A flow chart of the service request processing method described in the embodiments of the present application;
[0027] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0029] Figure 1 A schematic diagram of the structure of the middleware system provided in the embodiment of the present application is shown in FIG. Figure 1 As shown, it includes: a middleware service main program 110, a plug-in manager 120 and N plug-ins 130, where N is a positive integer;
[0030] The middleware service main program 110 is used to receive application service requests from various application programs, and each of the plug-ins 130 corresponds to one or more business functions;
[0031] The plug-in manager 120 is used to call one or more plug-ins 130 based on the application service request to execute the application service request.
[0032] Specifically, the middleware system described in the embodiments of the present application is mainly used to connect various device / protocol interfaces with various applications, and each plug-in uses a defined framework interface as a detection and loading interface and is deployed in the form of a dynamic library. The middleware system can dynamically load or unload the dynamic library of the plug-in module to achieve dynamic configuration of specific functions. Each plug-in runs in a separate thread. For complex function plug-ins, it can be extended to run in an independent process to improve the overall stability of the system. The middleware system design supports a plug-in module to call the existing functions of several other plug-in modules to achieve more complex functions, thereby improving module reusability and development efficiency.
[0033] Specifically, each plug-in described in the present application corresponds to one or more external device protocols, and each external device protocol can implement different functions. Therefore, it can be understood that each plug-in can implement one or more business functions.
[0034] Furthermore, through the middleware plug-in, multiple applications can be connected through Socket Connect, thereby receiving application server requests of each application.
[0035] More specifically, after the middleware system receives the application service request through the middleware service main program, it sends the service request to the plug-in manager. The plug-in manager selects the corresponding plug-in from N plug-ins to execute the application service request, and each plug-in feeds back its execution result to the middleware service main program.
[0036] In an embodiment of the present application, a middleware system is provided to modularly encapsulate basic business functions in the form of plug-ins, shield differences in device types, connection protocols, etc., and provide a unified interface. The plug-in framework uses the Socket method to provide basic business services, eliminate differences caused by intelligent systems, development languages, etc., and improve development efficiency and plug-in module reusability. The plug-in module can be dynamically configured for insertion and uninstallation, and can further provide cross-network service functions when using TCP Socket, greatly improving the flexibility in deployment and configuration.
[0037] Optionally, the middleware service main program is further used to send initialization plug-in management information to the plug-in manager when the middleware system is initialized and runs;
[0038] The plug-in manager loads M first target plug-ins among the N plug-ins based on the initialization plug-in management information, and each of the first target plug-ins feeds back first target plug-in information to the middleware service main program.
[0039] Specifically, in the embodiment of the present application, when the middleware system is used for the first time, it needs to be initialized. At this time, the middleware service main program generates initialization plug-in management information and sends the initialization plug-in management information to the plug-in manager.
[0040] Specifically, the initialization plug-in management information described in the embodiment of the present application will include plug-in information that needs to be called or uninstalled during the initialization process, and the plug-in manager will load M first target plug-ins among the N plug-ins based on the initialization plug-in management information.
[0041] The M first target plug-ins described in the embodiment of the present application are the plug-in information called in the initialization plug-in management information.
[0042] In an embodiment of the present application, when the middleware system is initially used, initialization plug-in management information can be generated and a basic first target plug-in can be configured to complete basic business functions.
[0043] Optionally, the first target plug-in is further used for:
[0044] When executing the application service request, dividing the application service request into a first application service sub-request and a second application service sub-request, and determining a second target plug-in corresponding to the second application service sub-request;
[0045] The first target plug-in processes the first application service sub-request and sends an internal service request to the plug-in manager. In response to the internal service request, the plug-in manager calls the second target plug-in to process the second application service sub-request. The second target plug-in directly feeds back the processing result of the second application service sub-request to the first target plug-in.
[0046] The first target plug-in feeds back the processing results of the first application service sub-request and the second application service sub-request to the middleware server main program.
[0047] After the plug-in manager selects a suitable first target plug-in for execution, the first target plug-in can be divided into several sub-steps or sub-functions according to actual functions, that is, determining the first application service sub-request to be processed by the first target plug-in and the second application service sub-request to be processed by other plug-ins.
[0048] The first target plug-in can send multiple internal service requests to the plug-in manager for some of the sub-steps or sub-functions, i.e., the second application service sub-requests. After receiving the internal service requests, the plug-in manager selects appropriate second target plug-ins one by one to implement the sub-steps or sub-functions. The second target plug-in directly feeds back the execution results to the first target plug-in. This process can be repeated and recursive in design.
[0049] After completing all functions, the first target plug-in feeds back the final execution result to the middleware server main program.
[0050] In the embodiment of the present application, the middleware system design supports one plug-in module to call the existing functions of several other plug-in modules to implement more complex functions, thereby improving module reusability and development efficiency.
[0051] Optionally, when a new third target plug-in is added to the middleware system, the third target plug-in sends plug-in registration information to the plug-in manager. In response to the plug-in registration information, the plug-in manager writes the third target plug-in into a plug-in function list and synchronizes the plug-in function list to the middleware service main program.
[0052] Specifically, the middleware system described in the embodiments of the present application supports dynamic loading or unloading of plug-in module dynamic libraries to achieve dynamic configuration of specific functions. When a new third target plug-in is added to the middleware system, the third target plug-in will be processed in the plug-in manager, and the third target plug-in will be written into the plug-in function list. Finally, the plug-in function list will be synchronized to the middleware service main program. The plug-in list records the names of all plug-ins that can be called by the plug-in manager.
[0053] It is understandable that, in the case of dynamic uninstallation to the fifth target plug-in in the middleware system, the plug-in manager will delete the fifth target plug-in from the plug-in function list, and then synchronize the updated plug-in function list to the middleware service main program.
[0054] In the embodiment of the present application, the middleware system described in the embodiment of the present application supports dynamic loading or unloading of plug-in module dynamic libraries, which is convenient for users to deploy.
[0055] Optionally, each of the plug-ins is deployed in a dynamic library manner, so that each plug-in can be dynamically configured to be inserted into the middleware system or uninstalled from the middleware system, and each of the plug-ins runs in a separate thread.
[0056] Specifically, each plug-in in the embodiment of the present application runs independently without affecting each other, and each plug-in can be dynamically configured and added to the middleware system during the normal operation of the middleware system, or uninstalled from the middleware system during the normal operation of the middleware system.
[0057] Optionally, the plug-in described in the embodiments of the present application specifically defines one or more of the following contents:
[0058] 1. Entry registration function, returns the plug-in handle
[0059] 2. Get the plugin name
[0060] 3. Get the plugin function list
[0061] 4. Plugin initialization and deinitialization
[0062] 5. Run and clean up
[0063] 6. Client access and exit
[0064] 7. Message processing
[0065] 8. Request processing
[0066] 9. Internal request processing
[0067] In the embodiment of the present application, the middleware system can dynamically load or unload the dynamic library of the plug-in module to achieve dynamic configuration of specific functions.
[0068] Figure 2 Schematic diagram of the service request processing method described in the embodiment of the present application. Figure 2 As shown, including:
[0069] Step 210, the middleware service main program receives each application service request and sends the application service request to the plug-in manager;
[0070] Step 220: The plug-in manager calls one or more plug-ins based on the application service request to execute the application service request.
[0071] The middleware system described in the embodiments of the present application is mainly used to connect various device / protocol interfaces with various applications, and each plug-in uses a defined framework interface as a detection and loading interface and is deployed in the form of a dynamic library. The middleware system can dynamically load or unload the dynamic library of the plug-in module to achieve dynamic configuration of specific functions. Each plug-in runs in a separate thread. For complex function plug-ins, it can be extended to run in an independent process to improve the overall stability of the system. The middleware system design supports a plug-in module to call the existing functions of several other plug-in modules to achieve more complex functions, thereby improving module reusability and development efficiency.
[0072] Specifically, after the middleware service main program receives the application service request, the middleware system sends the service request to the plug-in manager. The plug-in manager selects the corresponding plug-in from N plug-ins to execute the application service request, and each plug-in feeds back its execution result to the middleware service main program.
[0073] In an embodiment of the present application, a middleware system is provided to modularly encapsulate basic business functions in the form of plug-ins, shield differences in device types, connection protocols, etc., and provide a unified interface. The plug-in framework uses Socket to provide basic business services, eliminates differences caused by intelligent systems, development languages, etc., improves development efficiency and plug-in module reusability. Plug-in modules can be dynamically configured for insertion and uninstallation, and can further provide cross-network service functions when using TCP Socket, greatly improving the flexibility in deployment and configuration.
[0074] Figure 3 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the service request processing method, which includes: the middleware service main program receives each application service request and sends the application service request to the plug-in manager; the plug-in manager calls one or more plug-ins based on the application service request to execute the application service request.
[0075] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0076] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the service request processing method provided by the above-mentioned methods. The method includes: the middleware service main program receives each application service request and sends the application service request to the plug-in manager; the plug-in manager calls one or more plug-ins to execute the application service request based on the application service request.
[0077] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the service request processing method provided by the above-mentioned methods. The method includes: the middleware service main program receives each application service request and sends the application service request to the plug-in manager; the plug-in manager calls one or more plug-ins to execute the application service request based on the application service request.
[0078] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0079] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A middleware system, characterized in that: Includes: a middleware service main program, a plug-in manager and N plug-ins, where N is a positive integer; The middleware service main program is used to receive application service requests from various application programs, and each of the plug-ins corresponds to one or more business functions; The plug-in manager is used to call one or more plug-ins based on the application service request to execute the application service request; The middleware service main program is also used to send initialization plug-in management information to the plug-in manager when the middleware system is initialized and runs; The plug-in manager loads M first target plug-ins among the N plug-ins based on the initialization plug-in management information, and each of the first target plug-ins feeds back first target plug-in information to the middleware service main program; Wherein, the first target plug-in is further used for: When executing the application service request, dividing the application service request into a first application service sub-request and a second application service sub-request, and determining a second target plug-in corresponding to the second application service sub-request; The first target plug-in processes the first application service sub-request and sends an internal service request to the plug-in manager. In response to the internal service request, the plug-in manager calls the second target plug-in to process the second application service sub-request. The second target plug-in directly feeds back the processing result of the second application service sub-request to the first target plug-in. The first target plug-in feeds back the processing results of the first application service sub-request and the second application service sub-request to the middleware service main program.
2. The middleware system according to claim 1, characterized in that: When a new third target plug-in is added to the middleware system, the third target plug-in sends plug-in registration information to the plug-in manager. In response to the plug-in registration information, the plug-in manager writes the third target plug-in into a plug-in function list and synchronizes the plug-in function list to the middleware service main program.
3. The middleware system according to claim 1, characterized in that: Each of the plug-ins can be dynamically configured to be inserted into the middleware system or uninstalled from the middleware system, and each of the plug-ins runs in a separate thread.
4. A service request processing method based on the middleware system according to any one of claims 1 to 3, characterized in that: include: The middleware service main program receives each application service request and sends the application service request to the plug-in manager; The plug-in manager calls one or more plug-ins based on the application service request to execute the application service request.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the service request processing method according to claim 4 are implemented.
6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the service request processing method according to claim 4 are implemented.
7. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the service request processing method according to claim 4 are implemented.
