Business configuration method and system
By creating a shared memory space and process registry in the business configuration method and system, distributing and configuring business services, the problems of poor code reuse capabilities and poor configurability caused by the mixing of business functions and service operation control in the existing technology are solved, and efficient business function development and rapid response to new business needs are achieved.
Patent Information
- Application Number
- CN202111451659.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2041-11-30
AI Technical Summary
In the prior art, business functions and service operation control are mixed together, resulting in only one business function being completed for each service being started, poor code reuse capabilities, poor software operation configurability, and long function development cycle.
By providing a business configuration method and system, it receives the services to be executed, creates a shared memory space, distributes services to the main control module, configures functional modules, initiates call instructions based on the task list, starts processing subprocesses, and updates and manages process status according to the process registry.
It realizes the ability to complete multiple business functions for different services, reduces the need to redevelop services when new business needs are required, improves code reuse rate and software configurable performance, and reduces function development cycle and manpower consumption.
Smart Images

Figure CN114153449B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of business processing development, and in particular to a business configuration method and system. Background Art
[0002] In the current technical environment, business functions and service operation control are mixed together. Each service started can only complete one business function, and each new business demand requires the development of a service to achieve it. Therefore, when staff need to handle a certain business, they need to develop a separate service. If some parameters in the business need to be modified, they cannot reference the previous service and can only redevelop a new service, resulting in poor code reuse capabilities during the development process, extremely poor configurability during software operation, and a long function development cycle. Therefore, the industry urgently needs an efficient business-level architecture that can effectively realize code reuse, reduce the workload of staff, and improve the efficiency of development operations. Summary of the invention
[0003] The present invention aims to provide a business configuration method and system to effectively improve code reuse rate and improve development efficiency.
[0004] To achieve the above-mentioned purpose, the present invention provides a business configuration method, which includes: receiving a business to be executed, creating a shared memory space and writing the identity information of a corresponding number of main control modules into a process registry according to the number of services in the business to be executed, and then storing it in the shared memory space; distributing each service in the business to be executed to the main control module, and each main control module configures one or more functional modules in a task list according to the process registry in the shared memory space and the task type of the received service; initiating a call instruction to the corresponding functional module according to the task list, and the functional module starts one or more processing sub-processes according to the call instruction to perform corresponding task processing, and updates the process status of each sub-process to the process registry according to the identification information of the main control module according to a preset period; updating the activity check time and process status of the running main control module in the process registry according to the preset period, and starting and closing the corresponding process according to the process status in the process registry.
[0005] In the above-mentioned business configuration method, preferably, the identity information includes service number, service file name, minimum number of started processes, maximum number of started processes, number of started threads, idle sleep time, log file name, log level and task list.
[0006] In the above service configuration method, preferably, the process status of each subprocess includes the process number, identification information of the main control module, process name, process type, process status, process status update time and activity check time.
[0007] In the above-mentioned business configuration method, preferably, opening and closing the corresponding process according to the process status in the process registry includes: calling a pre-stored management policy according to the process type in the process status, and opening and closing the corresponding process according to the management policy.
[0008] In the above-mentioned business configuration method, preferably, opening and closing the corresponding process according to the management policy includes: when the process type is an initial process or a load process, comparing the difference between the activity check time and the current time with a preset sleep threshold, and closing the corresponding initial process or load process when the comparison result is greater than the first threshold; when the process type is a subprocess, retrieving the identification information corresponding to the subprocess in the process registry, and closing the subprocess according to the retrieval result; when the process type is a load process and the process state is idle, comparing the difference between the process state update time and the current time with a preset sleep threshold, and exiting the corresponding load process when the comparison result is greater than a second threshold; when the total number of processes with the same process name is less than the minimum number of processes to be started, opening an initial process with the same name according to the process name; when all processes with the same process name are in a busy state, the difference between the process state update time and the current time of all processes is greater than the second threshold, and the total number of processes is less than the maximum number of processes to be started, opening a load process with the same name according to the process name.
[0009] In the above service configuration method, preferably, the task types include: message receiving service, message sending service, real-time task processing service, scheduled task processing service and shared memory data processing service.
[0010] The present invention also provides a business configuration system, which includes a node management module, multiple main control modules and multiple functional modules; the node management module is used to create a shared memory space, write the identity information of the corresponding number of main control modules into a process registry according to the number of services in the business to be executed, and then store it in the shared memory space, and distribute each service in the business to be executed to the main control module; and, open and close the corresponding process according to the process status in the process registry; the main control module is used to configure one or more functional modules in a task list according to the task type of the service received according to the process registry in the shared memory space, and initiate a call instruction to the corresponding functional module according to the task list; and, update the activity check time and process status of the current main control module in the process registry according to a preset period; the functional module is used to open one or more processing sub-processes to perform corresponding task processing according to the received call instruction, and register the process status of each sub-process to the process registry according to the identification information of the main control module.
[0011] In the above-mentioned business configuration system, preferably, the node management module includes a management unit, and the management unit is used to call a pre-stored management policy according to the process type in the process state, and open and close the main control module or the functional module according to the management policy.
[0012] 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 the processor implements the above method when executing the computer program.
[0013] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for executing the above method.
[0014] The beneficial technical effect of the present invention is that the business configuration method and system provided by the present invention can complete multiple business functions for different services. When new business needs arise, it is only necessary to add the corresponding functional modules to complete the configuration without redeveloping the service. This effectively increases the code reuse capability during the development process, improves the configurable performance of the software during operation, reduces the time consumption of the function development cycle, and saves manpower. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of the present application, and do not constitute a limitation of the present invention. In the drawings:
[0016] Figure 1 A schematic diagram of a flow chart of a service configuration method provided by an embodiment of the present invention;
[0017] Figure 2 A schematic diagram of process management provided by an embodiment of the present invention;
[0018] Figure 3 A schematic diagram of the structure of a service configuration system provided by an embodiment of the present invention;
[0019] Figure 4 A schematic diagram of the structure of a node management module provided by an embodiment of the present invention;
[0020] Figure 5 The figure is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] The following will describe the implementation methods of the present invention in detail with reference to the accompanying drawings and embodiments, so that the implementation process of how the present invention applies technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly. It should be noted that as long as there is no conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other, and the technical solutions formed are all within the protection scope of the present invention.
[0022] In addition, the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be performed in an order different from that shown here.
[0023] Please refer to Figure 1 As shown, the present invention provides a service configuration method, the method comprising:
[0024] S101 receives a business to be executed, creates a shared memory space, writes the identity information of a corresponding number of master control modules into a process registry according to the number of services in the business to be executed, and then stores the information in the shared memory space;
[0025] S102 distributes each service in the business to be executed to the main control module, and each main control module configures one or more functional modules in the task list according to the process registration table in the shared memory space and the task type of the received service;
[0026] S103 initiates a call instruction to the corresponding function module according to the task list, and the function module starts one or more processing sub-processes according to the call instruction to perform corresponding task processing, and updates and registers the process status of each sub-process to the process registration table according to the preset period according to the identification information of the main control module;
[0027] S104 updates the activity check time and process status of the running main control module in the process registration table according to a preset period, and opens and closes the corresponding process according to the process status in the process registration table.
[0028] Among them, the identity information includes service number, service file name, minimum number of processes to start, maximum number of processes to start, number of threads to start, idle sleep time, log file name, log level and task list. The process status of each subprocess includes process number, identification information of the main control module, process name, process type, process status, process status update time and activity check time. In the specific implementation process, the above embodiment mainly adopts the service-oriented architecture design concept, and divides the service architecture into four layers, namely node manager, main control service, functional module, and functional module subprocess. Among them, the node manager is responsible for the creation and scheduling of the main control service; the main control service is responsible for the scheduling and transaction processing mechanism of the functional module, but does not handle specific functions; each functional module is responsible for the implementation of specific functions, and does not need to care about transaction processing; the functional module subprocess is called by the functional module to realize specific functions; the relationship between the node manager and the main control service and its various functional modules is realized through configuration.
[0029] Please refer to Figure 2 As shown, in one embodiment of the present invention, opening and closing the corresponding process according to the process status in the process registration table includes:
[0030] S201 retrieves a pre-stored management policy according to the process type in the process state;
[0031] S202 opens and closes the corresponding process according to the management policy. Specifically, opening and closing the corresponding process according to the management policy may include: when the process type is an initial process or a load process, comparing the difference between the activity check time and the current time with a preset sleep threshold, and closing the corresponding initial process or load process when the comparison result is greater than the first threshold; when the process type is a subprocess, retrieving the identification information corresponding to the subprocess in the process registry, and closing the subprocess according to the retrieval result; when the process type is a load process, and the process state is idle, comparing the difference between the process state update time and the current time with a preset sleep threshold, and exiting the corresponding load process when the comparison result is greater than the second threshold; when the total number of processes with the same process name is less than the minimum number of processes to be started, opening an initial process with the same name according to the process name; when all processes with the same process name are in a busy state, the difference between the process state update time and the current time of all processes is greater than the second threshold, and the total number of processes is less than the maximum number of processes to be started, opening a load process with the same name according to the process name.
[0032] In actual work, when the node manager is started, a shared memory space is created. The space contains an area for storing the status information of the child threads being started, namely the process registry, which specifically includes the process number, parent process number, process name, process type (initial process, load process, functional module child process), process status (busy, idle), process status update time, and the most recent activity check time. Afterwards, the master process started by the node manager will register basic information in the process registry. After each master process starts itself, it will connect to the shared memory to check whether its own information has been registered. Unregistered processes will automatically exit. The registered master process needs to regularly update its own activity check time and process status during operation. The child process started by the functional module is registered in the process registry by the functional module; the node manager manages the processes in the process registry as follows:
[0033] 1. For a process of type initial process or load process, if its most recent activity check time is more than three times the idle sleep time from the current time, it will be forced to exit.
[0034] 2. For a process of type functional module child process, if its parent process does not exist in the process registry, it will be forced to exit.
[0035] 3. For a process of type load process, if the time of its process status update is more than twice the idle sleep time from the current time, it will be exited normally.
[0036] 4. When the total number of processes with the same process name is less than the minimum number of processes to be started, an additional initial process with the same process name is started.
[0037] 5. When all process states of the same process name are busy, and the process state update time of all processes is more than twice the idle sleep time from the current time, and the total number of processes is less than the maximum number of processes to be started, an additional load process of the process is started.
[0038] In one embodiment of the present invention, the task types include: message receiving service, message sending service, real-time task processing service, scheduled task processing service and shared memory data processing service. Specifically, in actual work, the master control service includes the following types of services, and the functional modules corresponding to different task types (which may be implemented by code or script) are configured in the task list of the corresponding type of service. This part of the configuration information can be modified remotely, thereby realizing the configurability of the function:
[0039] 1. Message receiving service is used to process the sent messages. By configuring the list of processable message types in the task list of message receiving service, the message types that the message service can process can be controlled. The message receiving service will become busy when processing messages, and will be idle when it finds that there are no messages to be processed.
[0040] 2. Message sending service, used to send messages.
[0041] 3. Real-time task processing service is used to process real-time tasks. The characteristics of real-time tasks are irregular data arrival time and high response time requirements. Therefore, multi-threading is used, and each thread processes a task separately. Mutually exclusive snatching is used to ensure that the task will not be executed repeatedly. If there are still unsnatched tasks in the task list, the process status is busy, otherwise it is idle.
[0042] 4. Scheduled task processing service is used to process scheduled tasks. The characteristics of scheduled tasks are regular data arrival time and stable intervals. Therefore, each scheduled service executes a scheduled task separately. According to the specific characteristics of the scheduled task, it can plan its own scheduled start interval and execution duration. If there are still scheduled tasks that have not been obtained in the task list, the process status is not busy, otherwise it is idle.
[0043] 5. Shared memory data processing service is used to handle shared memory interaction tasks. Shared memory is actively input into the shared memory created by this system by other systems. There is unpredictability, so polling is required. When data is read, it enters the busy state, and when no data is read, it enters the idle state.
[0044] Afterwards, after the functional module is called up by the main control, a child process needs to be generated to complete the business function. At this time, the derived child process information is registered in the shared memory, and its parent process is marked as the identification information of the main control process that called up this task module. When an exception occurs in the main control process, the node manager can recycle the resources of the derived child process according to the predetermined rules.
[0045] Please refer to Figure 3As shown, the present invention also provides a business configuration system, the system includes a node management module, multiple main control modules and multiple functional modules; the node management module is used to create a shared memory space, write the identity information of the corresponding number of main control modules into the process registry according to the number of services in the business to be executed, and then store it in the shared memory space, and distribute each service in the business to be executed to the main control module; and, open and close the corresponding process according to the process status in the process registry; the main control module is used to configure one or more functional modules in the task list according to the task type of the service received according to the process registry in the shared memory space, and initiate a call instruction to the corresponding functional module according to the task list; and, update the activity check time and process status of the current main control module in the process registry according to a preset period; the functional module is used to open one or more processing sub-processes according to the received call instruction to perform the corresponding task processing, and update the process status of each sub-process to the process registry according to the identification information of the main control module according to the preset period. For further information, please refer to Figure 4 As shown, the node management module includes a management unit, and the management unit is used to call a pre-stored management strategy according to the process type in the process state, and turn on and off the main control module or the functional module according to the management strategy. The specific implementation method has been described in detail in the above embodiments, and will not be described in detail here.
[0046] The beneficial technical effect of the present invention is that the business configuration method and system provided by the present invention can complete multiple business functions for different services. When new business needs arise, it is only necessary to add the corresponding functional modules to complete the configuration without redeveloping the service. This effectively increases the code reuse capability during the development process, improves the configurable performance of the software during operation, reduces the time consumption of the function development cycle, and saves manpower.
[0047] 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 the processor implements the above method when executing the computer program.
[0048] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for executing the above method.
[0049] like Figure 5 As shown, the electronic device 600 may further include: a communication module 110, an input unit 120, an audio processing unit 130, a display 160, and a power supply 170. It is worth noting that the electronic device 600 does not necessarily have to include Figure 5 In addition, the electronic device 600 may also include Figure 5 For components not shown, reference may be made to the prior art.
[0050] like Figure 5 As shown, the central processor 100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor devices and / or logic devices. The central processor 100 receives inputs and controls the operations of various components of the electronic device 600.
[0051] The memory 140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 100 may execute the program stored in the memory 140 to implement information storage or processing.
[0052] The input unit 120 provides input to the CPU 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used to display display objects such as images and text. The display may be, for example, an LCD display, but is not limited thereto.
[0053] The memory 140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 140 may also be some other type of device. The memory 140 includes a buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application / function storage unit 142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 600 through the central processor 100.
[0054] The memory 140 may also include a data storage unit 143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 144 of the memory 140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0055] The communication module 110 is a transmitter / receiver 110 that transmits and receives signals via an antenna 111. The communication module (transmitter / receiver) 110 is coupled to the central processor 100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0056] Based on different communication technologies, multiple communication modules 110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module. The communication module (transmitter / receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide an audio output via the speaker 131 and receive an audio input from the microphone 132, thereby realizing a common telecommunication function. The audio processor 130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 130 is also coupled to the central processor 100, so that the sound can be recorded on the local machine through the microphone 132, and the sound stored on the local machine can be played through the speaker 131.
[0057] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0058] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0059] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0060] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0061] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A service configuration method, characterized in that: The method comprises: Receive the business to be executed, create a shared memory space, write the identity information of the corresponding number of main control modules into the process registry according to the number of services in the business to be executed, and then store it in the shared memory space; Distribute each service in the business to be executed to the main control module, and each main control module configures one or more functional modules in the task list according to the process registration table in the shared memory space and the task type of the received service; Initiate a call instruction to the corresponding function module according to the task list, and the function module starts one or more processing sub-processes according to the call instruction to perform corresponding task processing, and update and register the process status of each sub-process to the process registration table according to the preset period according to the identification information of the main control module; Update the activity check time and process status of the running main control module in the process registration table according to a preset period, and open and close the corresponding process according to the process status in the process registration table; Opening and closing the corresponding process according to the process status in the process registry comprises: calling a pre-stored management policy according to the process type in the process status, and opening and closing the corresponding process according to the management policy; Among them, opening and closing the corresponding process according to the management policy includes: When the process type is an initial process or a load process, the difference between the activity check time and the current time is compared with a preset sleep threshold, and when the comparison result is greater than a first threshold, the corresponding initial process or load process is closed; When the process type is a subprocess, searching the process registry for identification information corresponding to the subprocess, and closing the subprocess according to the search result; When the process type is a load process and the process state is idle, the difference between the process state update time and the current time is compared with a preset sleep threshold, and when the comparison result is greater than a second threshold, the corresponding load process is exited; When the total number of processes with the same process name is less than the minimum number of processes to start, an initial process with the same name is started according to the process name; When all processes with the same process name are in busy state, the difference between the process state update time of all processes and the current time is greater than the second threshold, and the total number of processes is less than the maximum number of processes to be started, a load process with the same name is started according to the process name.
2. The service configuration method according to claim 1, characterized in that: The identity information includes the service number, service file name, minimum number of processes to be started, maximum number of processes to be started, number of threads to be started, idle sleep time, log file name, log level and task list.
3. The service configuration method according to claim 1, characterized in that: The process status of each subprocess includes the process number, identification information of the main control module, process name, process type, process status, process status update time and activity check time.
4. The service configuration method according to claim 1, characterized in that: The task types include: message receiving service, message sending service, real-time task processing service, scheduled task processing service and shared memory data processing service.
5. A service configuration system, characterized in that: The system comprises a node management module, a plurality of main control modules and a plurality of functional modules; The node management module is used to create a shared memory space, write the identity information of the corresponding number of master control modules into the process registry according to the number of services in the business to be executed, and store it in the shared memory space, and distribute each service in the business to be executed to the master control module; and open and close the corresponding process according to the process status in the process registry; The main control module is used to configure one or more functional modules in a task list according to the process registration table in the shared memory space and the task type of the service received, and to initiate a call instruction to the corresponding functional module according to the task list; and to update the activity check time and process status of the current main control module in the process registration table according to a preset period; The functional module is used to start one or more processing sub-processes to execute corresponding task processing according to the received call instruction, and register the process status of each sub-process into the process registration table according to the identification information of the main control module; The node management module includes a management unit, and the management unit is used to call a pre-stored management strategy according to the process type in the process state, and turn on and off the main control module or the functional module according to the management strategy; Among them, opening and closing the corresponding process according to the management policy includes: When the process type is an initial process or a load process, the difference between the activity check time and the current time is compared with a preset sleep threshold, and when the comparison result is greater than a first threshold, the corresponding initial process or load process is closed; When the process type is a subprocess, searching the process registry for identification information corresponding to the subprocess, and closing the subprocess according to the search result; When the process type is a load process and the process state is idle, the difference between the process state update time and the current time is compared with a preset sleep threshold, and when the comparison result is greater than a second threshold, the corresponding load process is exited; When the total number of processes with the same process name is less than the minimum number of processes to start, an initial process with the same name is started according to the process name; When all processes with the same process name are in busy state, the difference between the process state update time of all processes and the current time is greater than the second threshold, and the total number of processes is less than the maximum number of processes to be started, a load process with the same name is started according to the process name.
6. 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 computer program, the method according to any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for causing a computer to execute the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Service updating method, device and equipment and storage medium
CN111984289A
Spacecraft task scheduling method and device
CN113138812A