An industrial design software based on redis and mq asynchronous batch data generation method
By using Redis and MQ for asynchronous batch data processing, the problem of incomplete downstream data after the master data is added in industrial design software was solved, realizing rapid data generation and integrity, and improving system availability and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-28
- Publication Date
- 2026-03-17
AI Technical Summary
In industrial design software, when users add or modify master data, and downstream data has not yet been generated, inconsistencies in data operations can occur, resulting in dirty data.
A combination of Redis caching and MQ message queues is used to asynchronously process batch data transfers. Data identifiers are created in Redis and stored in MQ. The background server pulls and executes sub-functions until all sub-functions are completed and the Redis identifiers are deleted.
It improves data processing efficiency, ensures data integrity, avoids dirty data issues while users wait for downstream data generation, and enhances system availability and user experience.
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial software, and more particularly to a method for industrial design software to asynchronously generate batch data based on Redis and message queue. Background Technology
[0002] Industrial design involves a lot of business logic. In industrial software, there are often many interdependencies between the various steps. When configuring business processes with a lot of related data, such as batch assignment of tasks or batch generation of multiple business data, a large amount of data is often generated. In order to provide a better user experience, a data list is returned after the user adds or modifies the master data. However, the downstream data corresponding to the operation in the data list is often not yet generated. If the downstream data button is clicked to enter the page at this time, the data is not complete, and the user's data modification is likely to generate dirty data. Summary of the Invention
[0003] The purpose of this invention is to address the shortcomings of existing technologies by proposing a method for industrial design software to asynchronously generate batch data based on Redis and message queues.
[0004] To achieve the above objectives, the present invention adopts the following technical solution: a method for industrial design software to asynchronously generate batch data based on Redis and message queue, comprising the following steps:
[0005] S1, users add master data in the system, and multiple master data are combined to form a list of master data;
[0006] Master data is the part that users fill in on the system page. It is the source of batch data generated from the basic information of the master data, such as product name, model, size, specifications, and time.
[0007] List master data is a collection of master data;
[0008] S2 handles data transfer on the backend server;
[0009] S2-1, After the master data is added, create the master data identifier in the cached Redis;
[0010] Redis (Remote Dictionary Server) is an open-source, network-enabled, in-memory or persistent, log-structured, key-value database written in ANSI C, and provides APIs for multiple languages.
[0011] S2-2, After the identifier is created, the master data is stored in the message queue (MQ);
[0012] Message Queues (MQ) are a type of "First-In, First-Out" (FIFO) data structure in basic data structures. They are generally used to solve problems such as application decoupling, asynchronous messaging, and traffic shaping, and to achieve high-performance, highly available, scalable, and eventually consistent architectures.
[0013] S3-1, The backend server actively pulls data for the corresponding category from the message queue (MQ);
[0014] S3-2: After the backend server retrieves the corresponding data, it asynchronously executes the batch addition function of each sub-function. After each sub-function is completed, it adds its own flag to the cache Redis.
[0015] S3-3: Read the number of sub-functions that have been stored in the Redis cache as the main data of the list; the last sub-function deletes the identifier in the Redis cache.
[0016] S3-4, when the cached identifier information cannot be obtained from the main list data, it means that the entire data has been added.
[0017] Preferably, the identifier of the master data refers to the unique primary key ID of the data.
[0018] Preferably, the backend server is a web server.
[0019] Preferably, the categories corresponding to the message queue (MQ) can be customized to have different categories.
[0020] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0021] 1. Solved the problem in the industrial design process that after a single master data is created, a lot of time is spent waiting for all the downstream sub-functions' big data to be created, during which the page is either inoperable or can be operated but generates dirty data.
[0022] 2. After the master data is added, multiple downstream sub-functions are added asynchronously in batches. After each sub-function is completed, the identifier is stored in the Redis cache, which improves the overall availability time of the function and ensures the cleanliness of the data.
[0023] 3. Asynchronous batch data processing using Redis and MQ enables both rapid use of main functions and complete use of sub-functions. Implementation
[0024] To provide a further understanding of the purpose, structure, features, and functions of the present invention, detailed descriptions are provided below with reference to specific embodiments.
[0025] An embodiment of the present invention provides a method for industrial design software to asynchronously generate batch data based on Redis and message queues, comprising the following steps:
[0026] S1, users add master data in the system, and multiple master data are combined to form a list of master data;
[0027] Master data is the part that users fill in on the system page. It is the source of batch data generated from the basic information of the master data, such as product name, model, size, specifications, and time.
[0028] List master data is a collection of master data;
[0029] S2 handles data transfer on the backend server;
[0030] S2-1, After the master data is added, create the master data identifier in the cached Redis;
[0031] Redis (Remote Dictionary Server) is an open-source, network-enabled, in-memory or persistent, log-structured, key-value database written in ANSI C, and provides APIs for multiple languages.
[0032] S2-2, After the identifier is created, the master data is stored in the message queue (MQ);
[0033] Message Queues (MQ) are a type of "First-In, First-Out" (FIFO) data structure in basic data structures. They are generally used to solve problems such as application decoupling, asynchronous messaging, and traffic shaping, and to achieve high-performance, highly available, scalable, and eventually consistent architectures.
[0034] S3-1, The backend server actively pulls data for the corresponding category from the message queue (MQ);
[0035] S3-2: After the backend server retrieves the corresponding data, it asynchronously executes the batch addition function of each sub-function. After each sub-function is completed, it adds its own identifier to the cache Redis, such as primary key ID, custom tag, etc.
[0036] S3-3: Read the number of sub-functions that have been stored in the Redis cache as the main data of the list; the last sub-function deletes the identifier in the Redis cache.
[0037] S3-4, when the cached identifier information cannot be obtained from the main list data, it means that the entire data has been added.
[0038] Preferably, the identifier of the master data refers to the unique primary key ID of the data, which is generally generated by the machine code and timestamp of different machines, such as snowflake ID.
[0039] Preferably, the backend server is mainly a web server, such as a web backend server developed in Java.
[0040] Preferably, the categories corresponding to the message queue (MQ) can be customized to have different categories.
[0041] The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for redis and mq asynchronous batch data generation based on industrial design software, characterized by Comprise the following steps: S1, the user adds master data in the system, and a plurality of master data forms a list master data; The master data is part of the system page filled by the user, and the basic information of the master data is used to generate batch data, such as product name, model, size, specification, time; The list master data is a collection of master data; S2, data flow is carried out on the background server; S2-1, after the master data is added, the identification of the master data is created in the cache redis; Redis (RemoteDictionaryServer) is a remote dictionary service, which is an open source using ANSI C language, supporting network, can be based on memory and persistent log type, Key-Value database, and provides API in multiple languages; S2-2, after the identification of the master data is created, the master data is stored in the message middleware MQ; MQ (MessageQueue) message queue is a kind of data structure of "first in first out" in basic data structure, which is generally used to solve the problems of application decoupling, asynchronous message, traffic peak cutting, high performance, high availability, scalability and eventual consistency architecture; The classification corresponding to the message middleware MQ can be customized to set different classifications; S3-1, the background server actively pulls the data corresponding to the message middleware MQ; S3-2, after the background server pulls the corresponding data, the batch addition function of each sub function is executed asynchronously, and each sub function adds its own identification bit to the cache redis after completion, which contains the primary key ID and the custom label; S3-3, the list master data reads the number of sub functions stored in the cache redis, and the last sub function deletes the identification in the cache redis; S3-4, when the list master data cannot obtain the cache identification information, it represents that the whole data addition is completed.
2. The method for redis and mq asynchronous batch data generation based on industrial design software according to claim 1, wherein: The identification of the master data refers to the unique primary key ID of the data.
3. The method for redis and mq asynchronous batch data generation based on industrial design software according to claim 1, wherein: The background server is a web server.
Citation Information
Patent Citations
Batch task processing method and system
CN108536532A
Processing method for realizing automatic repushing of message queue
CN114528153A