Communication message processing method and device, equipment, storage medium and program product
By establishing a mapping relationship between the communication transmission model and the codec on the server side, and using the codec manager to identify and decode communication message packets, the cumbersome data format processing problem in traditional communication methods is solved, and the efficiency of communication interaction is improved.
Patent Information
- Application Number
- CN202511737766.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-24
- Publication Date
- 2026-02-10
AI Technical Summary
Traditional communication methods require activating different services and changing communication protocols when dealing with complex data formats, making the communication process overly cumbersome.
By introducing a communication transmission model manager and a codec manager on the server side, a mapping relationship between the communication transmission model and the codec is established. The codec manager is used to call the codec in turn to identify and decode the communication message packets, adapting to different formats of communication message packets.
It enables flexible adaptation to changes in communication services without affecting the main logic code, improves the efficiency of the communication interaction process, and avoids data processing when opening different services and changing communication protocols.
Smart Images

Figure CN121509547A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication, and particularly relates to a communication message processing method and device, equipment, a storage medium and a program product. BACKGROUND
[0002] Commonly used distributed service data receiving modes are single data protocol processing. For example, a common HTTP server only processes HTTP (Hypertext Transfer Protocol) protocol services, and if TCP (Transmission Control Protocol) communication is needed, a TCP service needs to be started for processing.
[0003] However, the above mode needs to open different services to listen to multiple ports for processing corresponding data when complex multi-data format processing is performed, and different communication service components also need to be introduced. When a communication protocol is replaced, a large adjustment is needed, which leads to a too complicated communication interaction process. SUMMARY
[0004] The main purpose of the present application is to provide a communication message processing method, device, equipment, storage medium and program product, which aims to solve the technical problem that the traditional communication mode needs to open different services and replace communication protocols to process corresponding data when complex multi-data format processing is performed, leading to a too complicated communication interaction process.
[0005] To achieve the above purpose, the present application provides a communication message processing method, which is applied to a server. The server is connected with a communication transmission model manager and a codec manager. The communication transmission model manager includes multiple communication transmission models. The codec manager includes multiple codecs. The codec manager caches a mapping relationship between the communication transmission models and the codecs. The method comprises the following steps: When a communication message packet is received, the communication message packet is identified by sequentially calling each codec through the codec manager according to the mapping relationship between the communication transmission models and the codecs, so as to determine a target codec matched with the communication message packet; The communication message packet is decoded through the target codec, and a decoded message packet obtained is submitted to an upper-layer business logic; Application layer data returned by the upper-layer business logic is input into the target codec for communication coding, so as to obtain response data consistent in communication protocols; The response data is returned to a client.
[0006] In an embodiment, before the step of, in case that a communication message packet is received, according to the mapping relationship between the communication transmission model and each codec, sequentially calling each codec by the codec management manager to identify the communication message packet, the step further comprises: In case that a program starting instruction is received, loading the association relationship between the communication transmission processor and the communication transmission model by the communication transmission model manager, and loading the mapping relationship between the communication transmission model and the codec by the codec management manager; wherein each communication transmission model records a transmission layer protocol type and an associated codec name; According to the association relationship between the communication transmission processor and the communication transmission model, calling a corresponding target communication transmission processor, which is used to listen to a communication message packet sent by a client.
[0007] In an embodiment, the step of, in case that a program starting instruction is received, loading the association relationship between the communication transmission processor and the communication transmission model by the communication transmission model manager, and loading the mapping relationship between the communication transmission model and the codec by the codec management manager, comprises: In case that a program starting instruction is received, scanning local code files by the communication transmission model manager and the codec management manager, wherein the local code files comprise a communication model data file, a communication transmission processor interface file and a codec implementation file; According to the communication model data file and the communication transmission processor interface file, determining the association relationship between the communication transmission processor and the communication transmission model, and loading the association relationship between the communication transmission processor and the communication transmission model to the communication transmission model manager; According to the communication model data file and the codec implementation file, determining the mapping relationship between the communication transmission model and the codec, and loading the mapping relationship between the communication transmission model and the codec to the codec management manager.
[0008] In an embodiment, the step of, in case that a communication message packet is received, according to the mapping relationship between the communication transmission model and each codec, sequentially calling each codec by the codec management manager to identify the communication message packet, and determining a target codec matching the communication message packet, comprises: In case that a communication message packet is received, querying a codec identifier matching the communication message packet by the mapping relationship between the communication transmission model and each codec; According to the codec identifier, sequentially calling each codec associated with the communication transmission model by the codec management manager; Based on the codecs, the communication message packets are identified to determine the target codec that matches the communication message packets.
[0009] In one embodiment, the step of performing data identification on the communication message packet based on each codec to determine the target codec matching the communication message packet includes: The communication message packets are sequentially identified by the respective codecs to generate identification results. If the recognition result includes a success flag, then the recognition is stopped and the responding codec is identified as the target codec; If each codec returns a failure flag, an error message is generated and sent back to the client.
[0010] Furthermore, to achieve the above objectives, this application also proposes a communication message processing method, which is applied to a client and includes: The target communication transmission processor is determined from the communication transmission model manager by the communication transmission type; Obtain the peer address information of the target communication transmission processor, and establish a connection with the server based on the peer address information; After successfully connecting to the server, the communication message is transmitted to the server.
[0011] Furthermore, to achieve the above objectives, this application also proposes a communication message processing apparatus. The apparatus is applied to a server, which is connected to a communication transmission model manager and a codec manager. The communication transmission model manager includes multiple communication transmission models, and the codec manager includes multiple codecs. The codec manager caches the mapping relationship between the communication transmission models and each codec. The apparatus includes: The identification module is used to identify the communication message packet by sequentially calling each codec through the codec manager according to the mapping relationship between the communication transmission model and each codec when a communication message packet is received, and to determine the target codec that matches the communication message packet. The decoding module is used to decode the communication message packet through the target codec and submit the decoded message packet to the upper-layer business logic. The encoding module is used to input the application layer data returned by the upper-layer business logic into the target codec for communication encoding to obtain response data consistent with the communication protocol; The response module is used to send the response data back to the client.
[0012] In addition, to achieve the above objectives, this application also proposes a communication message processing device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the communication message processing method described above.
[0013] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the communication message processing method described above.
[0014] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the communication message processing method described above.
[0015] One or more technical solutions proposed in this application have at least the following technical effects: The communication message processing method of this application includes: upon receiving a communication message packet, according to the mapping relationship between the communication transmission model and each codec, sequentially calling each codec through the codec manager to identify the communication message packet, and determining the target codec that matches the communication message packet; decoding the communication message packet through the target codec, and submitting the decoded message packet to the upper-layer business logic; inputting the application layer data returned by the upper-layer business logic into the target codec for communication encoding to obtain response data consistent with the communication protocol; and sending the response data back to the client.
[0016] When this application receives a communication message, it calls each codec associated with the communication transmission model through the codec manager to perform communication identification on the communication message to determine the corresponding target codec. In this way, the target codec can adapt communication message messages of different formats, complete the encoding and decoding to obtain response data with consistent communication protocols, avoid the data processing of opening different services and changing communication protocols, and thus improve the efficiency of the entire communication interaction process. Attached Figure Description
[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a functional architecture diagram provided for Embodiment 1 of the communication message processing method of this application; Figure 2 This is a flowchart illustrating a first embodiment of the communication message processing method applied to the server in this application. Figure 3 This is a dependency graph between the various architectures provided in Embodiment 1 of this application; Figure 4 This is a flowchart illustrating a second embodiment of the communication message processing method applied to the server in this application. Figure 5 This is a flowchart illustrating a third embodiment of the communication message processing method applied to the server in this application. Figure 6 This is a flowchart illustrating an embodiment of the communication message processing method applied to a client in this application; Figure 7 This is a schematic diagram of the module structure of the communication message processing device according to an embodiment of this application; Figure 8 This is a schematic diagram of the device structure of the hardware operating environment involved in the communication message processing method in the embodiments of this application.
[0020] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0021] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0022] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific embodiments.
[0023] This application provides a communication message processing method. The method is applied to a server. The server is connected to a communication transmission model manager and a codec manager. The communication transmission model manager includes multiple communication transmission models, and the codec manager includes multiple codecs. The codec manager caches the mapping relationship between the communication transmission models and each codec.
[0024] To facilitate understanding of the principles of this embodiment, please refer to... Figure 1 , Figure 1This is a functional architecture diagram provided for Embodiment 1 of the communication message processing method of this application. This application uses a domain model design approach to construct capability boundaries and implements communication data processing relationships based on the model's dependencies (i.e., the communication transmission model manager). As shown in the diagram, the transport layer and application layer are completely separated according to the communication protocol layering. The transport layer serves as the basic capability, carrying the processing of the application layer. The transport layer defines communication transmission, such as TCP or UDP; the application layer matches the corresponding codec based on the data structure definition of the transport layer. During data processing, the communication transmission processor can identify and call different data codecs in the codec manager based on the data format, enabling layer-by-layer replacement without mutual interference.
[0025] Based on the above architecture, referring to Figure 2 , Figure 2 This is a flowchart illustrating an embodiment of the communication message processing method applied to a server in this application. In this embodiment, the communication message processing method includes steps S10-S40: Step S10: Upon receiving a communication message packet, based on the mapping relationship between the communication transmission model and each codec, the codec manager sequentially calls each codec to identify the communication message packet and determine the target codec that matches the communication message packet.
[0026] In this embodiment, the server enables flexible processing of data with different protocols and formats by calling the communication transmission model manager and the codec manager.
[0027] Specifically, the relationships between the modules are as follows: Figure 3 As shown, Figure 3 This is a dependency diagram between the various architectures provided in Embodiment 1 of this application.
[0028] The communication transmission model describes a data structure that describes communication transmission behavior. Its attributes include the transport layer protocol type (such as TCP, UDP, etc.), address, port and its associated codec information. It serves as a bridge connecting the transport layer and the application layer, and is used to guide the server on how to select the appropriate codec to process messages.
[0029] The communication transmission model relies on the communication transmission model manager, which is a management module that internally holds the association between communication transmission model caches (models, processors). Its functions include loading communication transmission models, obtaining communication transmission processors (types), and obtaining all communication transmission processors. It is used to load, cache, and manage multiple communication transmission models and model instances (i.e., model data).
[0030] The codec is a component that implements data format conversion, consisting of an encoder and a decoder, and can identify communication data. The decoder parses the received communication message into a data format that the service can recognize; the encoder encapsulates the data returned by the service into a response message that conforms to the communication protocol requirements. Each codec typically supports data processing of a specific format or protocol.
[0031] The codecs rely on a codec manager, which internally maintains a codec cache <name, codec> relationship. Its functions include retrieving codecs (names), retrieving all codecs, and loading codecs. The codec manager can provide codec lookup, retrieval, and matching functions based on codec names or identifiers, ensuring the server can correctly identify and process communication data of different formats.
[0032] The communication transmission processor implements the behavior of the communication transmission model, including behavioral methods for both server and client scenarios. Its functions include: starting a listener (address, port), establishing a connection (address, port), reading data, writing data (data, encoding / decoding), closing the connection, and closing the listener. The communication transmission processor depends on the aforementioned communication transmission model manager. The server, based on the communication transmission processor, adapts to the communication service by combining different communication transmission models. When writing data, the encoding / decoding manager calls the codec to encode data before sending and decode it after receiving.
[0033] In the specific implementation, the client sends a communication message to the server. Since this data includes a communication protocol header and business data, its format may vary depending on the protocol or application, requiring identification and decoding using the communication message processing method provided in this application. After receiving the communication message, the server uses the codec manager to call the data identification methods of each codec to determine whether each codec supports processing the current communication message. Upon successful identification, the target codec is selected for subsequent decoding operations.
[0034] Step S20: Decode the communication message packet using the target codec, and submit the decoded message packet to the upper-layer business logic.
[0035] In this embodiment, after determining the target codec, the communication message packet is parsed using the target codec and converted into a data structure with a recognizable format for processing by the upper-layer business logic.
[0036] The upper-layer business logic is the module or system on the server side responsible for handling specific business functions, such as order processing and user verification. It receives the decoded message, performs the corresponding operation, and returns the processing result.
[0037] Step S30: Input the application layer data returned by the upper-layer business logic into the target codec for communication encoding to obtain response data consistent with the communication protocol.
[0038] Step S40: Send the response data back to the client.
[0039] Application layer data is the data returned after processing by the upper-layer business logic. At this stage, it is in an internal format and needs to be encoded using a codec to encapsulate it into a format conforming to the communication protocol, generating a response message that meets the protocol requirements. This response message, with a format consistent with the client's expected protocol, is then sent back to the client, completing a full communication interaction.
[0040] During the aforementioned communication interaction, the distributed server can adapt to changes in communication services by modifying the communication transmission model without affecting the main logic code. It also supports most communication data processing, requiring only the enrichment of the communication transmission processor and codec implementation, which can be optimized independently. This embodiment completely decouples the transport layer from the application layer, allowing the server to flexibly change the communication type during interaction without impacting the application.
[0041] This application proposes a communication message processing method applied to a server. The server is connected to a communication transmission model manager and a codec manager. The communication transmission model manager includes multiple communication transmission models, and the codec manager includes multiple codecs. The codec manager caches the mapping relationship between the communication transmission models and each codec. When the server receives a communication message packet, it sequentially calls each codec to identify the communication message packet according to the mapping relationship between the communication transmission models and each codec, and determines the target codec that matches the communication message packet. The target codec decodes the communication message packet and submits the decoded message packet to the upper-layer business logic. The application layer data returned by the upper-layer business logic is input to the target codec for communication encoding to obtain response data consistent with the communication protocol. The response data is then sent back to the client. In this embodiment, upon receiving a communication message, the codec manager calls each codec associated with the communication transmission model to perform communication identification on the communication message to determine the corresponding target codec. This allows the target codec to adapt to communication message messages of different formats, complete encoding and decoding to obtain response data with consistent communication protocols, and avoid data processing issues related to activating different services and changing communication protocols, thereby improving the efficiency of the entire communication interaction process.
[0042] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to the first embodiment can be referred to the above description, and will not be repeated hereafter. Before the step described in this example of identifying the communication message packet by sequentially calling each codec through the codec manager according to the mapping relationship between the communication transmission model and each codec when a communication message packet is received, the method further includes: Step S01: Upon receiving the program start command, load the association between the communication transmission processor and the communication transmission model through the communication transmission model manager, and load the mapping relationship between the communication transmission model and the codec through the codec manager; wherein, each communication transmission model records the transport layer protocol type and the associated codec name.
[0043] Before implementing the above communication interaction process, this embodiment also needs to call the loading method of the communication transmission model manager and the loading method of the codec manager to start the server.
[0044] The program startup command is the starting signal that triggers the subsequent automatic loading and listening process. The association relationship refers to the two-way binding relationship between a communication transmission processor and a communication transmission model; once this relationship is loaded into the communication transmission model manager, the manager knows which processor class should be instantiated when a protocol defined by a certain model needs to be started.
[0045] The mapping relationship refers to the one-to-one correspondence between the declared codec names and the actual codecs within the same communication transmission model; this table is established by the codec manager during the startup phase and is used for the data format identification of the aforementioned communication message packets.
[0046] Further, in a feasible embodiment, the steps of loading the association between the communication transmission processor and the communication transmission model through the communication transmission model manager, and loading the mapping relationship between the communication transmission model and the codec through the codec manager, upon receiving a program start instruction, include: Upon receiving a program start command, the local code file is scanned by the communication transmission model manager and the codec manager. The local code file includes a communication model data file, a communication transmission processor interface file, and a codec implementation file. The association between the communication transmission processor and the communication transmission model is determined based on the communication model data file and the communication transmission processor interface file, and the association between the communication transmission processor and the communication transmission model is loaded into the communication transmission model manager. The mapping relationship between the communication transmission model and the codec is determined based on the communication model data file and the codec implementation file, and the mapping relationship between the communication transmission model and the codec is loaded into the codec manager.
[0047] The ground code file is a collection of static files stored in a specified directory, containing three key types of files: communication model data files, communication transmission processor interfaces / implementation classes, and codec implementation classes; scanning these files will complete the relationship establishment of the manager.
[0048] The communication model data file contains information such as the transport layer protocol type of the communication transmission model. The communication transmission processor interface file defines the lifecycle methods of the communication transmission processor implementation, used to establish the association between the model and the processor. The codec implementation file contains the class files of the codec logic; the codec manager binds the class names to the codec names declared in the model during scanning, completing the mapping.
[0049] Step S02: Based on the association between the communication transmission processor and the communication transmission model, the corresponding target communication transmission processor is invoked. The target communication transmission processor is used to listen for communication message packets sent by the client.
[0050] After the communication transmission model manager and codec manager have finished loading the data, if it is necessary to start a server to listen for data, the target communication transmission processor can be selected according to the content loaded by the communication transmission model manager, and the start listening method can be called to listen for communication message packets sent by the client.
[0051] For example, to facilitate understanding of the above startup process, refer to... Figure 4 , Figure 4 This is a flowchart illustrating a second embodiment of the communication message processing method applied to a server in this application. When the application starts, it calls the loading methods of the communication transmission model manager and the codec manager to scan local code files, obtaining the communication model data file, the communication transmission processor interface implementation code file, and the codec implementation file. Then, the communication transmission model manager stores the loaded file data in a cache according to the built-in association between the communication transmission processor and the communication transmission model, and the codec manager stores the loaded data in a cache according to the relationship between the name and the codec. At this point, if a server exists, the application can call the target communication transmission processor based on the loaded content managed by the communication transmission model and start a listening method to listen for data, thereby completing the startup process.
[0052] In the technical solution provided in this embodiment, during the above-mentioned startup phase, the relationship between the processor, model, and codec can be established at once using only local code files, without the need for manual coding, which significantly reduces configuration costs.
[0053] Based on the above embodiments of this application, in the third embodiment of this application, the same or similar content as the above embodiments can be referred to the above description, and will not be repeated hereafter. The step described in this example, upon receiving a communication message packet, and determining the target codec matching the communication message packet by sequentially calling each codec through the codec manager to identify the communication message packet according to the mapping relationship between the communication transmission model and each codec, includes: Step S11: Upon receiving a communication message, query the codec identifier that matches the communication message through the mapping relationship between the communication transmission model and each codec.
[0054] The mapping between the communication transmission model and each codec is a memory object parsed from the model file by the communication transmission model manager at startup. This object includes the transport layer protocol type and a list of all codec identifiers supported by the model, allowing for quick runtime lookup. The codec identifier is a short logical name declared within the model for each codec, serving as a unique key-value pair for subsequently finding the actual implementation class in the codec manager.
[0055] Step S12: Based on the codec identifier, sequentially call each codec associated with the communication transmission model through the codec manager.
[0056] Step S13: Based on each codec, perform data identification on the communication message packet to determine the target codec that matches the communication message packet.
[0057] In this embodiment, after the communication transmission processor receives the communication message packet, it obtains the codec identifier through the mapping relationship between the communication transmission model and each codec. Thus, the corresponding target codec can be called based on the codec identifier without the need for manual configuration of routing rules.
[0058] Furthermore, in a feasible embodiment, the step of performing data identification on the communication message packet based on each codec to determine the target codec matching the communication message packet includes: sequentially performing data identification on the communication message packet through each codec to generate an identification result; if the identification result includes a success flag, then stopping the identification and determining the responding codec as the target codec; if each codec returns a failure flag, then generating error information and feeding back the error information to the client.
[0059] The success flag indicates that the identification process terminates when the current codec determines that the communication message can be processed, at which point the current codec can be identified as the target codec. The failure flag indicates that the current codec cannot parse the message.
[0060] In this implementation, when all codecs do not match, the server constructs an exception message (including error code, prompt, original first 64 bytes, etc.) and writes it back to the client through the same connection to help the client quickly locate the format problem.
[0061] For example, to facilitate understanding of the specific execution process on the server side, refer to... Figure 5 , Figure 5 This is a flowchart illustrating a third embodiment of the communication message processing method applied to the server side in this application. During the data processing on the server side, when the target communication transmission processor on the server side receives request data (i.e., a communication message packet) sent by the client, it calls a read method to read data from the communication message packet. During the data reading process, the supported codec definitions are obtained through the mapping information built into the communication transmission processor, and the corresponding codec is retrieved from the codec manager using the name of the codec definition.
[0062] During the codec data identification process, if multiple codecs are involved, the codec that responds will be identified as the target codec upon successful identification. If none of the codecs support the requested data, an error message will be returned.
[0063] If it is determined that the target codec can handle the call to the decoding method, the communication message is decoded, and the decoded data is passed to the upper-layer application logic for processing. After the upper-layer application logic completes its processing, it returns the result to the communication transmission processor. Finally, the communication transmission processor encodes the result, generates the corresponding data, and writes it back to the client.
[0064] In the technical solution provided in this embodiment, after the communication transmission processor receives the communication message packet, it obtains the encoding and decoding definition through the model instance and calls the target encoding and decoding to perform decoding. After the upper-layer application logic processes the data, it encodes the result and returns it to the client to realize the complete data processing flow.
[0065] Based on the above embodiments, this application also proposes a communication message processing method, which is also implemented based on the above architecture and applied to a client. The method includes: Step A1: Determine the target communication transmission processor from the communication transmission model manager by communication transmission type.
[0066] The communication transmission type is the protocol family type specified by the client before initiating the call, such as TCP, UDP, TLS-TCP, etc. This communication transmission type serves as a query condition and is the basis for the aforementioned communication transmission model manager to quickly locate the target communication transmission processor.
[0067] Step A2: Obtain the peer address information of the target communication transmission processor, and establish a link with the server based on the peer address information.
[0068] It should be noted that the peer address information is the server IP and port tuple that the client needs to connect to; this information can be explicitly passed in by the business code or obtained through the service discovery center, and the target communication transmission processor will parse it into a Socket-level address object.
[0069] Step A3: After successfully connecting with the server, transmit the communication message to the server.
[0070] For example, to facilitate understanding of the specific execution process of the client, refer to Figure 6 , Figure 6 This is a flowchart illustrating an embodiment of the communication message processing method applied to a client in this application. During processing, the client first determines the communication transmission type of the data to be sent. Based on this type, it retrieves the corresponding target communication transmission processor from the communication transmission model manager. Then, it sends the target address and port of the target communication transmission processor to the processor, establishing a connection. Next, it sends the data and encoding type to the processor for processing. The processor obtains a codec to encode the data; if no codec exists, an error message is returned. If a codec exists, the data is directly encoded, written to the target server, and a read data method is called to wait for a response. Upon receiving a response, the previously retrieved codec is used for decoding, and the decoded response data is returned to each processing side.
[0071] In this embodiment, after obtaining the peer address information of the target communication transmission processor, the client initiates a handshake (TCP) or connection establishment process at the transport layer through the communication transmission processor. After successfully connecting with the server, the client can transmit communication message packets to the server. Finally, the client reads and decodes the response data and returns it to the processing side, thereby completing the entire communication interaction process.
[0072] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the communication message processing method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0073] This application also provides a communication message processing device, please refer to... Figure 7 , Figure 7This is a schematic diagram of the module structure of a communication message processing device according to an embodiment of this application; the device is applied to a server, the server is connected to a communication transmission model manager and a codec manager, the communication transmission model manager includes multiple communication transmission models, the codec manager includes multiple codecs, and the codec manager caches the mapping relationship between the communication transmission models and each codec; the communication message processing device includes: The identification module 701 is used to identify the communication message packet by sequentially calling each codec through the codec manager according to the mapping relationship between the communication transmission model and each codec when a communication message packet is received, and to determine the target codec that matches the communication message packet. The decoding module 702 is used to decode the communication message packet through the target codec and submit the decoded message packet to the upper-layer business logic. Encoding module 703 is used to input the application layer data returned by the upper layer business logic into the target codec for communication encoding to obtain response data consistent with the communication protocol; The response module 704 is used to send the response data back to the client.
[0074] In one implementation, the communication message processing device is further configured to, upon receiving a program start instruction, load the association between the communication transmission processor and the communication transmission model through the communication transmission model manager, and load the mapping relationship between the communication transmission model and the codec through the codec manager; wherein, each communication transmission model records the transport layer protocol type and the associated codec name; and calls the corresponding target communication transmission processor based on the association between the communication transmission processor and the communication transmission model, wherein the target communication transmission processor is used to listen for communication message packets sent by the client.
[0075] In one implementation, the communication message processing device is further configured to, upon receiving a program start instruction, scan local code files through the communication transmission model manager and the codec manager, wherein the local code files include a communication model data file, a communication transmission processor interface file, and a codec implementation file; determine the association relationship between the communication transmission processor and the communication transmission model based on the communication model data file and the communication transmission processor interface file, and load the association relationship between the communication transmission processor and the communication transmission model into the communication transmission model manager; and determine the mapping relationship between the communication transmission model and the codec based on the communication model data file and the codec implementation file, and load the mapping relationship between the communication transmission model and the codec into the codec manager.
[0076] In one implementation, the identification module 701 is further configured to, upon receiving a communication message packet, query the codec identifier matching the communication message packet through the mapping relationship between the communication transmission model and each codec; according to the codec identifier, sequentially call each codec associated with the communication transmission model through the codec manager; and perform data identification on the communication message packet based on each codec to determine the target codec matching the communication message packet.
[0077] In one implementation, the identification module 701 is further configured to sequentially identify the communication message packets through each codec and generate an identification result; if the identification result includes a success flag, then the identification is stopped and the responding codec is identified as the target codec; if each codec returns a failure flag, then an error message is generated and the error message is fed back to the client.
[0078] Other embodiments or specific implementations of the communication message processing device of this application can be found in the above-described method embodiments, and will not be repeated here.
[0079] The communication message processing apparatus provided in this application, employing the communication message processing method in the above embodiments, can solve the technical problem that traditional communication methods require activating different services and changing communication protocols to process corresponding data when handling complex multi-data formats, resulting in an overly cumbersome entire communication interaction process. Compared with the prior art, the beneficial effects of the communication message processing apparatus provided in this application are the same as those of the communication message processing method provided in the above embodiments, and other technical features in the communication message processing apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0080] This application provides a communication message processing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the communication message processing method in the first embodiment described above.
[0081] The following is for reference. Figure 8 , Figure 8This is a schematic diagram of the hardware operating environment involved in the communication message processing method in the embodiments of this application, showing a structural diagram of a communication message processing device suitable for implementing the embodiments of this application. The communication message processing device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 8 The communication message processing device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0082] like Figure 8 As shown, the communication message processing device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the communication message processing device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the communication message processing device to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows communication message processing devices with various systems, it should be understood that it is not required to implement or possess all of the systems shown. More or fewer systems may be implemented alternatively.
[0083] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0084] The communication message processing device provided in this application, employing the communication message processing method in the above embodiments, can solve the technical problem that traditional communication methods require activating different services and changing communication protocols to process corresponding data when handling complex multi-data formats, resulting in an overly cumbersome entire communication interaction process. Compared with the prior art, the beneficial effects of the communication message processing device provided in this application are the same as those of the communication message processing method provided in the above embodiments, and other technical features in this communication message processing device are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.
[0085] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0086] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0087] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the communication message processing method in the above embodiments.
[0088] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0089] The aforementioned computer-readable storage medium may be included in a communication message processing device; or it may exist independently and not assembled into a communication message processing device.
[0090] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by a communication message processing device, the communication message processing device: upon receiving a communication message packet, according to the mapping relationship between the communication transmission model and each codec, sequentially calls each codec through a codec manager to identify the communication message packet and determine a target codec matching the communication message packet; decodes the communication message packet through the target codec and submits the decoded message packet to the upper-layer business logic; inputs the application layer data returned by the upper-layer business logic into the target codec for communication encoding to obtain response data consistent with the communication protocol; and sends the response data back to the client.
[0091] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0092] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0093] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0094] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described communication message processing method. This solves the technical problem that traditional communication methods require activating different services and changing communication protocols to process corresponding data when handling complex multi-data formats, resulting in an overly cumbersome communication interaction process. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the communication message processing method provided in the above embodiments, and will not be repeated here.
[0095] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the communication message processing method described above.
[0096] The computer program product provided in this application can solve the technical problem that traditional communication methods require different services to be activated and communication protocols to be changed to process corresponding data when handling complex multi-data formats, resulting in an overly cumbersome entire communication interaction process. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the communication message processing method provided in the above embodiments, and will not be repeated here.
[0097] The above description is only a part of the embodiments of this application and does not limit the scope of protection of this application. All equivalent structural transformations made under the technical concept of this application and using the content of this application specification and drawings, or direct / indirect applications in other related technical fields, are included in the scope of protection of this application.
Claims
1. A communication message processing method, characterized in that, The method is applied to a server, which is connected to a communication transmission model manager and a codec manager. The communication transmission model manager includes multiple communication transmission models, and the codec manager includes multiple codecs. The codec manager caches the mapping relationship between the communication transmission models and each codec. The method includes: Upon receiving a communication message, the codec manager sequentially calls each codec to identify the communication message based on the mapping relationship between the communication transmission model and each codec, thereby determining the target codec that matches the communication message. The target codec decodes the communication message packet, and the decoded message packet is submitted to the upper-layer business logic. The application layer data returned by the upper-layer business logic is input into the target codec for communication encoding to obtain response data that is consistent with the communication protocol. The response data is then sent back to the client.
2. The method as described in claim 1, characterized in that, Before the step of identifying the communication message packet by sequentially calling each codec through the codec manager according to the mapping relationship between the communication transmission model and each codec when a communication message packet is received, the method further includes: Upon receiving the program start command, the association between the communication transmission processor and the communication transmission model is loaded through the communication transmission model manager, and the mapping relationship between the communication transmission model and the codec is loaded through the codec manager; wherein, each communication transmission model records the transport layer protocol type and the name of the associated codec. Based on the association between the communication transmission processor and the communication transmission model, the corresponding target communication transmission processor is invoked. The target communication transmission processor is used to listen for communication message packets sent by the client.
3. The method as described in claim 2, characterized in that, The steps of loading the association between the communication transmission processor and the communication transmission model through the communication transmission model manager, and loading the mapping relationship between the communication transmission model and the codec through the codec manager, upon receiving a program start command, include: Upon receiving a program start command, the local code file is scanned by the communication transmission model manager and the codec manager. The local code file includes a communication model data file, a communication transmission processor interface file, and a codec implementation file. The association between the communication transmission processor and the communication transmission model is determined based on the communication model data file and the communication transmission processor interface file, and the association between the communication transmission processor and the communication transmission model is loaded into the communication transmission model manager. The mapping relationship between the communication transmission model and the codec is determined based on the communication model data file and the codec implementation file, and the mapping relationship between the communication transmission model and the codec is loaded into the codec manager.
4. The method as described in claim 2, characterized in that, The step of determining the target codec matching the communication message message by sequentially calling each codec through the codec manager to identify the communication message message according to the mapping relationship between the communication transmission model and each codec, upon receiving a communication message message, includes: Upon receiving a communication message, the codec identifier matching the communication message is queried through the mapping relationship between the communication transmission model and each codec. Based on the codec identifier, the codec manager sequentially calls each codec associated with the communication transmission model; Based on the codecs, the communication message packets are identified to determine the target codec that matches the communication message packets.
5. The method as described in claim 3, characterized in that, The step of performing data identification on the communication message packet based on each codec and determining the target codec that matches the communication message packet includes: The communication message packets are sequentially identified by the respective codecs to generate identification results. If the identification result includes a success flag, then identification stops and the responding codec is identified as the target codec; If each codec returns a failure flag, an error message is generated and sent back to the client.
6. A communication message processing method, characterized in that, The method is applied to a client, and the method includes: The target communication transmission processor is determined from the communication transmission model manager by the communication transmission type; Obtain the peer address information of the target communication transmission processor, and establish a connection with the server based on the peer address information; After successfully connecting to the server, the communication message is transmitted to the server.
7. A communication message processing device, characterized in that, The device is applied to a server, which is connected to a communication transmission model manager and a codec manager. The communication transmission model manager includes multiple communication transmission models, and the codec manager includes multiple codecs. The codec manager caches the mapping relationship between the communication transmission models and each codec. The device includes: The identification module is used to identify the communication message packet by sequentially calling each codec through the codec manager according to the mapping relationship between the communication transmission model and each codec when a communication message packet is received, and to determine the target codec that matches the communication message packet. The decoding module is used to decode the communication message packet through the target codec and submit the decoded message packet to the upper-layer business logic. The encoding module is used to input the application layer data returned by the upper-layer business logic into the target codec for communication encoding to obtain response data consistent with the communication protocol; The response module is used to send the response data back to the client.
8. A communication message processing device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the communication message processing method as described in any one of claims 1 to 6.
9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the communication message processing method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the communication message processing method as described in any one of claims 1 to 6.