Message processing methods, apparatus, devices and storage media

By acquiring and configuring message generation templates and data generation rules, messages are generated and sent, solving the problem of customized coding required for complex logic or relationships in existing technologies, and achieving the effect of reducing development time and costs.

CN122086649APending Publication Date: 2026-05-26ARCHFORCE FINANCIAL TECH CO LTD +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202610561946.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-27
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In existing technologies, generating and sending messages with complex logic or relationships requires developers to perform customized coding, resulting in high development time and costs.

Method used

By obtaining the message generation template, configuring the target fields and data generation rules, the target message data is generated according to the dependency relationship between message types and sent to the message middleware without the need for customized coding.

Benefits of technology

It reduces the development time cost for developers, and can generate messages with complex logic or relationships by configuring data generation rules, thus reducing repetitive development work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122086649A_ABST
    Figure CN122086649A_ABST
Patent Text Reader

Abstract

This application discloses a message processing method, apparatus, device, and storage medium, relating to the field of computer technology. The message processing method includes: obtaining message generation templates for different message types, wherein the message generation templates are configured with target fields corresponding to the message types and data generation rules associated with the target fields; generating target message data corresponding to the message types in a preset database according to the dependencies between different message types and the data generation rules associated with each target field in the message generation templates; and sending the target message data stored in the database to a preset message middleware. This application eliminates the need for customized coding for complex logic or relationships; by configuring the data generation rules for each field, the corresponding data can be generated, reducing the development time cost for developers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a message processing method, apparatus, device, and storage medium. Background Technology

[0002] Message middleware is widely used in software systems. During the functional testing phase, it is necessary to generate and send a large number of messages of various types at high speed based on actual business logic to verify the performance bottlenecks of the message middleware consumer and the correctness of the business processing logic. However, if the various messages to be sent have complex logic or relationships, developers need to write special code to generate such messages with complex logic and relationships, resulting in high development time costs for developers.

[0003] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0004] The main purpose of this application is to provide a message processing method, apparatus, device, and storage medium that aims to reduce the development time cost for developers by eliminating the need for customized coding for complex logic or relationships.

[0005] To achieve the above objectives, this application proposes a message processing method, the method comprising: Obtain message generation templates for different message types, wherein the message generation template is configured with a target field corresponding to the message type and a data generation rule associated with the target field; Based on the dependencies between different message types and the data generation rules associated with each target field in the message generation template, target message data corresponding to the message type is generated in a preset database. The data generation rules include field referencing rules and preset message functions. The field referencing rules refer to the rules for referencing target fields between different message types. The message functions are configured according to preset instruction configuration information, which includes instruction identifiers and instruction parameters. The target message data stored in the database is sent to a preset message middleware.

[0006] In one embodiment, generating target message data corresponding to the message type in a preset database according to the data generation rules associated with each target field in the message generation template, based on the dependencies between different message types, includes: Determine the dependencies between different message types; Based on the aforementioned dependencies, determine the traversal order of each message generation template; The target fields in the message generation template corresponding to each message type are traversed in the traversal order to generate target message data of the corresponding message type in the database according to the data generation rules associated with each target field in each message generation template.

[0007] In one embodiment, generating target message data of the corresponding message type in the database according to the data generation rules associated with each target field in each message generation template includes: For each target field in each message generation template, if the data generation rule associated with the target field is a field reference rule, then the filling data of the target field is determined according to the data of the field indicated by the field reference rule. For each target field in each message generation template, if the data generation rule associated with the target field is a preset message function, then the message function is executed to obtain the fill data for the target field; Based on the populated data corresponding to each target field in each message generation template, target message data of the corresponding message type is formed in the database.

[0008] In one embodiment, executing the message function to obtain the populated data for the target field includes: When the message function is executed, the instruction identifier and instruction parameters corresponding to the message function are parsed out; The actual execution function associated with the instruction identifier is obtained by querying the preset mapping table; The instruction parameters are passed to the actual execution function to obtain the filling data for the target field.

[0009] In one embodiment, sending the target message data stored in the database to a preset message middleware includes: The target thread of the target instance registers a test task with the database, wherein the test task refers to the task of sending each of the target message data to the message middleware; After successful registration, the data preparation time and data transmission time of the batch to be sent are determined according to the configured duration in the preset message sending strategy. According to the data preparation time and data transmission time of the batch to be sent, the target message data corresponding to each batch to be sent is sent to the message middleware.

[0010] In one embodiment, after registering the test task with the database through the target thread of the target instance, the method further includes: If no heartbeat request is received from the target instance after successful registration, the target instance is determined to be in an abnormal state if no heartbeat request is received within a preset period.

[0011] In one embodiment, after sending the target message data corresponding to each batch to be sent to the message middleware according to the data preparation time and data transmission time of the batch to be sent, the method further includes: Receive the response information returned by the message middleware; If the response information indicates successful transmission, the status of each target message data corresponding to the batch to be sent will be updated to the status of successful transmission.

[0012] Furthermore, to achieve the above objectives, this application also proposes a message processing apparatus, the message processing apparatus comprising: The acquisition module is used to acquire message generation templates for different message types, wherein the message generation template is configured with a target field corresponding to the message type and a data generation rule associated with the target field; The generation module is used to generate target message data corresponding to the message type in a preset database according to the data generation rules associated with each target field in the message generation template, based on the dependency relationships between different message types. The data generation rules include field referencing rules and preset message functions. The field referencing rules refer to the rules for referencing target fields between different message types. The message functions are configured according to preset instruction configuration information, which includes instruction identifiers and instruction parameters. The sending module is used to send the target message data stored in the database to a preset message middleware.

[0013] In addition, to achieve the above objectives, this application also proposes a message processing apparatus, the apparatus comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the message processing method as described above.

[0014] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and which, when executed by a processor, implements the steps of the message processing method described above.

[0015] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the message processing method described above.

[0016] This application provides a message processing method, apparatus, device, and storage medium. The message processing method includes: obtaining message generation templates for different message types, wherein the message generation templates are configured with target fields corresponding to the message types and data generation rules associated with the target fields; generating target message data corresponding to the message types in a preset database according to the dependencies between different message types and the data generation rules associated with each target field in the message generation templates; and sending the target message data stored in the database to a preset message middleware. This application eliminates the need for customized coding for complex logic or relationships; by configuring the data generation rules for each field, the corresponding data can be generated, reducing the development time cost for developers. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart illustrating an embodiment of the message processing method of this application. Figure 2 This is a flowchart illustrating Embodiment 2 of the message processing method of this application; Figure 3 This is a flowchart illustrating Embodiment 3 of the message processing method of this application; Figure 4 A timing diagram for data transmission provided in an embodiment of this application; Figure 5 This is a schematic diagram of the module structure of the message processing device according to an embodiment of this application; Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the message processing method in the embodiments of this application.

[0020] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0021] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0022] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0023] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device, big data service platform, or message processing system capable of implementing the above functions. The following description uses a message processing system as an example to illustrate this embodiment and the subsequent embodiments.

[0024] Based on this, embodiments of this application provide a message processing method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the message processing method of this application.

[0025] Step S11: Obtain message generation templates for different message types, wherein the message generation template is configured with target fields corresponding to the message type and data generation rules associated with the target fields; It should be noted that different application scenarios correspond to different message types. Taking a securities trading system as an example, when an order is created and finally executed, multiple messages will be generated, namely order information, order confirmation information, and transaction information.

[0026] It should be noted that different message types correspond to different fields. Therefore, message generation templates for each message type are pre-configured. These templates include target fields corresponding to the message type and associated data generation rules. Optionally, the data generation rules include field referencing rules and preset message functions. The field referencing rules refer to rules for referencing target fields between different message types. For example, the value of a target field in transaction information can directly reference the value of a field in order information. The message functions include a random number generation function, a random selection function, a character concatenation function, and a reference function. The random number generation function generates random numbers, the random selection function randomly selects a value from multiple values, the character concatenation function concatenates different values, and the reference function references other field values ​​in the current message.

[0027] Step S12: Based on the dependency relationships between different message types and the data generation rules associated with each target field in the message generation template, generate the target message data corresponding to the message type in the preset database. In this embodiment, different messages may have dependencies. The traversal order of the message generation templates needs to be determined based on these dependencies. For example, a transaction message depends on an order message, so the order message must be processed first, followed by the transaction message. The target fields in each of the message generation templates are traversed according to the traversal order. For each target field in the message generation template, target message data corresponding to the message type is generated in a preset database according to the data generation rules associated with the target field. In other embodiments, if a target field is not associated with a data generation rule, a fixed value from the message generation template is used for filling.

[0028] Step S13: Send the target message data stored in the database to the preset message middleware.

[0029] It should be noted that a multi-threaded design is used for data transmission, supporting uniform, pulse, and stepped transmission modes. Uniform transmission refers to continuous transmission at a fixed rate, such as sending 1000 order messages per second stably during non-peak sales periods on e-commerce platforms. Pulse transmission refers to sending data in bursts to simulate sudden traffic peaks; for example, at the start of an e-commerce flash sale, 5000 messages per second are sent for one minute, pause for 30 seconds, and then 5000 messages per second again, replicating the peak and brief period of calm pulsed traffic. Stepped transmission refers to sending data at a gradually increasing or decreasing rate to simulate scenarios of gradually increasing or decreasing traffic; for example, gradually increasing the load during stress testing to see the system's limits.

[0030] In this embodiment, the DMP multi-active component, in conjunction with multi-threading and other collaborative work, sends the target message data stored in the database to a preset message middleware, achieving high availability and breakpoint resume, and ensuring stable operation of the system under high load.

[0031] In one feasible embodiment, the multithreading of each instance includes a registration thread, a heartbeat thread, a batch generation thread, a data sending thread, and a status update thread. The registration thread registers test tasks with the database, where each test task refers to sending target message data to the message middleware. The batch generation thread generates all batches to be sent based on the target message data after successful registration. The data sending thread sends the target message data corresponding to each batch to be sent to the message middleware according to the configured duration in the preset message sending strategy. The heartbeat thread sends heartbeat requests to the database at preset intervals to allow the database to determine the current instance status. The status update thread updates the data sending status in real time until sending is complete. Finally, after the entire stress test is completed, the registration information for the stress test is removed from the heartbeat thread to ensure reasonable resource release and optimized system operation.

[0032] This embodiment, through the above-described scheme, includes: obtaining message generation templates for different message types, wherein the message generation template is configured with target fields corresponding to the message type and data generation rules associated with the target fields; generating target message data corresponding to the message type in a preset database according to the dependencies between different message types and the data generation rules associated with each target field in the message generation template; and sending each target message data stored in the database to a preset message middleware. This embodiment eliminates the need for customized coding for complex logic or relationships; data generation can be achieved through the configured data generation rules, reducing repetitive development work and thus lowering development time costs.

[0033] In one feasible implementation, refer to Figure 2 , Figure 2 This is a flowchart illustrating a second embodiment of the message processing method of this application; the step of generating target message data corresponding to the message type in a preset database according to the data generation rules associated with each target field in the message generation template, based on the dependency relationships between different message types, includes: Step S21: Determine the dependencies between different message types; Step S22: Determine the traversal order of each message generation template according to the dependency relationship; It should be noted that there may be dependencies between the various messages. For example, taking a securities trading system as an example, each order information requires the generation of an order confirmation message and a transaction message, and the order number in the order confirmation message and the transaction message must be consistent with the number in the original order information. Therefore, the order confirmation message and the transaction message must be generated based on the corresponding order information. In this embodiment, it is necessary to determine whether there are dependencies between the fields corresponding to each message type, and determine the traversal order of each message generation template according to the dependencies; ensuring that the dependent message template is processed first, and the dependent party is processed later.

[0034] Step S23: Traverse each target field in the message generation template corresponding to each message type according to the traversal order, so as to generate target message data of the corresponding message type in the database according to the data generation rules associated with each target field in each message generation template.

[0035] In this embodiment, the message generation template to be processed is determined according to the traversal order. For example, the message generation template for the entrustment message is processed first. Further, each target field in the message generation template is processed one by one, and the corresponding fill data for the target field is generated according to the data generation rules associated with each target field. For example, for each target field, if there is a field referencing rule associated with it, the fill data for the target field is determined directly based on the data of the referenced field. For example, if the entrustment number in the entrustment confirmation information and the transaction information is the same as the number in the original entrustment information, the entrustment number in the entrustment confirmation information and the transaction information can directly reference the number in the entrustment information. If there is a random number generation function associated with it, the random number generation function is run to generate random numbers and use them as fill data for the target field; if it is a character concatenation function, the character concatenation function is run to concatenate the values ​​to be concatenated as indicated by the character concatenation function. If it is a reference function, the values ​​of other fields in the current message indicated by the reference function are used as fill data for the target field. In other embodiments, if it is a numeric type field, it can also be referenced proportionally to calculate the fill data for the target field based on the reference ratio and the value of the indicated field.

[0036] Furthermore, based on the fill data corresponding to each target field in each message generation template, target message data of the corresponding message type is formed in the database. After processing the first message generation template, the next message generation template is processed in traversal order. For example, the message generation template for a transaction message template. The subsequent traversal execution process is similar and will not be described in detail here.

[0037] This embodiment determines the traversal order of each message generation template based on the dependencies between different message types. Then, it traverses each target field in the message generation template corresponding to each message type according to the traversal order, generating target message data for the corresponding message type in the database based on the data generation rules associated with each target field in each message generation template. This embodiment eliminates the need for customized coding for complex logic or relationships; message generation can be achieved simply by configuring the data generation rules for each field, reducing repetitive development work and thus lowering development time costs.

[0038] In one feasible implementation, generating target message data of the corresponding message type in the database according to the data generation rules associated with each target field in each message generation template includes: Step S31: For each target field in each message generation template, if the data generation rule associated with the target field is a field reference rule, then the filling data of the target field is determined according to the data of the field indicated by the field reference rule.

[0039] It should be noted that the field referencing rules refer to the rules for referencing target fields between different message types. In this embodiment, when processing any target field in the message generation template, it is necessary to determine whether the target field is associated with a field referencing rule. If it is, the referenced message type and specific field are parsed according to the rule. For example, in a transaction message, the referenced message type is a commission message, and the referenced specific field is the commission ID. Further, the value of the commission ID of the commission message is queried in the database. Then, the retrieved value of the referenced field is directly assigned to the current target field to obtain the populated data for the target field. Alternatively, the populated data for the target field can be calculated based on the value of the referenced field; for example, the transaction fee in a transaction message = the transaction amount in a commission message × 0.05%. In other embodiments, if the format of the referenced value is inconsistent with the requirements of the target field, a format conversion is required before data population.

[0040] Step S32: For each target field in each message generation template, if the data generation rule associated with the target field is a preset message function, then the message function is executed to obtain the fill data of the target field; It should be noted that the message function is configured based on preset instruction configuration information. In essence, the message function uses imperative programming, combining instructions to create its complete execution logic. The return result of the last instruction is the function's return result. A single field of the message can be configured with a message function; during message function execution, the instructions are translated into corresponding Java methods for replacement.

[0041] Optionally, the instruction configuration information includes an instruction identifier, instruction parameters, and instruction execution result. It should be noted that the instruction parameters in the message functions corresponding to different fields are not entirely the same. Instruction parameters can be fixed values ​​configured by the user, or they can reference values ​​from other fields in the current message type. The instruction identifier is associated with the specific actual execution function. In a specific example, the instruction format is as follows: Instruction Identifier CODE<#C#>Instruction Parameter 1<#C#>Instruction Parameter 2<#C#>PARAM1.

[0042] In this system, the instruction identifier CODE is a fixed value, using a plug-in model. Instruction parameters are configured after the instruction CODE; <#C#> is a separator; PARAM1 is a special keyword representing the instruction's return value. Therefore, each instruction can use the results of other instructions as input parameters, enabling multi-instruction combinations to complete more complex logical operations. Users only need to configure the instruction parameters; the instructions are ultimately converted into Java methods for execution, generating corresponding data. This reduces user configuration costs and improves the accuracy and efficiency of data generation. In other embodiments, the execution time, parameters, results, and failure status of each instruction can also be recorded and associated with specific fields and messages for easier troubleshooting later.

[0043] For example, to generate an order number = WT_random number, you can use two instructions: Instruction 1: RANDOM_INT<#C#>1<#C#>100 (randomly generates an integer between 1 and 100, let's say 67); Instruction 2: CONCAT<#C#>_<#C#>WT<#C#>PARAM1, the execution logic is to use the first parameter to concatenate all subsequent parameters, PARAM1 references the result 67 from instruction 1, and concatenates it to get WT_67; the final function result WT_67890 is the filling data for the order number.

[0044] Furthermore, regarding the command to retrieve other field values ​​of the current message, assuming the current message format is: {ORDER:{PD_CD:“10002”}}, and the command is: JSON_PATH<#C#>$.ORDER.PD_CD. The execution logic in this case is to retrieve the value at the corresponding position in the current message according to the JSON path expression in the first parameter. The result after execution is: 10002.

[0045] In addition, the left-padding instruction is: LPAD<#C#>abc<#C#>0<#C#>5. The execution logic of this instruction is: to padded the first parameter with the second parameter to the left, until the length specified by the third parameter is reached. The result after execution is: 00abc.

[0046] In addition, the time retrieval command is: DATE<#C#>yyyy-MM-dd. The execution logic is: retrieve the generated data time and generate it according to the format of the first parameter. The result after execution is: 2025-12-24.

[0047] In addition, the numerical addition instruction is: ADD<#C#>1<#C#>2. The execution logic is: the first parameter is added to the second parameter, and the result is: 3.

[0048] In addition, the SQL query command is: SQL_LIST<#C#>select A from B. The execution logic is: execute the SQL and return the query results.

[0049] The instructions in this embodiment can be configured according to the actual situation, so that the complete execution logic of the message function can be formed by combining multiple instructions.

[0050] In one feasible implementation, executing the message function to obtain the populated data for the target field includes: Step S321: When executing the message function, the instruction identifier and instruction parameters corresponding to the message function are parsed and obtained; Step S322: Query the preset mapping table to obtain the actual execution function associated with the instruction identifier; Step S323: Pass the instruction parameters into the actual execution function to obtain the filling data of the target field.

[0051] In this embodiment, when executing the message function, the instruction identifier and instruction parameters corresponding to the message function are parsed; optionally, the execution parameters can also be empty. Further, the actual execution function associated with the instruction identifier is retrieved from a preset mapping table. For example, the identifier for generating random numbers corresponds to a Java method that generates random numbers within a specified range, thereby determining the actual logic to be executed by the instruction. Optionally, if a Java method is found, key information of the Java method is extracted, such as the number of input parameters and type requirements. The parsed instruction parameters are converted to the type required by the actual execution function, and then the converted instruction parameters are passed to the Java method. That is, in this embodiment, if the actual execution function executes successfully, the returned output value is the data to be filled in the target field; if execution fails (e.g., incorrect parameter type), a retry mechanism is triggered, for example, retrying a preset number of times, and returning a fallback value or the result of execution failure after a retry failure.

[0052] This embodiment designs message functions using imperative programming and a plug-in model, supporting operations such as random generation, field referencing, and character concatenation, and allowing for customization and extension. Functions execute using instruction combination logic, with instructions able to reference each other's results, efficiently generating message fields that meet business requirements.

[0053] Step S33: Based on the fill data corresponding to each target field in each message generation template, target message data of the corresponding message type is formed in the database.

[0054] In one feasible embodiment, the fill data corresponding to each target field in the message generation template is stored in a database to obtain the target message data corresponding to that message type. More specifically, a dedicated data table is pre-configured for each message type, with the table structure mapped one-to-one to the target fields in the message generation template, and preset data types and constraint rules. The fill data corresponding to each target field is converted according to the preset data types and constraint rules, and the converted data is stored in the data table corresponding to the message type.

[0055] This embodiment determines the fill data for the target field based on the data of the field indicated by the field reference rule if the data generation rule associated with the target field is a field reference rule; or, if the data generation rule associated with the target field is a preset message function, the message function is executed to obtain the fill data for the target field. Then, based on the fill data corresponding to each target field in each message generation template, target message data of the corresponding message type is formed in the database. This embodiment can realize direct referencing of message fields or proportional referencing of numerical fields, meeting the complex business logic requirements between multiple messages. Therefore, it eliminates the need for customized coding for complex logic or relationships; message generation can be achieved through configured data generation rules, reducing repetitive development work and thus lowering development time costs.

[0056] In one feasible implementation, refer to Figure 3 , Figure 3 This is a flowchart illustrating a third embodiment of the message processing method of this application; the step of sending the target message data stored in the database to a preset message middleware includes: Step S41: Register a test task with the database through the target thread of the target instance, wherein the test task refers to the task of sending each of the target message data to the message middleware; It should be noted that, referring to Figure 4 , Figure 4 This is a timing diagram of data transmission provided in one embodiment of this application. An efficient multi-threaded design is employed during data transmission to achieve high availability and resume data transmission from interrupted points. The target instance in this embodiment is a DMP instance. The DMP (Data Message Processor) component acts as a multi-active component, ensuring stable system operation even under high load.

[0057] In this embodiment, after the data is generated, the DMP component queries the database to check if the data source for the current stress test is ready, such as the order messages and transaction messages required for the stress test. If the data source is ready, the database returns a stress test ID, which is a globally unique identifier for the current stress test task. It should be noted that the DMP component is a highly available, multi-active component, with multiple DMP instances running simultaneously. It is necessary to clearly define which instance is responsible for handling the current stress test task. When the registration thread of a DMP instance successfully registers and obtains the stress test ID for the test task, it indicates that the DMP instance has successfully registered and can send the data corresponding to the test task.

[0058] In addition, in other embodiments, after successful registration, the DMP instance periodically updates the registration status to the database; more specifically: after successful registration, if no heartbeat request is received from the target instance within a preset period, the target instance is determined to be in an abnormal state, and the test task is registered to the database through the registration thread of other instances. Optionally, after a preset time, the registration thread of other DMP instances will re-register the stress test and continue sending from the unfinished batch.

[0059] Step S42: After successful registration, determine the data preparation time and data transmission time of the batch to be sent according to the configured duration in the preset message sending strategy. It should be noted that when sending messages according to a preset message sending strategy (e.g., uniform speed, pulse, step, etc.), the batch is the smallest time unit of the strategy. For example, a single message lasting 5 minutes corresponds to one batch.

[0060] In one embodiment, the batch generation and sending thread of the DMP instance generates all batches to be sent for the current load test task according to the order sending strategy, and stores the data preparation time, data sending time and load test ID of the batches to be sent in the database.

[0061] Step S43: According to the data preparation time and data transmission time of the batch to be sent, send the target message data corresponding to each batch to be sent to the message middleware.

[0062] In this embodiment, the DMP instance checks whether all batches to be sent have reached their data preparation time. When a batch reaches its data preparation time, the data sending thread queries the database for all message data corresponding to that batch, using the stress test ID as an identifier. The database returns the message data for that batch for subsequent sending. When a batch reaches its data sending time, the data sending thread asynchronously sends the data to the specified topic and partition of the message middleware.

[0063] In other embodiments, the status update thread receives response information returned by the message middleware; if the response information indicates successful transmission, the status of each target message data corresponding to the batch to be sent is updated to the successfully sent status. This continues until transmission is complete. After the entire stress test is completed, the registration information for this stress test is removed from the heartbeat thread to ensure reasonable resource release and optimized system operation.

[0064] This embodiment registers test tasks with the database through the target thread of the target instance. After successful registration, the data preparation time and data transmission time of the batch to be sent are determined according to the configured duration in the preset message sending strategy. Based on the data preparation time and data transmission time of the batch to be sent, each target message data corresponding to the batch to be sent is sent to the message middleware. By adopting a multi-threaded design, high availability and breakpoint resume data transmission are achieved, ensuring stable system operation under high load and meeting the testing requirements of the consumer end for the highest consumption performance.

[0065] It should be noted that the examples in the figure are only for understanding this application and do not constitute a limitation on the message processing method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0066] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0067] This application also provides a message processing apparatus, please refer to... Figure 5 , Figure 5 This is a schematic diagram of the module structure of a message processing device according to an embodiment of this application; the message processing device includes: The acquisition module 51 is used to acquire message generation templates for different message types, wherein the message generation template is configured with a target field corresponding to the message type and a data generation rule associated with the target field; The generation module 52 is used to generate target message data corresponding to the message type in a preset database according to the data generation rules associated with each target field in the message generation template, based on the dependency relationships between different message types. The data generation rules include field referencing rules and preset message functions. The field referencing rules refer to the rules for referencing target fields between different message types. The message functions are configured according to preset instruction configuration information, which includes instruction identifiers and instruction parameters. The sending module 53 is used to send the target message data stored in the database to a preset message middleware.

[0068] The generation module 52 is further configured to: Determine the dependencies between different message types; Based on the aforementioned dependencies, determine the traversal order of each message generation template; The target fields in the message generation template corresponding to each message type are traversed in the traversal order to generate target message data of the corresponding message type in the database according to the data generation rules associated with each target field in each message generation template.

[0069] The generation module 52 is further configured to: For each target field in each message generation template, if the data generation rule associated with the target field is a field reference rule, then the filling data of the target field is determined according to the data of the field indicated by the field reference rule, wherein the field reference rule refers to the rule that references target fields between different message types; For each target field in each message generation template, if the data generation rule associated with the target field is a preset message function, then the message function is executed to obtain the fill data for the target field; Based on the populated data corresponding to each target field in each message generation template, target message data of the corresponding message type is formed in the database.

[0070] The message function is configured according to preset instruction configuration information, wherein the instruction configuration information includes instruction identifier and instruction parameters; the generation module 52 is further configured to: When the message function is executed, the instruction identifier and instruction parameters corresponding to the message function are parsed out; The actual execution function associated with the instruction identifier is obtained by querying the preset mapping table; The instruction parameters are passed to the actual execution function to obtain the filling data for the target field.

[0071] The sending module 53 is further configured to: The target thread of the target instance registers a test task with the database, wherein the test task refers to the task of sending each of the target message data to the message middleware; After successful registration, the data preparation time and data transmission time of the batch to be sent are determined according to the configured duration in the preset message sending strategy. According to the data preparation time and data transmission time of the batch to be sent, the target message data corresponding to each batch to be sent is sent to the message middleware.

[0072] The message processing device is also used for: If no heartbeat request is received from the target instance after successful registration, the target instance is determined to be in an abnormal state if no heartbeat request is received within a preset period.

[0073] The message processing device is also used for: Receive the response information returned by the message middleware; If the response information indicates successful transmission, the status of each target message data corresponding to the batch to be sent will be updated to the status of successful transmission.

[0074] The message processing apparatus provided in this application, employing the message processing method described in the above embodiments, can solve the technical problems mentioned in the background section. Compared with the prior art, the beneficial effects of the message processing apparatus provided in this application are the same as those of the message processing method provided in the above embodiments, and other technical features in the message processing apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0075] This application provides a message processing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the message processing method in Embodiment 1 above.

[0076] The following is for reference. Figure 6 , Figure 6 This is a schematic diagram of the hardware operating environment involved in the message processing method in this application embodiment. The message processing device in this application embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (such as in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The message processing device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0077] like Figure 6As shown, the message processing device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the message processing device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. The communication device 1009 allows the message processing device to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows message processing devices with various systems, it should be understood that it is not required to implement or possess all of the systems shown. More or fewer systems may be implemented alternatively.

[0078] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0079] The message processing device provided in this application, employing the message processing method described in the above embodiments, can solve the technical problems mentioned in the background section. Compared with the prior art, the beneficial effects of the message processing device provided in this application are the same as those of the message processing method provided in the above embodiments, and other technical features of the message processing device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0080] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0081] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0082] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the message processing method described in the above embodiments.

[0083] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0084] The aforementioned computer-readable storage medium may be included in the message processing device; or it may exist independently and not assembled into the message processing device.

[0085] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by a message processing device, the message processing device: obtains message generation templates for different message types, wherein the message generation templates are configured with target fields corresponding to the message types and data generation rules associated with the target fields; generates target message data corresponding to the message types in a preset database according to the dependencies between different message types and the data generation rules associated with each target field in the message generation templates; and sends the target message data stored in the database to a preset message middleware. This application eliminates the need for customized coding for complex logic or relationships; it can be achieved through configured data generation rules, reducing repetitive development work and thus lowering development time costs.

[0086] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0087] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0088] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0089] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described message processing method, and is capable of solving the technical problems described in the background section. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the message processing method provided in the above embodiments, and will not be repeated here.

[0090] This application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the message processing method described above.

[0091] The computer program product provided in this application can solve the technical problems described in the background section. Compared with the prior art, the beneficial effects of the computer program product provided in the embodiments of this application are the same as the beneficial effects of the message processing method provided in the above embodiments, and will not be repeated here.

[0092] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0093] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0094] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A message processing method, characterized in that, include: Obtain message generation templates for different message types, wherein the message generation template is configured with a target field corresponding to the message type and a data generation rule associated with the target field; Based on the dependencies between different message types and the data generation rules associated with each target field in the message generation template, target message data corresponding to the message type is generated in a preset database. The data generation rules include field referencing rules and preset message functions. The field referencing rules refer to the rules for referencing target fields between different message types. The message functions are configured according to preset instruction configuration information, which includes instruction identifiers and instruction parameters. The target message data stored in the database is sent to a preset message middleware.

2. The message processing method as described in claim 1, characterized in that, The step of generating target message data corresponding to the message type in a preset database according to the data generation rules associated with each target field in the message generation template, based on the dependency relationships between different message types, includes: Determine the dependencies between different message types; Based on the aforementioned dependencies, determine the traversal order of each message generation template; The target fields in each of the message generation templates are traversed in the traversal order to generate target message data of the corresponding message type in the database according to the data generation rules associated with each target field in each message generation template.

3. The message processing method as described in claim 2, characterized in that, The step of generating target message data of the corresponding message type in the database according to the data generation rules associated with each target field in each message generation template includes: For each target field in each message generation template, if the data generation rule associated with the target field is a field reference rule, then the filling data of the target field is determined according to the data of the field indicated by the field reference rule. For each target field in each message generation template, if the data generation rule associated with the target field is a preset message function, then the message function is executed to obtain the fill data for the target field; Based on the populated data corresponding to each target field in each message generation template, target message data of the corresponding message type is formed in the database.

4. The message processing method as described in claim 3, characterized in that, The execution of the message function to obtain the populated data for the target field includes: When the message function is executed, the instruction identifier and instruction parameters corresponding to the message function are parsed out; The actual execution function associated with the instruction identifier is obtained by querying the preset mapping table; The instruction parameters are passed to the actual execution function to obtain the filling data for the target field.

5. The message processing method as described in claim 1, characterized in that, The step of sending the target message data stored in the database to a preset message middleware includes: The target thread of the target instance registers a test task with the database, wherein the test task refers to the task of sending each of the target message data to the message middleware; After successful registration, the data preparation time and data transmission time of the batch to be sent are determined according to the configured duration in the preset message sending strategy. According to the data preparation time and data transmission time of the batch to be sent, the target message data corresponding to each batch to be sent is sent to the message middleware.

6. The message processing method as described in claim 5, characterized in that, After registering the test task with the database through the target thread of the target instance, the process further includes: If no heartbeat request is received from the target instance after successful registration, the target instance is determined to be in an abnormal state if no heartbeat request is received within a preset period.

7. The message processing method as described in claim 5, characterized in that, After sending the target message data corresponding to each batch to be sent to the message middleware according to the data preparation time and data sending time of the batch to be sent, the method further includes: Receive the response information returned by the message middleware; If the response information indicates successful transmission, the status of each target message data corresponding to the batch to be sent will be updated to the status of successful transmission.

8. A message processing device, characterized in that, include: The acquisition module is used to acquire message generation templates for different message types, wherein the message generation template is configured with a target field corresponding to the message type and a data generation rule associated with the target field; The generation module is used to generate target message data corresponding to the message type in a preset database according to the data generation rules associated with each target field in the message generation template, based on the dependency relationships between different message types. The data generation rules include field referencing rules and preset message functions. The field referencing rules refer to the rules for referencing target fields between different message types. The message functions are configured according to preset instruction configuration information, which includes instruction identifiers and instruction parameters. The sending module is used to send the target message data stored in the database to a preset message middleware.

9. A message processing device, characterized in that, The message processing device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the message processing method as described in any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the message processing method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data generation method and device based on service scenario, and readable storage medium

    CN108984712A

  • Message sending method and device, equipment and storage medium

    CN111464427A

  • Multi-task visualization method and device, computer equipment and storage medium

    CN114819631A

  • Message processing method and device based on pressure test, equipment and storage medium

    CN119669054A