Method, apparatus, device and computer readable medium for processing a packet
By configuring the conversion and routing conditions in the cache table, the problem of strong system coupling in traditional message conversion schemes is solved, enabling flexible message conversion between different systems, reducing transformation costs and risks, and improving the applicability and stability of the system.
Patent Information
- Application Number
- CN202211147278.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-19
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2042-09-19
AI Technical Summary
Traditional message conversion schemes have strong system coupling, making them difficult to apply to scenarios that call more system services. This results in a large amount of manual modification required when new systems are added or old systems are decommissioned, increasing costs and risks.
By receiving the conversion message request from the initiator, and utilizing the conversion and routing conditions in the configuration table cache, the system performs field mapping and hierarchical position conversion according to the transaction identifier, adapting to message formats of different protocols and reducing system coupling.
It enables flexible message conversion between different systems, reduces labor costs, improves system applicability and stability, and reduces the risk of modification.
Smart Images

Figure CN115550437B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, device, and computer-readable medium for processing messages. Background Technology
[0002] Traditional message conversion schemes convert the sender's message according to the receiver's requirements using a fixed method before forwarding it. When more system services need to be invoked, changes in message format and network protocols necessitate customized implementations of the conversion and forwarding functions.
[0003] In the process of realizing this invention, the inventors discovered that the prior art has at least the following problems: the above-mentioned method has strong system coupling and is difficult to apply to scenarios that call more system services. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method, apparatus, device, and computer-readable medium for processing messages, which can reduce system coupling and are applicable to more system service scenarios.
[0005] To achieve the above objectives, according to one aspect of the present invention, a method for processing messages is provided, comprising:
[0006] Receive a conversion message request from the initiator, wherein the conversion message request includes a conversion message;
[0007] According to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache, the conversion message is converted into a transaction message. The conversion conditions include field mapping method and hierarchical position.
[0008] Based on the channel number of the initiator and the channel number of the interface provider, the transaction message is obtained and sent according to the routing conditions of the transaction message.
[0009] The receiving of the conversion message request from the initiator includes:
[0010] Receive a conversion message request from the caller based on the HTTP / HTTPS protocol, wherein the conversion message includes JSON data.
[0011] The receiving request from the initiator for a converted message based on the HTTP / HTTPS protocol includes:
[0012] Based on the Spring MVC framework, it receives converted message requests from the caller based on the HTTP / HTTPS protocol.
[0013] The receiving of the conversion message request from the initiator includes:
[0014] Receive a conversion message request from the initiator based on the SOCKET protocol, wherein the conversion message includes XML data.
[0015] The receiving of the SOCKET-based transformation message request from the initiator includes:
[0016] Based on the NETTY framework, it receives converted message requests from the caller based on the SOCKET protocol.
[0017] The step of converting the conversion message into a transaction message according to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache includes:
[0018] The transaction identifier is obtained from a preset field in the conversion message;
[0019] The conversion message is converted into a transaction message according to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache.
[0020] Obtaining the transaction identifier from a preset field in the converted message includes:
[0021] The transaction identifier is obtained from a preset field in the conversion message;
[0022] The verification conditions are queried based on the transaction identifier, and the fields in the conversion message are successfully verified according to the verification conditions.
[0023] The verification conditions include one or more of the following: length verification, non-empty verification, type verification, and field value range.
[0024] The step of obtaining and sending the transaction message according to the routing conditions of the transaction message based on the channel number of the initiator and the channel number of the interface provider includes:
[0025] The channel number of the initiator and the channel number of the interface provider are obtained from the preset fields in the conversion message;
[0026] Based on the channel number of the initiator and the channel number of the interface provider, the transaction message is obtained and sent according to the routing conditions of the transaction message.
[0027] The method further includes:
[0028] Upon receiving the baffle test instruction, the test file is obtained based on the transaction identifier and returned to the initiator.
[0029] The step of obtaining and sending the transaction message according to the routing conditions of the transaction message based on the channel number of the initiator and the channel number of the interface provider includes:
[0030] Upon receiving the baffle test instruction, the test file was not successfully obtained according to the transaction identifier.
[0031] Based on the channel number of the initiator and the channel number of the interface provider, the transaction message is obtained and sent according to the routing conditions of the transaction message.
[0032] The method further includes:
[0033] Receive the response message from the interface provider in response to the transaction message;
[0034] According to the conversion conditions corresponding to the transaction identifier in the response message obtained from the configuration table cache, the response message is converted into an initiator message;
[0035] Based on the channel number of the initiator and the channel number of the interface provider, the initiator message is obtained and sent according to the routing conditions of the initiator message.
[0036] The step of converting the response message into an initiator message according to the conversion conditions corresponding to the transaction identifier in the response message obtained from the configuration table cache includes:
[0037] According to the conversion conditions corresponding to the transaction identifier in the response message obtained from the configuration table cache;
[0038] If the conversion conditions corresponding to the transaction identifier in the response message include configured transcoding, then transcoding mapping is performed according to the configured transcoding to convert the response message into an initiator message.
[0039] The initiator message includes JSON data, and the transaction message includes XML data;
[0040] or,
[0041] The initiator message includes XML data, and the transaction message includes JSON data.
[0042] The message processing method described herein is applied in a message adaptation platform.
[0043] According to a second aspect of the present invention, an apparatus for processing messages is provided, comprising:
[0044] The receiving module is used to receive the conversion message request from the initiator, wherein the conversion message request includes a conversion message;
[0045] The conversion module is used to convert the conversion message into a transaction message according to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache. The conversion conditions include field mapping method and hierarchical position.
[0046] The sending module is used to obtain and send the transaction message according to the routing conditions of the transaction message based on the channel number of the initiator and the channel number of the interface provider.
[0047] According to a third aspect of the present invention, an electronic device for processing messages is provided, comprising:
[0048] One or more processors;
[0049] Storage device for storing one or more programs.
[0050] When the one or more programs are executed by the one or more processors, the one or more processors perform the methods described above.
[0051] According to a fourth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method as described above.
[0052] According to a fifth aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method as described above in the embodiments of the present invention.
[0053] One embodiment of the above invention has the following advantages or beneficial effects: receiving a conversion message request from the initiator, the conversion message request including a conversion message; converting the conversion message into a transaction message according to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache, the conversion conditions including field mapping method and hierarchical position; obtaining and sending the transaction message according to the channel number of the initiator and the channel number of the interface provider, based on the routing conditions of the transaction message. The conversion conditions can be preset in the configuration table cache, and the routing conditions are also determined by the channel number of the initiator and the channel number of the interface provider. The conversion conditions and routing conditions can change with changes in the initiator or the interface provider, thus reducing system coupling and making it suitable for more system service scenarios.
[0054] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0055] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0056] Figure 1 This is a schematic flowchart of the message processing method according to an embodiment of the present invention;
[0057] Figure 2 This is a schematic diagram of the application architecture for processing messages according to an embodiment of the present invention;
[0058] Figure 3 This is a schematic diagram illustrating the process of converting a conversion message into a transaction message according to an embodiment of the present invention;
[0059] Figure 4 This is a schematic diagram illustrating the process of obtaining a transaction identifier from a preset field in a conversion message according to an embodiment of the present invention;
[0060] Figure 5 This is a schematic diagram illustrating the process of sending transaction messages according to routing conditions according to an embodiment of the present invention;
[0061] Figure 6 This is a schematic diagram of the process of sending a response message to the initiator according to an embodiment of the present invention;
[0062] Figure 7 This is a schematic diagram of the process of converting a response message into an initiator message according to an embodiment of the present invention;
[0063] Figure 8 This is a schematic diagram illustrating the interaction of message processing according to an embodiment of the present invention;
[0064] Figure 9 This is a schematic diagram of a message adaptation platform according to an embodiment of the present invention;
[0065] Figure 10 This is a schematic diagram of the main structure of a message processing apparatus according to an embodiment of the present invention;
[0066] Figure 11 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;
[0067] Figure 12 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0068] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description. The acquisition, storage, use, and processing of data in the technical solutions of this application all comply with relevant national laws and regulations.
[0069] Traditional message conversion schemes rely on simple conversion rules, fixed conversion methods, and network protocols, resulting in inflexibility. This leads to strong system coupling. Specifically, the integration of new systems and the decommissioning of older systems require significant manual intervention to modify the system and perform conversions for specific transactions. This not only increases labor costs but also introduces unknown risks to the normal operation of the system.
[0070] In summary, due to the strong coupling of the system, the message conversion scheme is difficult to apply to scenarios that call more system services.
[0071] To address the technical problem of strong system coupling, the following technical solutions from the embodiments of the present invention can be adopted.
[0072] See Figure 1 That is, 100. Figure 1 This is a schematic diagram of the main flow of a message processing method according to an embodiment of the present invention, which converts and sends transaction messages according to conversion conditions and routing conditions. Figure 1 As shown, the specific steps include:
[0073] S101. Receive the conversion message request from the initiator, which includes a conversion message.
[0074] During the long-term system development process, different systems have chosen different technologies and frameworks. Even systems using the same technology may have different versions or format requirements. Currently, in project implementation, due to the large number of systems the client is connecting to, and the varying network communication methods and message types, customized development of conversion and forwarding functions is required when making calls to these systems.
[0075] Integrating new systems and decommissioning old systems also require modifications to related functionalities, increasing development and testing costs. Furthermore, changes to the sender or receiver messages necessitate corresponding modifications. These modifications place high demands on developers and testers, requiring them to be familiar with the operation of each interfacing system, increasing learning costs and the risk of errors.
[0076] In this embodiment of the invention, the initiator sends a conversion message request, which includes a conversion message. The interface provider receives the converted message, i.e., the transaction message.
[0077] See Figure 2 That is, 200. Figure 2 This is a schematic diagram of the application architecture for processing messages according to an embodiment of the present invention. Figure 2 It consists of three parts: the first part is the initiator of the call; the second part is the process of processing the message; and the third part is the interface provider.
[0078] Figure 2 This includes multiple call initiators, namely Call Initiator-1, Call Initiator-2, Call Initiator-3, etc. The call initiator is the party that initiates the API call operation, and obtains the required data from the API provider by processing the messages.
[0079] Similarly, Figure 2 This includes multiple interface providers, namely Interface Provider-1, Interface Provider-2, and Interface Provider-3, etc. Each interface provider is responsible for providing the interfaces required by the caller and obtaining transaction messages through these interfaces.
[0080] Figure 2 China adopts Figure 1 The example in this document describes message processing. For instance, before processing a message, the caller and the interface provider need to register in the registry center. The relevant information for the caller and the interface provider is then set in the configuration center.
[0081] In one embodiment of the present invention, a conversion message request based on the HTTP / HTTPS protocol is received from the caller, and the conversion message includes JSON data.
[0082] In practical applications, HTTP / HTTPS protocol-based message requests are frequently used in one or more of the following: counter displays, tablets, applications (APPs), and web browsers. Specifically, page requests on counter displays, tablets, APPs, or web browsers all require converted message requests. These converted messages include JSON data.
[0083] In one embodiment of the present invention, based on the Spring MVC framework, a conversion message request based on the HTTP / HTTPS protocol is received from the caller. That is, the conversion message request based on the HTTP / HTTPS protocol is processed and received according to the Spring MVC framework.
[0084] As an example, the Spring MVC framework receives a conversion message request for the HTTP / HTTPS protocol, processes the conversion message request, and then displays the transaction message in response to the conversion message on the returned page.
[0085] In one embodiment of the present invention, a conversion message request based on the SOCKET protocol is received from the caller, and the conversion message includes XML data.
[0086] In practical applications, SOCKET protocol-based message requests are frequently used in backend application systems. As an example, a backend application system may include one or more of the following: a customer relationship management system, a marketing system, a credit system, a core system, an investment and financial management system, and an Enterprise Service Bus (ESB).
[0087] Specifically, page requests in the backend application system require the transformation of message requests. The transformed message includes XML data.
[0088] In one embodiment of the present invention, the system receives a conversion message request based on the SOCKET protocol from the caller, using the NETTY framework. The NETTY framework features high performance, high stability, multiple pre-built encoding / decoding methods, support for various mainstream protocols, and customizable packet reassembly / splitting capabilities, facilitating the convenient and quick implementation of SOCKET protocol communication functions.
[0089] It is understood that the technical solutions in the embodiments of the present invention are applicable not only to conversion message requests based on the HTTP / HTTPS protocol, but also to conversion message requests based on the SOCKET protocol. Of course, the technical solutions in the embodiments of the present invention are also applicable to conversion message requests based on other protocols.
[0090] S102. Convert the conversion message into a transaction message according to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache. The conversion conditions include the field mapping method and the level position.
[0091] In embodiments of the present invention, the conversion of a transformed message into a transaction message is based on transformation conditions. These transformation conditions are typically pre-stored in a configuration table cache. As an example, when the platform of this embodiment starts up, i.e., before implementing the message processing method, multiple transformation conditions can be loaded into the configuration table cache. Furthermore, to ensure the accuracy of the transformation conditions, the configuration table cache can be updated according to an update cycle.
[0092] See Figure 3 That is, 300. Figure 3 This is a schematic diagram illustrating the process of converting a transformation message into a transaction message according to an embodiment of the present invention. Specifically, it includes the following steps:
[0093] S301. Obtain the transaction identifier from the preset fields in the conversion message.
[0094] In this embodiment of the invention, the conversion condition corresponds to the transaction identifier, and the conversion condition corresponding to the transaction identifier in the conversion message obtained from the configuration table cache is based on the transaction identifier.
[0095] The transaction identifier can be obtained from preset fields in the transformation message. As an example, if the transaction identifier is set in the fourth field of the transformation message, the transaction message can be obtained from the fourth field of the transformation message.
[0096] See Figure 4 That is, 400. Figure 4 This is a schematic diagram illustrating the process of obtaining a transaction identifier from a preset field in a conversion message according to an embodiment of the present invention. Specifically, it includes the following steps:
[0097] S401. Obtain the transaction identifier from the preset fields in the conversion message.
[0098] If a transaction identifier is set in a preset field in the conversion message, the transaction identifier can be obtained from the preset field in the conversion message.
[0099] S402. Query the verification conditions based on the transaction identifier, and successfully verify the fields in the converted message according to the verification conditions.
[0100] In this embodiment of the invention, to improve the security of processed messages, verification conditions can be used to validate fields in the transformed message. These verification conditions are obtained based on the transaction identifier.
[0101] In one embodiment of the present invention, a transaction identifier is used to query the data dictionary to see if a corresponding verification rule is configured. If a verification rule corresponding to the transaction identifier is found in the data dictionary, the verification rule needs to be used to verify the fields in the transformed message. If no verification rule corresponding to the transaction identifier is found in the data dictionary, then it is not necessary to verify the fields in the transformed message. It is understood that using the data dictionary to verify the fields in the transformed message helps to improve the security of the processed message.
[0102] In one embodiment of the present invention, the verification conditions include one or more of the following: length verification, non-empty verification, type verification, and field value range. It is understood that verification conditions can be used to validate fields in the converted message.
[0103] If the verification conditions are queried based on the transaction identifier and the fields in the conversion message are successfully verified according to the verification conditions, the conversion message can be converted into a transaction message; if the verification conditions are queried based on the transaction identifier and the fields in the conversion message are not verified according to the verification conditions, then it is not necessary to convert the conversion message into a transaction message.
[0104] exist Figure 4 In this embodiment, the security of the processed message is improved by verifying the fields in the conditional transaction transformation message.
[0105] S302. Convert the conversion message into a transaction message according to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache.
[0106] The conversion conditions corresponding to the transaction identifier in the conversion message retrieved from the configuration table cache can then be used to convert the conversion message into a transaction message according to these conditions. The conversion conditions include field mapping methods and hierarchical positions. As an example, the field mapping method includes a preset relationship where a field in the conversion message maps to a field in the transaction message. The hierarchical position includes the positional relationship where a field in the conversion message maps to a field in the transaction message.
[0107] Understandably, since each conversion message has a different transaction identifier, and the transaction identifier corresponds to the conversion condition, conversion messages with different transaction identifiers, along with their corresponding conversion conditions, can be converted into transaction messages. This method is applicable to converting multiple conversion messages into transaction messages.
[0108] exist Figure 3 In the embodiments, the conversion conditions corresponding to the transaction identifier are used to convert the conversion message into a transaction message, thereby increasing the applicability of the processed message.
[0109] S103. Based on the channel number of the initiator and the channel number of the interface provider, obtain and send the transaction message according to the routing conditions of the transaction message.
[0110] Once the transaction message is obtained, it can be sent to the interface provider based on the routing conditions of that transaction message. The routing conditions of the transaction message are determined based on the channel number of the caller and the channel number of the interface provider.
[0111] See Figure 5 That is, 500. Figure 5 This is a flowchart illustrating the process of sending transaction messages based on routing conditions according to an embodiment of the present invention. Specifically, it includes the following steps:
[0112] S501. Obtain the channel number of the initiator and the channel number of the interface provider from the preset fields in the conversion message.
[0113] The conversion message contains preset fields for the caller's channel ID and the interface provider's channel ID. Furthermore, the caller's channel ID and the interface provider's channel ID can be retrieved from these preset fields. The channel ID identifies the caller or interface provider. The IP address, port number, and communication method can be queried using the channel ID.
[0114] S502. Based on the channel number of the initiator and the channel number of the interface provider, obtain and send the transaction message according to the routing conditions of the transaction message.
[0115] Based on the channel ID of the initiator and the channel ID of the interface provider, the routing conditions for the corresponding transaction message can be queried. The database stores the mapping between channel IDs and IP addresses, port numbers, and communication methods. Then, based on these channel IDs and mappings, the routing conditions for the transaction message are determined. As an example, the routing conditions include the interface provider's IP address, port number, and communication method.
[0116] Once the routing conditions for the transaction message are obtained, the transaction message can be sent according to those conditions.
[0117] exist Figure 5 In this embodiment, after obtaining the routing conditions based on the channel number, the transaction message is sent according to the routing conditions. Since the routing conditions are determined according to the caller and the interface provider, even if the caller or the interface provider changes, the routing conditions will change accordingly and will not affect the normal sending of the transaction message.
[0118] This invention can be applied to baffle testing. In some cross-system performance testing projects, due to objective limitations, it is often impossible to build a complete test environment to complete the testing work. Generally, the system under test is built, and then software programs are used to simulate the functions of other related systems. This software program is generally called a baffle.
[0119] In one embodiment of the present invention, upon receiving a baffle test instruction, a test file is obtained based on the transaction identifier and returned to the initiating party. The baffle test is then performed based on whether the test file was successfully obtained. Successfully obtaining the test file and returning it to the initiating party indicates that the baffle test is complete.
[0120] In one embodiment of the present invention, if a baffle test instruction is received and the test file is not successfully obtained based on the transaction identifier, it indicates that the baffle test has not been completed. Then, the transaction message can be obtained and sent according to the routing conditions of the transaction message based on the channel number of the initiator and the channel number of the interface provider.
[0121] Understandably, if the shield test fails, a transaction message can be sent according to the routing conditions to deliver the transaction message to the interface provider.
[0122] That is: upon receiving the baffle test instruction, the test file was not successfully obtained based on the transaction identifier; based on the channel number of the initiator and the channel number of the interface provider, the transaction message was obtained and sent according to the routing conditions of the transaction message.
[0123] In one embodiment of the present invention, upon receiving a baffle test instruction, if the test file is not successfully obtained based on the transaction identifier, a baffle test failure message is sent to the initiator.
[0124] In one embodiment of the present invention, after receiving the transaction message, the interface provider may also respond to the transaction message by sending a response message to the initiator.
[0125] See Figure 6 That is, 600. Figure 6 This is a flowchart illustrating the process of sending a response message to the initiator according to an embodiment of the present invention. Specifically, it includes the following steps:
[0126] S601, Receive the response message from the interface provider in response to the transaction message.
[0127] In an embodiment of the present invention, after receiving the transaction message sent by the caller, the interface provider may also send a response message to the caller, that is, a response message in response to the transaction message.
[0128] S602. Convert the response message into an initiator message according to the conversion conditions corresponding to the transaction identifier in the response message obtained from the configuration table cache.
[0129] Sending a response message is similar to sending a conversion message, requiring message conversion. That is, the response message is converted into an initiator message according to the conversion conditions corresponding to the transaction identifier in the response message obtained from the configuration table cache.
[0130] See Figure 7 That is, 700. Figure 7 This is a flowchart illustrating the process of converting a response message into an initiator message according to an embodiment of the present invention. Specifically, it includes the following steps:
[0131] S701. According to the conversion conditions corresponding to the transaction identifier in the response message obtained from the configuration table cache.
[0132] Based on the transaction identifier, the conversion conditions corresponding to the transaction identifier in the response message obtained from the configuration table cache.
[0133] S702 If the conversion conditions corresponding to the transaction identifier in the response message include configured transcoding, then transcoding mapping is performed according to the configured transcoding to convert the response message into an initiator message.
[0134] If the conversion conditions corresponding to the transaction identifier in the response message include configured transcoding, then transcoding mapping is performed according to the configured transcoding to convert the response message into an initiator message.
[0135] Specifically, during the transcoding process, the key-value mapping is configured based on the specific fields. For example, if a gender field "SEX" is configured in the data dictionary table, then when processing the "SEX" field, while retaining the "SEX" field, a corresponding descriptive field "SEX_DESC" is added, with its value being the mapped value, for direct display on the front-end page.
[0136] exist Figure 7 In one embodiment, transcoding mapping is performed based on the conversion configuration to convert the response message into an initiator message.
[0137] S603. Based on the channel number of the initiator and the channel number of the interface provider, obtain and send the initiator message according to the routing conditions of the initiator message.
[0138] After obtaining the initiator message, the initiator message can be retrieved and sent according to the routing conditions of the initiator message based on the channel number of the initiator and the channel number of the interface provider.
[0139] exist Figure 6 In the embodiments, in response to the response message of the transaction message, the response message is transformed using the transformation conditions, and the initiator message is sent according to the routing conditions.
[0140] In one embodiment of the present invention, the process of processing messages involves a call initiator and an interface provider.
[0141] See Figure 8 That is, 800. Figure 8 This is a schematic diagram illustrating the interaction of message processing according to an embodiment of the present invention. The initiator initiates an interface call, providing the interface with the initiator's message. The interface provider sends a response message and transforms the response message.
[0142] In practical applications, the initiator message includes JSON data, and the transaction message includes XML data. Alternatively, the initiator message includes XML data, and the transaction message includes JSON data.
[0143] As an example, when a front-end page calls an investment and wealth management system's API, the front-end page sends JSON data based on the HTTP / HTTPS protocol, while the investment and wealth management system requires standard ESB-formatted XML messages. Therefore, during message processing, the JSON-formatted initiator message needs to be converted into an XML-formatted transaction message. Furthermore, when the API provider responds with a transaction message, the XML-formatted response message needs to be converted into a JSON-formatted initiator message.
[0144] As another example, the data sent by the front-end page is XML data based on the SOCKET protocol, while the API provider needs JSON data based on the HTTP / HTTPS protocol. Therefore, during message processing, the XML-formatted initiator message needs to be converted into a JSON-formatted transaction message. Furthermore, when the API provider responds with a transaction message, the JSON-formatted response message needs to be converted back into an XML-formatted initiator message.
[0145] In one embodiment of the present invention, considering the large number of messages to be processed, a message adaptation platform is used to perform the message processing. That is, the message processing method is applied in the message adaptation platform. The message adaptation platform can be located in a server.
[0146] See Figure 9 That is, 900. Figure 9 This is a schematic diagram of a message adaptation platform according to an embodiment of the present invention. Figure 9 The message adaptation platform receives HTTP / HTTPS-based messages via web channels. These HTTP / HTTPS-based messages include those from one or more devices such as counter displays, tablets, applications (APPs), and web browsers, and are mostly converted messages using the HTTP / HTTPS protocol. APPLICATION messages are also received via HTTP / HTTPS or SOCKET protocol. In the backend application system, SOCKET protocol-based message requests are more commonly used.
[0147] The message adaptation platform involves multiple modules. As an example, when proprietary systems such as the customer relationship management backend and marketing backend start up, they register their services with the Spring Eureka registry center. When a client requests a microservice system, routing and load balancing are implemented through components such as Spring Cloud Zuul, Spring Feign, and Spring Ribbon.
[0148] Based on Spring Boot, it receives message conversion requests from the caller using the HTTP / HTTPS protocol. The Spring MVC framework is a subset of Spring Boot. Based on the Netty framework, it receives message conversion requests from the caller using the SOCKET protocol.
[0149] The Oracle database is used to store basic data information such as transaction interface configurations, message conversion configurations, routing configurations, and data dictionary tables. When the message adaptation platform starts up, it caches these configurations in memory via the Spring Cart, improving query efficiency when processing messages.
[0150] In the embodiments of the present invention described above, a conversion message request from the initiator is received, the conversion message request including a conversion message; the conversion message is converted into a transaction message according to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache, the conversion conditions including field mapping method and hierarchical position; the transaction message is obtained and sent according to the routing conditions of the transaction message based on the channel number of the initiator and the channel number of the interface provider. The conversion conditions can be preset in the configuration table cache, and the routing conditions are also determined by the channel number of the initiator and the channel number of the interface provider. The conversion conditions and routing conditions can change as the initiator or the interface provider changes, thus reducing system coupling and making it suitable for more system service scenarios.
[0151] Furthermore, the technical solutions employed in this invention utilize multiple network protocols for communication. This standardizes the operational procedures for interfacing with the client's system during project implementation, improving implementation efficiency, saving bank costs, and enhancing system maintainability and stability.
[0152] See Figure 10 That is, 1000. Figure 10 This is a schematic diagram of the main structure of a message processing apparatus according to an embodiment of the present invention. The message processing apparatus can implement a message processing method, such as... Figure 10 As shown, the device for processing messages specifically includes:
[0153] The receiving module 1001 is used to receive a conversion message request from the initiator of the call, wherein the conversion message request includes a conversion message;
[0154] The conversion module 1002 is used to convert the conversion message into a transaction message according to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache. The conversion conditions include field mapping method and hierarchical position.
[0155] The sending module 1003 is used to obtain and send the transaction message according to the routing conditions of the transaction message based on the channel number of the initiator and the channel number of the interface provider.
[0156] In one embodiment of the present invention, the receiving module 1001 is specifically used to receive a conversion message request from the caller based on the HTTP / HTTPS protocol, wherein the conversion message includes JSON data.
[0157] In one embodiment of the present invention, the receiving module 1001 is specifically used to receive a conversion message request from the caller based on the HTTP / HTTPS protocol, using the SPRING MVC framework.
[0158] In one embodiment of the present invention, the receiving module 1001 is specifically used to receive a conversion message request from the initiator based on the SOCKET protocol, wherein the conversion message includes XML data.
[0159] In one embodiment of the present invention, the receiving module 1001 is specifically used to receive a conversion message request based on the SOCKET protocol from the caller, based on the NETTY framework.
[0160] In one embodiment of the present invention, the conversion module 1002 is specifically used to obtain the transaction identifier from a preset field in the conversion message;
[0161] The conversion message is converted into a transaction message according to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache.
[0162] In one embodiment of the present invention, the conversion module 1002 is specifically used to obtain the transaction identifier from a preset field in the conversion message;
[0163] The verification conditions are queried based on the transaction identifier, and the fields in the conversion message are successfully verified according to the verification conditions.
[0164] In one embodiment of the present invention, the verification conditions include one or more of the following: length verification, non-empty verification, type verification, and field value range.
[0165] In one embodiment of the present invention, the sending module 1003 is specifically used to obtain the channel number of the initiator and the channel number of the interface provider from the preset fields in the conversion message;
[0166] Based on the channel number of the initiator and the channel number of the interface provider, the transaction message is obtained and sent according to the routing conditions of the transaction message.
[0167] In one embodiment of the present invention, the sending module 1003 is further configured to receive a baffle test instruction, obtain a test file according to the transaction identifier, and return the test file to the initiator.
[0168] In one embodiment of the present invention, the sending module 1003 is specifically used to receive a baffle test instruction and to determine that the test file was not successfully obtained according to the transaction identifier.
[0169] Based on the channel number of the initiator and the channel number of the interface provider, the transaction message is obtained and sent according to the routing conditions of the transaction message.
[0170] In one embodiment of the present invention, the receiving module 1001 is specifically used to receive the response message from the interface provider in response to the transaction message;
[0171] The conversion module 1002 is specifically used to convert the response message into an initiator message according to the conversion conditions corresponding to the transaction identifier in the response message obtained from the configuration table cache;
[0172] The sending module 1003 is specifically used to obtain and send the initiator message according to the routing conditions of the initiator message based on the channel number of the initiator and the channel number of the interface provider.
[0173] In one embodiment of the present invention, the conversion module 1002 is specifically used to convert according to the conversion conditions corresponding to the transaction identifier in the response message obtained from the configuration table cache;
[0174] If the conversion conditions corresponding to the transaction identifier in the response message include configured transcoding, then transcoding mapping is performed according to the configured transcoding to convert the response message into an initiator message.
[0175] In one embodiment of the present invention, the initiator message includes JSON data, and the transaction message includes XML data;
[0176] or,
[0177] The initiator message includes XML data, and the transaction message includes JSON data.
[0178] Figure 11 That is, 1100, illustrates an exemplary system architecture 1100 to which the method or apparatus for processing messages in which embodiments of the present invention can be applied.
[0179] like Figure 11 As shown, system architecture 1100 may include terminal devices 1101, 1102, and 1103, network 1104, and server 1105. Network 1104 is used as a medium to provide communication links between terminal devices 1101, 1102, and 1103 and server 1105. Network 1104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0180] Users can use terminal devices 1101, 1102, and 1103 to interact with server 1105 via network 1104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 1101, 1102, and 1103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0181] Terminal devices 1101, 1102, and 1103 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0182] Server 1105 can be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices 1101, 1102, and 1103 (for example only). The backend management server can analyze and process data such as received product information query requests, and feed back the processing results (such as target push information and product information - for example only) to the terminal devices.
[0183] It should be noted that the message processing method provided in this embodiment of the invention is generally executed by server 1105, and correspondingly, the message processing device is generally located in server 1105.
[0184] It should be understood that Figure 11 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0185] A computing program product according to an embodiment of the present invention includes a computer program, which, when executed by a processor, implements the message processing method provided in the embodiment of the present invention.
[0186] The following is for reference. Figure 12 That is, 1200, which shows a structural schematic diagram of a computer system 1200 suitable for implementing a terminal device of the present invention. Figure 12 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0187] like Figure 12 As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1202 or programs loaded from storage section 1208 into random access memory (RAM) 1203. The RAM 1203 also stores various programs and data required for the operation of the system 1200. The CPU 1201, ROM 1202, and RAM 1203 are interconnected via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0188] The following components are connected to I / O interface 1205: an input section 1206 including a keyboard, mouse, etc.; an output section 1207 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN card, modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to I / O interface 1205 as needed. Removable media 1211, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1210 as needed so that computer programs read from them can be installed into storage section 1208 as needed.
[0189] In particular, according to embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention 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 communication section 1209, and / or installed from removable medium 1211. When the computer program is executed by central processing unit (CPU) 1201, it performs the functions defined above in the system of this invention.
[0190] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0191] 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 the present invention. 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 a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may 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.
[0192] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor can be described as including a receiving module, a conversion module, and a sending module. The names of these modules do not necessarily limit the module itself; for example, a receiving module can also be described as "for receiving a conversion message request from a caller, wherein the conversion message request includes a conversion message."
[0193] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include:
[0194] Receive a conversion message request from the initiator, wherein the conversion message request includes a conversion message;
[0195] According to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache, the conversion message is converted into a transaction message. The conversion conditions include field mapping method and hierarchical position.
[0196] Based on the channel number of the initiator and the channel number of the interface provider, the transaction message is obtained and sent according to the routing conditions of the transaction message.
[0197] According to the technical solution of this embodiment of the invention, a conversion message request from a call initiator is received, the conversion message request including a conversion message; the conversion message is converted into a transaction message according to the conversion conditions corresponding to the transaction identifier in the conversion message obtained from the configuration table cache, the conversion conditions including field mapping method and hierarchical position; the transaction message is obtained and sent according to the routing conditions of the transaction message based on the channel number of the call initiator and the channel number of the interface provider. The conversion conditions can be preset in the configuration table cache, and the routing conditions are also determined by the channel number of the initiator and the channel number of the interface provider. The conversion conditions and routing conditions can change with changes in the call initiator or the interface provider, thus reducing system coupling and making it suitable for more system service scenarios.
[0198] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method of processing a packet, the method comprising: Comprise: Before processing the message, the calling initiator and the interface provider need to be registered in the registration center, the relevant information of the calling initiator and the interface provider is set in the configuration center, the conversion message request of the calling initiator is received, and the conversion message request includes the conversion message; A plurality of conversion conditions are loaded into the configuration table cache, the configuration table cache is updated according to the update period, the conversion message is converted into a transaction message according to the conversion condition corresponding to the transaction identifier in the conversion message obtained from the configuration table cache, and the conversion condition includes a field mapping mode and a hierarchical position; The field mapping mode includes a preset relationship that a field in the conversion message is mapped to a field in the transaction message; The hierarchical position includes the position relationship that a field in the conversion message is mapped to a field in the transaction message; According to the channel number of the calling initiator and the channel number of the interface provider, the transaction message is obtained and sent according to the routing condition of the transaction message; The method for processing the message is applied to a message adaptation platform, and routing and load balancing are realized through SPRING CLOUD ZUUL, SPRING FEIGN and SPRING RIBBON components; The message adaptation platform receives messages based on HTTP / HTTPS through a WEB channel, and receives messages based on HTTP / HTTPS or messages based on SOCKET protocol through an APPLICATION; Based on SPRING BOOT, the conversion message request of the calling initiator based on HTTP / HTTPS protocol is received; SPRING MVC framework belongs to SPRING BOOT; Based on the NETTY framework, the conversion message request of the calling initiator based on the SOCKET protocol is received; The ORACLE database is used to store transaction interface configuration, message conversion configuration, routing configuration and data dictionary table; When the message adaptation platform starts, the configuration is cached into the memory through SPRING CACHE, so as to improve the query efficiency when processing the message; The method further comprises: Based on the SPRING MVC framework, the conversion message request of the calling initiator based on the HTTP / HTTPS protocol is received, and the conversion message includes JSON data; The conversion message request of the calling initiator based on the SOCKET protocol is received, and the conversion message includes XML data; The conversion message request based on the SOCKET protocol is used in the back-end application system; The method further comprises: The response message of the interface provider in response to the transaction message is received; According to the conversion condition corresponding to the transaction identifier in the response message obtained from the configuration table cache, the response message is converted into an initiator message; And according to the conversion condition corresponding to the transaction identifier in the response message obtained from the configuration table cache; If the conversion code is configured in the conversion condition corresponding to the transaction identifier in the response message, the conversion code is mapped to convert the response message into an initiator message; In the conversion code mapping process, the KEY-VALUE mapping of the configuration specific field is mapped. According to the channel number of the calling initiator and the channel number of the interface provider, the initiator message is obtained and sent according to the routing condition of the transaction message; The initiator message includes JSON data, and the transaction message includes XML data; Or, The initiator message includes XML data, and the transaction message includes JSON data.
2. The method of claim 1, wherein, The receiving of the SOCKET-based conversion message request of the calling initiator includes: Based on the NETTY framework, the SOCKET-based conversion message request of the calling initiator is received.
3. The method of claim 1, wherein, The conversion of the conversion message into the transaction message according to the conversion condition corresponding to the transaction identifier in the conversion message obtained from the configuration table cache includes: The transaction identifier is obtained in the preset field in the conversion message; The conversion of the conversion message into the transaction message according to the conversion condition corresponding to the transaction identifier in the conversion message obtained from the configuration table cache.
4. The method of claim 3, wherein, The transaction identifier is obtained in the preset field in the conversion message; According to the transaction identifier, the check condition is queried, and the field in the conversion message is successfully checked according to the check condition. The check condition includes one or more of the following: length check, non-empty check, type check, and field value range.
5. The method of claim 4, wherein, According to the channel number of the calling initiator and the channel number of the interface provider, the initiator message is obtained and sent according to the routing condition of the transaction message.
6. The method of claim 1, wherein, The channel number of the initiator and the channel number of the interface provider are obtained in the preset field in the conversion message; According to the channel number of the calling initiator and the channel number of the interface provider, the initiator message is obtained and sent according to the routing condition of the transaction message. The method further includes:
7. The method of claim 1, wherein, Upon receiving the baffle test instruction, a test file is obtained according to the transaction identifier, and the test file is returned to the calling initiator. According to the channel number of the calling initiator and the channel number of the interface provider, the initiator message is obtained and sent according to the routing condition of the transaction message.
8. The method of claim 1, wherein, Upon receiving the baffle test instruction, a test file is obtained according to the transaction identifier; According to the channel number of the calling initiator and the channel number of the interface provider, the initiator message is obtained and sent according to the routing condition of the transaction message. The method for processing messages is applied to a message adaptation platform.
9. The method of claim 1, wherein, It includes:
10. An apparatus for processing a packet, the apparatus comprising: It is applied to a message adaptation platform, and routing and load balancing are realized through SPRING CLOUD ZUUL, SPRING FEIGN and SPRING RIBBON components; the message adaptation platform receives messages based on HTTP / HTTPS through a WEB channel, and receives messages based on HTTP / HTTPS or SOCKET protocol through an APPLICATION; Based on SPRING BOOT, the SOCKET-based conversion message request of the calling initiator is received. The SPRING MVC framework belongs to the SPRING BOOT; based on the NETTY framework, a conversion message request of a calling initiator based on a SOCKET protocol is received; The ORACLE database is used to store transaction interface configurations, message conversion configurations, routing configurations and data dictionary tables; when the message adaptation platform is started, the configurations are cached into the memory through the SPRING CACHE, so as to improve the query efficiency when processing messages; Before processing the message, the calling initiator and the interface provider need to be registered in the registration center, and the related information of the calling initiator and the interface provider is set in the configuration center; a conversion message request of the calling initiator is received, and the conversion message request includes a conversion message; based on the SPRING MVC framework, a conversion message request of the calling initiator based on the HTTP / HTTPS protocol is received, and the conversion message includes JSON data; A conversion message request of the calling initiator based on the SOCKET protocol is received, and the conversion message includes XML data; the conversion message request based on the SOCKET protocol is used in the back-end application system; and a response message of the interface provider in response to the transaction message is received; According to the conversion condition corresponding to the transaction identifier in the response message obtained from the configuration table cache, the response message is converted into an initiator message; According to the channel number of the calling initiator and the channel number of the interface provider, the initiator message is obtained and sent according to the routing condition of the initiator message; According to the conversion condition corresponding to the transaction identifier in the response message obtained from the configuration table cache; If the conversion condition corresponding to the transaction identifier in the response message includes a configuration code, then the code mapping is performed according to the configuration code, so as to convert the response message into an initiator message; In the code mapping process, the KEY-VALUE mapping of the configuration specific field is performed; The conversion module is used to load multiple conversion conditions into the configuration table cache, update the configuration table cache according to the update period, convert the conversion message into a transaction message according to the conversion condition corresponding to the transaction identifier in the conversion message obtained from the configuration table cache, and the conversion condition includes a field mapping mode and a hierarchical position; the field mapping mode includes a preset relationship that one field in the conversion message is mapped to one field in the transaction message; the hierarchical position includes a position relationship that one field in the conversion message is mapped to one field in the transaction message; The sending module is used to obtain the transaction message according to the channel number of the calling initiator and the channel number of the interface provider, and send the transaction message according to the routing condition of the transaction message; The initiator message includes JSON data, and the transaction message includes XML data; Or, The initiator message includes XML data, and the transaction message includes JSON data.
11. An electronic device for processing a packet, the electronic device comprising: Comprise: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-9.
12. A computer readable medium having stored thereon a computer program, characterized in that, The program, when executed by the processor, implements the method of any one of claims 1-9.
13. A computer program product comprising a computer program, characterized in that, The computer program, when executed by the processor, implements the method of any one of claims 1-9.
Citation Information
Patent Citations
Interface testing method and device, simulation baffle and system
CN107656874A
System supporting multi-channel transaction, and multi-channel transaction processing method
CN109246188A
Message processing method and system
CN112866268A
Message forwarding and receiving gateway system based on bank multi-communication protocol
CN113612681A
Reconstruction system upgrading switching method and device
CN113722290A