CN115150349A - Message processing method, device, equipment and storage medium - Google Patents

Message processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN115150349A
CN115150349A CN202110342495.6A CN202110342495A CN115150349A CN 115150349 A CN115150349 A CN 115150349A CN 202110342495 A CN202110342495 A CN 202110342495A CN 115150349 A CN115150349 A CN 115150349A
Authority
CN
China
Prior art keywords
message
field value
target
generating
identification field
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110342495.6A
Other languages
Chinese (zh)
Inventor
李华楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202110342495.6A priority Critical patent/CN115150349A/en
Publication of CN115150349A publication Critical patent/CN115150349A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/07User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
    • H04L51/18Commands or executable codes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the disclosure relates to a message processing method, a message processing device, message processing equipment and a storage medium. The method comprises the following steps: acquiring an initial message, and determining an original field value to be subjected to differentiation processing in the initial message; generating a differential identification field value based on the original field value; wherein a field length of the disparity identification field value is the same as a field length of the original field value; and generating a target message based on the initial message and the difference identification field value, so that the message processing terminal stores the target message and generates a differential message based on the target message. When the same message is pulled in a differentiated mode, the message is generated and processed in a differentiated mode by using the differentiated identification field value, the storage space of the message is saved, the performance loss of equipment is reduced, and the compatibility of an original communication frame is improved.

Description

Message processing method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of communications technologies, and in particular, to a message processing method, apparatus, device, and storage medium.
Background
In scenes such as live broadcast and social application which need real-time message processing, when different clients pull the same message, customized/differentiated processing is performed on the message according to message pull requests corresponding to the clients for reasons such as privacy and information protection, system security maintenance and the like, so that messages (namely differentiated messages) with different contents are generated, and the differentiated messages are fed back to the corresponding clients.
The current schemes for differentially processing messages mainly include: the method comprises the steps of generating various differentiation messages according to request parameters corresponding to various clients in advance, and feeding back the differentiation messages corresponding to the clients when one client requests the messages. One is to generate each differentiated message content in advance according to the request parameters corresponding to each client, then fuse all the differentiated message contents into the message to generate a message containing all the differentiated contents, and when any client requests the message, feed the message back to the client. Both of these two processing methods require generation of all differentiated message contents, resulting in excessive occupation of memory space and excessive loss of performance. Yet another is to add special fields in the messaging protocol or message structure to identify the different content of different clients. However, this method requires changing the communication protocol or message structure throughout the whole communication process, which may result in excessive changes of the whole communication framework and poor compatibility.
In a word, the existing message differentiation processing mode can cause the problems of excessive occupation of storage space, excessive loss of performance of each communication terminal device, poor compatibility of a communication frame and the like.
Disclosure of Invention
In order to solve the technical problems or at least partially solve the technical problems, the present disclosure provides a message processing method, apparatus, device and storage medium.
The embodiment of the disclosure provides a message processing method, which is applied to a message generating end, and the method comprises the following steps:
acquiring an initial message, and determining an original field value to be subjected to differentiation processing in the initial message;
generating a differential identification field value based on the original field value; wherein a field length of the disparity identification field value is the same as a field length of the original field value;
and generating a target message based on the initial message and the difference identification field value, so that the message processing terminal stores the target message, and generates a differential message based on the target message.
The embodiment of the present disclosure further provides a message processing method, which is applied to a message processing end, and the method includes:
acquiring a message acquisition request sent by a client, wherein the message acquisition request at least comprises a message identifier and environment variable information adapted to the client;
determining a target message based on the message identifier, and determining a difference identifier field value to be subjected to difference processing in the target message;
determining a corresponding original field value in the target message based on the differential identification field value;
and generating a differential message corresponding to the message acquisition request based on the target message, the environment variable information and the original field value, and feeding the differential message back to the client.
The embodiment of the present disclosure further provides a message processing apparatus configured at a message generating end, where the apparatus includes:
an original field value determining module, configured to obtain an initial message and determine an original field value to be processed in a differentiated manner in the initial message;
a difference identification field value generation module, configured to generate a difference identification field value based on the original field value; wherein a field length of the disparity identification field value is the same as a field length of the original field value;
and the target message generating module is used for generating a target message based on the initial message and the difference identification field value so that the message processing terminal stores the target message and generates a differential message based on the target message.
The embodiment of the present disclosure further provides a message processing apparatus configured at a message processing end, where the apparatus includes:
the system comprises a message acquisition request acquisition module, a message processing module and a message processing module, wherein the message acquisition request acquisition module is used for acquiring a message acquisition request sent by a client, and the message acquisition request at least comprises a message identifier and environment variable information adaptive to the client;
a difference identification field value determining module, configured to determine a target message based on the message identification, and determine a difference identification field value to be processed in the target message in a differentiation manner;
an original field value determining module, configured to determine a corresponding original field value in the target message based on the differential identification field value;
a differentiated message generation module for generating a differentiated message based on the target message, the environment variable information, and the original field value, and generating a differential message corresponding to the message acquisition request, and feeding back the differential message to the client.
An embodiment of the present disclosure further provides an electronic device, including:
a processor and a memory;
the processor is configured to execute the message processing method applied to the message generation end or the message processing method applied to the message processing end in any embodiment of the present disclosure by calling the program or the instruction stored in the memory.
Embodiments of the present disclosure also provide a computer-readable storage medium storing a program or instructions for causing a computer to execute steps of a message processing method applied to a message generating side or a message processing method applied to a message processing side in any of the embodiments of the present disclosure.
According to the message processing scheme provided by the embodiment of the disclosure, the initial message is obtained, and the original field value to be processed in a differentiation mode in the initial message is determined; generating a difference identification field value based on the original field value; wherein, the field length of the difference identification field value is the same as the field length of the original field value; and generating the target message based on the initial message and the difference identification field value, so that the message processing terminal stores the target message, and generating the difference message based on the target message. The method and the device realize the special identification of the original field value to be subjected to the differential processing in the message by using the field value of the differential identification, so that the target message only carries the special identification, the generation of each differential message before the message is pulled is avoided, the storage space of the message is greatly saved, and the performance loss of the device is reduced. And the difference identification field value contains the original field value, thereby avoiding the problem of message distortion. In addition, the field length of the difference identification field value is the same as that of the original field value, so that the influence on the original communication protocol and the original message structure is avoided, and the compatibility of the original communication frame is improved.
Drawings
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 disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic diagram of a real-time message interaction scenario provided by an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a message processing method applied to a message generating end according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of another message processing method applied to a message generating end according to an embodiment of the present disclosure;
fig. 4 is a schematic flowchart of a message processing method applied to a message processing end according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a message processing apparatus configured at a message generating end according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a message processing apparatus configured at a message processing end according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be described in further detail below. It should be noted that, in the case of no conflict, the embodiments of the present disclosure and the features of the embodiments may be combined with each other.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
The message processing method provided by the embodiment of the disclosure is mainly suitable for the situation that different clients pull the same real-time message differently in a real-time message interaction scene. Fig. 1 is a diagram of an application scenario of real-time message interaction according to an embodiment of the present disclosure. As shown in fig. 1, in a scene that requires real-time message processing, such as a live broadcast, a social application, etc., there are a message generating end 110 that produces messages, a message processing end 120 that stores and responds to interactive requests to process messages, and a plurality of clients 130. The message generator 110 generates a message based on various interactions of any client 130 and sends the message to the message processor 120 for storage. Any client 130 sends a message acquisition request to the message handler 120. The message processing terminal 120 obtains the requested message from the storage space thereof based on the message obtaining request, and performs differentiation processing on the message according to the environment variable information of the client terminal 130 carried in the message obtaining request, so as to generate a differentiation message adapted to the client terminal 130. Then, the message processing end 120 feeds back the differentiated message to the client 130.
It should be noted that the message generating end 110 and the message processing end 120 may be integrated into a certain electronic device, or both may be integrated into the same electronic device.
The message processing method applied to the message generating end provided by the embodiment of the disclosure may be executed by a message processing apparatus configured at the message generating end, where the apparatus may be implemented in a software and/or hardware manner, and the apparatus may be integrated in an electronic device with a certain operation function, such as a notebook computer, a desktop computer, or a server.
Fig. 2 is a flowchart of a message processing method applied to a message generating end according to an embodiment of the present disclosure. Referring to fig. 2, the message processing method applied to the message generating end specifically includes:
s210, obtaining the initial message, and determining an original field value to be subjected to differentiation processing in the initial message.
The message generating end acquires a certain message (namely an initial message) based on the interactive operation of the client or the information published by the maintenance personnel in the background. Then, whether the initial message is a message that needs to be differentially pulled by different clients is judged. For example, a message list is maintained in the message generation end, and the message list at least stores relevant information of messages that need to be pulled differentially (such as message identifiers and message sources that are composed of message names and message sequence numbers) and fields that each message needs to be processed differentially. And the message generating terminal matches the acquired initial message with the messages in the message list. If the matching fails, the initial message does not need to be processed differently, and the initial message can be directly stored to a message processing end. And if the matching is successful, determining that the initial message needs to be subjected to differentiation processing. And then, searching and determining a message field needing to be subjected to differential processing in the initial message from the message list, and extracting and obtaining a field value of the message field, namely an original field value from the initial message.
S220, generating a difference identification field value based on the original field value; the field length of the disparity identification field value is the same as the field length of the original field value.
The disparity identification field value refers to a field value specially labeled with an original field value, and includes information of the original field value.
In order to save the storage space required by the message in the process of message differentiation processing, reduce the performance lost by interacting the differentiated message, and improve the compatibility of the existing interaction framework, the embodiment of the disclosure abandons the scheme of writing more differentiated messages or changing the communication protocol/message format, but marks the original field value of the message field to be differentiated in the initial message, generates the differential identification field value, and merges the differential identification field value into the initial message for storage. In this way, only one message is stored, and the message carries the label of the differential processing. When the client pulls the message, the original field value is restored from the stored message, and then the differentiated message is generated by performing differentiated processing on the original field value. In order to ensure that the message format is not changed, the performance loss of the message parsing of each end is not increased, in the embodiment of the present disclosure, the field lengths of the set original field value and the set differentiated identification field value are equal.
In some embodiments, the difference identification field value may be generated without introducing further content, but with specific processing of the original field value itself. In other embodiments, a field value with a special mark function (e.g., a character or string distinguished from a regular field value) may be introduced, and the difference identification field value may be generated using the special field value and the original field value together.
In some embodiments, S220 includes: determining a target character string from each set character string; based on the original field value and the target character string, a differential identification field value is generated. Wherein the set character string is a field value having a special function, which is different from any character string in the initial message. In some embodiments, the string is set to be a magic string. The reason is that the magic character string belongs to illegal characters, cannot be input by using an input device, has a specific generation strategy, is not easy to be confused with characters in a message, and has better anti-collision and anti-attack capabilities. Specifically, the message generation side acquires one setting character string from a plurality of setting character strings as a target character string. For example, a plurality of magic character strings are generated in advance, and one of the magic character strings is randomly selected as a target character string. Then, the message generating end combines the original field value and the target character string (for example, two character strings are connected, or two character strings are mixed according to a certain rule, etc.), and generates a differential identification field value. When the target character string is a magic character string, based on the characteristic that the magic character string has high identifiability, a mode of connecting an original field value with the magic character string can be adopted. Therefore, the algorithm complexity of the generation of the difference identification field value and the restoration of the subsequent original field value can be simplified, and the performance loss of the difference message interaction is further saved.
And S230, generating a target message based on the initial message and the difference identification field value, so that the message processing terminal stores the target message, and generating a difference message based on the target message.
And fusing the difference identification field value into the initial message to generate a target message. The target message needs to be stored in the message processing end, so that the message processing end can interact with the client. In some embodiments, the message generating side and the message processing side are integrated in the same electronic device, so that the message generating side transmits the target message to the message processing side, and the message processing side stores the target message in the electronic device. In some embodiments, the message generating end and the message processing end are respectively integrated in different electronic devices, so that the message generating end sends the target message to the message processing end, so that the message processing end stores the target message in the electronic device where the message processing end is located.
If the message processing end needs to interact the target message, the message processing end needs to restore the field value of the difference identifier into an original field value in the target message, and then differentiates the original field value by using the environment variable information (such as the client identifier, the client version number, the system information of the system where the client is located) of the client pulling the message, so that the differentiation message adaptive to the client can be generated.
In some embodiments, generating the target message based on the initial message and the delta identification field value comprises: replacing an original field value in the initial message according to the difference identification field value to generate a temporary message; and if the first occurrence frequency of the difference identification field value in the temporary message meets the set condition, generating the target message based on the serialization result of the temporary message and the occurrence position information of the difference identification field in the serialization result. Specifically, when the differential identification field value is "magic string + original field value", the original field value in the initial message is directly replaced with the differential identification field value, generating an un-serialized interim message. Then, in order to further prevent the value of a field in the message from conflicting with the value of the difference identifier field, the embodiment needs to further perform anti-collision processing. In the implementation, the number of occurrences (i.e., the first occurrence number) of the value of the difference identifier field in the temporary message needs to be determined first. Then, whether the first occurrence number meets a set condition is judged. Such as by predetermining the number of occurrences of the original field value in the initial message and comparing the first number of occurrences with it. And if the first occurrence frequency meets the set condition, the temporary message is considered to be correct, and the serialization result and the occurrence position information of the differentiated field value in the serialization result are taken as the target message.
According to the technical scheme of the embodiment of the disclosure, the initial message is obtained, and the original field value to be processed in a differentiation mode in the initial message is determined; generating a difference identification field value based on the original field value; wherein, the field length of the difference identification field value is the same as that of the original field value; and generating a target message based on the initial message and the difference identification field value, so that the message processing terminal stores the target message to the message processing terminal, and generates a differential message based on the target message. The method and the device have the advantages that the original field value to be subjected to differentiation processing in the message is specially identified by utilizing the differential identification field value, so that the target message only carries the special identification, the generation of each differentiation message before the message is pulled is avoided, the storage space of the message is greatly saved, and the performance loss of the device is reduced. And the difference identification field value contains the original field value, thereby avoiding the problem of message distortion. In addition, the field length of the difference identification field value is the same as that of the original field value, so that the influence on the original communication protocol and the original message structure is avoided, and the compatibility of the original communication frame is improved.
Fig. 3 is a flowchart of another message processing method applied to a message generating end according to an embodiment of the present disclosure. The message processing method applied to the message generating end further optimizes the generation of the target message based on the serialization result of the temporary message and the occurrence position information of the differential identification field in the serialization result if the first occurrence frequency of the differential identification field value in the temporary message meets the set condition. Wherein explanations of the same or corresponding terms as those of the above embodiments are omitted. Referring to fig. 3, the message processing method applied to the message generating end includes:
s310, obtaining the initial message, and determining the original field value to be processed in a differentiation mode in the initial message.
S320, determining a target character string from the setting character strings.
And S330, generating a difference identification field value based on the original field value and the target character string.
S340, replacing the original field value in the initial message with the differential identification field value to generate an interim message.
S350, determining the first occurrence number of the difference identification field value in the temporary message.
A recursive computation is used to determine the first number of occurrences of the value of the diff identification field in the interim message. In some embodiments, this recursive computation may be implemented by a protobuf plug-in. The recursive computation should involve traversal of various types of characters in the Message, such as string type, string array type, and Message type, to ensure completeness of traversal.
S360, the temporary message is serialized, the result of the serialization is generated and, and determining a second number of occurrences and occurrence location information of the difference identification field value in the serialized result.
And serializing the temporary message according to the communication protocol of the real-time message to generate a serialized result of the temporary message. Then, the second occurrence number of the difference identification field value in the serialized result and the specific position information (i.e., the occurrence position information) of each difference identification field value in the serialized result are queried by using the magic character string.
Since the interim message is obtained by replacing the original field value with the differential identification field value, its corresponding first number of occurrences should be correct. The serialization result may be the same after each field value is serialized, so the second occurrence frequency may be inaccurate, but the target message to be stored and subsequently consumed is serialized. Therefore, the first number of occurrences and the second number of occurrences need to be compared to determine whether the serialization result is reliable.
And S370, if the first occurrence frequency is not equal to the second occurrence frequency, re-determining the target character string based on the set character strings, and returning to execute the step of generating the difference identification field value based on the original field value and the target character string until the first occurrence frequency is determined to be equal to the second occurrence frequency.
If the first occurrence number is not equal to the second occurrence number, the target character string does not reach the anti-collision purpose, and other field values identical to the difference identification field value exist in the serialization result. At this time, a new setting character string is selected from the setting character strings to replace the original target character string. Then, the step S330 and the following steps are executed again until the first occurrence number and the second occurrence number are equal.
And S380, if the first occurrence frequency is equal to the second occurrence frequency, generating the target message based on the serialization result of the temporary message and the occurrence position information of the difference identification field value in the serialization result.
If the first occurrence number is equal to the second occurrence number, it indicates that there are no other field values in the serialization result that conflict with the differential identification field value. Then, the serialization result corresponding to the second occurrence number and the occurrence position information may be collectively used as the target message.
And S390, sending the target message to the message processing terminal so that the message processing terminal stores the target message and generates a differentiated message based on the target message.
According to the technical scheme of the embodiment of the disclosure, the first occurrence frequency of the value of the difference identification field in the temporary message is determined; serializing the temporary message to generate a serialized result, and determining second occurrence times and occurrence position information of the difference identifier field value in the serialized result; and if the first occurrence frequency is equal to the second occurrence frequency, generating the target message based on the serialization result and the occurrence position information. And if the first occurrence frequency is not equal to the second occurrence frequency, re-determining the target character string based on each set character string, and returning to execute the step of generating the differential identification field value based on the original field value and the target character string until the first occurrence frequency is determined to be equal to the second occurrence frequency. The comparison between the occurrence frequency of the difference identification field value in the temporary message and the occurrence frequency of the difference identification field value in the serialization result is realized, so that the situation that other field values identical to the difference identification field value are contained in the serialization result of the message is avoided, the accuracy of the serialization result of the temporary message carrying the difference identification field value is ensured, and the accuracy of the subsequently generated difference message is also improved.
The message processing method applied to the message processing side provided by the embodiment of the present disclosure may be executed by a message processing apparatus configured at the message processing side, where the apparatus may be implemented by software and/or hardware, and the apparatus may be integrated in an electronic device with a certain operation function, for example, a notebook computer, a desktop computer, or a server.
Fig. 4 is a flowchart of a message processing method applied to a message processing end according to an embodiment of the present disclosure. According to the above description, in the embodiment of the present disclosure, the differentiation processing of the message is not performed at the stage of generating the message, but the differentiation processing process is set in the process of feeding back the message to be pulled by the message processing end. Therefore, the problem that a large number of messages are processed in a differentiated mode, and the obtained multiple differentiated messages are not pulled to be consumed, so that the storage space and the performance are wasted can be solved. Referring to fig. 4, the message processing method applied to the message processing end specifically includes:
s410, acquiring a message acquisition request sent by the client, wherein the message acquisition request at least comprises a message identifier and environment variable information of the adaptive client.
The environment variable information refers to information representing the condition of the client, such as a client identifier (client name, client ID, etc.), a client version number, system information of a system in which the client is located, and the like.
When a client wants to pull a message, a message acquisition request is generated based on environment variable information of the client and related information (such as a message identifier, a message ID and the like) of the message, and the message acquisition request is sent to a message processing terminal. The message processing end receives the message acquisition request. The reason why the message acquisition request needs to carry the environment variable information of the client is that the embodiment of the present disclosure performs differentiation processing when the message is pulled, and different client environments perform different differentiation processing on the message, so that the environment variable information needs to be acquired when the differentiation processing is performed.
S420, determining a target message based on the message identifier, and determining a value of a difference identifier field to be processed in the target message in a differentiation mode.
And the message processing terminal searches the target message from the storage space according to the message identifier. Then, the value of the difference identification field in the target message is obtained according to the appearance position in the target message.
In some embodiments, determining the target message based on the message identification comprises: if the message acquisition request is determined to be the acquisition request of the differentiated message based on the message identifier, searching a target message based on the message identifier; the target message comprises the serialization result of the message to be acquired and the occurrence position information of the difference identification field value in the serialization result. Specifically, considering that some messages do not need to be processed differentially, after receiving the message acquisition request, the message processing end determines whether the message pulled by the client is the message that needs to be processed differentially based on the message identifier. For example, the message identification is matched to a list of messages. And if the matching fails, determining that the pulled message does not need differential processing, and feeding back a serialized result of the message queried from the storage space to the client. And if the matching is successful, determining that the message pulled by the message acquisition request is a message needing differential processing. At this time, the serialization result and the corresponding appearance position information are inquired from the storage space.
In some embodiments, determining the difference identification field value to be processed differentially in the target message comprises: and determining the field value of the position corresponding to the position information appearing in the serialization result as the difference identification field value in the target message. Specifically, if the target message includes the occurrence location information, the field value at the location pointed by the occurrence location information is extracted from the serialization result, so as to obtain the difference identification field value. For example, the disparity identity field value may be extracted from a position pointed to by any of the presence position information. To ensure the accuracy of the difference identification field value and its subsequent restored original field value, the difference identification field value may be extracted from multiple locations, verifying its correctness. If a plurality of difference identification field values are not consistent, one difference identification field value with the same field value and the largest number can be selected.
And S430, determining a corresponding original field value in the target message based on the difference identification field value.
And generating a rule of the difference identification field value according to the original field value, and reversely obtaining the original field value from the difference identification field value.
In some embodiments, S430 includes: and determining an original field value corresponding to the difference identification field value in the target message based on the difference identification field value and the target character string. In this embodiment, the target character string is removed from the difference identification field value, and the rest is the original field value. It should be noted that the target character string may be a character string with special identification, such as a magic character string, and the message processing end may identify the target character string in the value of the difference identification field. The target character string may also be stored in the message processing terminal by the message generating terminal in correspondence with the target message, and the message processing terminal may obtain the target character string from the storage space according to the target message and the correspondence relationship therebetween.
S440, generating a differential message corresponding to the message acquisition request based on the target message, the environment variable information and the original field value, and feeding the differential message back to the client.
The original field value is differentiated by using the environment variable information, and the processing result is merged into the serialization result, so that a differentiation message can be generated, and the differentiation message is fed back to the client.
In some embodiments, generating a differentiated message corresponding to the message acquisition request based on the target message, the environment variable information, and the original field value includes: generating a differentiated field value based on the environment variable information and the original field value; and replacing the difference identification field value in the target message according to the difference field value to generate a difference message. Specifically, the original field value is processed by using the environment variable information, and a differentiated field value is obtained. Then, all the difference identification field values in the serialization result are replaced by the difference field values, so that the difference message can be obtained. It should be noted that the original field value, the diff identification field value and the diff field value may be in serialized form directly.
According to the technical scheme provided by the embodiment of the disclosure, a message acquisition request sent by a client is acquired, wherein the message acquisition request at least comprises a message identifier and environment variable information adaptive to the client; determining a target message based on the message identifier, and determining a difference identifier field value to be subjected to difference processing in the target message; determining a corresponding original field value in the target message based on the differential identification field value; and generating a differential message corresponding to the message acquisition request based on the target message, the environment variable information and the original field value, and feeding the differential message back to the client. The method and the device have the advantages that when the message is pulled, the original field value is obtained through the difference identification field value in the message, and then the original field value is subjected to differentiation processing through the environment variable information corresponding to the client side, so that the differentiation message adaptive to the client side is generated, the process that the differentiation message is generated and stored before the message is pulled is avoided, and therefore the storage space required for storing the message and the loss of the device performance are reduced.
Fig. 5 is a schematic structural diagram of a message processing apparatus configured at a message generation end according to an embodiment of the present disclosure. As shown in fig. 5, the apparatus includes:
an original field value determining module 510, configured to obtain an initial message, and determine an original field value to be processed in a differentiation manner in the initial message;
difference identifier field value the generation module (520) is used to generate, for generating a differential identification field value based on the original field value; wherein, the field length of the difference identification field value is the same as the field length of the original field value;
and a target message generating module 530, configured to generate a target message based on the initial message and the difference identification field value, so that the message processing end stores the target message, and generates a differentiated message based on the target message.
In some embodiments, the difference identifier field value generation module 520 is specifically configured to:
determining a target character string from each set character string; wherein the set character string is different from the character string in the initial message;
based on the original field value and the target character string, a differential identification field value is generated.
In some embodiments, the target message generation module 530 includes:
the temporary message generation submodule is used for replacing an original field value in the initial message according to the difference identification field value to generate a temporary message;
and the target message determining submodule is used for generating the target message based on the serialization result of the temporary message and the appearance position information of the difference identification field in the serialization result if the first appearance frequency of the difference identification field value in the temporary message meets the set condition.
In some embodiments of the present invention, the, the target message determination submodule is specifically configured to:
determining a first number of occurrences of a differential identification field value in the interim message;
serializing the temporary message to generate a serialized result, and determining a second occurrence frequency and an occurrence position of the difference identifier field value in the serialized result;
and if the first occurrence frequency is equal to the second occurrence frequency, generating a target message based on the serialization result and the occurrence position information.
In some embodiments, the target message determination sub-module is further specifically configured to:
and if the first occurrence frequency is not equal to the second occurrence frequency, re-determining the target character string based on each set character string, and returning to execute the step of generating the difference identification field value based on the original field value and the target character string until the first occurrence frequency is determined to be equal to the second occurrence frequency.
In some embodiments, the string is set to a magic string.
The message processing device configured at the message generating end provided by the embodiment of the disclosure realizes the special identification of the original field value to be subjected to the differentiation processing in the message by using the field value of the differential identification, so that the target message only carries the special identification, thereby avoiding the generation of each differential message before the message is pulled, greatly saving the storage space of the message, and reducing the performance loss of the device. And, the difference identification field value contains the original field value, thus avoiding the problem of message distortion. In addition, the field length of the difference identification field value is the same as that of the original field value, so that the influence on the original communication protocol and the original message structure is avoided, and the compatibility of the original communication frame is improved.
Fig. 6 is a schematic structural diagram of a message processing apparatus configured at a message processing end according to an embodiment of the present disclosure. As shown in fig. 6, the apparatus includes:
a message obtaining request obtaining module 610, configured to obtain a message obtaining request sent by a client, where the message obtaining request at least includes a message identifier and environment variable information adapted to the client;
a difference identifier field value determining module 620, configured to determine a target message based on the message identifier, and determine a difference identifier field value to be processed in the target message in a differentiated manner;
an original field value determining module 630, configured to determine a corresponding original field value in the target message based on the differential identification field value;
the differentiated message generating module 640 is configured to generate a differentiated message corresponding to the message obtaining request based on the target message, the environment variable information, and the original field value, and feed the differentiated message back to the client.
In some embodiments, the differential identification field value determination module 620 includes a target message lookup sub-module to:
if the message acquisition request is determined to be the acquisition request of the differentiated message based on the message identifier, searching a target message based on the message identifier; the target message comprises the serialization result and the difference of the message to be acquired identifying occurrence position information of a field value in the serialized result.
In some embodiments, the delta identification field value determination module 620 includes a delta identification field value determination sub-module to:
and determining the field value of the position corresponding to the position information appearing in the serialization result as the difference identification field value in the target message.
In some embodiments, the original field value determining module 630 is specifically configured to:
based on the difference identification field value and the target character string, and determining an original field value corresponding to the difference identification field value in the target message.
In some embodiments, the differentiated message generating module 640 is specifically configured to:
generating a differentiated field value based on the environment variable information and the original field value;
and replacing the difference identification field value in the target message according to the difference field value to generate a difference message.
The message processing device configured at the message processing end provided by the embodiment of the disclosure realizes that the original field value is obtained by the difference identification field value in the message when the message is pulled, and then the original field value is differentiated by using the environment variable information corresponding to the client, so as to generate the differentiated message adapted to the client, thereby avoiding the process of generating and storing the differentiated message before the message is pulled, and further reducing the storage space required for storing the message and the loss of the device performance.
It should be noted that, in the embodiments of the foregoing apparatuses, the modules and the sub-modules included in the embodiments are merely divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be implemented; in addition, the specific names of the functional modules/sub-modules are only for convenience of distinguishing from each other, and are not used to limit the scope of the present disclosure.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in fig. 7, the electronic device 700 includes one or more processors 701 and memory 702.
The processor 701 may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device 700 to perform desired functions.
Memory 702 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. Volatile memory can include, for example, random Access Memory (RAM), cache memory (or the like). The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer readable storage medium, and the processor 701 may execute the program instructions to implement at least the functions of the message processing method applied to the message generating side or the message processing method applied to the message processing side of the embodiments of the present disclosure described above. Various contents such as an initial message, a target message, a setting character string, etc. may also be stored in the computer-readable storage medium.
In one example, the electronic device 700 may further include: an input device 703 and an output device 704, which are interconnected by a bus system and/or other form of connection mechanism (not shown). The input device 703 may include, for example, a keyboard, a mouse, and the like. The output device 704 may output various information to the outside. The output devices 704 may include, for example, a display, speakers, a printer, and a communication network and remote output devices connected thereto, among others.
Of course, for simplicity, only some of the components of the electronic device 700 relevant to the present disclosure are shown in fig. 7, and components such as buses, input/output interfaces, and the like are omitted. In addition, electronic device 700 may include any other suitable components depending on the particular application.
In addition to the above methods and apparatuses, embodiments of the present disclosure may also be a computer program product including computer program instructions that, when executed by a processor, cause the processor to perform the steps of the message processing method applied to the message generating side or the steps of the message processing method applied to the message processing side provided by the embodiments of the present disclosure.
The computer program product may write program code for carrying out operations for embodiments of the present disclosure in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present disclosure may also be a computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the message processing method applied to the message generating side or the steps of the message processing method applied to the message processing side provided by the embodiments of the present disclosure.
The computer-readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
It is to be understood that the terminology used in the disclosure is for the purpose of describing particular embodiments only, and is not intended to limit the scope of the present application. As used in the specification and claims of this disclosure, the terms "a," "an," "the," and/or "the" are not intended to be inclusive in the singular, but rather are inclusive in the plural, unless the context clearly dictates otherwise. The term "and/or" includes any and all combinations of one or more of the associated listed items. Relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, or apparatus comprising the element.
The foregoing are merely exemplary embodiments of the present disclosure, which enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (15)

1. A message processing method is applied to a message generating end, and the method comprises the following steps:
acquiring an initial message, and determining an original field value to be subjected to differentiation processing in the initial message;
generating a differential identification field value based on the original field value; wherein a field length of the disparity identification field value is the same as a field length of the original field value;
and generating a target message based on the initial message and the difference identification field value, so that the message processing terminal stores the target message, and generates a differential message based on the target message.
2. The method of claim 1, wherein generating a difference identification field value based on the original field value comprises:
determining a target character string from each set character string; wherein the set string is different from the string in the initial message;
generating a differential identification field value based on the original field value and the target string.
3. The method of claim 2, wherein generating a target message based on the initial message and the difference identifier field value comprises:
replacing the original field value in the initial message according to the differential identification field value to generate an interim message;
and if the first occurrence frequency of the difference identification field value in the temporary message meets a set condition, generating the target message based on the serialization result of the temporary message and the occurrence position information of the difference identification field in the serialization result.
4. The method according to claim 3, wherein if the first occurrence number of the difference identifier field value in the interim message satisfies a set condition, the generating the target message based on the serialization result of the interim message and the occurrence position information of the difference identifier field in the serialization result comprises:
determining a first number of occurrences of the delta identification field value in the interim message;
serializing the temporary message to generate the serialized result, and determining the second occurrence frequency and the occurrence position information of the difference identification field value in the serialized result;
and if the first occurrence frequency is equal to the second occurrence frequency, generating the target message based on the serialization result and the occurrence position information.
5. The method of claim 4, wherein after said determining a second number of occurrences of said delta identification field value in said serialized result and said occurrence location information, said method further comprises:
and if the first occurrence frequency is not equal to the second occurrence frequency, re-determining the target character string based on each set character string, and returning to execute the step of generating the difference identification field value based on the original field value and the target character string until the first occurrence frequency is determined to be equal to the second occurrence frequency.
6. The method according to any one of claims 2-5, wherein the setting string is a magic string.
7. A message processing method is applied to a message processing terminal, and the method comprises the following steps:
acquiring a message acquisition request sent by a client, wherein the message acquisition request at least comprises a message identifier and environment variable information adaptive to the client;
determining a target message based on the message identifier, and determining a difference identifier field value to be subjected to difference processing in the target message;
determining a corresponding original field value in the target message based on the differential identification field value;
and generating a differential message corresponding to the message acquisition request based on the target message, the environment variable information and the original field value, and feeding the differential message back to the client.
8. The method of claim 7, wherein the determining a target message based on the message identification comprises:
if the message acquisition request is determined to be the acquisition request of the differential message based on the message identifier, searching the target message based on the message identifier; the target message comprises a serialization result of the message to be acquired and occurrence position information of the difference identification field value in the serialization result.
9. The method of claim 8, wherein determining the value of the difference identifier field to be processed differently in the target message comprises:
and determining a field value at a position corresponding to the occurrence position information in the serialization result as the difference identification field value in the target message.
10. The method of claim 8, wherein said determining a corresponding original field value in said target message based on said delta identification field value comprises:
and determining the original field value corresponding to the difference identification field value in the target message based on the difference identification field value and the target character string.
11. The method of claim 7, wherein generating a differentiated message corresponding to the message acquisition request based on the target message, the environment variable information, and the original field value comprises:
generating a differentiated field value based on the environment variable information and the original field value;
and replacing the difference identification field value in the target message according to the difference field value to generate the difference message.
12. A message processing apparatus, provided at a message generation side, comprising:
an original field value determining module, configured to obtain an initial message and determine an original field value to be processed in a differentiated manner in the initial message;
a difference identification field value generation module that generates a difference identification field value, for generating a differential identification field value based on the original field value; wherein a field length of the disparity identification field value is the same as a field length of the original field value;
and the target message generating module is used for generating a target message based on the initial message and the difference identification field value so that the message processing terminal stores the target message and generates a differential message based on the target message.
13. A message processing apparatus, configured at a message processing side, the apparatus comprising:
the system comprises a message acquisition request acquisition module, a message processing module and a message processing module, wherein the message acquisition request acquisition module is used for acquiring a message acquisition request sent by a client, and the message acquisition request at least comprises a message identifier and environment variable information adaptive to the client;
a difference identification field value determining module, configured to determine a target message based on the message identification, and determine a difference identification field value to be processed in the target message in a differentiation manner;
an original field value determining module, configured to determine a corresponding original field value in the target message based on the differential identification field value;
and the differentiated message generating module is used for generating a differentiated message corresponding to the message acquiring request based on the target message, the environment variable information and the original field value, and feeding the differentiated message back to the client.
14. An electronic device, characterized in that the electronic device comprises:
a processor and a memory;
the processor is configured to perform the steps of the method of any one of claims 1 to 6, or the steps of the method of any one of claims 7 to 11, by calling a program or instructions stored in the memory.
15. A computer-readable storage medium, characterized in that it stores a program or instructions for causing a computer to perform the steps of the method according to any one of claims 1 to 6, or to perform the steps of the method according to any one of claims 7 to 11.
CN202110342495.6A 2021-03-30 2021-03-30 Message processing method, device, equipment and storage medium Pending CN115150349A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110342495.6A CN115150349A (en) 2021-03-30 2021-03-30 Message processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110342495.6A CN115150349A (en) 2021-03-30 2021-03-30 Message processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115150349A true CN115150349A (en) 2022-10-04

Family

ID=83403794

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110342495.6A Pending CN115150349A (en) 2021-03-30 2021-03-30 Message processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115150349A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040071136A1 (en) * 2001-01-29 2004-04-15 Josef Laumen Message transfer device and method for transferring messages
CN1949894A (en) * 2006-11-08 2007-04-18 华为技术有限公司 Short message centre and short message for warding method
US7774445B1 (en) * 2004-12-27 2010-08-10 Emc Corporation System and method for managing zoning in a storage area network by comparing zone sets and identifying differences between zone sets
CN102664007A (en) * 2012-03-27 2012-09-12 上海量明科技发展有限公司 Method, client and system for generating character identification content
US9166936B1 (en) * 2014-06-26 2015-10-20 Parlant Technology, Inc. Message customization
CN108199812A (en) * 2017-12-28 2018-06-22 武汉华显光电技术有限公司 Data transfer control method, device and computer readable storage medium
CN110147413A (en) * 2019-04-26 2019-08-20 平安科技(深圳)有限公司 Date storage method, data query method, apparatus, equipment and storage medium
CN111147354A (en) * 2019-12-25 2020-05-12 广州华多网络科技有限公司 Message processing method, device, equipment and storage medium
EP3739824A1 (en) * 2019-05-17 2020-11-18 Beijing Xiaomi Mobile Software Co., Ltd. Message processing method and apparatus, electronic device and machine-readable storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040071136A1 (en) * 2001-01-29 2004-04-15 Josef Laumen Message transfer device and method for transferring messages
US7774445B1 (en) * 2004-12-27 2010-08-10 Emc Corporation System and method for managing zoning in a storage area network by comparing zone sets and identifying differences between zone sets
CN1949894A (en) * 2006-11-08 2007-04-18 华为技术有限公司 Short message centre and short message for warding method
CN102664007A (en) * 2012-03-27 2012-09-12 上海量明科技发展有限公司 Method, client and system for generating character identification content
US9166936B1 (en) * 2014-06-26 2015-10-20 Parlant Technology, Inc. Message customization
CN108199812A (en) * 2017-12-28 2018-06-22 武汉华显光电技术有限公司 Data transfer control method, device and computer readable storage medium
CN110147413A (en) * 2019-04-26 2019-08-20 平安科技(深圳)有限公司 Date storage method, data query method, apparatus, equipment and storage medium
WO2020215558A1 (en) * 2019-04-26 2020-10-29 平安科技(深圳)有限公司 Data storage method, data query method, apparatus and device and storage medium
EP3739824A1 (en) * 2019-05-17 2020-11-18 Beijing Xiaomi Mobile Software Co., Ltd. Message processing method and apparatus, electronic device and machine-readable storage medium
CN111147354A (en) * 2019-12-25 2020-05-12 广州华多网络科技有限公司 Message processing method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US20190251143A1 (en) Web page rendering method and related device
CN107704479B (en) File generation method and device
CN110119292B (en) System operation parameter query method, matching method, device and node equipment
US20040193465A1 (en) Automated workflow assignment to print jobs
EP3217632B1 (en) Oid configuration, parsing method, client, node, database and storage medium
CN114090671A (en) Data import method and device, electronic equipment and storage medium
CN114168343A (en) Service request response method, device, server and storage medium
US10956659B1 (en) System for generating templates from webpages
CN113111669A (en) Increment-based front-end multi-language internationalized translation method and device
CN114329097B (en) Method and device for registering product identifications in batches, electronic equipment and storage medium
CN115150349A (en) Message processing method, device, equipment and storage medium
CN106301906B (en) Object configuration method and device based on distributed system
CN113761419A (en) Display method and device of topological information, electronic equipment and storage medium
CN112433752A (en) Page parsing method, device, medium and electronic equipment
CN112667274A (en) Method and device for generating application programming interface document and electronic equipment
CN111178025A (en) Editing method and device of nuclear power plant operation guide rules, computer equipment and storage medium
CN112988391B (en) Data processing method, device, equipment and storage medium
CN115357548B (en) Block chain-based electronic contract query method, device, equipment and medium
CN115310065B (en) File generation method and device, storage medium and electronic equipment
US10133758B2 (en) Cell-based database management system
CN114928466B (en) Automatic identification method and device for encrypted data, storage medium and computer equipment
CN115237729A (en) Prompt message generation method and device, computer equipment and storage medium
CN113761508A (en) Information processing method, information processing device, electronic equipment and storage medium
CN117555632A (en) Form processing method, form processing device, electronic equipment and storage medium
CN114461302A (en) Parameter checking method, checking template generating method and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination