Order processing method and system based on message queue
By adopting intelligent shunt and dynamic consumption strategies based on message queues in high concurrency scenarios, the database row lock contention problem is solved, system performance and stability are improved, data consistency and efficient order processing are ensured.
Patent Information
- Application Number
- CN202510347436.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-06-27
AI Technical Summary
The prior art is difficult to effectively reduce database row lock contention in high concurrency scenarios, resulting in system performance and response speed being affected, and lack of cross-store consistency and real-timeness.
Using the order processing method based on message queue, through intelligent diversion and dynamic consumption strategies, the order addition and inventory reservation operations are executed simultaneously within the same transaction, and subsequent state flow operations are processed as asynchronous tasks, and real-time monitoring and dynamic rules are used to adjust and optimize the diversion strategy.
It significantly reduces database row lock contention, improves system concurrency processing capabilities and stability, ensures data consistency, and improves order processing efficiency and system TPS.
Smart Images

Figure CN120219045A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and more particularly to an order processing method and system based on a message queue. Background Art
[0002] In the current order processing system under high-concurrency scenarios, especially in the inventory update link, the following several technical means are usually adopted to ensure data consistency and the normal operation of the order processing process:
[0003] 1. Optimization of database lock mechanism:
[0004] Traditionally, the system uses pessimistic locks and optimistic locks to manage concurrent access, ensuring that only a single transaction can update the same data row at the same time. However, when the order volume surges and multiple orders operate on the same inventory record simultaneously, these lock mechanisms will cause a large number of row-level lock contentions, resulting in transaction waiting, lock conflicts, and even deadlocks, thus seriously affecting the system performance and response speed.
[0005] 2. Database sharding and table partitioning strategy:
[0006] To disperse the database pressure, some systems shard and partition the data by store, product, or order type, and disperse the concurrent access to multiple database instances. This method alleviates the pressure on the single-point database to a certain extent, but at the same time introduces the complexity of cross-database transaction management, data consistency maintenance, and subsequent data aggregation, and cannot completely eliminate the row lock competition problem caused by high concurrency.
[0007] 3. Optimization of business logic:
[0008] Some systems reduce the frequency of real-time access to inventory data through means such as business process optimization, introducing caches, batch updates, and delayed processing. Although these measures can partially alleviate the lock contention caused by concurrent updates, it is still difficult to meet the requirements of real-time and high-concurrency processing during the order peak period.
[0009] In summary, although the existing technologies have adopted various means (such as lock mechanisms, database sharding and table partitioning, business logic optimization, and asynchronous processing, etc.) to improve in dealing with high-concurrency order processing and inventory update problems, each solution has limitations, such as serious row lock contentions, prominent cross-database consistency problems, insufficient real-time performance, and inaccurate scheduling. Therefore, there is an urgent need for a technical solution that can further reduce database lock competition, improve concurrent processing capabilities, and system stability on the premise of ensuring data consistency. Summary of the Invention
[0010] The technical task of the present invention is to address the above deficiencies and provide an order processing method and system based on a message queue. Aiming at the row lock contention problem generated during inventory update in a high-concurrency environment, an efficient and reliable optimization solution is proposed, which can significantly reduce database row lock contention, improve the system's concurrent processing ability, enhance system stability and data consistency, and optimize resource utilization and system scalability.
[0011] The technical solution adopted by the present invention to solve its technical problems is as follows:
[0012] An order processing method based on a message queue, the implementation of this method includes the following steps:
[0013] 1) Receive order data from the business middle platform and preprocess the order data. The preprocessing includes data parsing, format verification, and preliminary order classification;
[0014] 2) According to the preprocessed order data, read relevant fields including at least order type, order priority, product attributes, store information, real-time requirements, and inventory occupancy risk indicators from a preset business rule library, and label the order with data;
[0015] 3) Use a rule engine to intelligently split the order and determine whether there is a risk of inventory reservation lock contention for the order. The rule engine makes the following judgments based on the information in the business rule library:
[0016] If the order type, product attributes, and store information indicate that the order has a high inventory occupancy risk, and the inventory occupancy risk indicator exceeds a preset threshold, then assign the order to a sequential consumption queue;
[0017] Otherwise, according to the real-time requirements of the order and the current store load situation, intelligently select to assign the order to a parallel consumption queue or a sequential consumption queue;
[0018] 4) Push the overall message of the split order (including information on order addition and inventory reservation operations) to the corresponding consumption queue through the message queue, where the order addition and inventory reservation operations are synchronously executed within the same database transaction to ensure the atomicity and consistency of order data and reserved inventory data;
[0019] 5) After the order addition and inventory reservation operations are successfully submitted, submit the subsequent status transition operations of the order (including payment confirmation, logistics scheduling, order completion, etc.) as asynchronous tasks to the status transition queue for processing;
[0020] 6) The key metrics including message queue length, TPS, and database lock waiting time are collected by the real-time monitoring module, and the monitoring data is fed back to the dynamic rule module. The dynamic rule module automatically adjusts the parameters in the rule engine according to the real-time data to achieve the adaptive optimization of the order diversion strategy.
[0021] This method mainly optimizes the processing of order creation and inventory reservation operations (as an atomic transaction) and subsequent status transitions. By introducing intelligent diversion and dynamic consumption strategies, it ensures that both real-time requirements can be met in high-concurrency scenarios and the problem of reservation lock contention caused by order creation and inventory reservation operations can be avoided.
[0022] Furthermore, the business rule library stores various order diversion rules, including: for reservation operations on the same inventory record, if the concurrent orders exceed a certain threshold, they are automatically assigned to the sequential consumption queue; for orders that are not prone to lock contention or have high real-time requirements, parallel consumption is allowed;
[0023] The business rule library also includes order placement time and historical inventory occupancy statistical data to assist in determining whether an order is in a high-concurrency and high-risk state.
[0024] Furthermore, the rule engine uses preset if-then rules and dynamic thresholds, combined with real-time monitoring data, to make intelligent judgments on the order diversion strategy and achieve automatic switching between sequential consumption and parallel consumption modes;
[0025] Using an if-then structure or rule statements (such as implemented using rule engines like Drools, Easy Rules, etc.), judgments are made based on order attributes (order type, priority, placement time, product information, etc.) and real-time system metrics (queue length, current load, lock waiting time, etc.), and the optimal diversion path is dynamically selected.
[0026] For orders that will cause inventory reservation lock contention (such as multiple orders simultaneously updating the reservation of the same inventory record), they are diverted to a dedicated queue, and a sequential consumption strategy is adopted to ensure that order creation and inventory reservation transactions are submitted in a strict order, thereby reducing lock contention caused by concurrent updates of the same record;
[0027] For orders with high real-time requirements, although the business has strict requirements for response speed, if there is no problem involving lock contention, parallel consumption is allowed to make full use of the system's concurrent processing capabilities;
[0028] For orders with low real-time requirements, the parallel or sequential processing strategy is intelligently selected according to the current queue consumption situation to dynamically balance the processing speed and the risk of lock contention.
[0029] This rule-based intelligent shunting mechanism can not only ensure the atomicity and consistency of order creation and inventory reservation operations, but also flexibly adjust the consumption mode according to specific situations, thereby improving the overall system processing efficiency.
[0030] Meanwhile, an interface is provided for system administrators or automation modules to update and adjust the rules, ensuring that the system can flexibly respond to business changes.
[0031] Furthermore, the real-time monitoring module monitors the queue depth of the message queue, the consumer processing speed, and the database lock waiting time in real time, and feeds the monitoring data back to the dynamic rule module to dynamically adjust the shunting rules and consumption mode parameters.
[0032] Furthermore, the asynchronous state transition operation includes steps such as payment confirmation, logistics scheduling, and order completion, and is processed through an independent state transition queue to reduce the load on the main order processing flow.
[0033] Furthermore, this method also includes an exception handling and intelligent retry mechanism. When exceptions occur in order addition, inventory reservation, or state transition operations, the exception orders are re-pushed to the corresponding queues for compensation processing according to the preset retry strategy, and an alarm is triggered when consecutive retry failures occur.
[0034] Furthermore, the specific process of order processing is as follows:
[0035] S1. Order reception and preprocessing: The system receives various order data from the business middle platform, and after being parsed, data verified, and preliminarily classified by the preprocessing module, it provides basic data for subsequent shunting.
[0036] S2. Intelligent shunting by the rule engine: According to order attributes, order placement regions, product information, and business rules, it is judged whether there is a risk of inventory reservation lock contention for this order; if there is a risk, the order is assigned to the sequential consumption queue to ensure that the reservation operations for the same inventory record are submitted in sequence; otherwise, it is assigned to the parallel consumption queue to meet the real-time requirements.
[0037] S3. Order addition and inventory reservation operations: The shunted order messages enter the message queue, and the consumer executes order addition and inventory reservation operations according to the consumption mode (sequential or parallel). This step is completed within the same transaction to ensure data consistency.
[0038] S4. Asynchronous processing of order state transition: After the order is successfully created, subsequent state transitions (such as payment confirmation, logistics scheduling, etc.) are processed asynchronously without affecting the synchronous submission in the order addition stage.
[0039] S5. Exception Handling and Intelligent Retry: When an exception occurs during the order addition and inventory reservation operations, the system will perform intelligent retries according to preset policies to ensure the correct submission of transactions;
[0040] S6. Real-time Monitoring and Dynamic Rule Adjustment: The system monitors key metrics such as queue length, processing speed, and lock contention in real time and feeds the data back to the rule engine to dynamically adjust the order diversion strategy, ensuring the stability and efficiency of the system in high-concurrency scenarios;
[0041] Among them, the lock contention judgment process includes:
[0042] Order Receiving and Data Reading: The system first receives order data and obtains information on each key field from the business rule library to provide a basis for subsequent judgments;
[0043] Judging Whether It Is Prone to Lock Contention: Determine whether there is a high risk of inventory reservation lock contention for the order by judging the order type (such as orders for popular products, dense orders from the same store);
[0044] Risk Assessment and Queue Allocation: For high-risk orders, further compare whether the inventory occupancy risk indicator exceeds the set threshold. If it exceeds the threshold, directly allocate them to the sequential consumption queue to ensure the orderliness of operations; otherwise, intelligently select the processing mode according to the store load and real-time requirements; for low-risk orders, directly judge whether to use parallel consumption (high real-time) or sequential consumption (low real-time) according to the real-time requirements;
[0045] Outputting the Diversion Result: Output the diversion queue of the order according to the judgment result for use in the subsequent order processing process;
[0046] The real-time monitoring and dynamic rule adjustment process includes:
[0047] The real-time monitoring module continuously collects key system metrics (such as TPS, message queue length, database lock waiting time, etc.) and feeds this data back to the dynamic rule module; the dynamic rule module automatically adjusts relevant thresholds and consumption modes (such as the switch between sequential and parallel consumption) according to the real-time data and updates the parameters of the rule engine; after receiving the updated parameters, the rule engine adjusts the intelligent diversion strategy to achieve closed-loop feedback, so that the entire system always maintains the best operating state in high-concurrency situations.
[0048] The present invention also claims to protect an order processing system based on a message queue, including:
[0049] An order receiving and preprocessing module that receives order data from the business middle platform and preprocesses the order data, and the preprocessing includes data parsing, format verification, and preliminary order classification;
[0050] A rule-based intelligent order diversion module, which is used to intelligently divert orders by using a built-in rule engine after preprocessing;
[0051] A task scheduling and consumption strategy module of a message queue, which is used to push the overall message of the diverted order (including information on order addition and inventory reservation operations) to the corresponding consumption queue through the message queue;
[0052] An asynchronous processing module for order status transition, which is used to submit subsequent status transition operations of the order (including payment confirmation, logistics scheduling, order completion, etc.) as asynchronous tasks to a status transition queue for processing after the order addition and inventory reservation operations are successfully submitted;
[0053] A real-time monitoring and dynamic rule adjustment module, which is used to collect key indicators and feedback the monitoring data to the dynamic rule module. The dynamic rule module automatically adjusts the parameters in the rule engine according to the real-time data to achieve adaptive optimization of the order diversion strategy;
[0054] The system specifically implements order processing through the above method.
[0055] The present invention also claims protection for an order processing device based on a message queue, including: at least one memory and at least one processor;
[0056] The at least one memory is used to store machine-readable programs;
[0057] The at least one processor is used to call the machine-readable program to implement the above method.
[0058] The present invention also claims protection for a computer-readable medium, on which computer instructions are stored, and when the computer instructions are executed by a processor, the above method can be implemented.
[0059] Compared with the prior art, the order processing method and system based on a message queue of the present invention have the following beneficial effects:
[0060] Through the intelligent order diversion method based on a message queue and a rule engine, the present invention realizes the effective separation of order addition and inventory reservation operations (as a transaction whole) from subsequent status transitions. For orders that may cause lock contention, a sequential consumption strategy is adopted, while for other orders, a parallel processing or intelligent allocation method is flexibly adopted. Through such a design, the system ensures the atomicity and data consistency of order addition and inventory reservation operations, and at the same time significantly reduces the risk of database row lock contention caused by concurrent updates of the same inventory record, thereby improving the processing efficiency and system stability in a high-concurrency environment.
[0061] The actual test results show that this solution has significantly improved the order synchronization speed, and the system TPS has doubled. Thus, the present invention not only directly solves the problem of high-concurrency inventory reservation lock contention, but also realizes the efficient utilization of resources and load balancing through intelligent shunting and dynamic scheduling, effectively ensuring the stability and efficiency of the order processing process, which matches and supports the technical problems to be solved by the invention purpose, and achieves the expected technical effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 is a flowchart of an order processing method based on a message queue provided by an embodiment of the present invention;
[0063] Figure 2 is a flowchart of lock contention judgment provided by an embodiment of the present invention;
[0064] Figure 3 is a flowchart of real-time monitoring and dynamic rule adjustment provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0065] The present invention will be further described below in conjunction with specific embodiments.
[0066] The embodiment of the present invention provides an order processing method based on a message queue, and the implementation of this method includes the following steps:
[0067] 1. Receive order data from the business middle platform, and preprocess the order data. The preprocessing includes data parsing, format verification, and preliminary order classification;
[0068] 2. According to the preprocessed order data, read relevant fields including at least order type, order priority, commodity attributes, store information, real-time requirement, and inventory occupation risk index from a preset business rule library, and label the order with data;
[0069] 3. Use a rule engine to intelligently shunt the order, and judge whether there is a risk of inventory reservation lock contention for the order. The rule engine makes the following judgments according to the information in the business rule library:
[0070] If the order type, commodity attributes, and store information indicate that the order has a high inventory occupation risk, and the inventory occupation risk index exceeds a preset threshold, then allocate the order to the sequential consumption queue;
[0071] Otherwise, intelligently select to allocate the order to the parallel consumption queue or the sequential consumption queue according to the real-time requirement of the order and the current store load situation;
[0072] 4. Push the shunted overall order messages (including information on order creation and inventory reservation operations) to the corresponding consumption queues through a message queue. The order creation and inventory reservation operations are synchronously executed within the same database transaction to ensure the atomicity and consistency of order data and reserved inventory data;
[0073] 5. After the order creation and inventory reservation operations are successfully submitted, submit the subsequent status transition operations of the order (including payment confirmation, logistics scheduling, order completion, etc.) as asynchronous tasks to the status transition queue for processing;
[0074] 6. Collect key metrics including message queue length, TPS, and database lock waiting time through a real-time monitoring module, and feedback the monitoring data to the dynamic rule module. The dynamic rule module automatically adjusts the parameters in the rule engine based on the real-time data to achieve adaptive optimization of the order shunting strategy.
[0075] It also includes an exception handling and intelligent retry mechanism. When exceptions occur in order creation, inventory reservation, or status transition operations, the exception orders are re-pushed to the corresponding queues for compensation processing according to the preset retry strategy, and an alarm is triggered when consecutive retry failures occur.
[0076] Among them, the business rule library also includes the order placement time and historical inventory occupancy statistical data to assist in judging whether the order is in a high-concurrency and high-risk state.
[0077] The rule engine uses preset if-then rules and dynamic thresholds, and combines real-time monitoring data to make intelligent judgments on the order shunting strategy, realizing automatic switching between sequential consumption and parallel consumption modes.
[0078] The real-time monitoring module monitors the queue depth of the message queue, the consumer processing speed, and the database lock waiting time in real time, and feeds the monitoring data back to the dynamic rule module to dynamically adjust the shunting rules and consumption mode parameters.
[0079] The asynchronous status transition operations include steps such as payment confirmation, logistics scheduling, and order completion, and are processed through an independent status transition queue to reduce the load on the main order processing flow.
[0080] This method mainly optimizes the processing of order creation and inventory reservation operations (as an atomic transaction) and subsequent status transitions. By introducing intelligent shunting and dynamic consumption strategies, it ensures that both real-time requirements can be met in high-concurrency scenarios and the problem of reserved lock contention caused by order creation and inventory reservation operations can be avoided. The specific implementation process is as follows:
[0081] 1. Order reception and preprocessing:
[0082] The system first receives various order data from the business middle platform. The order types include purchase orders (self - pick - up, delivery), general orders, cloud purchase orders, and activity orders. The received orders first enter the pre - processing module, where data parsing, format verification, and integrity verification are performed, and preliminary classification is carried out according to key attributes such as the order placement area, product information, and order type. This stage aims to provide accurate order basic data for subsequent intelligent diversion.
[0083] The pre - processing module performs the following operations:
[0084] Data parsing and format verification: Parse the format of the order data, verify the integrity and legality of each field (such as order number, user information, product information, order placement time, store information, etc.) to ensure data quality.
[0085] Preliminary order classification: Perform preliminary classification according to information such as order type, order placement area, and product attributes to provide basic data for subsequent intelligent diversion.
[0086] Data tagging: For each order, the system reads relevant fields from the business rule library, including order type, order priority, product attributes, store information, real - time requirement, and historical inventory occupancy risk indicators, and performs data tagging to identify which orders may cause inventory reservation lock contention.
[0087] 2. Rule - based intelligent order diversion:
[0088] After pre - processing, the system uses a built - in rule engine to perform intelligent diversion on the orders. The order data together with the tagging information enters the rule engine module. The rule engine reads the preset business rule library, and based on the preset business rules (such as order priority, order placement time, product attributes, store allocation logic, etc.), dynamically determines the best processing path for each order. Specifically, it includes the following:
[0089] (1) Business rule library: Stores various order diversion rules. For example, for the reservation operation of the same inventory record, if the concurrent orders exceed a certain threshold, they are automatically assigned to the sequential consumption queue; for orders that are not likely to cause lock contention or have high real - time requirements, parallel consumption is allowed.
[0090] (2) Decision logic: Adopts an if - then structure or rule statements (such as implemented using rule engines like Drools, Easy Rules, etc.), makes judgments based on order attributes (order type, priority, order placement time, product information, etc.) and real - time system metrics (queue length, current load, lock waiting time, etc.), and dynamically selects the optimal diversion path.
[0091] (3) Interface and Extension: Provide interfaces for system administrators or automation modules to update and adjust rules, ensuring that the system can flexibly respond to business changes.
[0092] It should be noted that the order addition and inventory reservation operations are executed within the same transaction, constituting the overall operation of order creation.
[0093] For orders that may cause inventory reservation lock contention (such as multiple orders simultaneously updating the reservation of the same inventory record), the system will divert them to a dedicated queue and adopt a sequential consumption strategy to ensure that the order addition and inventory reservation transactions are submitted in a strict order, thereby reducing lock contention caused by concurrent updates of the same record.
[0094] For orders with high real-time requirements, although the business has strict requirements for response speed, if there is no problem causing lock contention, parallel consumption can be allowed to fully utilize the system's concurrent processing capabilities.
[0095] For orders with low real-time requirements, the system can intelligently select a parallel or sequential processing strategy based on the current queue consumption situation to dynamically balance the processing speed and the risk of lock contention.
[0096] This rule-based intelligent diversion mechanism can not only ensure the atomicity and consistency of order creation and inventory reservation operations, but also flexibly adjust the consumption mode according to specific situations, thereby improving the overall system processing efficiency.
[0097] The business rule library includes the following key fields and corresponding judgment logics:
[0098] Order type: Determine whether the order belongs to a purchase order, ordinary order, cloud purchase order, or activity order, and identify whether there are risk factors under high concurrency.
[0099] Order priority and order placement time: Determine whether the order is during the peak period and whether the order priority is high.
[0100] Commodity attributes: Identify popular commodities or commodities with tight inventory. Such orders are prone to concurrent reservations of the same inventory record.
[0101] Store information: Analyze the order density of the same store. If the order volume of the store is large, the orders of this store are more likely to have lock contention.
[0102] Real-time requirement: Determine the requirement of the order for processing timeliness and decide whether parallel consumption is allowed.
[0103] Inventory occupancy risk indicator: Evaluate the inventory reservation risk that the order may cause based on historical data statistics and real-time monitoring data.
[0104] Based on the above fields, the rules engine makes intelligent judgments through decision-making logic:
[0105] If comprehensive judgments such as order type, product attributes, and store information indicate that there is a high risk of inventory reservation for this order, and the inventory occupancy risk indicator exceeds the preset threshold, the system will allocate this order to the sequential consumption queue to ensure that order creation and inventory reservation operations are submitted in a strictly sequential order within the same transaction, avoiding row lock contention caused by concurrent updates to the same inventory record.
[0106] For orders with low risk and high real-time requirements, the rules engine will allocate them to the parallel consumption queue to make full use of multi-threaded or distributed consumption nodes for fast processing.
[0107] For orders with general real-time requirements, the system intelligently selects parallel or sequential consumption modes based on the current queue load and store conditions to achieve load balancing.
[0108] 3. Task scheduling and consumption strategies of the message queue:
[0109] The overall order messages after shunting (including order creation and inventory reservation information) will be pushed to the corresponding message queues and then pushed to their respective consumption queues through message queues (such as Kafka, RabbitMQ, or Redis queues). The message queue plays the role of peak shaving, valley filling, task scheduling, and load balancing at this stage.
[0110] For orders that may cause inventory reservation lock contention, the queue adopts the sequential consumption mode to ensure that reservation operations for the same store or the same product are carried out in sequence, thus avoiding multiple consumers from concurrently operating on the same record.
[0111] For other orders, the system supports parallel consumption, making full use of multi-threaded or distributed consumption nodes for high-concurrency processing; at the same time, the system also supports dynamically adjusting the consumption mode according to the real-time load status and queue depth, choosing parallel or sequential modes to achieve the optimal processing effect.
[0112] The scheduling parameters attached to the messages (such as order priority, consumption timeout, retry times, etc.) provide a basis for consumers to ensure the stable operation of the system in a high-concurrency environment.
[0113] The characteristics of the message queue include:
[0114] Sequential consumption: For orders allocated to the sequential consumption queue, consumers process them in strict sequence to ensure that there are no concurrent conflicts in the reservation updates of the same inventory record, thus reducing the risk of row lock contention.
[0115] Parallel Consumption: For orders assigned to the parallel consumption queue, consumer nodes support parallel processing, which improves processing speed and meets real-time requirements. The system also supports dynamically adjusting the consumption mode according to the real-time load.
[0116] At this stage, both the order creation and inventory reservation operations are completed within the same database transaction to ensure the atomicity and consistency of order data and reserved inventory data.
[0117] 4. Asynchronous Processing of Single Status Transition:
[0118] After the order creation and inventory reservation operations (as a whole) are successfully submitted, the order enters the subsequent status transition stage. This stage includes subsequent operations such as payment confirmation, logistics scheduling, and order completion. To avoid affecting the real-time performance of the order creation process and database pressure, these operations are all processed asynchronously through an independent status transition queue, decoupled from the order creation operation, and reducing the pressure on the main process. Asynchronous processing can not only improve the overall processing throughput, make full use of the system's parallel capabilities, but also make each link independent, reduce the interference of subsequent processing on the main transaction, facilitate subsequent exception handling and business expansion, and improve the overall throughput.
[0119] 5. Exception Handling and Intelligent Retry Mechanism:
[0120] During the entire order processing process, whether it is the order creation and inventory reservation stage or the subsequent status transition stage, if network fluctuations, concurrent conflicts, or other abnormal situations occur, the system will capture the exceptions and record detailed logs. For the order creation and inventory reservation stage, since the operations are executed within the same transaction, if an exception occurs, it will be automatically rolled back to ensure data consistency; the system will, according to the preset retry strategy, re-push the failed orders into the queue for compensation processing. For the status transition link, the system also adopts an intelligent retry mechanism. According to the preset retry strategy (combining the reason for failure and the number of retries), the abnormal tasks are re-put into the queue for compensation processing. According to the type of exception and the number of retries, the retry interval is dynamically adjusted. Continuous retry failures will trigger an alarm mechanism to facilitate timely manual intervention.
[0121] 6. Real-time Monitoring and Dynamic Rule Adjustment:
[0122] The system is built with a real-time monitoring module to monitor key indicators such as the length of the message queue, the processing speed of consumers, the execution of transactions, and the database lock waiting time. Specifically, it includes:
[0123] (1) Load Threshold: According to the data such as the queue depth, TPS (Transactions Per Second), and lock waiting time monitored in real time, dynamically adjust the threshold for order shunting. For example, when it is detected that the lock waiting time of a certain inventory record continues to be high, automatically increase the sequential consumption priority of this order type.
[0124] (2) Consumption mode switching: Dynamically switch between parallel consumption and sequential consumption according to the current system load and response latency, ensuring both real-time performance and avoiding concurrent update conflicts.
[0125] (3) Adaptive adjustment: Using historical data and real-time feedback, the system can automatically adjust the parameters of decision rules, such as reducing the maximum concurrency of parallel processing or extending the retry interval, to optimize the overall processing performance and stability.
[0126] (4) Feedback closed-loop: After the monitoring module collects key metrics in real-time, the dynamic rules module feeds this data back to the rule engine, enabling it to continuously adjust and optimize the order diversion strategy, achieving system self-regulation and continuous optimization.
[0127] The monitoring data is fed back to the rule engine in real-time, and the rule engine dynamically adjusts the order diversion rules and consumption strategies based on this data. For example, when it detects a serious lock contention situation in the inventory reservation operation for a certain type of order, the system can temporarily increase the sequential consumption priority of this type of order; while in low-load situations, parallel consumption can be allowed to improve the response speed. The dynamic adjustment mechanism ensures that the system always maintains optimal performance in different scenarios.
[0128] The dynamic rules module implements the following functions:
[0129] Dynamic threshold adjustment: Automatically adjust key parameters such as the inventory occupancy risk threshold and the maximum concurrency of parallel consumption according to real-time monitoring data.
[0130] Consumption mode switching: When a high lock contention time is detected in the inventory reservation operation for a specific order or store, the system can temporarily switch the consumption mode of this type of order from parallel to sequential consumption; conversely, parallel processing is allowed in low-load situations to meet real-time requirements.
[0131] Rule parameter update: Feed the results of dynamic rule adjustment back to the rule engine, enabling it to use the updated parameters in subsequent order diversion, achieving closed-loop feedback and adaptive optimization.
[0132] This method, through an intelligent order diversion method based on a message queue, treats the order addition and inventory reservation operations as a whole and consumes them sequentially or in parallel within the same transaction, and intelligently selects the consumption mode according to the order type and lock contention risk; at the same time, the subsequent order status transition adopts asynchronous processing to effectively disperse the concurrent pressure. The system, with the help of the rule engine and real-time monitoring, realizes dynamic scheduling and intelligent retry, significantly reducing the risk of database row lock contention, improving the order processing efficiency and system stability in a high-concurrency environment, and providing a flexible, efficient, and scalable order processing solution.
[0133] As Figure 1 shown, the specific process of order processing is as follows:
[0134] S1. Order Receiving and Preprocessing: The system receives various order data from the business middleware, and through the preprocessing module, it performs parsing, data verification, and preliminary classification to provide basic data for subsequent shunting.
[0135] S2. Intelligent Shunting by Rule Engine: According to order attributes, order placement regions, product information, and business rules, determine whether there is a risk of inventory reservation lock contention for this order; if there is a risk, assign the order to the sequential consumption queue to ensure that reservation operations for the same inventory record are submitted in sequence; otherwise, assign it to the parallel consumption queue to meet real-time requirements.
[0136] S3. Order Creation and Inventory Reservation Operations: The shunted order messages enter the message queue, and consumers perform order creation and inventory reservation operations according to the consumption mode (sequential or parallel). This step is completed within the same transaction to ensure data consistency.
[0137] S4. Asynchronous Processing of Order Status Transitions: After the order is successfully created, subsequent status transitions (such as payment confirmation, logistics scheduling, etc.) are processed asynchronously without affecting the synchronous submission in the order creation stage.
[0138] S5. Exception Handling and Intelligent Retry: When an exception occurs during order creation and inventory reservation operations, the system will perform intelligent retry according to the preset strategy to ensure the correct submission of the transaction.
[0139] S6. Real-time Monitoring and Dynamic Rule Adjustment: The system monitors key metrics such as queue length, processing speed, and lock contention in real time, and feeds the data back to the rule engine to dynamically adjust the order shunting strategy to ensure the stability and efficiency of the system in high-concurrency scenarios.
[0140] As Figure 2 shown, the lock contention judgment process includes:
[0141] Order Receiving and Data Reading: The system first receives the order data and obtains the information of each key field from the business rule library to provide a basis for subsequent judgment.
[0142] Judgment of Whether It Is Prone to Lock Contention: Determine whether there is a high risk of inventory reservation lock contention for this order by judging the order type (such as orders for popular products, dense orders from the same store).
[0143] Risk assessment and queue allocation: For high-risk orders, further compare whether the inventory occupancy risk indicator exceeds the set threshold. If it exceeds the threshold, directly allocate them to the sequential consumption queue to ensure the order of operations; otherwise, intelligently select the processing mode according to the store load and real-time requirements; For low-risk orders, directly determine whether to use parallel consumption (high real-time) or sequential consumption (low real-time) based on real-time requirements;
[0144] Output the shunting result: Output the shunting queue of the order according to the judgment result for use in the subsequent order processing flow;
[0145] As Figure 3 shown, the real-time monitoring and dynamic rule adjustment process includes:
[0146] The real-time monitoring module continuously collects key system indicators (such as TPS, message queue length, database lock waiting time, etc.) and feeds this data back to the dynamic rule module; The dynamic rule module automatically adjusts relevant thresholds and consumption modes (such as the switch between sequential or parallel consumption) based on real-time data and updates the parameters of the rule engine; After receiving the updated parameters, the rule engine adjusts the intelligent shunting strategy to achieve closed-loop feedback, so that the entire system always maintains the best operating state under high concurrency.
[0147] This embodiment realizes the whole process from order reception, preprocessing, intelligent shunting, message queue task scheduling, to the synchronous processing of order addition and inventory reservation, and then to the asynchronous processing of subsequent order status transitions through the intelligent order shunting method based on message queue and rule engine. The system uses various key fields (order type, priority, commodity attributes, store information, real-time requirements, and inventory occupancy risk indicators) in the business rule library to intelligently judge the order shunting strategy, and at the same time combines real-time monitoring data for dynamic rule adjustment, effectively reducing the risk of database row lock contention in high-concurrency scenarios and ensuring the atomicity and data consistency of order addition and inventory reservation operations. Actual tests show that after adopting this embodiment, the order synchronization speed has been significantly improved, and the system TPS has doubled, fully verifying the technical effects and application advantages of the present invention in high-concurrency order processing.
[0148] The embodiment of the present invention also provides an order processing system based on a message queue, and this system realizes order processing through the order processing method based on a message queue described in the above embodiment.
[0149] The system includes:
[0150] 1. An order reception and preprocessing module, which receives order data from the business middle platform and preprocesses the order data. The preprocessing includes data parsing, format verification, and preliminary order classification.
[0151] The system first receives various order data from the business middle platform. The order types include purchase orders (self-pickup, delivery), general orders, cloud purchase orders, and activity orders. The received orders first enter the preprocessing module, where data parsing, format verification, and integrity verification are performed, and preliminary classification is carried out according to key attributes such as the order placement area, product information, and order type. This stage aims to provide accurate order basic data for subsequent intelligent diversion.
[0152] The preprocessing module performs the following operations:
[0153] Data parsing and format verification: Parse the format of the order data, verify the integrity and legality of each field (such as order number, user information, product information, order time, store information, etc.) to ensure data quality.
[0154] Preliminary order classification: Perform preliminary classification according to information such as order type, order placement area, and product attributes to provide basic data for subsequent intelligent diversion.
[0155] Data tagging: For each order, the system reads relevant fields from the business rule library, including order type, order priority, product attributes, store information, real-time requirement, and historical inventory occupancy risk indicators, and performs data tagging to identify which orders may cause inventory reservation lock contention.
[0156] 2. The rule-based intelligent order diversion module is used to perform intelligent diversion of orders using the built-in rule engine after preprocessing.
[0157] After preprocessing, the system performs intelligent diversion of orders using the built-in rule engine. The order data together with the tagging information enters the rule engine module. The rule engine reads the preset business rule library, and based on the preset business rules (such as order priority, order time, product attributes, store allocation logic, etc.), dynamically determines the best processing path for each order. The specific contents include the following:
[0158] (1) Business rule library: Stores various order diversion rules. For example, for the reservation operation of the same inventory record, if the concurrent orders exceed a certain threshold, they are automatically assigned to the sequential consumption queue; for orders that are not likely to cause lock contention or have high real-time requirements, parallel consumption is allowed.
[0159] (2) Decision logic: Adopts an if-then structure or rule statements (such as implemented using rule engines like Drools, Easy Rules, etc.), makes judgments based on order attributes (order type, priority, order time, product information, etc.) and real-time system metrics (queue length, current load, lock waiting time, etc.), and dynamically selects the optimal diversion path.
[0160] (3) Interfaces and Extensions: Provide interfaces for system administrators or automation modules to update and adjust rules, ensuring that the system can flexibly respond to business changes.
[0161] It should be noted that the order creation and inventory reservation operations are executed within the same transaction, constituting the overall operation of order creation.
[0162] For orders that may cause inventory reservation lock contention (such as multiple orders simultaneously updating the reservation of the same inventory record), the system will divert them to a dedicated queue and adopt a sequential consumption strategy to ensure that the order creation and inventory reservation transactions are submitted in a strict sequence, thereby reducing lock contention caused by concurrent updates to the same record.
[0163] For orders with high real-time requirements, although the business has strict requirements for response speed, if there are no issues causing lock contention, parallel consumption can be allowed to fully utilize the system's concurrent processing capabilities.
[0164] For orders with lower real-time requirements, the system can intelligently select a parallel or sequential processing strategy based on the current queue consumption situation to dynamically balance the processing speed and the risk of lock contention.
[0165] This rule-based intelligent diversion mechanism can not only ensure the atomicity and consistency of order creation and inventory reservation operations, but also flexibly adjust the consumption mode according to specific situations, thereby improving the overall system processing efficiency.
[0166] The business rule library includes the following key fields and corresponding judgment logics:
[0167] Order type: Determine whether the order belongs to a purchase order, ordinary order, cloud purchase order, or activity order, and identify whether there are risk factors under high concurrency.
[0168] Order priority and order placement time: Determine whether the order is during a peak period and whether the order priority is high.
[0169] Commodity attributes: Identify popular commodities or commodities with tight inventory. Such orders are prone to concurrent reservations of the same inventory record.
[0170] Store information: Analyze the order density of the same store. If the order volume of the store is large, orders from that store are more likely to have lock contention.
[0171] Real-time requirements: Determine the order's requirement for processing timeliness and decide whether parallel consumption is allowed.
[0172] Inventory occupancy risk indicator: Evaluate the inventory reservation risk that the order may cause based on historical data statistics and real-time monitoring data.
[0173] Based on the above fields, the rules engine makes intelligent judgments through decision-making logic.
[0174] 3. The task scheduling and consumption strategy module of the message queue is used to push the overall shunted order messages (including information on order creation and inventory reservation operations) to the corresponding consumption queues through the message queue.
[0175] The overall shunted order messages (including order creation and inventory reservation information) will be pushed to the corresponding message queues and then to their respective consumption queues through the message queue (such as Kafka, RabbitMQ, or Redis queue). The message queue plays the role of peak shaving, valley filling, task scheduling, and load balancing at this stage.
[0176] For orders that may cause contention for inventory reservation locks, the queue adopts a sequential consumption mode to ensure that reservation operations for the same store or the same product are carried out sequentially, thus avoiding concurrent operations on the same record by multiple consumers.
[0177] For other orders, the system supports parallel consumption, making full use of multi-threading or distributed consumption nodes to achieve high-concurrency processing; at the same time, the system also supports dynamically adjusting the consumption mode according to the real-time load status and queue depth, choosing parallel or sequential mode to achieve the best processing effect.
[0178] The scheduling parameters attached to the messages (such as order priority, consumption timeout, retry times, etc.) provide a basis for consumers to ensure the stable operation of the system in a high-concurrency environment.
[0179] The characteristics of the message queue include:
[0180] Sequential consumption: For orders assigned to the sequential consumption queue, consumers process them strictly in order to ensure that there are no concurrent conflicts in the reservation update of the same inventory record, thus reducing the risk of row lock contention.
[0181] Parallel consumption: For orders assigned to the parallel consumption queue, consumer nodes support parallel processing to improve processing speed and meet real-time requirements. The system also supports dynamically adjusting the consumption mode according to the real-time load.
[0182] In this module, both order creation and inventory reservation operations are completed within the same database transaction to ensure the atomicity and consistency of order data and reserved inventory data.
[0183] 4. The asynchronous processing module for order status transition is used to submit subsequent order status transition operations (including payment confirmation, logistics scheduling, order completion, etc.) as asynchronous tasks to the status transition queue for processing after the order creation and inventory reservation operations are successfully submitted.
[0184] After the successful submission of the order creation and inventory reservation operations (as a whole), the order enters the subsequent status transition phase. This phase includes subsequent operations such as payment confirmation, logistics scheduling, and order completion. To avoid affecting the real-time performance of the order creation process and database pressure, these operations are all processed asynchronously through an independent status transition queue, decoupled from the order creation operation, and reducing the pressure on the main process. Asynchronous processing can not only improve the overall processing throughput and make full use of the system's parallel capabilities, but also make each link independent, reduce the interference of subsequent processing on the main transaction, facilitate subsequent exception handling and business expansion, and improve the overall throughput.
[0185] 5. Exception Handling and Intelligent Retry Module
[0186] During the entire order processing process, whether it is the order creation and inventory reservation stage or the subsequent status transition stage, if network fluctuations, concurrent conflicts, or other abnormal situations occur, the system will capture the exceptions and record detailed logs. For the order creation and inventory reservation stage, since the operations are executed in the same transaction, if an exception occurs, it will be automatically rolled back to ensure data consistency; the system will re-push the failed order into the queue for compensation processing according to the preset retry policy. For the status transition link, the system also adopts an intelligent retry mechanism. According to the preset retry policy (combining the reason for failure and the number of retries), the abnormal task will be re-put into the queue for compensation processing. According to the exception type and the number of retries, the retry interval will be dynamically adjusted. Continuous retry failures will trigger an alarm mechanism to facilitate timely manual intervention.
[0187] 6. Real-time Monitoring and Dynamic Rule Adjustment Module, which is used to collect key metrics and feedback the monitoring data to the dynamic rule module. The dynamic rule module automatically adjusts the parameters in the rule engine according to the real-time data to achieve adaptive optimization of the order shunting strategy.
[0188] The system is built with a real-time monitoring module to monitor key metrics such as the message queue length, consumer processing speed, transaction execution status, and database lock waiting time. Specifically, it includes:
[0189] (1) Load Threshold: Dynamically adjust the threshold of order shunting according to the real-time monitored data such as queue depth, TPS (Transactions Per Second), and lock waiting time. For example, when it is detected that the lock waiting time of a certain inventory record is continuously high, automatically increase the sequential consumption priority of this order type.
[0190] (2) Consumption Mode Switching: Dynamically switch between parallel consumption and sequential consumption according to the current system load and response latency, ensuring both real-time performance and avoiding concurrent update conflicts.
[0191] (3) Adaptive adjustment: By leveraging historical data and real-time feedback, the system can automatically adjust the parameters of decision rules, such as reducing the maximum concurrency of parallel processing or extending the retry interval, to optimize the overall processing performance and stability.
[0192] (4) Feedback closed-loop: After the monitoring module collects key metrics in real time, the dynamic rules module feeds this data back to the rule engine, enabling it to continuously adjust and optimize the order diversion strategy, achieving self-regulation and continuous optimization of the system.
[0193] The monitoring data is fed back to the rule engine in real time, and the rule engine dynamically adjusts the order diversion rules and consumption strategies based on this data. For example, when it is detected that there is a serious lock competition in the inventory reservation operation for a certain type of order, the system can temporarily increase the sequential consumption priority of this type of order; while in low-load situations, parallel consumption is allowed to improve the response speed. The dynamic adjustment mechanism ensures that the system always maintains optimal performance in different scenarios.
[0194] The dynamic rules module implements the following functions:
[0195] Dynamic threshold adjustment: Automatically adjusts key parameters such as the inventory occupancy risk threshold and the maximum concurrency of parallel consumption based on real-time monitoring data.
[0196] Consumption mode switching: When it is detected that there is a high lock contention in the inventory reservation operation for a specific order or store, the system can temporarily switch the consumption mode of this type of order from parallel to sequential consumption; conversely, parallel processing is allowed in low-load situations to meet real-time requirements.
[0197] Rule parameter update: Feeds the results of dynamic rule adjustments back to the rule engine, enabling it to use the updated parameters in subsequent order diversion, achieving closed-loop feedback and adaptive optimization.
[0198] An embodiment of the present invention also provides an order processing device based on a message queue, including: at least one memory and at least one processor;
[0199] The at least one memory is used to store machine-readable programs;
[0200] The at least one processor is used to call the machine-readable program to implement the order processing method based on the message queue described in the above embodiment.
[0201] An embodiment of the present invention also provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor is caused to execute the order processing method based on a message queue described in the above embodiment. Specifically, a system or device equipped with a storage medium can be provided, on which software program code for implementing the functions of any one of the above embodiments is stored, and the computer (or CPU or MPU) of the system or device is caused to read and execute the program code stored in the storage medium.
[0202] In this case, the program code read from the storage medium itself can implement the functions of any one of the above embodiments. Therefore, the program code and the storage medium storing the program code constitute a part of the present invention.
[0203] Examples of the storage medium for providing the program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code can be downloaded from a server computer via a communication network.
[0204] In addition, it should be clear that not only can the functions of any one of the above embodiments be realized by executing the program code read by the computer, but also by causing an operating system or the like operating on the computer based on the instructions of the program code to complete part or all of the actual operations.
[0205] In addition, it can be understood that the program code read from the storage medium is written into a memory provided in an expansion board inserted into the computer or into a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, the CPU or the like installed on the expansion board or the expansion unit is caused to execute part and all of the actual operations, thereby realizing the functions of any one of the above embodiments.
[0206] The present invention has been described in detail above with reference to the drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above-mentioned multiple embodiments, those skilled in the art can know that the code review means in different above embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the protection scope of the present invention.
Claims
1. An order processing method based on a message queue, characterized in that: The implementation of this method includes the following steps: 1) Receive order data from the business middle station and pre-process the order data, including data analysis, format verification and preliminary order classification; 2) Based on the pre-processed order data, read relevant fields including at least order type, order priority, product attributes, store information, real-time requirements, and inventory occupancy risk indicators from the preset business rule library, and mark the order data; 3) Using the rule engine to intelligently divert the orders and determine whether the orders have the risk of causing contention for the inventory reservation lock. The rule engine makes the following determinations based on the information in the business rule library: If the order type, product attributes and store information indicate that the order has a high inventory occupancy risk, and the inventory occupancy risk index exceeds a preset threshold, the order is assigned to a sequential consumption queue; Otherwise, the order is intelligently assigned to a parallel consumption queue or a sequential consumption queue based on the real-time requirements of the order and the current store load. 4) Pushing the diverted order message to the corresponding consumption queue through the message queue, wherein the order addition and inventory reservation operations are synchronously executed in the same database transaction to ensure the atomicity and consistency of the order data and the reserved inventory data; 5) After the order addition and inventory reservation operations are successfully submitted, the subsequent state transfer operations of the order are submitted as asynchronous tasks to the state transfer queue for processing; 6) The real-time monitoring module collects key indicators including message queue length, TPS, and database lock waiting time, and feeds the monitoring data back to the dynamic rule module. The dynamic rule module automatically adjusts the parameters in the rule engine according to the real-time data to achieve adaptive optimization of the order diversion strategy.
2. The order processing method based on message queue according to claim 1, characterized in that: The business rule library stores various order diversion rules, including: for the reservation operation of the same inventory record, if the concurrent orders exceed a certain threshold, they are automatically allocated to the sequential consumption queue; for orders that are not prone to lock contention or have high real-time requirements, parallel consumption is allowed; The business rule library also includes order placement time and historical inventory occupancy statistics to assist in determining whether an order is in a high-concurrency and high-risk state.
3. An order processing method based on a message queue according to claim 1 or 2, characterized in that: The rule engine uses preset if-then rules and dynamic thresholds, combined with real-time monitoring data to make intelligent judgments on the order diversion strategy, and realize automatic switching between sequential consumption and parallel consumption modes; Adopt if-then structure or rule statement, make judgments based on order attributes and real-time system indicators, and dynamically select the optimal diversion path.
4. The order processing method based on message queue according to claim 1, characterized in that: The real-time monitoring module monitors the queue depth, consumer processing speed and database lock waiting time of the message queue in real time, and feeds the monitoring data back to the dynamic rule module to dynamically adjust the diversion rules and consumption mode parameters.
5. The order processing method based on message queue according to claim 1, characterized in that: The asynchronous state transfer operation includes payment confirmation, logistics scheduling and order completion steps, and is processed through an independent state transfer queue to reduce the load of the main order processing process.
6. The order processing method based on message queue according to claim 1, characterized in that: It also includes exception handling and intelligent retry mechanisms. When an exception occurs in order addition, inventory reservation or status transfer operations, the abnormal order will be pushed back to the corresponding queue for compensation processing according to the preset retry strategy, and an alarm will be triggered when continuous retries fail.
7. The order processing method based on message queue according to claim 1, characterized in that: The specific process of order processing is as follows: S1. Order reception and preprocessing: The system receives various order data from the business platform, and performs parsing, data verification and preliminary classification through the preprocessing module to provide basic data for subsequent diversion; S2. Intelligent diversion by rule engine: Based on order attributes, ordering area, product information and business rules, determine whether the order has the risk of causing contention for inventory reservation locks; if there is a risk, assign the order to a sequential consumption queue to ensure that reservation operations for the same inventory record are submitted in order; Otherwise, it is assigned to the parallel consumption queue to meet the real-time requirements; S3, order addition and inventory reservation operations: The diverted order messages enter the message queue, and consumers perform order addition and inventory reservation operations based on the consumption mode. This step is completed in the same transaction to ensure data consistency; S4. Asynchronous processing of order status flow: After the order is successfully created, the subsequent status flow is processed asynchronously, which does not affect the synchronous submission of the order addition stage; S5. Exception handling and intelligent retry: When an exception occurs during order addition and inventory reservation operations, the system will perform intelligent retries based on the preset strategy to ensure that the transaction is submitted correctly; S6. Real-time monitoring and dynamic rule adjustment: The system monitors key indicators such as queue length, processing speed, lock contention, etc. in real time, and feeds the data back to the rule engine to dynamically adjust the order diversion strategy to ensure the stability and efficiency of the system in high-concurrency scenarios; The lock contention judgment process includes: Order receiving and data reading: The system first receives the order data and obtains the key field information from the business rule library to provide a basis for subsequent judgment; Determine whether lock contention is likely to occur: Determine whether the order has a high risk of inventory reservation lock contention by judging the order type; Risk assessment and queue allocation: For high-risk orders, we further compare whether the inventory occupancy risk index exceeds the set threshold. If it exceeds the threshold, it will be directly allocated to the sequential consumption queue to ensure the order of operation; otherwise, we intelligently select the processing mode based on the store load and real-time requirements; for low-risk orders, we directly determine whether to use parallel consumption or sequential consumption based on real-time requirements; Output diversion results: Output the diversion queue of the order according to the judgment results for use in subsequent order processing processes; The real-time monitoring and dynamic rule adjustment process includes: The real-time monitoring module continuously collects key system indicators and feeds this data back to the dynamic rule module; the dynamic rule module automatically adjusts relevant thresholds and consumption patterns based on real-time data, and updates the parameters of the rule engine; after receiving the updated parameters, the rule engine adjusts the intelligent diversion strategy to achieve closed-loop feedback, so that the entire system always maintains the best operating state under high concurrency conditions.
8. An order processing system based on a message queue, characterized in that: include: The order receiving and preprocessing module receives order data from the business middle station and preprocesses the order data, including data parsing, format verification and preliminary order classification; A rule-based intelligent order diversion module, which is used to intelligently divert orders using a built-in rule engine after pre-processing; The task scheduling and consumption strategy module of the message queue is used to push the diverted order overall message to the corresponding consumption queue through the message queue; An asynchronous processing module for order status transfer, which is used to submit subsequent order status transfer operations as asynchronous tasks to the status transfer queue for processing after the order addition and inventory reservation operations are successfully submitted; Real-time monitoring and dynamic rule adjustment module, which is used to collect key indicators and feed the monitoring data back to the dynamic rule module. The dynamic rule module automatically adjusts the parameters in the rule engine according to the real-time data to achieve adaptive optimization of the order diversion strategy; The system specifically implements order processing through the method described in any one of claims 1 to 7.
9. An order processing device based on a message queue, characterized in that: include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is used to call the machine-readable program to implement the method described in any one of claims 1 to 7.
10. A computer-readable medium, characterized in that The computer readable medium stores computer instructions, which, when executed by a processor, can implement the method described in any one of claims 1 to 7.
Citation Information
Cited By
Cross-border e-commerce settlement declaration processing method, electronic equipment and computer readable medium
CN120430788A
Big data-based integral shopping mall order rolling processing optimization method and system
CN120996870A
API data interaction processing method of cake electronic coupon API docking system
CN121560897A