Message processing method, device, server and storage medium
Through the conversion of the message according to the message protocol of the application server during the message transmission process, the problem of low transmission efficiency of the application server's memory occupation of large and more efficient information was solved, and more efficient message transmission was achieved.
Patent Information
- Application Number
- CN202110676875.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-18
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2041-06-18
AI Technical Summary
In the prior art, the application server's memory usage and low delivery efficiency are caused by the process of messaging.
By obtaining the message sent by the first application server, it is determined that the message receiving terminal belongs to the second application server, and the message is converted according to the message protocol of the first application server and the second application server. The information of the identification finally sent the message to the second application server.
It reduces the memory occupation and message interaction of the application server, and improves the efficiency of message transmission.
Smart Images

Figure CN113296986B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a message processing method, device, server and storage medium. Background Art
[0002] Due to the differences in deployment environments and operating architectures, the strong independence and weak correlation between application servers lead to data dispersion and information silos. However, there is usually a need for message communication between different application servers to meet production needs. Therefore, how to transmit messages between two different application servers is particularly critical.
[0003] In the prior art, when a message sender sends a message to a message receiver, the first application server to which the message sender belongs obtains the message and writes the message into a file in a common file format, that is, converts the message into a file in a format that can be recognized by both the first application server and the second application server. The file is then sent to the second application server to which the message receiver belongs. The second application server parses the file, encapsulates it into a message commonly used by the second application server, and sends it to the corresponding message receiver of the second application server.
[0004] However, the above method uses files as intermediate media, which easily causes a large amount of memory space on the application server to be occupied, and the intermediate conversion process is complicated and inefficient. Summary of the invention
[0005] The embodiments of the present application provide a message processing method, device, server and storage medium to solve the problems of large memory usage and low transmission efficiency on the application server side during message transmission in the prior art.
[0006] In a first aspect, an embodiment of the present application provides a message processing method, which is applied to a server, comprising:
[0007] Acquire a first message sent by a first application server, where the first message includes an identifier of the first application server, message content, and an identifier of a message receiving end;
[0008] If the message receiving end belongs to the second application server, convert the first message according to the message protocol of the first application server and the message protocol of the second application server to generate a second message that can be recognized by the second application server;
[0009] Send the second message to the second application server.
[0010] In a possible design of the first aspect, after obtaining the first message sent by the first application server, the method further includes:
[0011] Determine the identifier of the second application server corresponding to the identifier of the message receiving terminal according to the correspondence between the locally stored device identifier and the identifier of the application server;
[0012] The interface of the second application server corresponding to the identifier of the second application server is queried to determine whether the message receiving end belongs to the second application server.
[0013] In another possible design of the first aspect, converting the first message according to a message protocol of the first application server and a message protocol of the second application server to generate a second message that can be recognized by the second application server includes:
[0014] Parsing the first message according to the message protocol of the first application server to obtain the message content and the identifier of the message receiving end;
[0015] According to the message protocol of the second application server, the message content and the identifier of the message receiving end are encapsulated to obtain the second message.
[0016] In yet another possible design of the first aspect, the method further includes:
[0017] If the message receiving end does not belong to the second application server, an error report is sent to the first application server, where the error report is used to indicate that the message receiving end does not belong to the second application server.
[0018] In a second aspect, an embodiment of the present application provides a message processing method, which is applied to a first application server, including:
[0019] Obtain the message content sent by the message sender and the identifier of the message receiver;
[0020] Determining, according to the identifier of the message receiving end, whether the application server to which the message receiving end belongs is the first application server;
[0021] If the application server to which the message receiving end belongs is not the first application server, encapsulating the message content, the message receiving end identifier and the first application server identifier according to the message protocol of the first application server to obtain a first message;
[0022] The first message is sent to the server.
[0023] In a possible design of the second aspect, the method further includes:
[0024] If the application server to which the message receiving end belongs is the first application server, the message content is sent to the message receiving end according to the identifier of the message receiving end.
[0025] In another possible design of the second aspect, the method further includes:
[0026] Obtaining an error report sent by the server, wherein the error report is used to indicate that the message receiving end does not belong to the second application server;
[0027] Send an error report to the message sending end.
[0028] In a third aspect, an embodiment of the present application provides a message processing method, which is applied to a second application server, including:
[0029] receiving a second message sent by the server, where the second message is obtained by the server encapsulating the message content and the identifier of the message receiving end according to the message protocol of the second application server;
[0030] The message content is sent to the message receiving end according to the identifier of the message receiving end.
[0031] In a fourth aspect, an embodiment of the present application provides a message processing device, applied to a server, comprising: an acquisition module, a generation module and a sending module;
[0032] The acquisition module is used to acquire a first message sent by the first application server, where the first message includes an identifier of the first application server, message content, and an identifier of a message receiving end;
[0033] The generating module is used for converting the first message according to the message protocol of the first application server and the message protocol of the second application server to generate a second message that can be recognized by the second application server if the message receiving end belongs to the second application server;
[0034] The sending module is used to send the second message to the second application server.
[0035] In a possible design of the fourth aspect, the apparatus further includes: a processing module;
[0036] The processing module is used to determine the identifier of the second application server corresponding to the identifier of the message receiving end according to the correspondence between the locally stored device identifier and the identifier of the application server, and to query the interface of the second application server corresponding to the identifier of the second application server to determine whether the message receiving end belongs to the second application server.
[0037] In another possible design of the fourth aspect, the generating module is specifically used to:
[0038] Parsing the first message according to the message protocol of the first application server to obtain the message content and the identifier of the message receiving end;
[0039] According to the message protocol of the second application server, the message content and the identifier of the message receiving end are encapsulated to obtain the second message.
[0040] In another possible design of the fourth aspect, the sending module is also used to send an error report to the first application server if the message receiving end does not belong to the second application server, and the error report is used to indicate that the message receiving end does not belong to the second application server.
[0041] In a fifth aspect, an embodiment of the present application provides a message processing device, which is applied to a first application server, and includes: an acquisition module, a determination module, a processing module, and a sending module;
[0042] The acquisition module is used to acquire the message content sent by the message sending end and the identifier of the message receiving end;
[0043] The determining module is used to determine whether the application server to which the message receiving end belongs is the first application server according to the identifier of the message receiving end;
[0044] The processing module is configured to encapsulate the message content, the message receiving end identifier and the first application server identifier according to the message protocol of the first application server to obtain a first message if the application server to which the message receiving end belongs is not the first application server;
[0045] The sending module is used to send the first message to the server.
[0046] In a possible design of the fifth aspect, the sending module is also used to send the message content to the message receiving end according to the identifier of the message receiving end if the application server to which the message receiving end belongs is the first application server.
[0047] In another possible design of the fifth aspect, the acquisition module is further used to obtain an error report sent by the server, where the error report is used to indicate that the message receiving end does not belong to the second application server;
[0048] The sending module is further used to send an error report to the message sending end.
[0049] In a sixth aspect, an embodiment of the present application provides a message processing device, applied to a second application server, comprising: an acquisition module and a sending module;
[0050] The acquisition module is used to receive a second message sent by the server, where the second message is obtained by the server encapsulating the message content and the identifier of the message receiving end according to the message protocol of the second application server;
[0051] The sending module is used to send the message content to the message receiving end according to the identifier of the message receiving end.
[0052] In the seventh aspect, an embodiment of the present application provides a server, comprising: a processor, a memory, a transceiver, and computer program instructions stored in the memory and executable on the processor, wherein when the processor executes the computer program instructions, it implements the message processing method provided in the first aspect and various possible designs mentioned above.
[0053] In an eighth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, a transceiver, and computer program instructions stored in the memory and executable on the processor, wherein when the processor executes the computer program instructions, it implements a message processing method as provided in the second aspect and various possible designs described above.
[0054] In the ninth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, a transceiver, and computer program instructions stored in the memory and executable on the processor, wherein when the processor executes the computer program instructions, it implements the message processing method provided in the third aspect above.
[0055] In the tenth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer execution instructions. When the computer execution instructions are executed by a processor, they are used to implement the message processing method provided in the first aspect and various possible designs, or to implement the message processing method provided in the second aspect and various possible designs, or to implement the message processing method provided in the third aspect and various possible designs.
[0056] In the eleventh aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, is used to implement a message processing method as provided in the first aspect and various possible designs, or to implement a message processing method as provided in the second aspect and various possible designs, or to implement a message processing method as provided in the third aspect and various possible designs.
[0057] The embodiment of the present application provides a message processing method, device, server and storage medium, which obtains a first message sent by a first application server, then determines that the message receiving end belongs to a second application server, converts the first message according to the message protocol of the first application server and the message protocol of the second application server, generates a second message that can be recognized by the second application server, and then sends the second message to the second application server. In this technical solution, starting from the message protocol involved in the message, the memory usage on the application server side and the risk of message interaction delay between different application servers are reduced, and the efficiency of message transmission is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0059] Figure 1 A schematic diagram of the information transfer process provided by the prior art;
[0060] Figure 2A A schematic diagram of an application scenario of the message processing method provided in an embodiment of the present application;
[0061] Figure 2B A schematic diagram of a TCP message provided in an embodiment of the present application;
[0062] Figure 3 A flowchart of a method for processing a message according to an embodiment of the present application;
[0063] Figure 4 A flowchart of a second embodiment of a method for processing messages provided in an embodiment of the present application;
[0064] Figure 5 A schematic diagram of the structure of a first embodiment of a message processing device provided in an embodiment of the present application;
[0065] Figure 6 A schematic diagram of the structure of Embodiment 2 of a message processing device provided in an embodiment of the present application;
[0066] Figure 7 A schematic diagram of the structure of a third embodiment of a message processing device provided in an embodiment of the present application;
[0067] Figure 8 A schematic diagram of the structure of a server provided in an embodiment of the present application;
[0068] Fig. 9 A schematic diagram of the structure of a first embodiment of an electronic device provided in an embodiment of the present application;
[0069] Fig.10A schematic diagram of the structure of a second electronic device embodiment provided in the present application.
[0070] The above drawings show clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0071] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0072] Before introducing the embodiments of the present application, the background technology of the present application is first explained:
[0073] Application systems are increasingly integrated into the production, management, and operations of enterprises. However, due to differences in development platforms, application architectures, and deployment environments, the heterogeneity of various application systems is becoming increasingly serious. Strong system independence and weak correlation lead to problems such as data dispersion and information islands. There is usually a need for message communication between different systems within an enterprise or between systems of different enterprises. Therefore, information interaction and data sharing between application systems are particularly important.
[0074] In the prior art, information is transmitted between different instant messaging systems, generally in the form of format files. Specifically, Figure 1 A flow chart of information transmission provided by the prior art, such as Figure 1 As shown, in the prior art, information transmission between two systems (implemented by the server side of the system, for example, the server side of system A and the server side of system B) includes the following steps:
[0075] Step 1: The server of system A receives a message from the client of the message sender of system A;
[0076] The message includes the information of the message sender, the message content and the message receiver;
[0077] Step 2: The server of system A queries the information of the message recipient;
[0078] Step 3: Determine whether the message receiver is in system A. If not, go to step 5; if yes, go to step 4;
[0079] Step 4: Send the information to the client of the message recipient of system A;
[0080] Step 5: Write the message into a file in a common file format (the file format can be recognized by the server of system A and the server of system B);
[0081] The file includes: the system ID of the message sender, the user number of the message sender, the user number of the message receiver, the message type, the message content, etc.
[0082] Step 6: System A server sends the file to system B server;
[0083] Step 7: The system B server reads the file content and uses the system B message protocol to encapsulate it into a message that can be recognized by the system B client;
[0084] Step 8: Send the encapsulated message to the client of system B.
[0085] The above is a method of transmitting messages between different application systems in the prior art. However, this method has the following disadvantages:
[0086] 1) Using files as intermediate media occupies memory space and input and output (IO) resources of different application systems, thereby increasing resource consumption;
[0087] 2) The entire transmission process involves operations such as writing files, transferring files, and reading files. The message transmission efficiency is low and cannot meet the real-time requirements;
[0088] 3) It is necessary to modify the existing application system to enable it to read, write, send and receive files, which violates the open-closed principle of software design.
[0089] Based on the technical problems existing in the above-mentioned prior art, Figure 2A Schematic diagram of an application scenario of the message processing method provided in the embodiment of the present application. Figure 2A As shown, the application scenario includes: a server 10, a first application server 11, a second application server 12, a message sending terminal 13 and a message receiving terminal 14.
[0090] Among them, the server can be a message forwarder, such as a router, which has a message receiving interface based on the underlying Transmission Control Protocol (TCP) protocol and can receive any upper-layer protocol message based on the TCP protocol; the first application server 11 and the second application server 12 are used to represent different instant messaging systems, and user information synchronization has been achieved between the two; the message sending end 13 and the message receiving end 14 are the clients corresponding to the first application server 11 and the second application server 12, respectively, and can be terminal devices such as mobile phones, computers, smart watches, tablets, smart TVs, etc.
[0091] Optionally, the first application server 11 and the second application server 12 can provide communication coverage for a specific geographical area, and can communicate with terminal devices located in the coverage area. It can be a base station (Base Transceiver Station, BTS) in a Global System for Mobile Communications (Global System for Mobile Communications, abbreviated as: GSM) system or a Code Division Multiple Access (Code Division Multiple Access, abbreviated as: CDMA) system, or a base station (NodeB, NB) in a WCDMA system, or an evolved base station (Evolutional Node B, eNB or eNodeB) in a Long Term Evolution (Long Term Evolution, abbreviated as: LTE) system, or a wireless controller in a cloud radio access network (Cloud Radio Access Network, CRAN), or the first application server 11 and the second application server 12 can be a mobile switching center, a relay station, an access point, a vehicle-mounted device, a wearable device, a hub, a switch, a bridge, a router, a network side device in a 5G network, or a network device in a future evolved public land mobile network (Public Land Mobile Network, PLMN), or a base station providing satellite services, etc.
[0092] Optionally, the terminal device (message sending end 13 and message receiving end 14) includes but is not limited to being connected via a wired line, such as via a Public Switched Telephone Networks (PSTN), a Digital Subscriber Line (DSL), a digital cable, a direct cable connection; and / or another data connection / network; and / or via a wireless interface, such as for a cellular network, a Wireless Local Area Network (WLAN), a digital television network such as a DVB-H network, a satellite network, an AM-FM broadcast transmitter; and / or another device configured to receive / send communication signals; and / or an Internet of Things (IoT) device. A terminal device configured to communicate via a wireless interface may be referred to as a "wireless communication terminal", "wireless terminal" or "mobile terminal". Examples of mobile terminals include, but are not limited to, satellite or cellular telephones; Personal Communications System (PCS) terminals that may combine a cellular radiotelephone with data processing, fax, and data communications capabilities; PDAs which may include a radiotelephone, pager, Internet / Intranet access, a Web browser, a notepad, a calendar, and / or a Global Positioning System (GPS) receiver; and conventional laptop and / or palmtop receivers or other electronic devices that include a radiotelephone transceiver.
[0093] In one possible implementation, when the message sending end 13 needs to send a message to the message receiving end 14, the first application server 11 that provides services for the message sending end 13 receives the message, adds the identifier of the first application server 11 to the message, and then sends the message to the server 10. The server 10 parses the message based on the message protocol of the first application server 11 corresponding to the identifier of the first application server 11, and then encapsulates the parsed message (encapsulates it according to the message protocol of the second application server 12) to obtain a message that can be recognized by the message receiving end 14.
[0094] Furthermore, the message is sent to the second application server 12 , and then forwarded by the second application server 12 to the message receiving terminal 14 .
[0095] Optionally, the message receiving end 14 may also be a client corresponding to the first application server 11 . In this possible implementation, the first application server 11 directly sends the message to the message receiving end 14 without being processed by the server 10 .
[0096] It is worth noting that the embodiment of the present application does not limit the number of messages. For the processing of multiple messages, corresponding processing can be performed based on the first-in-first-out order; there is no limit on the number of application servers, which can be added according to actual conditions.
[0097] Optional, Figure 2B A schematic diagram of a TCP message provided in an embodiment of the present application. Figure 2B As shown, the relationship diagram includes a message header and a TCP message body.
[0098] Among them, the message header includes: port number, sequence number, control bit, check bit; the TCP message body includes the message format of the message protocol, such as the message header and message body (application transmission content); the message header includes: message sender, message receiver, message type, etc.; the message body includes: content (text, emoticons, pictures, etc.) and commands (notification, query, receipt, etc.).
[0099] From this, we can see that no matter what protocol the above application system uses, as long as it is based on the TCP protocol, it is inside the TCP message body during transmission. Therefore, the TCP message receiving interface provided by the server (for example, Router) can receive messages from any instant messaging application system based on the TCP protocol.
[0100] In response to the above-mentioned technical problems, the inventor's technical conception process is as follows: The inventor discovered that in the prior art, message transmission requires the generation and parsing of message-related files between different application systems, which affects memory usage. Therefore, a message forwarder can be used to process the messages to be transmitted according to the message protocols of different application systems, thereby avoiding the above-mentioned technical problems.
[0101] The following is a detailed description of the technical solution of the present application through specific embodiments using the application scenarios corresponding to the above-mentioned figures. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0102] Figure 3 The flowchart of the message processing method embodiment 1 provided in the present application embodiment is as follows. The interaction between the server, the first application server and the second application server is described, such as Figure 3 As shown, the message processing method may include the following steps:
[0103] Step 31: Obtain the message content sent by the message sending end and the identifier of the message receiving end.
[0104] In this solution, when user A sends a message to user B, the technical implementation is: user A's terminal device (message sending end) sends the message to user B's terminal device (message receiving end).
[0105] Among them, in the process of processing messages between the terminal device of user A and the terminal device of user B, the application server to which the message sending end belongs is called the first application server; the application server to which the message receiving end belongs is called the first application server, or the second application server (depending on the application server to which the message receiving end belongs); the server acts as the middleware between different application servers to realize functions such as message format processing and message sending and receiving, which are described in detail in the following embodiments.
[0106] In this step, the message sent by the message sending end includes the specific content of the message and the recipient information of the message, that is, the message content and the identifier of the message receiving end, the message content and the identifier of the message receiving end sent by the first application server through the message sending end.
[0107] Step 32: Determine, based on the identifier of the message receiving end, whether the application server to which the message receiving end belongs is the first application server.
[0108] In this step, the first application server is the application server to which the message sending end belongs. The first application server queries whether there is a message transmission interface corresponding to the message receiving end in the first application server according to the identifier of the message receiving end.
[0109] In a possible implementation, if the message transmission interface corresponding to the message receiving end is queried in the first application server, then the application server to which the message receiving end belongs is the first application server.
[0110] Furthermore, according to the identifier of the message receiving end, the first application server sends the message content to the message receiving end, thereby completing the transmission of the message from the message sending end to the message receiving end.
[0111] In another possible implementation, if the message transmission interface corresponding to the message receiving end is not found in the first application server, the application server to which the message receiving end belongs is not the first application server, and step 33 is executed.
[0112] Step 33: If the application server to which the message receiving end belongs is not the first application server, encapsulate the message content, the protocol message receiving end identifier and the first application server identifier according to the message of the first application server to obtain a first message;
[0113] In this step, since the message receiving end and the message sending end belong to different application servers, the message sent by the message sending end cannot be directly recognized by the message receiving end, and the message needs to be processed accordingly.
[0114] Optionally, the first application server encapsulates the message content, the message receiving end identifier and the first application server identifier to obtain a message format that can be parsed by a subsequent server according to the message protocol of the first application server, that is, the first message.
[0115] Step 34: Send a first message to the server.
[0116] In this step, the first application server sends the first message to the server.
[0117] After this step, the identifier of the second application server corresponding to the identifier of the message receiving end is determined according to the correspondence between the locally stored device identifier and the identifier of the application server.
[0118] Specifically, the corresponding relationship between the device identifier and the identifier of the application server is pre-stored in the local storage of the server. When receiving the first message, the server first stores the first message in the message receiving queue.
[0119] Among them, the message receiving queue is to enable the server to cope with large-scale concurrent reception of multiple first messages and cache the received first messages. The embodiment of the present application is described using one first message as an example, and the processing principle of multiple first messages is the same.
[0120] Furthermore, when it is detected that the first message in the message receiving queue has not been consumed, the first message is parsed according to the identifier of the system to which the first message belongs (the identifier of the first application server) and the message protocol of the first application server to obtain the message receiving end identifier, and based on the above correspondence, it is determined that the application server is the second application server.
[0121] Finally, the interface of the second application server corresponding to the identifier of the second application server is queried to determine whether the message receiving end belongs to the second application server. That is, the server calls the user query interface of the second application server to query whether the message receiving end belongs to the second application server. At this time, there are two possible implementations:
[0122] In a possible implementation, if the message receiving end does not belong to the second application server, an error report is sent to the first application server, where the error report is used to indicate that the message receiving end does not belong to the second application server.
[0123] Optionally, the message receiver may have changed the relevant application server information, and the error report can also provide maintenance information reference for technical personnel.
[0124] At this time, the first application server can be used to obtain an error report sent by the server, where the error report is used to indicate that the message receiving end does not belong to the second application server, and send the error report to the message sending end.
[0125] In another possible implementation, the message receiving end belongs to the second application server, and the following step 35 is executed.
[0126] Step 35: If the message receiving end belongs to the second application server, the first message is converted according to the message protocol of the first application server and the message protocol of the second application server to generate a second message that can be recognized by the second application server.
[0127] In one possible implementation, the first message is parsed according to the message protocol of the first application server to obtain the message content and the identifier of the message receiving end, and the message content and the identifier of the message receiving end are encapsulated according to the message protocol of the second application server to obtain the second message.
[0128] That is, according to the message protocol of the second application server, the message content parsed according to the message protocol of the first application server and the identifier of the message receiving end are encapsulated to obtain the second message recognized by the second application server, and the second message is inserted into the message sending queue.
[0129] The message sending queue is to match the time difference between the server message processing rate and the message sending rate. This setting is required and caches the second message after the server encapsulation. The second message is obtained by the server encapsulating the message content and the identifier of the message receiving end according to the message protocol of the second application server.
[0130] Step 36: Send a second message to the second application server.
[0131] In this step, the server takes out the second message from the message sending queue and sends it to the second application server, and the second application server receives the second message.
[0132] Step 37: Send the message content to the message receiving end according to the identifier of the message receiving end.
[0133] In this step, the second application server sends the message content to the message receiving terminal corresponding to user B according to the identifier of the message receiving terminal, so as to realize the message transmission between the terminal device of user A and the terminal device of user B.
[0134] It should be understood that in the above execution process, the message itself should also carry relevant information of the message sender, and when the message receiving end obtains the message content, the message receiving end obtains the information of the message sender.
[0135] The embodiment of the present application provides a message processing method, which obtains a first message sent by a first application server, then determines that the message receiving end belongs to a second application server, converts the first message according to the message protocol of the first application server and the message protocol of the second application server, generates a second message that can be recognized by the second application server, and then sends the second message to the second application server. In this technical solution, starting from the message protocol involved in the message, it avoids the problems of excessive memory usage and low efficiency on the application server side, reduces the risk of message interaction delays between different application servers, and the setting of the message cache queue improves the server throughput and prevents process blocking.
[0136] Based on the above embodiments, Figure 4 The flowchart of the second embodiment of the message processing method provided in the embodiment of the present application is used to explain in detail the internal processing flow of the server, such as Figure 4 As shown, the message processing method includes the following steps:
[0137] Step 1. Start;
[0138] Step 2: The server receives a message from the first application server;
[0139] Step 3: Insert the message into the message receiving queue;
[0140] Among them, there are multiple messages to be processed in the queue. They are processed one by one according to the principle of first-in-first-out, or they can be processed in parallel, depending on the actual situation.
[0141] Step 4: Take the message out of the queue;
[0142] Step 5: Parse the message according to the message protocol of the first application server;
[0143] Step 6: Determine whether the message receiving end belongs to the second application server. If not, execute step 7; if yes, execute step 8;
[0144] Step 7: Send an error report to the first application server;
[0145] Step 8: Encapsulate the parsed message according to the message protocol of the second application server;
[0146] Step 9: Insert the encapsulated message into the message sending queue;
[0147] Step 10: Take the encapsulated message from the message sending queue and send it to the second application server;
[0148] Step 11. End.
[0149] The embodiment of the present application provides a message processing method, in which the server receives a message from a first application server, inserts the message into a message receiving queue, takes out multiple pending messages in the message receiving queue in a certain order, and processes them, and determines whether the message receiving end corresponding to the taken out message belongs to the second application server. If so, the message is parsed according to the message protocol of the first application server, and then the parsed message is encapsulated according to the message protocol of the second application server, and the result is added to the message sending queue, waiting to be sent to the second application server; if not, an error report is sent to the first application server. In this technical solution, the message is processed according to the message protocols of different application servers, so that the message is converted into a message that can be recognized by the application server corresponding to the message receiving end, avoiding the problem of increased running memory and reduced efficiency of the application server during message transmission in the prior art.
[0150] Based on the above message processing method embodiment, Figure 5 This is a structural diagram of a message processing device embodiment 1 provided in the present application. Figure 5 As shown, the message processing device can be integrated on the server, including: an acquisition module 51, a generation module 52 and a sending module 53;
[0151] The acquisition module 51 is used to acquire a first message sent by the first application server, where the first message includes an identifier of the first application server, message content, and an identifier of a message receiving end;
[0152] A generating module 52, configured to convert the first message according to the message protocol of the first application server and the message protocol of the second application server to generate a second message that can be recognized by the second application server if the message receiving end belongs to the second application server;
[0153] The sending module 53 is used to send a second message to the second application server.
[0154] In a possible design of the embodiment of the present application, the device further includes: a processing module 54;
[0155] Processing module 54 is used to determine the identifier of the second application server corresponding to the identifier of the message receiving end according to the correspondence between the locally stored device identifier and the identifier of the application server, and to query the interface of the second application server corresponding to the identifier of the second application server to determine whether the message receiving end belongs to the second application server.
[0156] In another possible design of the embodiment of the present application, the generating module 52 is specifically used for:
[0157] Parse the first message according to the message protocol of the first application server to obtain the message content and the identifier of the message receiving terminal;
[0158] According to the message protocol of the second application server, the message content and the identifier of the message receiving end are encapsulated to obtain a second message.
[0159] In another possible design of the embodiment of the present application, the sending module 53 is also used to send an error report to the first application server if the message receiving end does not belong to the second application server, and the error report is used to indicate that the message receiving end does not belong to the second application server.
[0160] The message processing device provided in the embodiment of the present application can be used to execute the technical solution of the message processing method involved in the server in the above embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0161] Secondly, Figure 6 This is a structural diagram of Embodiment 2 of the message processing device provided in the embodiment of the present application. Figure 6 As shown, the message processing device can be integrated on the electronic device corresponding to the first application server, including: an acquisition module 61, a determination module 62, a processing module 63 and a sending module 64;
[0162] An acquisition module 61 is used to acquire the message content sent by the message sending end and the identifier of the message receiving end;
[0163] A determination module 62, configured to determine whether the application server to which the message receiving terminal belongs is the first application server according to the identifier of the message receiving terminal;
[0164] The processing module 63 is used for encapsulating the message content, the message receiving end identifier and the first application server identifier according to the message protocol of the first application server to obtain a first message if the application server to which the message receiving end belongs is not the first application server;
[0165] The sending module 64 is configured to send a first message to the server.
[0166] In a possible design of an embodiment of the present application, the sending module 64 is also used to send the message content to the message receiving end according to the identifier of the message receiving end if the application server to which the message receiving end belongs is the first application server.
[0167] In another possible design of the embodiment of the present application, the acquisition module 61 is further used to obtain an error report sent by the server, where the error report is used to indicate that the message receiving end does not belong to the second application server;
[0168] The sending module 64 is further configured to send an error report to the message sending end.
[0169] The message processing device provided in the embodiment of the present application can be used to execute the technical solution of the message processing method involved in the first application server in the above embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0170] at last, Figure 7 This is a schematic diagram of the structure of Embodiment 3 of the message processing device provided in the embodiment of the present application. Figure 7 As shown, the message processing device can be integrated on the electronic device corresponding to the second application server, including: an acquisition module 71 and a sending module 72;
[0171] The acquisition module 71 is used to receive a second message sent by the server, where the second message is obtained by the server encapsulating the message content and the identifier of the message receiving end according to the message protocol of the second application server;
[0172] The sending module 72 is used to send the message content to the message receiving end according to the identifier of the message receiving end.
[0173] The message processing device provided in the embodiment of the present application can be used to execute the technical solution of the message processing method involved in the second application server in the above embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0174] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0175] Figure 8 This is a schematic diagram of the structure of the server provided in the embodiment of the present application. Figure 8 As shown, the server may include: a processor 80 , a memory 81 , a transceiver 82 , and computer program instructions stored in the memory 81 and executable on the processor 80 .
[0176] The server may be a message forwarder, such as a Router.
[0177] The processor 80 executes the computer execution instructions stored in the memory, so that the processor 80 executes the scheme in the above embodiment. The processor 80 can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0178] The memory 81 and the transceiver 82 are connected to the processor 80 through the system bus and communicate with each other. The memory 81 is used to store computer program instructions. The transceiver 82 is used to communicate with other application servers and computers, and the transceiver 82 constitutes a communication interface.
[0179] Optionally, in hardware implementation, the above Figure 5 The acquisition module 51 and the sending module 53 in the illustrated embodiment correspond to the transceiver 82 in this embodiment.
[0180] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0181] The server provided in the embodiment of the present application can be used to execute the technical solutions involved in the server in the above embodiments. Its implementation principles and technical effects are similar and will not be repeated here.
[0182] Fig. 9 This is a schematic diagram of the structure of the electronic device embodiment 1 provided in the present application. Fig. 9 As shown, the electronic device may include: a processor 90 , a memory 91 , a transceiver 92 , and computer program instructions stored in the memory 91 and executable on the processor 90 .
[0183] The electronic device corresponds to the first application server, which may be a server of an instant messaging system.
[0184] The processor 90 executes the computer execution instructions stored in the memory, so that the processor 90 executes the scheme in the above embodiment. The processor 90 can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0185] The memory 91 and the transceiver 92 are connected to the processor 90 through the system bus and communicate with each other. The memory 91 is used to store computer program instructions. The transceiver 92 is used to communicate with other application servers, servers, computers, etc., and the transceiver 92 constitutes a communication interface.
[0186] Optionally, in hardware implementation, the above Figure 6 The acquisition module 61 and the sending module 64 in the illustrated embodiment correspond to the transceiver 92 in this embodiment.
[0187] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0188] The electronic device provided in the embodiment of the present application can be used to execute the technical solution involved in the first application server in the above embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0189] Fig.10 This is a schematic diagram of the structure of the electronic device embodiment 2 provided in the present application. Fig.10 As shown, the electronic device may include: a processor 100 , a memory 101 , a transceiver 102 , and computer program instructions stored in the memory 101 and executable on the processor 100 .
[0190] The electronic device corresponds to the second application server, which may be a server of an instant messaging system.
[0191] The processor 100 executes the computer execution instructions stored in the memory, so that the processor 100 executes the scheme in the above embodiment. The processor 100 can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0192] The memory 101 and the transceiver 102 are connected to the processor 100 through the system bus and communicate with each other. The memory 101 is used to store computer program instructions. The transceiver 102 is used to communicate with other application servers, servers, computers, etc., and the transceiver 102 constitutes a communication interface.
[0193] Optionally, in hardware implementation, the above Figure 7 The acquisition module 71 and the sending module 72 in the illustrated embodiment correspond to the transceiver 102 in this embodiment.
[0194] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0195] The electronic device provided in the embodiment of the present application can be used to execute the technical solution involved in the second application server in the above embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0196] An embodiment of the present application also provides a chip for running instructions, which is used to execute the technical solution of the message processing method in the above embodiment.
[0197] An embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the message processing method in the above embodiment.
[0198] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0199] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0200] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A message processing method, characterized in that: Applicable to servers, including: Acquire a first message sent by a first application server, where the first message includes an identifier of the first application server, message content, and an identifier of a message receiving end; If the message receiving end belongs to the second application server, convert the first message according to the message protocol of the first application server and the message protocol of the second application server to generate a second message that can be recognized by the second application server; Sending the second message to the second application server; After obtaining the first message sent by the first application server, the method further includes: Determine the identifier of the second application server corresponding to the identifier of the message receiving terminal according to the correspondence between the locally stored device identifier and the identifier of the application server; Querying the interface of the second application server corresponding to the identifier of the second application server to determine whether the message receiving end belongs to the second application server; If the message receiving end does not belong to the second application server, an error report is sent to the first application server, where the error report is used to indicate that the message receiving end does not belong to the second application server.
2. The method according to claim 1, characterized in that: The converting the first message according to the message protocol of the first application server and the message protocol of the second application server to generate a second message that can be recognized by the second application server includes: Parsing the first message according to the message protocol of the first application server to obtain the message content and the identifier of the message receiving end; According to the message protocol of the second application server, the message content and the identifier of the message receiving end are encapsulated to obtain the second message.
3. A message processing method, characterized in that: Applied to an application server, the application server includes: a first application server and a second application server, the method includes: The first application server obtains the message content sent by the message sending end and the identifier of the message receiving end; The first application server determines, according to the identifier of the message receiving end, whether the application server to which the message receiving end belongs is the first application server; If the application server to which the message receiving end belongs is not the first application server, the first application server encapsulates the message content, the message receiving end identifier and the first application server identifier according to the message protocol of the first application server to obtain a first message; The first application server sends the first message to the server, so that the server determines the identifier of the second application server corresponding to the identifier of the message receiving end according to the correspondence between the locally stored device identifier and the identifier of the application server; queries the interface of the second application server corresponding to the identifier of the second application server to determine whether the message receiving end belongs to the second application server; if the message receiving end does not belong to the second application server, sends an error report to the first application server, and the error report is used to indicate that the message receiving end does not belong to the second application server; if the message receiving end belongs to the second application server, converts the first message according to the message protocol of the first application server and the message protocol of the second application server to generate a second message that can be recognized by the second application server; sends the second message to the second application server; The first application server obtains an error report sent by the server, where the error report is used to indicate that the message receiving end does not belong to the second application server; The first application server sends an error report to the message sending terminal; The second application server receives a second message sent by the server, where the second message is obtained by the server determining that the message receiving end belongs to the second application server and encapsulating the message content and the identifier of the message receiving end according to the message protocol of the second application server; The second application server sends the message content to the message receiving end according to the identifier of the message receiving end.
4. The method according to claim 3, characterized in that The method further comprises: If the application server to which the message receiving end belongs is the first application server, the message content is sent to the message receiving end according to the identifier of the message receiving end.
5. A message processing device, characterized in that: Applied to the server, including: an acquisition module, a generation module, a sending module and a processing module; The acquisition module is used to acquire a first message sent by the first application server, where the first message includes an identifier of the first application server, message content, and an identifier of a message receiving end; The generating module is used for converting the first message according to the message protocol of the first application server and the message protocol of the second application server to generate a second message that can be recognized by the second application server if the message receiving end belongs to the second application server; The sending module is used to send the second message to the second application server; The processing module is used to determine the identifier of the second application server corresponding to the identifier of the message receiving end according to the correspondence between the device identifier and the identifier of the application server stored locally; Querying the interface of the second application server corresponding to the identifier of the second application server to determine whether the message receiving end belongs to the second application server; The sending module is further used to send an error report to the first application server if the message receiving end does not belong to the second application server, and the error report is used to indicate that the message receiving end does not belong to the second application server.
6. A message processing device, characterized in that: Applied to an application server, the application server comprises: a first application server and a second application server, the first application server comprises: a first acquisition module, a determination module, a processing module and a first sending module; The first acquisition module is used to acquire the message content sent by the message sending end and the identifier of the message receiving end; The determining module is used to determine whether the application server to which the message receiving end belongs is the first application server according to the identifier of the message receiving end; The processing module is configured to encapsulate the message content, the message receiving end identifier and the first application server identifier according to the message protocol of the first application server to obtain a first message if the application server to which the message receiving end belongs is not the first application server; The first sending module is used to send the first message to the server, so that the server determines the identifier of the second application server corresponding to the identifier of the message receiving end according to the correspondence between the locally stored device identifier and the identifier of the application server; queries the interface of the second application server corresponding to the identifier of the second application server to determine whether the message receiving end belongs to the second application server; if the message receiving end does not belong to the second application server, sends an error report to the first application server, and the error report is used to indicate that the message receiving end does not belong to the second application server; if the message receiving end belongs to the second application server, converts the first message according to the message protocol of the first application server and the message protocol of the second application server to generate a second message that can be recognized by the second application server; sends the second message to the second application server; The first acquisition module is further used to acquire an error report sent by the server, wherein the error report is used to indicate that the message receiving end does not belong to the second application server; The first sending module is further used to send an error report to the message sending end; The second application server includes: a second acquisition module and a second sending module; The second acquisition module is used to receive a second message sent by the server, where the second message is obtained by the server determining that the message receiving end belongs to the second application server and encapsulating the message content and the identifier of the message receiving end according to the message protocol of the second application server; The second sending module is used to send the message content to the message receiving end according to the identifier of the message receiving end.
7. A server, characterized in that: include: A processor, a memory, a transceiver, and computer program instructions stored in the memory and executable on the processor, wherein the processor implements the message processing method as described in any one of claims 1 to 2 when executing the computer program instructions.
8. An electronic device, characterized in that: include: A processor, a memory, a transceiver, and computer program instructions stored in the memory and executable on the processor, wherein the processor implements the message processing method as described in any one of claims 3 to 4 when executing the computer program instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the message processing method as described in any one of claims 1 to 4 above.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, it is used to implement the message processing method as described in any one of claims 1 to 4 above.
Citation Information
Patent Citations
Protocol conversion method and device
CN109688164A