Service implementation method and device
By assigning supervision tasks to subservices and dynamically configuring message topics, the problem of wasting information topic resources under high concurrent traffic in the existing technology is solved, and efficient asynchronous processing services and resource utilization is achieved.
Patent Information
- Application Number
- CN202311577064.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-23
- Publication Date
- 2025-05-23
AI Technical Summary
The existing method of high concurrent traffic through MQ peak cutting requires applying for a large number of topical resources, resulting in resource waste and unbalanced utilization.
Dynamically configure topic indexes and topic values to achieve efficient asynchronous processing services by assigning regulatory tasks to subservices and sending subservice messages to corresponding message topics in the preset message topic cluster.
In the case of high concurrency and large traffic, the pressure on the system by high concurrency services is effectively alleviated, the topic resources of message topics are saved, and the resource utilization rate is improved.
Smart Images

Figure CN120029725A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for implementing a service. Background Art
[0002] Logistics fulfillment service is a comprehensive service that includes warehousing-related sub-services, distribution-related sub-services, and value-added service-related sub-services. Considering the high concurrency scenario of logistics fulfillment service, the existing logistics fulfillment service is mainly implemented by the ERP system issuing orders by calling the order issuing interface of the logistics fulfillment service, and then asynchronously calling the warehousing sub-service, distribution sub-service, and value-added sub-service by sending related sub-service messages to the message queue to alleviate the pressure of high-concurrency logistics fulfillment service on the system.
[0003] In the process of implementing the present invention, the inventors found that the prior art has the following problems:
[0004] The existing method of shaving high concurrent traffic through MQ requires applying for a large number of message topic resources. One business corresponds to one topic channel. When there are many types of businesses, more topic resources will be occupied. In addition, due to business differences, the message occupancy rate in the topic channel is uneven. Some topic channels may only have a few messages, wasting resources. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a method and device for implementing a service, which can effectively alleviate the pressure of high-concurrency services on the system under high-concurrency traffic conditions, save message topic resources, and improve topic resource utilization.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for implementing a service is provided, including:
[0007] In response to receiving the service implementation request, determining sub-services included in the service and corresponding sub-service messages;
[0008] Assigning a corresponding supervision task to the sub-service, and sending the sub-service message to a message topic corresponding to the supervision task, where the message topic is located in a preset message topic cluster;
[0009] In response to monitoring the sub-service message in the message topic, the corresponding execution logic is called to execute the sub-service according to the sub-service message and the supervision task, so as to implement the service.
[0010] Optionally, allocating a corresponding supervision task to the sub-service includes: creating a supervision task corresponding to the sub-service through a task management service; and associating and attaching information of the sub-service to the supervision task.
[0011] Optionally, before sending the sub-service message to the message topic corresponding to the supervision task, the method also includes: generating a topic index based on the task information of the supervision task; determining the message topic corresponding to the supervision task from the message topic cluster, and using the message topic as the value corresponding to the topic index; and configuring the topic index and the value corresponding to the topic index into the configuration file in a dynamic configuration manner.
[0012] Optionally, according to the sub-service message and the supervision task, the corresponding execution logic is called to execute the sub-service, including: determining the business identifier according to the task information of the supervision task; determining the corresponding execution logic according to a pre-built unified processing interface in combination with the business identifier, and dynamically calling the execution logic to execute the sub-service according to the sub-service message.
[0013] Optionally, after calling the corresponding execution logic to execute the sub-service, the method further includes: saving the execution result of the sub-service, and establishing an association relationship between the execution result and the service.
[0014] Optionally, the method further includes: in response to receiving a query request for the service execution result, obtaining a corresponding execution result according to the association relationship, and returning the result to the visual query page.
[0015] Optionally, when the execution result of the service is failure, the method further includes: determining a failed task that failed to execute based on the execution result of the service; resetting the failed task by calling corresponding execution logic; or obtaining an execution log of the failed task, determining the cause of the failure based on the execution log, and determining a notification method for the execution result based on the cause.
[0016] According to a second aspect of an embodiment of the present invention, a device for implementing a service is provided, including:
[0017] A sub-service determination module, configured to determine the sub-services and corresponding sub-service messages included in the service in response to receiving a service implementation request;
[0018] A message topic determination module, used to assign a corresponding supervision task to the sub-service, and send the sub-service message to a message topic corresponding to the supervision task, wherein the message topic is located in a preset message topic cluster;
[0019] The service implementation module is used to respond to the sub-service message monitored in the message topic, and call the corresponding execution logic to execute the sub-service according to the sub-service message and the supervision task to implement the service.
[0020] According to a third aspect of an embodiment of the present invention, there is provided an electronic implementation device for a service, including:
[0021] one or more processors;
[0022] a storage device for storing one or more programs,
[0023] When the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the embodiment of the present invention.
[0024] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method provided by the first aspect of the embodiment of the present invention is implemented.
[0025] An embodiment of the invention has the following advantages or beneficial effects: by responding to receiving a service implementation request, determining the sub-services and corresponding sub-service messages included in the service; assigning corresponding supervision tasks to the sub-services, and sending the sub-service messages to the message topics corresponding to the supervision tasks, and the message topics are located in a preset message topic cluster; in response to monitoring the sub-service messages in the message topics, calling the corresponding execution logic to execute the sub-services according to the sub-service messages and the supervision tasks to implement the technical solution of the service, and realizing a method for efficient asynchronous processing of services. In the case of high concurrency and high traffic, it not only effectively alleviates the pressure of high-concurrency services on the system, but also saves message topic resources and improves the resource utilization of message topic. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0027] Figure 1 is a schematic diagram of the main process of the method for implementing the service according to an embodiment of the present invention;
[0028] Figure 2 It is a comparison diagram of the implementation principle of the service implementation method of the embodiment of the present invention and the existing MQ peak shaving method for high concurrent traffic;
[0029] Figure 3 is a detailed flowchart of a method for implementing a service according to an embodiment of the present invention;
[0030] Figure 4 This is a schematic diagram of main modules of a device for implementing a service according to an embodiment of the present invention;
[0031] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0032] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0033] It should be noted that in the technical solution of the present invention, the collection / collection, update, analysis, use, transmission, storage and other aspects of user personal information involved are in compliance with the provisions of relevant laws and regulations, are used for legal and reasonable purposes, are not shared, leaked or sold outside of these legal uses, and are subject to supervision and management by national regulatory authorities. Necessary measures should be taken for user personal information to selectively block the use or access to personal information data to prevent illegal access to such personal information data, ensure that persons who have access to personal information data comply with the provisions of relevant laws and regulations, and ensure the security of user personal information. In addition, once these user personal information data are no longer needed, the risks should be minimized by limiting or even prohibiting data collection and / or deleting data.
[0034] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0035] The existing method of shaving high concurrent traffic through MQ requires applying for a large number of message topic resources. One business corresponds to one topic channel. When there are many types of businesses, more topic resources will be occupied. In addition, due to business differences, the message occupancy rate in the topic channel is uneven. Some topic channels may only have a few messages, which wastes resources and cannot meet the actual application needs well.
[0036] In order to solve the above problems existing in the prior art, the present invention proposes a method for implementing a service, which establishes a supervision task corresponding to the sub-service according to the sub-service composition of the service, determines the message topic corresponding to the supervision task from the preset message topic cluster, and sends the sub-service message to the determined message topic, so as to consume the sub-service message by calling the corresponding execution logic, thereby implementing the service. A method for efficient asynchronous processing of services is implemented, which effectively alleviates the pressure of high-concurrency services on the system under high-concurrency and high-traffic conditions, saves message topic resources, and improves the resource utilization of message topic.
[0037] In the introduction to the embodiments of the present invention, the terms and their meanings are as follows:
[0038] RPC: is a protocol for requesting services from a remote computer program over a network. It assumes the existence of some transport protocol, such as TCP or UDP, to carry information data between communicating programs.
[0039] DUCC: It is a configuration center that can centrally manage cluster configuration files and dynamically update configuration parameters.
[0040] MQ: Message Queuing is an application-to-application communication method.
[0041] Figure 1 is a schematic diagram of the main process of the method for implementing the service according to an embodiment of the present invention, such as Figure 1 As shown, the service implementation method of the embodiment of the present invention includes the following steps S101 to S103.
[0042] Step S101: In response to receiving a service implementation request, determining sub-services included in the service and corresponding sub-service messages.
[0043] Specifically, the logistics fulfillment service is a comprehensive service. After the order is issued through the order issuing interface, it is necessary to asynchronously call the warehousing sub-service, the distribution sub-service, and the value-added sub-service to complete the content of the fulfillment service. When a service implementation request is received, the specific sub-services included in the service and the corresponding sub-service messages can be determined by parsing the request information. The specific sub-services included in the service and the corresponding sub-service messages can also be determined from the specified storage medium based on the service identifier in the request information. Usually, the sub-services included in the service are multiple businesses, such as the warehousing sub-service, distribution sub-service, and value-added sub-service mentioned above.
[0044] Step S102: assign a corresponding supervision task to the sub-service, and send the sub-service message to a message topic corresponding to the supervision task, where the message topic is in a preset message topic cluster.
[0045] Specifically, considering that the method of asynchronously calling each sub-service through the MQ message queue not only occupies too many message topic resources, but also as time goes by, the system will receive newly created logistics fulfillment services and clean up the completed logistics fulfillment services. Accordingly, topics will be continuously added and abandoned. This asynchronous execution method is not conducive to the management and maintenance of the sub-services corresponding to the topic. The embodiment of the present invention establishes an asynchronous supervision task Task for supervising each sub-service according to the sub-services included in the service, and manages the execution of the sub-services through the supervision task.
[0046] At the same time, considering the reasonable and effective use of message subject resources, the embodiment of the present invention needs to sort out the message volume of each sub-service included in the service in advance, one sub-service corresponds to one message subject topic, count the large data volume topics with message volume greater than the preset threshold, and then combine the number of other topics and the corresponding message volume to determine the number of topics in the topic cluster. For example, for a service including 1,000 businesses, only 74 topics of the corresponding 1,000 topics have a message volume greater than 1,000, and the remaining 926 topics have a very small message volume, then it can be determined that 100 topics can meet the current service. At this time, the number of message subject topics in the message subject cluster is defined as 100, and businesses with small message volumes can share one topic, which effectively saves message subject topic resources compared to the existing 1,000 topics.
[0047] Furthermore, for the supervision task corresponding to the sub-service, by establishing a corresponding relationship between the supervision task and a topic in the message topic cluster, the sub-service message of the sub-service is sent to the corresponding topic, so that the utilization rate of the topic can be reasonably controlled. It can be understood that the embodiment of the present invention determines the message topic corresponding to the sub-service message through the supervision task, and manages the execution status of the sub-service. The task module can be used to encapsulate these specific implementation details, so that the user can obtain the execution status of each sub-service in the service through the task module.
[0048] Figure 2It is a comparison diagram of the implementation principles of the service implementation method of the embodiment of the present invention and the existing MQ peak shaving method for high concurrent traffic. Existing method: Generate a corresponding topic for each business according to the business composition of the service, and then asynchronously call the execution processing logic of each business by asynchronously monitoring the business message to perform business processing. The service implementation method of the embodiment of the present invention: Use the task module to manage the various sub-services of the service, including determining the topic corresponding to the sub-service message, and monitoring the sub-service message, etc., and then asynchronously call the execution processing logic of the sub-service corresponding to each supervision task to perform sub-service processing.
[0049] According to an embodiment of the present invention, allocating a corresponding supervision task to the sub-service includes: creating a supervision task corresponding to the sub-service through a task management service; and associating and attaching information of the sub-service to the supervision task.
[0050] Specifically, an asynchronous supervision task Task of the subservice is created by calling the addTask method of the task management service TaskService, and a corresponding relationship between the subservice and the supervision task is established. Then, the task information of the asynchronous supervision task is constructed based on the application name, business type, warehouse type, carrier channel of the subservice, and the service identifier of the service to which the subservice belongs, and the task information is associated and attached to the asynchronous supervision task.
[0051] According to another embodiment of the present invention, before sending the sub-service message to the message topic corresponding to the supervision task, the method also includes: generating a topic index based on the task information of the supervision task; determining the message topic corresponding to the supervision task from the message topic cluster, and using the message topic as the value corresponding to the topic index; and configuring the topic index and the value corresponding to the topic index into a configuration file in a dynamic configuration manner.
[0052] Specifically, before sending the sub-service message to the message topic corresponding to the supervision task, the embodiment of the present invention generates a topic index Key according to the application name, business type, warehouse type, and carrier channel in the task information; according to the estimated message volume of the business, the corresponding message topic is determined from the preset topic cluster, and the determined message topic is used as the Value, and the determined Key-Value is stored in the dynamically configured DUCC. In this way, in the abnormal case of high storage pressure on the topic, the dynamically configured Value can be changed at any time to achieve real-time switching of topics and ensure the purpose of reasonable allocation of topic resources.
[0053] For example, for the task information whose application name is CO, business type is updateWbPackageBy PackageNo, warehouse type is 100008, and carrier channel is 5, its corresponding topic index Key is CO_updateWbPackageByPackageNo_100008_5. If it is determined that the message topic corresponding to the supervision task is topic9, then the corresponding Value is 9. In addition, the embodiment of the present invention supports dynamic configuration of Key-Value through a visual page to improve configuration efficiency.
[0054] Based on the above dynamic configuration of the correspondence between supervision tasks and message topics, sub-service messages can be sent to the corresponding message topics conveniently, quickly and easily maintained, so as to better balance the amount of messages stored in each topic and improve the resource utilization of message topics.
[0055] Step S103: In response to monitoring the sub-service message in the message topic, calling corresponding execution logic to execute the sub-service according to the sub-service message and the supervision task to implement the service.
[0056] Specifically, the embodiment of the present invention realizes asynchronous self-production and self-consumption of business messages through a message topic cluster. When a sub-task message is monitored in the message topic, the corresponding execution logic is determined according to the task information of the supervision task, and the corresponding sub-service is executed by consuming the sub-task message, thereby realizing the service.
[0057] According to one embodiment of the present invention, based on the sub-service message and the supervision task, the corresponding execution logic is called to execute the sub-service, including: determining the business identifier based on the task information of the supervision task; determining the corresponding execution logic based on a pre-built unified processing interface in combination with the business identifier, and dynamically calling the execution logic to execute the sub-service according to the sub-service message.
[0058] Specifically, in order to facilitate management, the embodiment of the present invention exposes a unified processing interface com.xx.xxx.Handler to the outside, and then determines the specific execution logic in combination with an alias. The specific business identifier is determined according to the application name and business type in the task information, and the business identifier is used as an alias; the corresponding execution logic is then determined through com.xx.xxx.Handler and the alias, so as to dynamically call the execution logic to consume the sub-service message execution sub-service. For example, for distribution-related businesses, they can be divided into distribution sub-services of Logistics Company A, distribution sub-services of Logistics Company B, and distribution sub-services of Logistics Company C according to the fine-grained business type. The alias is obtained according to the application name and business type of the sub-service: Application Name_Logistics Company A. Then, it can be determined that the execution logic of Logistics Company A is dynamically called through the unified processing interface, and the execution logic here can exist in the form of microservices.
[0059] According to another embodiment of the present invention, after calling the corresponding execution logic to execute the sub-service, the method further includes: saving the execution result of the sub-service, and establishing an association relationship between the execution result and the service.
[0060] Specifically, after calling the corresponding execution logic to execute the sub-service, for the integrity and traceability of the sub-service execution, the execution result of the sub-service needs to be saved. For abnormal execution results, the number of calls, error causes, etc. can be saved, and an association between the execution result and the service can be established. This is achieved by obtaining the service identifier of the service to which the sub-service belongs in the task information of the execution result, and then associating the execution result and the service identifier.
[0061] According to another embodiment of the present invention, the method further includes: in response to receiving a query request for the service execution result, obtaining the corresponding execution result according to the association relationship, and returning it to the visual query page.
[0062] Specifically, considering the existing method of cutting high concurrent traffic through MQ, due to a large number of topics and when there is serial interaction logic between services, if an exception occurs during the implementation of the service, it is not easy to quickly locate the link where the exception occurs. The embodiment of the present invention exposes the asynchronous task interface com.xx.xxx.TaskService.addTask in the form of RPC, so as to provide a visual query page through the interface, and obtain the execution results of the tasks corresponding to each business included in the service by entering the service identifier, such as the order number of the order of the logistics fulfillment service, that is, a set of execution results. Of course, it can also be further optimized to only display the tasks with failed execution results. It can be understood that the task information of the task can be displayed in the corresponding execution result in the visual query page, so that the user can obtain complete business-related information. At the same time, considering the reliability of asynchronous tasks, the embodiment of the present invention supports a retry mechanism to further ensure the execution of the task according to the set number of retries. In addition, it also supports updating the topic corresponding to the task by updating the dynamic configuration to facilitate the management and maintenance of the task. Each specific asynchronous task supports viewing the asynchronous task's application, business type, type description, sub-business type, service identifier, error message, processing status, number of retries, whether it is suspended, creation time, update time, and topic cluster information.
[0063] According to another embodiment of the present invention, when the execution result of the service is failure, the method further includes: determining a failed task that failed to execute according to the execution result of the service; resetting the failed task by calling a corresponding execution logic; or obtaining an execution log of the failed task, determining a cause of the failure according to the execution log, and determining a notification method for the execution result according to the cause.
[0064] Specifically, when there is a failed execution result in the execution result of the service, the failed task that failed to execute is determined based on the obtained execution result of the service. For failed tasks, the embodiment of the present invention supports two processing methods. The reset of the failed task can be initiated through the above-mentioned visualization page. At this time, the task information of the task will be directly read, and the corresponding execution logic will be directly called to re-execute the failed business through the unified processing interface combined with the business identifier determined by the task information. In addition, the cause of the failure can be determined based on the execution log, and the cause can be determined as whether it is caused by a business abnormality or a system abnormality, and the corresponding alarm notification will be prompted according to different reasons.
[0065] Figure 3It is a detailed flow chart of the implementation method of the service of the embodiment of the present invention. The embodiment of the present invention uses the above-mentioned determination of the topic corresponding to the sub-service message, the monitoring of the sub-service message, and the asynchronous call of the execution processing logic of each sub-service as an asynchronous peak shaving module. The user ERP system verifies the parameters and pre-occupies the inventory by calling the order issuance interface of the logistics fulfillment service. After the pre-occupation of the inventory is completed, the data message is processed to facilitate the storage of the generated order in the warehouse. Through the asynchronous task interface com.xx.xxx.TaskService.addTask, the composition of the sub-service is determined from the data message of the service, and then the corresponding supervision task can be obtained; the information of the sub-service is encapsulated and associated with the supervision task; then the corresponding topic index Key is determined according to the task information of the supervision task, and the topic channel corresponding to the topic index Key is determined by querying the Key-Value value in the dynamic configuration. Then the task information of the supervision task is stored in the warehouse, and the sub-service message is sent to the above-determined topic channel. When the sub-service message is detected in the topic channel, the corresponding execution logic is determined by calling the unified processing interface com.xx.xxx.Handler, combined with the application name and business type in the task information. For example, for a task with an application name of co and a business type of ql, the corresponding execution logic can be determined through co_ql, and the corresponding execution logic can be called to execute the business, and the execution results (execution status, number of calls, error reasons, etc.) are stored in the task table. In addition, when the execution result of the service is found to be a failure through the visual query page, the failed task is determined, and the failed task is reset by calling the corresponding execution logic. Of course, the reset process is not limited to only when the execution result fails. Users can manually reset the required tasks through the visual query page according to the needs of the scenario.
[0066] Figure 4 FIG. 1 is a schematic diagram of the main modules of the device for implementing the service according to an embodiment of the present invention. Figure 4 As shown, the service implementation device 400 mainly includes a sub-service determination module 401, a message subject determination module 402 and a service implementation module 403.
[0067] The sub-service determination module 401 is used to determine the sub-services and corresponding sub-service messages included in the service in response to receiving the service implementation request;
[0068] A message topic determination module 402, configured to assign a corresponding supervision task to the sub-service, and send the sub-service message to a message topic corresponding to the supervision task, wherein the message topic is located in a preset message topic cluster;
[0069] The service implementation module 403 is used to respond to the sub-service message monitored in the message topic and call the corresponding execution logic to execute the sub-service according to the sub-service message and the supervision task to implement the service.
[0070] According to an embodiment of the present invention, the message subject determination module 402 is further used to: create a supervision task corresponding to the sub-service through a task management service; and associate and attach information of the sub-service to the supervision task.
[0071] According to another embodiment of the present invention, the service implementation device 400 also includes a dynamic configuration module (not shown in the figure), which is used to: generate a topic index according to the task information of the supervision task before sending the sub-service message to the message topic corresponding to the supervision task; determine the message topic corresponding to the supervision task from the message topic cluster, and use the message topic as the value corresponding to the topic index; and configure the topic index and the value corresponding to the topic index into the configuration file in a dynamic configuration manner.
[0072] According to another embodiment of the present invention, the service implementation module 403 is also used to: determine the business identifier based on the task information of the supervision task; determine the corresponding execution logic based on a pre-built unified processing interface and the business identifier, and dynamically call the execution logic to execute the sub-service according to the sub-service message.
[0073] According to another embodiment of the present invention, the service implementation device 400 also includes an execution result storage module (not shown in the figure), which is used to: after calling the corresponding execution logic to execute the sub-service, save the execution result of the sub-service and establish an association relationship between the execution result and the service.
[0074] According to another embodiment of the present invention, the service implementation device 400 also includes an execution result query module (not shown in the figure), which is used to: in response to receiving a query request for the service execution result, obtain the corresponding execution result according to the association relationship, and return it to the visual query page.
[0075] According to another embodiment of the present invention, when the execution result of the service is failure, the service implementation device 400 also includes an execution result processing module (not shown in the figure), which is used to: determine the failed task that failed to execute according to the execution result of the service; reset the failed task by calling the corresponding execution logic; or obtain the execution log of the failed task, determine the cause of the failure according to the execution log, and determine the notification method of the execution result according to the cause.
[0076] Figure 5is an exemplary system architecture diagram to which embodiments of the present invention can be applied.
[0077] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0078] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Terminal devices 501, 502, 503 can be installed with various communication client applications, such as service implementation applications, etc. (only as an example).
[0079] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0080] The server 505 may be a server that provides various services, such as a background management server (only an example) that provides support for the services performed by the user using the terminal devices 501, 502, and 503. In response to receiving a service implementation request, the background management server may determine the sub-services and corresponding sub-service messages included in the service; assign corresponding supervision tasks to the sub-services, and send the sub-service messages to the message topics corresponding to the supervision tasks, and the message topics are located in a preset message topic cluster; in response to monitoring the sub-service messages in the message topics, according to the sub-service messages and the supervision tasks, call the corresponding execution logic to execute the sub-services to implement the services, and feed back the processing results (such as execution, etc. - only an example) to the terminal device.
[0081] It should be noted that the service implementation method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the service implementation device is generally set in the server 505 .
[0082] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0083] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. Figure 6The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0084] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0085] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0086] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0087] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination thereof.
[0088] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0089] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes: a sub-service determination module, a message topic determination module and a service implementation module.
[0090] Among them, the names of these modules do not constitute a limitation of the module itself in some cases. For example, the sub-service determination module can also be described as "a module for determining the sub-services and corresponding sub-service messages included in the service in response to receiving a service implementation request."
[0091] On the other hand, the present invention also provides a computer-readable medium, which may be included in the device described in the embodiment; or it may exist independently without being assembled into the device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by a device, the device includes: in response to receiving a service implementation request, determining the sub-services and corresponding sub-service messages included in the service; assigning a corresponding supervision task to the sub-service, and sending the sub-service message to the message topic corresponding to the supervision task, the message topic being in a preset message topic cluster; in response to monitoring the sub-service message in the message topic, calling the corresponding execution logic to execute the sub-service according to the sub-service message and the supervision task to implement the service.
[0092] According to the technical solution of the embodiment of the present invention, it has the following advantages or beneficial effects: by responding to receiving a service implementation request, determining the sub-services and corresponding sub-service messages included in the service; assigning corresponding supervision tasks to the sub-services, and sending the sub-service messages to the message topics corresponding to the supervision tasks, and the message topics are located in a preset message topic cluster; in response to monitoring the sub-service messages in the message topics, calling the corresponding execution logic to execute the sub-services according to the sub-service messages and the supervision tasks to implement the technical solution of the service, and realizing a method for efficient asynchronous processing of services. In the case of high concurrency and large traffic, it not only effectively alleviates the pressure of high-concurrency services on the system, but also saves message topic resources and improves the resource utilization of message topic.
[0093] The specific implementation methods described herein do not constitute limitations on the scope of protection of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A method for implementing a service, It is characterized in that include: In response to receiving the service implementation request, determining sub-services included in the service and corresponding sub-service messages; Assigning a corresponding supervision task to the sub-service, and sending the sub-service message to a message topic corresponding to the supervision task, where the message topic is located in a preset message topic cluster; In response to monitoring the sub-service message in the message topic, the corresponding execution logic is called to execute the sub-service according to the sub-service message and the supervision task, so as to implement the service.
2. The method according to claim 1, It is characterized in that Assign corresponding supervision tasks to the sub-services, including: Creating a supervision task corresponding to the sub-service through a task management service; The information of the sub-service is associated and attached to the supervision task.
3. The method according to claim 2, It is characterized in that Before sending the sub-service message to the message topic corresponding to the supervision task, the method further includes: Generate a subject index based on the task information of the supervision task; Determine the message topic corresponding to the supervision task from the message topic cluster, and use the message topic as the value corresponding to the topic index; The topic index and the value corresponding to the topic index are configured into a configuration file in a dynamic configuration manner.
4. The method according to claim 2, It is characterized in that According to the sub-service message and the supervision task, calling corresponding execution logic to execute the sub-service includes: Determine a service identifier according to the task information of the supervision task; According to the pre-built unified processing interface, in combination with the service identifier, the corresponding execution logic is determined, and according to the sub-service message, the execution logic is dynamically called to execute the sub-service.
5. The method according to claim 1, It is characterized in that After calling the corresponding execution logic to execute the sub-service, the method further includes: The execution result of the sub-service is saved, and an association relationship between the execution result and the service is established.
6. The method according to claim 5, It is characterized in that The method further comprises: In response to receiving a query request for the service execution result, the corresponding execution result is obtained according to the association relationship and returned to the visual query page.
7. The method according to claim 5, It is characterized in that When the execution result of the service is failure, the method further includes: Determine the failed task that failed to execute according to the execution result of the service; and reset the failed task by calling the corresponding execution logic; Alternatively, the execution log of the failed task is obtained, the cause of the failure is determined according to the execution log, and the notification method of the execution result is determined according to the cause.
8. A device for implementing a service, It is characterized in that include: A sub-service determination module, configured to determine the sub-services and corresponding sub-service messages included in the service in response to receiving a service implementation request; A message topic determination module, used to assign a corresponding supervision task to the sub-service, and send the sub-service message to a message topic corresponding to the supervision task, wherein the message topic is located in a preset message topic cluster; The service implementation module is used to respond to the sub-service message monitored in the message topic, and call the corresponding execution logic to execute the sub-service according to the sub-service message and the supervision task to implement the service.
9. A mobile electronic device terminal, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.