Synchronous message communication method and device, computer equipment, readable storage medium and program product

By using distributed key-value databases to realize synchronous message communication between clients and servers in the private cloud, the deployment complexity and inefficient resource utilization caused by limited resources are solved, and efficient resource utilization and simplified deployment process is achieved.

CN119473661APending Publication Date: 2025-02-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411667333.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the private cloud field, limited resources lead to complex deployment processes, high resource consumption and low resource utilization.

Method used

Through the distributed key-value database, synchronous message communication between the client and the server is realized, new pending tasks are created, topic and business data are written into message tasks, and sent to the distributed key-value database. The message tasks are sent to the server through the listening mechanism Process and send the processing results back to the client.

Benefits of technology

It simplifies the deployment process, reduces resource consumption, improves resource utilization, and realizes efficient communication between clients and servers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473661A_ABST
    Figure CN119473661A_ABST
Patent Text Reader

Abstract

The invention relates to a synchronous message communication method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: newly establishing a to-be-processed task, writing a theme of a server corresponding to a client into a message header of the to-be-processed task, and writing service data into a message body of the to-be-processed task to obtain a message task; sending the message task to a distributed key value database; sending the message task to the server side to indicate a distributed key value database to send the message task to the server side through a monitoring mechanism; sending the message task to the server to instruct the server to process the message task and write a processing result into the message task to obtain a processing task; sending the processing task to a distributed key value database; sending the processing task to the client by the distributed key value database to indicate the distributed key value database to send the processing task to the client through a monitoring mechanism; a processing task from a distributed key value database is received. The method can simplify the deployment process and reduce resource consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing communication technology, and in particular to a synchronous message communication method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] Building a complete cloud computing product does require a lot of components and technologies, and OpenStack is a typical example. As an open source cloud computing management platform, OpenStack covers multiple aspects such as computing, storage, and networking, and relies on multiple components to implement its functions, such as databases (such as MySQL or PostgreSQL for storing metadata), RabbitMQ (as a message queue for asynchronous communication between components), etc.

[0003] However, in the field of private cloud, resources are often limited, including hardware resources (such as servers, storage devices, network devices, etc.) and software resources (such as operating systems, middleware, applications, etc.). Therefore, when deploying private cloud, simplifying the deployment process, reducing resource consumption, and improving resource utilization have become important considerations. Summary of the invention

[0004] Based on this, it is necessary to provide a synchronous message communication method, device, computer equipment, computer-readable storage medium and computer program product that can simplify the deployment process, reduce resource consumption and improve resource utilization in response to the above technical problems.

[0005] In a first aspect, the present application provides a synchronous message communication method, applied to a client, comprising:

[0006] Create a new task to be processed, write the subject of the server corresponding to the client into the message header of the task to be processed, write the business data into the message body of the task to be processed, and obtain a message task;

[0007] Send the message task to the distributed key-value database; instruct the distributed key-value database to send the message task to the server through a monitoring mechanism; instruct the server to process the message task and write the processing result into the message task to obtain a processing task; send the processing task to the distributed key-value database; instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism;

[0008] Receive processing tasks from the distributed key-value database.

[0009] In one of the embodiments, the message header of the message task further includes: a message task identifier and a timeout duration;

[0010] The receiving of the processing task from the distributed key-value database includes: if the processing task corresponding to the message task identifier is not received within the timeout period, then stop waiting; if the processing task corresponding to the message task identifier is received within the timeout period, then record the processing task.

[0011] In a second aspect, the present application provides a synchronous message communication method, which is applied to a distributed key-value database, including:

[0012] Receive a message task from a client, wherein the message task is obtained by writing the subject of the server corresponding to the client into the message header of the task to be processed and writing the business data into the message body of the task to be processed after the client creates a task to be processed;

[0013] The message task is sent to the server through a monitoring mechanism; the server is instructed to process the message task and write the processing result into the message task to obtain a processing task; the processing task is sent to a distributed key-value database;

[0014] The processing task is sent to the client through a monitoring mechanism.

[0015] In one embodiment, the establishment of the monitoring mechanism includes:

[0016] Receive a first listening request from a client; parse the first listening request to obtain a first listening topic to be listened to by the client; establish a first listening object, and when the message header of a received processing task includes the first listening topic, send the processing task to the client; receive a second listening request from a server, parse the second listening request to obtain a second topic to be listened to by the server; establish a second listening object, and when the message header of a received message task includes the second listening topic, send the message task to the server.

[0017] In a third aspect, the present application provides a synchronous message communication method, applied to a server, comprising:

[0018] Receive a message task from a distributed key-value database; the message task is sent by the distributed key-value database through a monitoring mechanism. After the client creates a new task to be processed, the message task writes the subject of the server corresponding to the client into the message header of the task to be processed, writes the business data into the message body of the task to be processed, and sends it to the distributed key-value database;

[0019] The message task is processed and the processing result is written into the message task to obtain a processing task; the processing task is sent to a distributed key-value database; and the distributed key-value database is instructed to send the processing task to the client through a monitoring mechanism.

[0020] In one embodiment, the message header of the message task includes: the message sending time and the timeout duration; before processing the message task, it also includes:

[0021] Obtain the message sending time and timeout duration from the message header of the message task; determine the timeout time based on the message sending time and the timeout duration; if the current time is less than the timeout time, judge the message task as timed out and ignore the message task; if the current time is not less than the timeout time, judge the message task as not timed out and process the message task.

[0022] In a fourth aspect, the present application further provides a synchronous message communication device, applied to a client, comprising:

[0023] A creation module is used to create a new task to be processed, write the subject of the server corresponding to the client into the message header of the task to be processed, write the business data into the message body of the task to be processed, and obtain a message task.

[0024] A message task sending module is used to send the message task to a distributed key-value database; to instruct the distributed key-value database to send the message task to the server through a monitoring mechanism; to instruct the server to process the message task and write the processing result into the message task to obtain a processing task; to send the processing task to the distributed key-value database; to instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism.

[0025] The processing task receiving module is used to receive processing tasks from the distributed key-value database.

[0026] In a fifth aspect, the present application also provides a synchronous message communication device, which is applied to a distributed key-value database, including:

[0027] The message receiving module is used to receive message tasks from the client. The message task is obtained by writing the subject of the server corresponding to the client into the message header of the task to be processed and writing the business data into the message body of the task to be processed after the client creates a new task to be processed.

[0028] The message task forwarding module is used to send the message task to the server through a monitoring mechanism; to instruct the server to process the message task and write the processing result into the message task to obtain a processing task; and to send the processing task to a distributed key-value database.

[0029] The processing task forwarding module is used to send the processing task to the client through a monitoring mechanism.

[0030] In a sixth aspect, the present application further provides a synchronous message communication device, applied to a server, comprising:

[0031] A message task receiving module is used to receive message tasks from a distributed key-value database; the message task is sent by the distributed key-value database through a monitoring mechanism, and after the client creates a new task to be processed, the subject of the server corresponding to the client is written into the message header of the task to be processed, and the business data is written into the message body of the task to be processed and sent to the distributed key-value database;

[0032] The processing task sending module is used to process the message task and write the processing result into the message task to obtain the processing task; send the processing task to the distributed key-value database; and instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism.

[0033] In a seventh aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps described in the first aspect, the second aspect, or the third aspect when executing the computer program.

[0034] In an eighth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps described in the first aspect, the second aspect, or the third aspect.

[0035] In a ninth aspect, the present application further provides a computer program product, comprising a computer program, which implements the steps described in the first aspect, the second aspect or the third aspect when executed by a processor.

[0036] The above-mentioned synchronous message communication method, device, computer equipment, computer-readable storage medium and computer program product create a new task to be processed, write the subject of the server corresponding to the client into the message header of the task to be processed, write the business data into the message body of the task to be processed, and obtain the message task; send the message task to a distributed key-value database; instruct the distributed key-value database to send the message task to the server through a monitoring mechanism; instruct the server to process the message task and write the processing result into the message task to obtain a processing task; send the processing task to a distributed key-value database; instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism; receive the processing task from the distributed key-value database. Realizing communication between the client and the server based on a distributed key-value database can simplify the deployment process, reduce resource consumption and improve resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0038] FIG1 is a schematic diagram of a process of applying a synchronous message communication method to a client in one embodiment;

[0039] FIG2 is a schematic diagram of a process of applying a synchronous message communication method to a distributed key-value database in one embodiment;

[0040] FIG3 is a schematic diagram of a process of applying a synchronous message communication method to a server in one embodiment;

[0041] FIG4 is a schematic diagram of a workflow of a synchronous message communication method in one embodiment;

[0042] FIG5 is a structural diagram of a synchronous message communication device applied to a client in one embodiment;

[0043] FIG6 is a structural diagram of a synchronous message communication device applied to a distributed key-value database in one embodiment;

[0044] FIG7 is a structural diagram of a synchronous message communication device applied to a server in one embodiment;

[0045] FIG8 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

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

[0047] In one embodiment, as shown in FIG1 , a synchronous message communication method is provided, which is applied to a client. In this embodiment, the method includes the following steps:

[0048] Step 102, creating a new task to be processed, writing the subject of the server corresponding to the client into the message header of the task to be processed, and writing the business data into the message body of the task to be processed to obtain a message task.

[0049] Among them, the topic is associated with the publish / subscribe function. The server can register its own service in the distributed key-value database and specify a topic. The client can find available services by searching this topic.

[0050] Among them, the message header belongs to system data, including: subject, message task identifier, sending time and timeout time, etc.

[0051] Optionally, the subject may be the port number of the server. The business data may be configuration information.

[0052] Exemplarily, a new task to be processed is created, the port number of the server corresponding to the client is written into the message header of the task to be processed, a lease is bound, and the configuration information is written into the message body of the task to be processed to obtain the message task.

[0053] Among them, a lease is a mechanism for maintaining data consistency and coordinating resource access. Specifically, a lease can be regarded as a contract or agreement that stipulates the control or access rights of a client to a message task, etc. within a certain period of time.

[0054] Step 104, sending the message task to the distributed key-value database; instructing the distributed key-value database to send the message task to the server through a monitoring mechanism; instructing the server to process the message task and write the processing result into the message task to obtain a processing task; sending the processing task to the distributed key-value database; instructing the distributed key-value database to send the processing task to the client through a monitoring mechanism.

[0055] Optionally, the distributed key-value database may be etcd.

[0056] Exemplarily, the message task is sent to ETCD; ETCD is instructed to send the message task to the server through a monitoring mechanism; the server is instructed to process the message task and write the processing result into the message task to obtain a processing task; the processing task is sent to a distributed key-value database; the distributed key-value database is instructed to send the processing task to the client through a monitoring mechanism.

[0057] Step 106: Receive a processing task from the distributed key-value database.

[0058] Exemplarily, a processing task is received from ETCD.

[0059] In an exemplary embodiment, the message header of the message task further includes: a message task identifier and a timeout duration;

[0060] The receiving of the processing task from the distributed key-value database includes: if the processing task corresponding to the message task identifier is not received within the timeout period, then stop waiting; if the processing task corresponding to the message task identifier is received within the timeout period, then record the processing task.

[0061] The message task identifier is unique and is used to distinguish different message tasks.

[0062] Among them, a server can communicate with multiple clients, while a client only communicates with one server. Therefore, the client determines whether it is the processing task it needs through the unique identification code in the message header of the processing task.

[0063] Optionally, the timeout period can be 1 second.

[0064] Exemplarily, if the processing task corresponding to the message task identifier is not received for more than 1 second, the waiting is stopped; if the processing task corresponding to the message task identifier is received within 1 second, the processing task is recorded.

[0065] In this embodiment, if the task times out, the waiting stops, which can prevent the situation where the task continues to wait and other message tasks are not processed because no task is received.

[0066] The above-mentioned synchronous message communication method, device, computer equipment, computer-readable storage medium and computer program product create a new task to be processed, write the subject of the server corresponding to the client into the message header of the task to be processed, write the business data into the message body of the task to be processed, and obtain the message task; send the message task to a distributed key-value database; instruct the distributed key-value database to send the message task to the server through a monitoring mechanism; instruct the server to process the message task and write the processing result into the message task to obtain a processing task; send the processing task to a distributed key-value database; instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism; receive the processing task from the distributed key-value database. Realizing communication between the client and the server through a distributed key-value database can simplify the deployment process, reduce resource consumption and improve resource utilization.

[0067] In one embodiment, as shown in FIG2 , a synchronous message communication method is provided, which is applied to a distributed key-value database. In this embodiment, the method includes the following steps:

[0068] Step 202, receiving a message task from the client, wherein the message task is obtained by writing the subject of the server corresponding to the client into the message header of the task to be processed and writing the business data into the message body of the task to be processed after the client creates a task to be processed.

[0069] Among them, the message header of the message task includes a subject. After receiving the message task, the message header will be parsed to obtain the subject.

[0070] Among them, not only can it receive message tasks from the client, but it can also receive processing tasks from the server.

[0071] Exemplarily, a message task is received from a client and a subject of the message task is obtained. After the client creates a new task to be processed, the subject of the server corresponding to the client is written into the message header of the task to be processed, and the business data is written into the message body of the task to be processed.

[0072] Step 204, sending the message task to the server through a monitoring mechanism; instructing the server to process the message task and write the processing result into the message task to obtain a processing task; and sending the processing task to a distributed key-value database.

[0073] Among them, the server to be sent is determined by the topic.

[0074] Exemplarily, through a monitoring mechanism, the message task is sent to a server corresponding to the topic; to instruct the server to process the message task and write the processing result into the message task to obtain a processing task; and the processing task is sent to a distributed key-value database.

[0075] Step 206: Send the processing task to the client through a monitoring mechanism.

[0076] Among them, one server can communicate with multiple clients, and one client only communicates with one server. Therefore, the processing task is sent to multiple clients communicating with the server of the corresponding topic through the topic in the message header of the processing task.

[0077] Exemplarily, the processing task is sent to the client through a monitoring mechanism.

[0078] In an exemplary embodiment, the establishment of the monitoring mechanism includes:

[0079] Receive a first listening request from a client; parse the first listening request to obtain a first listening topic to be listened to by the client; establish a first listening object, and when the message header of a received processing task includes the first listening topic, send the processing task to the client; receive a second listening request from a server, parse the second listening request to obtain a second topic to be listened to by the server; establish a second listening object, and when the message header of a received message task includes the second listening topic, send the message task to the server.

[0080] Among them, the theme and the server correspond one to one, and the second theme is the theme of each server itself.

[0081] Exemplarily, a first listening request is received from a client; the first listening request is parsed to obtain a first listening topic to be listened to by the client; a first listening object is established, and when the message header of the received processing task includes the first listening topic, the processing task is sent to the corresponding client; a second listening request is received from a server, the second listening request is parsed to obtain a second topic to be listened to by the server; a second listening object is established, and when the message header of the received message task includes the second listening topic, the message task is sent to the server.

[0082] In this embodiment, through the monitoring mechanism, the required message tasks or processing tasks can be monitored at all times and the corresponding data can be obtained in time.

[0083] The above-mentioned synchronous message communication method, device, computer equipment, computer-readable storage medium and computer program product receive a message task from a client. After the client creates a new task to be processed, the message task is obtained by writing the subject of the server corresponding to the client into the message header of the task to be processed and writing the business data into the message body of the task to be processed. The message task is sent to the server through a monitoring mechanism; the server is instructed to process the message task and write the processing result into the message task to obtain a processing task; the processing task is sent to a distributed key-value database. The processing task is sent to the client through a monitoring mechanism. Realizing communication between the client and the server through a distributed key-value database can simplify the deployment process, reduce resource consumption and improve resource utilization.

[0084] In one embodiment, as shown in FIG3 , a synchronous message communication method is provided, which is applied to a server. In this embodiment, the method includes the following steps:

[0085] Step 302, receiving a message task from a distributed key-value database; the message task is sent by the distributed key-value database through a monitoring mechanism, and after the client creates a new task to be processed, the message task writes the subject of the server corresponding to the client into the message header of the task to be processed, writes the business data into the message body of the task to be processed, and sends it to the distributed key-value database.

[0086] Among them, the message task is sent to the server by the distributed key-value database through the topic of the message task using the monitoring mechanism.

[0087] Exemplarily, a message task is received from a distributed key-value database; the message task is sent by the distributed key-value database through a monitoring mechanism. After the client creates a new task to be processed, the subject of the server corresponding to the client is written into the message header of the task to be processed, and the business data is written into the message body of the task to be processed and sent to the distributed key-value database.

[0088] Step 304, process the message task and write the processing result into the message task to obtain a processing task; send the processing task to a distributed key-value database; instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism.

[0089] Before processing the message task and writing the processing result into the message task, it is determined whether the message task has timed out.

[0090] Exemplarily, if the message task has not timed out, the message task is processed and the processing result is written into the message task to obtain a processing task; the processing task is sent to the distributed key-value database; to instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism.

[0091] In an exemplary embodiment, the message header of the message task includes: message sending time and timeout duration; before processing the message task, it also includes:

[0092] Obtain the message sending time and timeout duration from the message header of the message task; determine the timeout time based on the message sending time and the timeout duration; if the current time is less than the timeout time, judge the message task as timed out and ignore the message task; if the current time is not less than the timeout time, judge the message task as not timed out and process the message task.

[0093] Exemplarily, the message sending time and timeout duration are obtained from the message header of the message task; the timeout time can be obtained by adding the message sending time to the timeout duration; if the current time is less than the timeout time, the message task is judged to be timed out and the message task is ignored; if the current time is not less than the timeout time, the message task is judged to be not timed out and the message task is processed.

[0094] In this embodiment, by determining whether a message task has timed out, those message tasks that have timed out and are discarded are discarded, thereby preventing time from being wasted due to processing discarded message tasks.

[0095] The above-mentioned synchronous message communication method, device, computer equipment, computer-readable storage medium and computer program product receive message tasks from a distributed key-value database; the message task is sent by the distributed key-value database through a monitoring mechanism, and after the client creates a new task to be processed, the subject of the server corresponding to the client is written into the message header of the task to be processed, and the business data is written into the message body of the task to be processed to obtain and send it to the distributed key-value database. The message task is processed and the processing result is written into the message task to obtain a processing task; the processing task is sent to the distributed key-value database; to instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism. Realizing communication between the client and the server through a distributed key-value database can simplify the deployment process, reduce resource consumption and improve resource utilization.

[0096] In an exemplary embodiment, as shown in FIG4 , a synchronous message communication method is applied to a system consisting of a client, a distributed key-value database and a server. A client communicates with only one server, and a server communicates with multiple clients. Each topic corresponds to a server, and the client and the server communicate through the corresponding topic. The above-mentioned synchronous message communication method includes:

[0097] The server sends a monitoring request to the distributed key-value database ETCD, and the prefix of the monitoring request is the subject of the server itself, so as to monitor the message task sent to the server; the client sends a monitoring request to the distributed key-value database ETCD, and the prefix of the monitoring request is the subject of the server to be communicated, so as to monitor the processing task of the corresponding subject. After the monitoring event is established, communication can be carried out. First, the server creates a new task to be processed, writes the subject of the server corresponding to the client into the message header of the task to be processed, writes the business data into the message body of the task to be processed, and obtains the message task, which has a message task identification code; then sends the message task to the distributed key-value database. The distributed key-value database receives the message task from the client, and sends the message task to the server through the monitoring mechanism. The server receives the message task from the distributed key-value database; processes the message task and writes the processing result into the message task to obtain the processing task; and sends the processing task to the distributed key-value database. After receiving the processing task, the distributed key-value database sends the processing task to the client through the monitoring mechanism. The client receives the processing task from the distributed key-value database.

[0098] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0099] In an exemplary embodiment, as shown in FIG5 , a synchronous message communication device is provided, which is applied to a client and includes: a creation module, a message task sending module and a processing task receiving module, wherein:

[0100] A creation module is used to create a new task to be processed, write the subject of the server corresponding to the client into the message header of the task to be processed, write the business data into the message body of the task to be processed, and obtain a message task.

[0101] A message task sending module is used to send the message task to a distributed key-value database; to instruct the distributed key-value database to send the message task to the server through a monitoring mechanism; to instruct the server to process the message task and write the processing result into the message task to obtain a processing task; to send the processing task to the distributed key-value database; to instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism.

[0102] The processing task receiving module is used to receive processing tasks from the distributed key-value database.

[0103] In one embodiment, the processing task receiving module is further used to:

[0104] If the processing task corresponding to the message task identifier is not received within the timeout period, the waiting is stopped; if the processing task corresponding to the message task identifier is received within the timeout period, the processing task is recorded.

[0105] In an exemplary embodiment, as shown in FIG6 , a synchronous message communication device is provided, which is applied to a distributed key-value database, and includes: a message receiving module, a message task forwarding module, and a processing task forwarding module, wherein:

[0106] The message receiving module is used to receive message tasks from the client. The message task is obtained by writing the subject of the server corresponding to the client into the message header of the task to be processed and writing the business data into the message body of the task to be processed after the client creates a new task to be processed.

[0107] The message task forwarding module is used to send the message task to the server through a monitoring mechanism; to instruct the server to process the message task and write the processing result into the message task to obtain a processing task; and to send the processing task to a distributed key-value database.

[0108] The processing task forwarding module is used to send the processing task to the client through a monitoring mechanism.

[0109] In one embodiment, the monitoring module is further included, which is used to:

[0110] Receive a first listening request from a client; parse the first listening request to obtain a first listening topic to be listened to by the client; establish a first listening object, and when the message header of a received processing task includes the first listening topic, send the processing task to the client; receive a second listening request from a server, parse the second listening request to obtain a second topic to be listened to by the server; establish a second listening object, and when the message header of a received message task includes the second listening topic, send the message task to the server.

[0111] In an exemplary embodiment, as shown in FIG. 7 , a synchronous message communication device is provided, which is applied to a server, and includes: a message task receiving module and a processing task sending module, wherein:

[0112] A message task receiving module is used to receive message tasks from a distributed key-value database; the message task is sent by the distributed key-value database through a monitoring mechanism, and after the client creates a new task to be processed, the subject of the server corresponding to the client is written into the message header of the task to be processed, and the business data is written into the message body of the task to be processed and sent to the distributed key-value database;

[0113] The processing task sending module is used to process the message task and write the processing result into the message task to obtain the processing task; send the processing task to the distributed key-value database; and instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism.

[0114] In one embodiment, the processing task sending module further includes:

[0115] Obtain the message sending time and timeout duration from the message header of the message task; determine the timeout time based on the message sending time and the timeout duration; if the current time is less than the timeout time, judge the message task as timed out and ignore the message task; if the current time is not less than the timeout time, judge the message task as not timed out and process the message task.

[0116] Each module in the above synchronous message communication device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.

[0117] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG8. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store processing tasks. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a synchronous message communication method is implemented.

[0118] Those skilled in the art will understand that the structure shown in FIG. 8 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0119] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0120] Create a new task to be processed, write the subject of the server corresponding to the client into the message header of the task to be processed, write the business data into the message body of the task to be processed, and obtain a message task;

[0121] Send the message task to the distributed key-value database; instruct the distributed key-value database to send the message task to the server through a monitoring mechanism; instruct the server to process the message task and write the processing result into the message task to obtain a processing task; send the processing task to the distributed key-value database; instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism;

[0122] Receive processing tasks from the distributed key-value database.

[0123] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0124] The receiving of the processing task from the distributed key-value database includes: if the processing task corresponding to the message task identifier is not received within the timeout period, then stop waiting; if the processing task corresponding to the message task identifier is received within the timeout period, then record the processing task.

[0125] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0126] Receive a message task from a client, wherein the message task is obtained by writing the subject of the server corresponding to the client into the message header of the task to be processed and writing the business data into the message body of the task to be processed after the client creates a task to be processed;

[0127] The message task is sent to the server through a monitoring mechanism; the server is instructed to process the message task and write the processing result into the message task to obtain a processing task; the processing task is sent to a distributed key-value database;

[0128] The processing task is sent to the client through a monitoring mechanism.

[0129] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0130] Receive a first listening request from a client; parse the first listening request to obtain a first listening topic to be listened to by the client; establish a first listening object, and when the message header of a received processing task includes the first listening topic, send the processing task to the client; receive a second listening request from a server, parse the second listening request to obtain a second topic to be listened to by the server; establish a second listening object, and when the message header of a received message task includes the second listening topic, send the message task to the server.

[0131] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0132] Receive a message task from a distributed key-value database; the message task is sent by the distributed key-value database through a monitoring mechanism. After the client creates a new task to be processed, the message task writes the subject of the server corresponding to the client into the message header of the task to be processed, writes the business data into the message body of the task to be processed, and sends it to the distributed key-value database;

[0133] The message task is processed and the processing result is written into the message task to obtain a processing task; the processing task is sent to a distributed key-value database; and the distributed key-value database is instructed to send the processing task to the client through a monitoring mechanism.

[0134] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0135] Obtain the message sending time and timeout duration from the message header of the message task; determine the timeout time based on the message sending time and the timeout duration; if the current time is less than the timeout time, judge that the message task is timed out, and ignore the message task; if the current time is not less than the timeout time, judge that the message task is not timed out, and process the message task.

[0136] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0137] Create a new task to be processed, write the subject of the server corresponding to the client into the message header of the task to be processed, write the business data into the message body of the task to be processed, and obtain a message task;

[0138] Send the message task to the distributed key-value database; instruct the distributed key-value database to send the message task to the server through a monitoring mechanism; instruct the server to process the message task and write the processing result into the message task to obtain a processing task; send the processing task to the distributed key-value database; instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism;

[0139] Receive processing tasks from the distributed key-value database.

[0140] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0141] The receiving of the processing task from the distributed key-value database includes: if the processing task corresponding to the message task identifier is not received within the timeout period, then stop waiting; if the processing task corresponding to the message task identifier is received within the timeout period, then record the processing task.

[0142] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0143] Receive a message task from a client, wherein the message task is obtained by writing the subject of the server corresponding to the client into the message header of the task to be processed and writing the business data into the message body of the task to be processed after the client creates a task to be processed;

[0144] The message task is sent to the server through a monitoring mechanism; the server is instructed to process the message task and write the processing result into the message task to obtain a processing task; the processing task is sent to a distributed key-value database;

[0145] The processing task is sent to the client through a monitoring mechanism.

[0146] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0147] Receive a first listening request from a client; parse the first listening request to obtain a first listening topic to be listened to by the client; establish a first listening object, and when the message header of a received processing task includes the first listening topic, send the processing task to the client; receive a second listening request from a server, parse the second listening request to obtain a second topic to be listened to by the server; establish a second listening object, and when the message header of a received message task includes the second listening topic, send the message task to the server.

[0148] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0149] Receive a message task from a distributed key-value database; the message task is sent by the distributed key-value database through a monitoring mechanism. After the client creates a new task to be processed, the message task writes the subject of the server corresponding to the client into the message header of the task to be processed, writes the business data into the message body of the task to be processed, and sends it to the distributed key-value database;

[0150] The message task is processed and the processing result is written into the message task to obtain a processing task; the processing task is sent to a distributed key-value database; and the distributed key-value database is instructed to send the processing task to the client through a monitoring mechanism.

[0151] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0152] Obtain the message sending time and timeout duration from the message header of the message task; determine the timeout time based on the message sending time and the timeout duration; if the current time is less than the timeout time, judge that the message task is timed out, and ignore the message task; if the current time is not less than the timeout time, judge that the message task is not timed out, and process the message task.

[0153] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0154] Create a new task to be processed, write the subject of the server corresponding to the client into the message header of the task to be processed, write the business data into the message body of the task to be processed, and obtain a message task;

[0155] Send the message task to the distributed key-value database; instruct the distributed key-value database to send the message task to the server through a monitoring mechanism; instruct the server to process the message task and write the processing result into the message task to obtain a processing task; send the processing task to the distributed key-value database; instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism;

[0156] Receive processing tasks from the distributed key-value database.

[0157] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0158] The receiving of the processing task from the distributed key-value database includes: if the processing task corresponding to the message task identifier is not received within the timeout period, then stop waiting; if the processing task corresponding to the message task identifier is received within the timeout period, then record the processing task.

[0159] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0160] Receive a message task from a client, wherein the message task is obtained by writing the subject of the server corresponding to the client into the message header of the task to be processed and writing the business data into the message body of the task to be processed after the client creates a task to be processed;

[0161] The message task is sent to the server through a monitoring mechanism; the server is instructed to process the message task and write the processing result into the message task to obtain a processing task; the processing task is sent to a distributed key-value database;

[0162] The processing task is sent to the client through a monitoring mechanism.

[0163] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0164] Receive a first listening request from a client; parse the first listening request to obtain a first listening topic to be listened to by the client; establish a first listening object, and when the message header of a received processing task includes the first listening topic, send the processing task to the client; receive a second listening request from a server, parse the second listening request to obtain a second topic to be listened to by the server; establish a second listening object, and when the message header of a received message task includes the second listening topic, send the message task to the server.

[0165] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0166] Receive a message task from a distributed key-value database; the message task is sent by the distributed key-value database through a monitoring mechanism. After the client creates a new task to be processed, the message task writes the subject of the server corresponding to the client into the message header of the task to be processed, writes the business data into the message body of the task to be processed, and sends it to the distributed key-value database;

[0167] The message task is processed and the processing result is written into the message task to obtain a processing task; the processing task is sent to a distributed key-value database; and the distributed key-value database is instructed to send the processing task to the client through a monitoring mechanism.

[0168] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0169] Obtain the message sending time and timeout duration from the message header of the message task; determine the timeout time based on the message sending time and the timeout duration; if the current time is less than the timeout time, judge that the message task is timed out, and ignore the message task; if the current time is not less than the timeout time, judge that the message task is not timed out, and process the message task.

[0170] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0171] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0172] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A synchronous message communication method, characterized in that: Applied to a client, the method comprises: Create a new task to be processed, write the subject of the server corresponding to the client into the message header of the task to be processed, write the business data into the message body of the task to be processed, and obtain a message task; Send the message task to the distributed key-value database; instruct the distributed key-value database to send the message task to the server through a monitoring mechanism; instruct the server to process the message task and write the processing result into the message task to obtain a processing task; send the processing task to the distributed key-value database; instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism; Receive processing tasks from the distributed key-value database.

2. The method according to claim 1, characterized in that The message header of the message task also includes: a message task identifier and a timeout duration; The receiving of the processing task from the distributed key-value database includes: If the processing task corresponding to the message task identifier is not received within the timeout period, stop waiting; If a processing task corresponding to the message task identifier is received within the timeout period, the processing task is recorded.

3. A synchronous message communication method, characterized in that: Applied to a distributed key-value database, the method comprises: Receive a message task from a client, wherein the message task is obtained by writing the subject of the server corresponding to the client into the message header of the task to be processed and writing the business data into the message body of the task to be processed after the client creates a task to be processed; The message task is sent to the server through a monitoring mechanism; the server is instructed to process the message task and write the processing result into the message task to obtain a processing task; the processing task is sent to a distributed key-value database; The processing task is sent to the client through a monitoring mechanism.

4. The method according to claim 3, characterized in that The establishment of the monitoring mechanism includes: Receive a first monitoring request from a client; parse the first monitoring request to obtain a first monitoring topic to be monitored by the client; establish a first monitoring object, and when a message header of a received processing task includes the first monitoring topic, send the processing task to the client; Receive a second monitoring request from the server, parse the second monitoring request, and obtain the second topic to be monitored by the server; establish a second monitoring object, and when the message header of the received message task includes the second topic, send the message task to the server.

5. A synchronous message communication method, characterized in that: Applied to the server, the method includes: Receive a message task from a distributed key-value database; the message task is sent by the distributed key-value database through a monitoring mechanism. After the client creates a new task to be processed, the subject of the server corresponding to the client is written into the message header of the task to be processed, and the business data is written into the message body of the task to be processed and sent to the distributed key-value database; The message task is processed and the processing result is written into the message task to obtain a processing task; the processing task is sent to a distributed key-value database; and the distributed key-value database is instructed to send the processing task to the client through a monitoring mechanism.

6. The method according to claim 5, characterized in that The message header of the message task includes: the message sending time and the timeout duration; before processing the message task, it also includes: Obtain the message sending time and timeout duration from the message header of the message task; Determine a timeout time based on the message sending time and the timeout duration; If the current time is less than the timeout time, the message task is judged to be timed out, and the message task is ignored; If the current time is not less than the timeout time, it is determined that the message task has not timed out, and the message task is processed.

7. A synchronous message communication device, characterized in that: Applied to a client, the device comprises: A creation module is used to create a new task to be processed, write the subject of the server corresponding to the client into the message header of the task to be processed, write the business data into the message body of the task to be processed, and obtain a message task; A message task sending module is used to send the message task to a distributed key-value database; to instruct the distributed key-value database to send the message task to the server through a monitoring mechanism; to instruct the server to process the message task and write the processing result into the message task to obtain a processing task; to send the processing task to the distributed key-value database; to instruct the distributed key-value database to send the processing task to the client through a monitoring mechanism; The processing task receiving module is used to receive processing tasks from the distributed key-value database.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A 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 method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.