Message processing method, electronic equipment, storage medium and program product
By adding code at the bytecode level to the access service framework and message middleware client of the banking application system, the load testing messages are identified and separated, solving the intrusive problem caused by hard-coded modification of the source code, and realizing end-to-end load testing support and business logic protection.
Patent Information
- Application Number
- CN202511825227.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-03-10
AI Technical Summary
In the production environment of banking application systems, load testing messages and business messages are processed by the same computing nodes, which requires existing technologies to modify the source code through hard coding, which is highly intrusive and affects business logic.
Add message recognition, sending interception, and shadow consumer creation code at the bytecode level of the access service framework and message middleware client. Implement instrumentation technology through message processing probes to identify and separate stress test messages, avoiding modification of the source code.
It enables load testing of banking application systems in a production environment, covering the entire testing chain, avoiding the impact on business messages, reducing the intrusion on the original business logic, and requiring no manual modification of the source code.
Smart Images

Figure CN121635863A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of financial technology, and in particular, to a message processing method, an electronic device, a storage medium and a program product. BACKGROUND
[0002] In the scenario of implementing stress testing for a production environment of a bank application system, an application node reuses the production environment to implement stress testing, so that stress testing messages and business messages are processed by the same computing node.
[0003] At present, in order to make the stress testing messages cover the full link of the application node for testing and avoid the influence of the stress testing messages on the link of the business messages, a commonly used message processing method is to modify the source code of the bank application system through a hard coding manner, but the original business logic of the bank application system is greatly invaded. SUMMARY
[0004] Embodiments of the present application provide a message processing method, an electronic device, a storage medium and a program product, which realize the message processing function to solve the problem of great invasion of the modification of the source code in the prior art on the business.
[0005] In a first aspect, the embodiments of the present application provide a message processing method applied to an application node, which includes: adding message identification code in a first original bytecode of an access service framework of the application node and making the message identification code effective, so that when a first request message is received by using the access service framework, the message type of the first request message is identified by executing the message identification code, and the first request message of the message type being a stress testing message type is processed; adding message sending interception code in a second original bytecode of a message middleware client of the application node and making the message sending interception code effective, so that when a second request message is sent by using the message middleware client, the second request message is sent to a corresponding message queue based on the message type of the second request message by executing the message sending interception code; the second request message is a message processed by using the message identification code; adding shadow consumer creation code in the second original bytecode of the message middleware client of the application node and making the shadow consumer creation code effective, so that when a message is consumed by using the message middleware client, a shadow consumer is created by executing the shadow consumer creation code and the shadow consumer is started to consume the corresponding message queue.
[0006] In a second aspect, an embodiment of the present application provides a message processing apparatus applied to an application node, the apparatus comprising: a first adding module configured to add a message identification code in a first original bytecode of the application node for accessing a service framework, and enable the message identification code, so that when a first request message is received by using the service framework, the message type of the first request message is identified by executing the message identification code, and the first request message of the message type of a stress test message type is processed; a second adding module configured to add a message sending interception code in a second original bytecode of a message middleware client of the application node, and enable the message sending interception code, so that when a second request message is sent by using the message middleware client, the second request message is sent to a corresponding message queue based on the message type of the second request message by executing the message sending interception code; the second request message is a message processed by using the message identification code; and a third adding module configured to add a shadow consumer creation code in the second original bytecode of the message middleware client of the application node, and enable the shadow consumer creation code, so that when a message is consumed by using the message middleware client, a shadow consumer is created by executing the shadow consumer creation code, and the shadow consumer consumes the corresponding message queue.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor, so that the at least one processor can execute the message processing method of any embodiment of the present application.
[0008] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the message processing method of any embodiment of the present application.
[0009] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, and the computer program is executed by a processor to implement the message processing method of any embodiment of the present application.
[0010] In the embodiments of the present application, the message identification code can be added in the first original bytecode of the application node accessing the service framework, and the message identification code is validated, so that when the first request message is received by using the service framework, the message type of the first request message is identified by executing the message identification code, and the first request message of the message type of the stress test message type is processed. The message identification code can be added at the bytecode level of the service framework, and the source code of the service framework is not modified. The message sending interception code is added in the second original bytecode of the message middleware client of the application node, and the message sending interception code is validated, so that when the second request message is sent by using the message middleware client, the second request message is sent to the corresponding message queue based on the message type of the second request message by executing the message sending interception code. The message sending interception code can be added at the bytecode level of the message middleware client, and the source code of the message middleware client is not modified. The shadow consumer creation code is added in the second original bytecode of the message middleware client of the application node, and the shadow consumer creation code is validated, so that when the message is consumed by using the message middleware client, the shadow consumer is created by executing the shadow consumer creation code, and the shadow consumer consumes the corresponding message queue. The shadow consumer creation code can be added at the bytecode level of the message middleware client, and the source code of the message middleware client is not modified. In the above technical solution, the code is added at the bytecode level, the source code of the bank application system is not modified, the invasiveness to the original business logic of the bank application system is effectively reduced, and the functions that the application node in the role of the producer sends the stress test message to the shadow message queue, and the application node in the role of the consumer creates the shadow consumer to consume the stress test message in the shadow message queue are realized. Further, the support for stress test of the asynchronous message in the scene that the bank application system implements the stress test in the production environment is further realized, so that the stress test message can cover the whole link of the application node for testing, and the influence of the stress test message on the business message link is avoided. BRIEF DESCRIPTION OF DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0012] Figure 1 is a flow diagram of a message processing method provided by the embodiments of the present application;
[0013] Figure 2 is another flow diagram of a message processing method provided by the embodiments of the present application;
[0014] Figure 3a is a flowchart of a message processing method provided by an embodiment of the present application;
[0015] Figure 3b is a timing diagram of a message processing method provided by an embodiment of the present application;
[0016] Figure 4 is a structural schematic diagram of a message processing apparatus provided by an embodiment of the present application;
[0017] Figure 5 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0018] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in a clear and complete manner with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application but not all of them. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative effort should fall within the protection scope of the present application.
[0019] It should be noted that the terms “first”, “second”, “target” and “original” and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms “include”, “have” and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units need not be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0020] Figure 1 is a flowchart of a message processing method provided by an embodiment of the present application, and the embodiment can be applied to a scenario in which asynchronous messages in a stress testing scenario need to be processed. The message processing method provided by the embodiment can be executed by a message processing apparatus provided by an embodiment of the present application, and the apparatus can be implemented in a software and / or hardware manner. In one specific embodiment, the message processing apparatus can be integrated in an electronic device, and the electronic device is an application node, for example, the electronic device can be a computer or a server or the like. The execution subject of the method can be an application node (i.e., an electronic device).
[0021] In one specific implementation, an application node is an independent, deployable, and running application instance of a specific business logic in a distributed system architecture, and each application node can assume a specific functional role, i.e., a producer role and a consumer role; when an application node assumes a producer role, the application node can generate and send messages, i.e., send the generated messages to a specified message queue or topic; when an application node assumes a consumer role, the application node can read and consume messages from a specified message queue or topic, i.e., execute corresponding business logic according to the content of the messages; when an application node assumes both a producer role and a consumer role, the application node can both send messages to a specified message queue or topic and read and consume messages from a specified message queue or topic.
[0022] The following is an example of an application node assuming both a producer role and a consumer role. Referring to FIG. 1, an application node 100 can assume both a producer role and a consumer role, and the application node 100 can include a message processing module 110 and a message processing module 120. Figure 1 The message processing method of the present embodiment includes but is not limited to the following steps:
[0023] S110, adding a message identification code in the first original bytecode of the application node accessing the service framework and making the message identification code effective, so that when a first request message is received by using the service framework, the message type of the first request message is identified by executing the message identification code, and the first request message of the message type of a stress test message is processed.
[0024] The service framework is a software infrastructure or middleware layer integrated in the application node, which is used to receive and uniformly process all external service requests of the application node, i.e., the application node can receive the request message sent by the external device through the service framework.
[0025] Bytecode is a compiled binary file composed of code and data and used to implement a specific software. The first original bytecode is the binary bytecode obtained by compiling the source code of the service framework.
[0026] The message identification code is a program code for identifying the message type of a message and specially processing a stress test message (i.e., a message of the stress test message type). The first request message is a request message received by the application node using the service framework. The message type can include a stress test message type and a business message type.
[0027] Specifically, a preset message identification code can be acquired, then after the source code of the access service framework of the application node is compiled to obtain first original bytecode, the message identification code is written into the first original bytecode by using a bytecode injection tool, at this time, the code of the access service framework at the bytecode level is modified, and the source code of the access service framework is not modified; then, the first original bytecode after the message identification code is added is reloaded to make the message identification code take effect.
[0028] After that, when the application node receives the first request message sent by the external device by using the access service framework, the message type of the first request message, i.e., the stress test message type or the business message type, can be identified by executing the message identification code, and the first request message of the message type of the stress test message type is additionally processed, for example, a preset stress test identifier is added in the message header of the first request message, wherein the preset stress test identifier is a flag that is set in advance to represent that the message type is the stress test message type, and the first request message of the stress test message type is additionally processed, and the first request message is also subjected to the conventional business logic processing, wherein the conventional business logic processing is the business logic processing that already exists in the source code of the access service framework.
[0029] S120, a message sending interception code is added in the second original bytecode of the message middleware client of the application node, and the message sending interception code is made effective, so that when the second request message is sent by using the message middleware client, the second request message is sent to the corresponding message queue based on the message type of the second request message by executing the message sending interception code.
[0030] The message middleware client is a software component or library for interacting between the application program and the message middleware, encapsulates the underlying details of communication with the message middleware server, and provides a simple and unified application programming interface for the application node to send and receive messages. The second original bytecode is the binary bytecode obtained by compiling the source code of the message middleware client.
[0031] The message sending interception code is a program code for intercepting the request message of the stress test message type and sending the request message to the shadow message queue.
[0032] The second request message is a message that needs to be sent to the corresponding message queue by the application node through the message middleware client, and the second request message is processed by using the message identification code; the message queue includes a formal message queue and a shadow message queue, the formal message queue is used to save the message of the business message type, and the shadow message queue is used to save the message of the stress test message type.
[0033] Specifically, a preset message sending interception code can be obtained. Then, after compiling the source code of the message middleware client of the application node to obtain the second raw bytecode, the message sending interception code is written into the second raw bytecode using a bytecode injection tool. At this time, the code of the message middleware client at the bytecode level is modified, but the source code of the message middleware client is not modified. Then, the second raw bytecode with the added message sending interception code is reloaded to make the message sending interception code take effect.
[0034] Subsequently, when an application node sends a second request message using the message middleware client, it can execute message sending interception code to send the second request message to the corresponding message queue based on its message type. For example, it can determine whether the message header of the second request message contains a preset load testing flag. If the message header contains this flag, it indicates that the message type of the second request message is a load testing message, and in this case, the second request message is sent to the corresponding shadow message queue. Otherwise, it indicates that the message type of the second request message is a business message, and in this case, the second request message is sent to the corresponding formal message queue. The specific shadow message queue or formal message queue to which the application node should send the message via the message middleware client can be determined from the application node's configuration file.
[0035] S130. Add shadow consumer creation code to the second raw bytecode of the message middleware client of the application node, and make the shadow consumer creation code effective, so that when using the message middleware client to consume messages, the shadow consumer creation code is executed to create a shadow consumer and start the shadow consumer to consume the corresponding message queue.
[0036] The shadow consumer creation code is a piece of program code used to create a shadow consumer and start it to consume the corresponding message queue. The shadow consumer is used to consume messages in the shadow message queue, that is, to consume messages of the load testing message type.
[0037] Specifically, a preset shadow consumer creation code can be obtained. Then, after compiling the source code of the message middleware client of the application node to obtain the second raw bytecode, the shadow consumer creation code is written into the second raw bytecode using a bytecode injection tool. At this time, the code of the message middleware client at the bytecode level is modified, but the source code of the message middleware client is not modified. Then, the second raw bytecode after adding the shadow consumer creation code is reloaded to make the shadow consumer creation code take effect.
[0038] Subsequently, when the application node consumes messages using the message middleware client, it can create a shadow consumer by executing the shadow consumer creation code, and start the shadow consumer to consume the corresponding shadow message queue. That is, it creates a shadow consumer object instance and starts the shadow consumer object instance to consume the corresponding shadow message queue. At the same time, it will execute the regular business logic processing already present in the source code of the message middleware client, that is, create a formal consumer and start the formal consumer to consume the corresponding formal message queue. The formal consumer is used to consume messages in the formal message queue, that is, to consume messages of the business message type.
[0039] It should be noted that the above does not limit the execution order between S120 and S130. That is, S120 can be executed first and then S130 can be executed; or S130 can be executed first and then S120 can be executed; or S120 and S130 can be executed simultaneously. The execution order is determined according to the actual situation.
[0040] It should be noted that the above steps can be selected and executed according to the functional role of the application node.
[0041] The technical solution of this application embodiment adds message identification code to the first raw bytecode of the access service framework of the application node and makes the message identification code effective. This allows the message type of the first request message to be identified and processed when the access service framework receives a first request message, by executing the message identification code. The message identification code can be added at the bytecode level of the access service framework without modifying its source code. Furthermore, message sending interception code is added to the second raw bytecode of the message middleware client of the application node and made effective. This allows the message sending interception code to be executed when the message middleware client sends a second request message. The message sending interception code intercepts the second request message and sends it to the corresponding message queue based on the message type of the second request message. This message sending interception code can be added at the bytecode level of the message middleware client without modifying the source code of the message middleware client. Shadow consumer creation code is added to the second original bytecode of the message middleware client on the application node and made active. This allows the creation of a shadow consumer and its consumption of the corresponding message queue when the message middleware client is used to consume messages. This shadow consumer creation code is added at the bytecode level of the message middleware client without modifying the source code of the message middleware client. In the above technical solution, by adding code at the bytecode level without modifying the source code of the bank application system, the intrusion into the original business logic of the bank application system is effectively reduced. This enables the application nodes in the producer role to send load test messages to the shadow message queue, and the application nodes in the consumer role to create shadow consumers to consume load test messages in the shadow message queue. Furthermore, it enables the bank application system to support load testing of asynchronous messages in production environment scenarios, allowing load test messages to cover the entire application node chain for testing and avoiding the impact of load test messages on the business message chain.
[0042] The following further describes a message processing method provided by an embodiment of this application. Figure 2 This is another flowchart illustrating the message processing method provided in this application's embodiments. This application's embodiments are optimizations based on the above embodiments, and are explained using the example of an application node simultaneously acting as both a producer and a consumer. See also... Figure 2 The method in this embodiment includes, but is not limited to, the following steps:
[0043] S210. Connect the message processing probe to the application node, and use the message processing probe to pull the message identification code, message sending interception code and shadow consumer creation code for the application node from the configuration center.
[0044] Optionally, a configuration center and a message processing probe may be pre-built before executing the message processing method of the embodiments of this application.
[0045] The configuration center is responsible for managing the addition, maintenance, and distribution of producer-consumer policies (i.e., producer-consumer configuration information, message identification codes, message sending interception codes, and shadow consumer creation codes). It provides a policy management interface for application developers to call and set producer-consumer policies, and a policy retrieval interface for message processing probes to retrieve producer-consumer policies. Specifically, application developers pre-set producer-consumer policies, i.e., producer-consumer configuration information in the format of [official message queue name: shadow message queue name], as well as common message identification codes, message sending interception codes, and shadow consumer creation codes. They then upload and set the producer-consumer policies through the policy management interface provided by the configuration center. The configuration center then writes the producer-consumer policies uploaded by application developers into the policy configuration table for storage. The [official message queue name: shadow message queue name] indicates which message queue the producer should send load testing messages to, on which application nodes to create shadow consumers, and which message queue the shadow consumers consume.
[0046] The message processing probe is connected to the application node and runs in the same process as the application node. The message processing probe is responsible for periodically pulling the producer and consumer policies related to the currently connected application node from the configuration center through the policy retrieval interface provided by the configuration center, and using bytecode enhancement technology to implement message identification code instrumentation in the access service framework (that is, writing the message identification code into the first raw bytecode of the access service framework), and at the same time implementing message sending interception code and shadow consumer creation code instrumentation in the message middleware client (that is, writing the message sending interception code and shadow consumer creation code into the second raw bytecode of the message middleware client).
[0047] Bytecode enhancement is a method of modifying bytecode files to generate new bytecode files. Modifying the generated bytecode enhances its functionality, essentially modifying the application's binary file. Its main purposes are to reduce redundant code, improve program performance, and add specific features. Instrumentation, on the other hand, utilizes bytecode enhancement techniques to replace or insert code snippets into the source code using a specific strategy. It modifies the bytecode level and does not alter the source code itself.
[0048] For example, when an application node simultaneously assumes the roles of both producer and consumer, such as Figure 3a The diagram shown is a flowchart example of a message processing method provided in an embodiment of this application. Figure 3aThe document describes the components involved in the message processing process, which is as follows: For an application node, a producer-consumer strategy for that application node is configured in the configuration center; the configured message processing probe is connected to the application node, at which point the message processing probe will run as part of the application node in the same process; during runtime, the message processing probe retrieves message identification code, message sending interception code, and shadow consumer creation code from the configuration center, and then, through instrumentation, writes the message identification code into the first raw bytecode of the access service framework, and writes the message sending interception code and shadow consumer creation code into the second raw bytecode of the message middleware client.
[0049] Optionally, the message identification code includes: performing type identification on the received first request message to obtain the message type of the first request message, that is, obtaining key field information from the first request message, such as the source Internet Protocol address, and then determining the message type of the first request message based on the key field information. For example, determining whether the source Internet Protocol address of the first request message is within a preset business address range, where the preset business address range is a pre-set range of Internet Protocol addresses for sending business messages. If the source Internet Protocol address of the first request message is within the preset business address range, then the message type of the first request message is determined to be a business message type; otherwise, the message type of the first request message is determined to be a load testing message type. Then, when the message type of the first request message is a load testing message type, a preset load testing identifier is stored in the thread-private space of the target thread processing the first request message. This marks the first request message and its request context with a preset load testing identifier, which can improve computational efficiency, reduce implementation complexity, and thus improve the efficiency and accuracy of message type identification, as well as the efficiency of labeling the preset load testing identifier.
[0050] Optionally, the message sending interception code includes: determining whether the message type of the second request message to be sent is a load testing message type. That is, when the second request message is a message processed by the message identification code, the code can query whether a preset load testing identifier exists in the thread private space of the thread processing the second request message. If it exists, the message type of the second request message is determined to be a load testing message type; otherwise, the message type of the second request message is determined to be a business message type. When the second request message is not a message processed by the message identification code, key field information can be obtained from the second request message, and the message type of the second request message can be determined based on the key field information. Then, when the message type of the second request message is a load testing message type, the message processing probe is used to obtain the name of the first shadow message queue from the policy configuration table in the configuration center based on the name of the first formal message queue, and the second request message is sent to the first shadow message queue corresponding to the name of the first shadow message queue. This can improve computational efficiency, reduce implementation complexity, and thus improve message sending efficiency and accuracy. The name of the first formal message queue is the name of the formal message queue to which the message generated by the application node needs to be sent. It is pre-configured for the application node and can be obtained from the application node's configuration file.
[0051] Optionally, the shadow consumer creation code includes: using a message processing probe, querying the producer-consumer configuration information corresponding to the second formal message queue name from the policy configuration table in the configuration center, based on the second formal message queue name, to obtain the query result. The second formal message queue name is the name of the formal message queue that the application node will consume when consuming messages; it is pre-configured for the application node and can be obtained from the application node's configuration file. The first formal message queue name and the second formal message queue name can be the same or different. If the query result is not empty, it indicates that a shadow consumer needs to be created. At this point, a shadow consumer can be created, retrieving the shadow message queue name corresponding to the second formal message queue name from the query result, obtaining the second shadow message queue name, and starting the shadow consumer to consume the second shadow message queue corresponding to the second shadow message queue name. This improves computational efficiency, reduces implementation complexity, and thus improves the creation efficiency and accuracy of the shadow consumer.
[0052] S220. Using a message processing probe, instrumentation technology is employed to add message recognition code to the first raw bytecode.
[0053] Specifically, by using a message processing probe and employing instrumentation techniques, the first target location of the method for processing request messages is determined from the first raw bytecode of the access service framework. This first target location is where the message identification code needs to be written. Then, the message identification code is written into the first target location of the first raw bytecode, which can improve the efficiency and accuracy of determining the first target location, thereby improving the efficiency and accuracy of writing the message identification code.
[0054] Optionally, in the first raw bytecode after adding message recognition code, the complete processing logic of the method for processing request messages is as follows: the received first request message is type-identified to obtain the message type of the first request message; when the message type of the first request message is a load test message type, the preset load test flag is stored in the thread-private space of the target thread processing the first request message, and the first request message is processed by regular business logic; when the message type of the first request message is a business message type, the first request message is processed by regular business logic according to the business processing logic in the source code of the access service framework.
[0055] S230. Reload the first raw bytecode after adding the message identification code, so that when the first request message is received by the access service framework, the message identification code is executed to identify the message type of the first request message and process the first request message whose message type is a load test message type.
[0056] Specifically, the first raw bytecode after adding the message identification code is reloaded to make the message identification code effective. This allows the application node to identify the message type of the first request message (i.e., load testing message type or business message type) by executing the message identification code when it receives the first request message from an external device using the access service framework. The first request message with the load testing message type is then processed additionally. Specifically, a preset load testing identifier is stored in the thread-private space of the target thread that processes the first request message. While performing additional processing on the first request message with the load testing message type, regular business logic processing is also performed on the first request message.
[0057] S240. Using a message processing probe, instrumentation techniques are employed to add message sending interception code to the second raw bytecode.
[0058] Specifically, a message processing probe can be used to determine the second target location of the producer's message sending method from the second raw bytecode of the message middleware client using instrumentation technology. The second target location is where the message sending interception code needs to be written. Then, the message sending interception code is written into the second target location of the second raw bytecode, which can improve the efficiency and accuracy of determining the second target location, thereby improving the efficiency and accuracy of writing the message sending interception code.
[0059] Optionally, in the second raw bytecode after adding message sending interception code, the complete processing logic of the producer's message sending method is as follows: determine whether the message type of the second request message to be sent is a load testing message type; if the message type of the second request message is a load testing message type, use the message processing probe to obtain the name of the first shadow message queue from the policy configuration table in the configuration center based on the name of the first formal message queue, and send the second request message to the first shadow message queue corresponding to the name of the first shadow message queue; if the message type of the second request message is a business message type, send the second request message to the first formal message queue corresponding to the name of the first formal message queue.
[0060] S250. Reload the second raw bytecode after adding the message sending interception code, so that when the message middleware client sends the second request message, the message sending interception code is executed to send the second request message to the corresponding message queue based on the message type of the second request message.
[0061] Specifically, the second raw bytecode after adding the message sending interception code is reloaded to make the message sending interception code effective. This allows the application node to execute the message sending interception code when sending the second request message using the message middleware client. When the message type of the second request message is a load testing message type, the message processing probe is used to obtain the name of the first shadow message queue from the policy configuration table in the configuration center based on the name of the first official message queue, and the second request message is sent to the first shadow message queue corresponding to the name of the first shadow message queue. When the message type of the second request message is a business message type, the second request message is sent to the first official message queue corresponding to the name of the first official message queue.
[0062] S260. Using a message processing probe, instrumentation techniques are employed to add shadow consumer creation code to the second raw bytecode.
[0063] Specifically, by using message processing probes and employing instrumentation techniques, the third target location of the consumer's consumption method can be determined from the second raw bytecode of the message middleware client. This third target location is where the shadow consumer creation code needs to be written. Then, the shadow consumer creation code is written into the third target location of the second raw bytecode, which can improve the efficiency and accuracy of determining the third target location, thereby improving the efficiency and accuracy of writing the shadow consumer creation code.
[0064] Optionally, in the second raw bytecode after adding the shadow consumer creation code, the complete processing logic of the consumer consumption method is as follows: create a formal consumer and start the formal consumer to consume the formal message queue corresponding to the second formal message queue name; then, using the message processing probe, query the producer-consumer configuration information corresponding to the second formal message queue name from the policy configuration table in the configuration center based on the second formal message queue name, and obtain the query result; if the query result is not empty, create a shadow consumer, obtain the second shadow message queue name from the query result, and start the shadow consumer to consume the second shadow message queue corresponding to the second shadow message queue name; if the query result is empty, do not perform the shadow consumer creation operation.
[0065] S270. Reload the second raw bytecode after adding the shadow consumer creation code, so that when using the message middleware client to consume messages, the shadow consumer creation code is executed to create a shadow consumer and start the shadow consumer to consume the corresponding message queue.
[0066] Specifically, the second raw bytecode after adding the shadow consumer creation code can be reloaded to make the shadow consumer creation code effective. This allows application nodes to execute the shadow consumer creation code when consuming messages using the message middleware client. Using the message processing probe, the application can query the producer-consumer configuration information corresponding to the second official message queue name from the policy configuration table in the configuration center based on the second official message queue name, and obtain the query result. If the query result is not empty, a shadow consumer is created, the second shadow message queue name is obtained from the query result, and the shadow consumer is started to consume the second shadow message queue corresponding to the second shadow message queue name. If the query result is empty, the shadow consumer creation operation is not performed.
[0067] For example, such as Figure 3b The diagram shown is a timing example of a message processing method provided in an embodiment of this application. Figure 3bThe overall timing process of message processing is shown when the application node simultaneously assumes the roles of producer and consumer: (1) Setting producer-consumer strategy, that is, the application developer sets the producer-consumer strategy, that is, the producer-consumer configuration information with the configuration format of [formal message queue name: shadow message queue name], as well as the general message identification code, message sending interception code and shadow consumer creation code, and uploads and sets the producer-consumer strategy through the strategy management interface provided by the configuration center. Then the configuration center writes the producer-consumer strategy uploaded by the application developer into the strategy configuration table for storage; (2) Message identification code instrumentation, that is, the message processing probe periodically pulls the message identification code related to the application node from the configuration center through the strategy pull interface, and then writes the message identification code into the first original bytecode of the application node's access service framework through instrumentation. The first original bytecode after adding the message identification code is reloaded so that when the application node receives the first request message through the access service framework, it can identify whether the first request message is a load test message through the message identification code, and save the preset load test flag in the private thread of the target thread that processes the load test message. In the space; (3) Instrumentation of message sending interception code and shadow consumer creation code, that is, the message processing probe periodically pulls the message sending interception code related to the application node from the configuration center through the policy pull interface, and then writes the message sending interception code into the second original bytecode of the message middleware client of the application node through instrumentation, and reloads the second original bytecode after adding the message sending interception code so that when the application node uses the message middleware client to send the second request message (i.e., load test message or business message) in the future, it will send the load test message to the shadow message queue and the business message to the formal message queue by executing the message sending interception code; at the same time, the message processing probe periodically pulls the shadow consumer creation code related to the application node from the configuration center through the policy pull interface, and then writes the shadow consumer creation code into the second original bytecode of the message middleware client of the application node through instrumentation, and reloads the second original bytecode after adding the shadow consumer creation code so that when the application node uses the message middleware client to consume messages in the future, it will create a shadow consumer by executing the shadow consumer creation code and start the shadow consumer to consume the shadow message queue.
[0068] It should be noted that the above does not limit the execution order between branches S240 to S250 and branches S260 to S270. That is, branches S240 to S250 can be executed first, followed by branches S260 to S270; branches S260 to S270 can be executed first, followed by branches S240 to S250; or branches S240 to S250 and S260 to S270 can be executed simultaneously. The execution order is determined according to the actual situation.
[0069] It should be noted that the above steps can be selected and executed according to the functional role of the application node.
[0070] The technical solution of this application embodiment can integrate a message processing probe into the application node and use the message processing probe to pull message identification code, message sending interception code, and shadow consumer creation code for the application node from the configuration center. Then, using the message processing probe, message identification code is added to the first original bytecode using instrumentation technology, and the first original bytecode with added message identification code is reloaded. This allows the message identification code to be executed when the access service framework receives a first request message, identifying the message type of the first request message and processing the first request message whose message type is a load testing message. The message identification code can be added at the bytecode level of the access service framework without modifying the configuration. The source code of the access service framework is modified, which improves the writing efficiency and accuracy of message identification code. Then, using a message processing probe, message sending interception code is added to the second raw bytecode using instrumentation technology. The second raw bytecode with the added message sending interception code is then reloaded. This ensures that when the message middleware client sends a second request message, the message sending interception code is executed, and the second request message is sent to the corresponding message queue based on the message type of the second request message. Message sending interception code can be added at the bytecode level of the message middleware client without modifying the message middleware client's source code, and the writing efficiency and accuracy of the message sending interception code can be improved. After ensuring accuracy, a message processing probe is used to add shadow consumer creation code to the second original bytecode using instrumentation technology. The second original bytecode with the added shadow consumer creation code is then reloaded. This ensures that when the message middleware client consumes messages, the shadow consumer creation code is executed to create a shadow consumer and start consuming the corresponding message queue. This shadow consumer creation code can be added at the bytecode level of the message middleware client without modifying the client's source code, and it improves the writing efficiency and accuracy of the shadow consumer creation code. Therefore, through message processing probes and instrumentation technology, automatic code modification at the bytecode level is effectively achieved. This feature allows for testing of asynchronous messages without modifying the source code of the banking application system. It further decouples the producer and consumer-related logic from the application business code, effectively reducing the intrusion into the original business logic of the banking application system. Moreover, it eliminates the need for manual modification by application developers, reducing implementation costs. This enables application nodes in the producer role to send load test messages to the shadow message queue, and application nodes in the consumer role to create shadow consumers to consume load test messages in the shadow message queue. This further enables the banking application system to support load testing of asynchronous messages in production environment scenarios, allowing load test messages to cover the entire application node chain for testing, and avoiding the impact of load test messages on the business message chain.Furthermore, the method in this embodiment requires only the deployment of a small number of configuration center nodes, and all producer-consumer strategies take effect promptly through remote configuration. Application developers do not need to understand the specific implementation process, effectively reducing subsequent maintenance costs.
[0071] Figure 4 This is a schematic diagram of a message processing device provided in an embodiment of this application, with reference to... Figure 4 The message processing device may include:
[0072] The first addition module 410 is used to add message identification code to the first raw bytecode of the access service framework of the application node and make the message identification code effective so that when the access service framework receives the first request message, the message type of the first request message is identified by executing the message identification code and the first request message whose message type is a load test message type is processed.
[0073] The second addition module 420 is used to add message sending interception code to the second raw bytecode of the message middleware client of the application node, and make the message sending interception code effective, so that when the message middleware client sends the second request message, the message sending interception code is executed to send the second request message to the corresponding message queue based on the message type of the second request message; the second request message is a message processed by the message identification code;
[0074] The third addition module 430 is used to add shadow consumer creation code to the second raw bytecode of the message middleware client of the application node, and make the shadow consumer creation code effective, so that when using the message middleware client to consume messages, the shadow consumer creation code is executed to create a shadow consumer and start the shadow consumer to consume the corresponding message queue.
[0075] In one embodiment, the first adding module 410 adds message identification code to the first original bytecode of the access service framework of the application node and makes the message identification code effective, including: accessing a message processing probe in the application node and using the message processing probe to pull the message identification code for the application node from the configuration center; using the message processing probe, adding the message identification code to the first original bytecode using instrumentation technology; and reloading the first original bytecode after adding the message identification code.
[0076] In one embodiment, the message identification code in the first addition module 410 includes: performing type identification on the received first request message to obtain the message type of the first request message; when the message type of the first request message is a load test message type, storing a preset load test identifier in the thread private space of the target thread that processes the first request message.
[0077] In one embodiment, the second adding module 420 adds message sending interception code to the second raw bytecode of the message middleware client of the application node and makes the message sending interception code effective, including: accessing a message processing probe in the application node and using the message processing probe to pull message sending interception code for the application node from the configuration center; using the message processing probe, adding message sending interception code to the second raw bytecode using instrumentation technology; and reloading the second raw bytecode after adding the message sending interception code.
[0078] In one embodiment, the message sending interception code in the second addition module 420 includes: determining whether the message type of the second request message to be sent is a stress test message type; when the message type of the second request message is a stress test message type, using a message processing probe, obtaining the name of the first shadow message queue from the policy configuration table of the configuration center based on the name of the first official message queue, and sending the second request message to the first shadow message queue corresponding to the name of the first shadow message queue.
[0079] In one embodiment, the third adding module 430 adds shadow consumer creation code to the second raw bytecode of the message middleware client of the application node and makes the shadow consumer creation code effective, including: accessing a message processing probe in the application node and using the message processing probe to pull the shadow consumer creation code for the application node from the configuration center; using the message processing probe, adding the shadow consumer creation code to the second raw bytecode using instrumentation technology; and reloading the second raw bytecode after adding the shadow consumer creation code.
[0080] In one embodiment, the shadow consumer creation code in the third addition module 430 includes: using a message processing probe, querying the producer-consumer configuration information corresponding to the second formal message queue name from the policy configuration table of the configuration center based on the second formal message queue name, and obtaining the query result; when the query result is not empty, creating a shadow consumer, obtaining the second shadow message queue name from the query result, and starting the shadow consumer to consume the second shadow message queue corresponding to the second shadow message queue name.
[0081] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional modules is merely an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0082] The message processing apparatus provided in this embodiment can be applied to the message processing method provided in any of the above embodiments, and has corresponding functions and beneficial effects.
[0083] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 A block diagram is shown of an exemplary electronic device 11 suitable for implementing embodiments of the present application. Figure 5 The electronic device 11 shown is merely an example and should not impose any limitations on the functionality and scope of use of this embodiment.
[0084] like Figure 5 As shown, the electronic device 11 is represented in the form of a general-purpose computing electronic device. The components of the electronic device 11 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).
[0085] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, industry-standard architecture buses, microchannel architecture buses, enhanced industry-standard architecture buses, Video Electronics Standards Association (VESA) local buses, and peripheral component interconnect buses.
[0086] Electronic device 11 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 11, including volatile and non-volatile media, removable and non-removable media.
[0087] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory 30 and / or cache memory 32. Electronic device 11 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 Not shown; usually referred to as a "hard drive"). Although Figure 5 As not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.
[0088] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of this application.
[0089] Electronic device 11 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with electronic device 11, and / or with any device that enables electronic device 11 to communicate with one or more other computing devices (e.g., network interface card and modem, etc.). Such communication can be performed through input / output interface 22. Furthermore, electronic device 11 can also communicate with one or more networks (e.g., local area network, wide area network, and / or public network) through network adapter 20.
[0090] like Figure 5 As shown, network adapter 20 communicates with other modules of electronic device 11 via bus 18. It should be understood that, although... Figure 5 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 11, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, tape drives, and data backup storage systems.
[0091] The processing unit 16 executes various functional applications and page displays by running programs stored in the system memory 28, such as implementing a message processing method provided in any embodiment of this application.
[0092] This application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements a message processing method, such as that provided in any embodiment of this application.
[0093] The computer storage medium of this embodiment can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, 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.
[0094] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0095] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, radio frequency, etc., or any suitable combination thereof.
[0096] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages as well as conventional procedural 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 it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0097] This application also provides a computer program product, including a computer program that, when executed by a processor, implements a message processing method as provided in any embodiment of this application.
[0098] In the implementation of a computer program product, computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages as well as conventional procedural 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 local area networks (LANs) or wide area networks (WANs), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0099] Those skilled in the art will understand that the modules or steps described above in this application can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, which can then be stored in a storage device for execution by a computing device. Alternatively, they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0100] Note that the above are merely preferred embodiments and the technical principles employed in this application. Those skilled in the art will understand that this application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments. Many other equivalent embodiments may be included without departing from the inventive concept of this application, and the scope of this application is determined by the scope of the appended claims.
Claims
1. A message processing method characterized by, The method applied to an application node comprises: adding message identification code in first original bytecode of an access service framework of the application node, and enabling the message identification code, so that when a first request message is received by using the access service framework, the message type of the first request message is identified by executing the message identification code, and the first request message of the message type being a stress test message type is processed; adding message sending interception code in second original bytecode of a message middleware client of the application node, and enabling the message sending interception code, so that when a second request message is sent by using the message middleware client, the second request message is sent to a corresponding message queue based on the message type of the second request message by executing the message sending interception code; the second request message is a message processed by using the message identification code; adding shadow consumer creation code in the second original bytecode of the message middleware client of the application node, and enabling the shadow consumer creation code, so that when a message is consumed by using the message middleware client, a shadow consumer is created by executing the shadow consumer creation code, and the shadow consumer consumes a corresponding message queue.
2. The message processing method of claim 1, wherein, adding message identification code in first original bytecode of an access service framework of the application node, and enabling the message identification code, comprises: accessing a message processing probe in the application node, and pulling message identification code for the application node from a configuration center by using the message processing probe; adding the message identification code in the first original bytecode by using the message processing probe and adopting a patching technology; reloading the first original bytecode after the message identification code is added.
3. The message processing method of claim 2, wherein, The message identification code comprises: identifying the type of the received first request message to obtain the message type of the first request message; when the message type of the first request message is a stress test message type, saving a preset stress test identifier in a thread private space of a target thread processing the first request message.
4. The message processing method of claim 1, wherein, adding message sending interception code in second original bytecode of a message middleware client of the application node, and enabling the message sending interception code, comprises: accessing a message processing probe in the application node, and pulling message sending interception code for the application node from a configuration center by using the message processing probe; adding the message sending interception code in the second original bytecode by using the message processing probe and adopting a patching technology; reloading the second original bytecode after the message sending interception code is added.
5. The message processing method of claim 4, wherein, The message sending interception code comprises: determining whether the message type of the second request message to be sent is a stress test message type; when the message type of the second request message is a stress test message type, obtaining a first shadow message queue name from a policy configuration table of the configuration center based on a first formal message queue name by using the message processing probe, and sending the second request message to a first shadow message queue corresponding to the first shadow message queue name.
6. The message processing method of claim 1, wherein, adding shadow consumer creation code in second original bytecode of a message middleware client of the application node, and enabling the shadow consumer creation code, comprises: accessing a message processing probe in the application node, and pulling, by the message processing probe, shadow consumer creation code for the application node from a configuration center; adding, by the message processing probe, the shadow consumer creation code to the second original bytecode by using a patching technique; reloading the second original bytecode after the shadow consumer creation code is added.
7. The message processing method of claim 6, wherein, The shadow consumer creation code comprises: querying, by the message processing probe, producer-consumer configuration information corresponding to the second formal message queue name from a policy configuration table of the configuration center based on the second formal message queue name, to obtain a query result; when the query result is not empty, creating a shadow consumer, obtaining a second shadow message queue name from the query result, and starting the shadow consumer to consume a second shadow message queue corresponding to the second shadow message queue name.
8. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the message processing method in any one of claims 1 to 7.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the message processing method in any one of claims 1 to 7.
10. A computer program product comprising a computer program, characterized in that, The computer program, when executed by the processor, implements the message processing method according to any one of claims 1 to 7. The computer program, when executed by the processor, implements the message processing method according to any one of claims 1 to 7.