CN113064584B - Idempotent implementation method, device, equipment and medium - Google Patents

Idempotent implementation method, device, equipment and medium Download PDF

Info

Publication number
CN113064584B
CN113064584B CN202110435226.4A CN202110435226A CN113064584B CN 113064584 B CN113064584 B CN 113064584B CN 202110435226 A CN202110435226 A CN 202110435226A CN 113064584 B CN113064584 B CN 113064584B
Authority
CN
China
Prior art keywords
idempotent
result
processed
target
identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110435226.4A
Other languages
Chinese (zh)
Other versions
CN113064584A (en
Inventor
周剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202110435226.4A priority Critical patent/CN113064584B/en
Publication of CN113064584A publication Critical patent/CN113064584A/en
Application granted granted Critical
Publication of CN113064584B publication Critical patent/CN113064584B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Library & Information Science (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of artificial intelligence, and discloses a method, a device, equipment and a medium for realizing idempotent, wherein the method comprises the following steps: obtaining an idempotent identifier to be processed on the request annotation parameter carried by an idempotent call request sent by the target software based on the idempotent annotation based on the SPEL expression; obtaining a distributed lock adding result by the idempotent mark to be processed; when the distributed lock adding result is failure, determining that the execution state of the target idempotent computing result is in process, otherwise, determining an idempotent identification searching result according to the idempotent identification to be processed, the cache and the database; and when the idempotent identification searching result is failure, determining a target idempotent computing result according to the idempotent identification to be processed, updating a cache and a database according to the target idempotent computing result, otherwise, determining the target idempotent computing result according to the execution state corresponding to the idempotent identification to be processed. The programmer is not required to write codes in the target software by himself to realize idempotent, and the later maintenance of the target software is facilitated.

Description

Idempotent implementation method, device, equipment and medium
Technical Field
The application relates to the technical field of artificial intelligence, in particular to an idempotent implementation method, device, equipment and medium.
Background
Idempotent features that the effect produced by multiple calls is the same as that produced by one call, so as to avoid the condition that the input parameters are the same and multiple submissions are executed multiple times. With the development of technology, idempotent is widely applied, for example, order payment and the like all require that the same input parameters are executed for multiple times, and the obtained result is consistent with the obtained result obtained by executing once, so as to avoid repeated payment to cause multiple payments. In the prior art, a programmer writes codes in a program file which needs to adopt idempotent to realize idempotent, firstly, whether a request is executed or not is judged according to the state and the progress of service data, and then corresponding processing is carried out. Because of inconsistent code level, business understanding, implementation mode and style of developers, the later maintenance of software is not facilitated, and the repeated development increases the development cost.
Disclosure of Invention
The application mainly aims to provide a method, a device, equipment and a medium for realizing idempotent, and aims to solve the technical problems that a programmer writes codes by oneself in a program file requiring idempotent to realize idempotent in the prior art, the code level, service understanding, implementation mode and style of a developer are inconsistent, the later maintenance of software is not facilitated, and the development cost is increased by repeated development.
In order to achieve the above object, the present application proposes a method for realizing idempotent, the method comprising:
an idempotent call request sent by target software based on idempotent annotation is obtained, wherein the idempotent call request carries request annotation parameters;
Based on a SPEL expression, analyzing the request annotation parameters and generating and processing idempotent identifications to obtain idempotent identifications to be processed;
performing distributed lock adding processing on the idempotent identifiers to be processed to obtain a distributed lock adding result;
when the distributed lock addition result is failure, determining that the execution state in the target idempotent computing result corresponding to the idempotent identifier to be processed is in processing;
When the distributed lock adding result is successful, determining an idempotent identification searching result according to the idempotent identification to be processed, the cache and the database;
When the idempotent identification searching result is failure, carrying out idempotent calculation according to the idempotent identification to be processed, determining the target idempotent calculation result, and updating the cache and the database according to the target idempotent calculation result;
and when the idempotent identifier search result is successful, acquiring an execution state of the idempotent identifier to be processed, and determining the target idempotent computing result according to the execution state corresponding to the idempotent identifier to be processed.
Further, the step of analyzing the request annotation parameter and generating the idempotent identifier based on the SPEL expression to obtain the idempotent identifier to be processed includes:
analyzing the request annotation parameters based on the SPEL expression to obtain parameter analysis results;
And acquiring a preset idempotent identifier generation rule, adopting the preset idempotent identifier generation rule, and performing idempotent identifier generation processing according to the parameter analysis result to obtain the idempotent identifier to be processed.
Further, the step of adding the distributed lock to the idempotent identifier to be processed to obtain a distributed lock adding result includes:
And performing distributed lock registration on the idempotent identifier to be processed, determining that the distributed lock adding result is successful when registration is successful, determining the distributed lock identifier according to the idempotent identifier to be processed, and determining that the distributed lock adding result is failed when registration fails.
Further, when the distributed lock addition result is successful, determining an idempotent identifier search result according to the idempotent identifier to be processed, the cache and the database, including:
when the distributed lock adding result is successful, searching the idempotent mark to be processed in the cache to obtain a cache searching result;
When the cache searching result is successful, determining that the idempotent identification searching result is successful, otherwise, searching the idempotent identification to be processed in the database to obtain a database searching result;
And when the database searching result is successful, determining that the idempotent identification searching result is successful, searching the idempotent identification to be processed in the database to obtain idempotent identification data to be updated in a supplementing mode, and storing the idempotent identification data to be updated in the cache, otherwise, determining that the idempotent identification searching result is failed.
Further, when the idempotent identifier search result is failure, performing idempotent calculation according to the idempotent identifier to be processed, determining the target idempotent calculation result, and updating the cache and the database according to the target idempotent calculation result, wherein the method comprises the following steps:
When the searching result of the idempotent identification is failure, carrying out idempotent calculation according to the idempotent identification to be processed, and taking the executing state, the result type and the return information obtained by the idempotent calculation as the target idempotent calculation result;
storing the target idempotent computing result into the database, and storing the target idempotent computing result into the cache;
And sending the target idempotent computing result to the target software.
Further, the step of storing the target idempotent computing result in the database and storing the target idempotent computing result in the cache includes:
Performing Json character string conversion on the returned information of the target idempotent computing result to obtain Json format returned information corresponding to the target idempotent computing result;
Storing the execution state, the return information and the result type of the Json format corresponding to the target idempotent computing result into the database, and storing the execution state, the return information and the result type of the Json format corresponding to the target idempotent computing result into the cache.
Further, the step of determining the target idempotent computing result according to the execution state corresponding to the idempotent identifier to be processed includes:
When the execution state corresponding to the idempotent identifier to be processed is successful, acquiring the execution state, the return information and the result type of the idempotent identifier to be processed from the cache, and determining the target idempotent calculation result according to the execution state, the return information and the result type of the idempotent identifier to be processed;
When the execution state corresponding to the idempotent identifier to be processed is failure, analyzing the failure times of the request annotation parameters to obtain target failure times, and acquiring the execution times corresponding to the idempotent identifier to be processed from the cache;
when the target failure times are smaller than or equal to the execution times corresponding to the idempotent identifications to be processed, determining that the target idempotent calculation result is the execution failure;
when the target failure times are larger than the execution times corresponding to the idempotent identifications to be processed, idempotent calculation is carried out according to the idempotent identifications to be processed, the execution state, the result type and the return information obtained by the idempotent calculation are used as target idempotent calculation results, the target idempotent calculation results are stored in the database, and the target idempotent calculation results are stored in the cache.
The application also provides an idempotent implementation device, which comprises:
The request acquisition module is used for acquiring an idempotent call request sent by the target software based on the idempotent annotation, wherein the idempotent call request carries request annotation parameters;
The idempotent identification determining module is used for analyzing the request annotation parameters and generating and processing the idempotent identifications based on the SPEL expression to obtain the idempotent identifications to be processed;
The distributed lock adding result determining module is used for adding distributed lock processing to the idempotent identifier to be processed to obtain a distributed lock adding result;
The first processing module is used for determining that the execution state in the target idempotent computing result corresponding to the idempotent identifier to be processed is in processing when the distributed lock adding result is failure;
The second processing module is used for determining an idempotent identification searching result according to the idempotent identification to be processed, the cache and the database when the distributed lock adding result is successful;
the first target idempotent computing result determining module is used for performing idempotent computing according to the idempotent identifier to be processed when the idempotent identifier searching result is failure, determining the target idempotent computing result and updating the cache and the database according to the target idempotent computing result;
and the second target idempotent computing result determining module is used for acquiring the execution state of the idempotent identifier to be processed when the idempotent identifier searching result is successful, and determining the target idempotent computing result according to the execution state corresponding to the idempotent identifier to be processed.
The application also proposes a computer device comprising a memory storing a computer program and a processor implementing the steps of any of the methods described above when the processor executes the computer program.
The application also proposes a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method of any of the above.
According to the idempotent implementation method, device, equipment and medium, through the idempotent call request sent by the target software based on the idempotent annotation, a programmer is not required to write codes in the target software which needs to adopt idempotent to realize idempotent, and can realize idempotent only by making simple annotations in the target software, so that the post maintenance of the target software is facilitated, repeated development in a plurality of target software is avoided, and the development cost is reduced; the request annotation parameters are analyzed and the idempotent identifications are generated based on the SPEL expression, the idempotent identifications to be processed are obtained, the idempotent identifications are configured by adopting the SPEL expression which is the most familiar to Java developers, the extra learning cost of the developers is reduced, the state checking is not needed to be realized in a method for realizing the program logic of the target software, and the development efficiency is improved; the idempotent identifier to be processed is added with distributed lock processing, so that the capability of preventing repeated submission of idempotent call requests is achieved; the target idempotent computing result is stored by adopting the cache and the database, so that the idempotent query efficiency is improved, and the data loss is prevented.
Drawings
FIG. 1 is a flow chart of a method for implementing idempotent according to an embodiment of the application;
FIG. 2 is a schematic block diagram of an idempotent implementation device according to one embodiment of the application;
Fig. 3 is a schematic block diagram of a computer device according to an embodiment of the present application.
The achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
In order to solve the technical problems that a programmer writes codes by oneself in a program file requiring idempotent to realize idempotent, and the later maintenance of software is not facilitated due to inconsistent code level, service understanding, implementation mode and style of a developer, and development cost is increased by repeated development in the prior art, the application provides an idempotent implementation method, which is applied to the technical field of artificial intelligence. According to the idempotent implementation method, the idempotent call request sent by the target software based on the idempotent annotation is analyzed and the idempotent identification is generated based on the SPEL expression, then the obtained idempotent identification is added with the distributed lock processing, the target idempotent calculation result is determined according to the processing result, a programmer is not required to write codes in the target software with idempotent to realize idempotent, and the idempotent can be realized only by simply annotating the target software, so that the post maintenance of the target software is facilitated, repeated development in a plurality of target software is avoided, and the development cost is reduced.
Referring to fig. 1, in an embodiment of the present application, a method for implementing idempotent is provided, where the method includes:
s1: an idempotent call request sent by target software based on idempotent annotation is obtained, wherein the idempotent call request carries request annotation parameters;
S2: based on a SPEL expression, analyzing the request annotation parameters and generating and processing idempotent identifications to obtain idempotent identifications to be processed;
s3: performing distributed lock adding processing on the idempotent identifiers to be processed to obtain a distributed lock adding result;
S4: when the distributed lock addition result is failure, determining that the execution state in the target idempotent computing result corresponding to the idempotent identifier to be processed is in processing;
s5: when the distributed lock adding result is successful, determining an idempotent identification searching result according to the idempotent identification to be processed, the cache and the database;
S6: when the idempotent identification searching result is failure, carrying out idempotent calculation according to the idempotent identification to be processed, determining the target idempotent calculation result, and updating the cache and the database according to the target idempotent calculation result;
S7: and when the idempotent identifier search result is successful, acquiring an execution state of the idempotent identifier to be processed, and determining the target idempotent computing result according to the execution state corresponding to the idempotent identifier to be processed.
According to the method, through the idempotent call request sent by the target software based on the idempotent annotation, a programmer is not required to write codes in the target software which needs to adopt idempotent to realize idempotent, and the idempotent can be realized by only making simple annotations in the target software, so that the post maintenance of the target software is facilitated, repeated development in a plurality of target software is avoided, and the development cost is reduced; the request annotation parameters are analyzed and the idempotent identifications are generated based on the SPEL expression, the idempotent identifications to be processed are obtained, the idempotent identifications are configured by adopting the SPEL expression which is the most familiar to Java developers, the extra learning cost of the developers is reduced, the state checking is not needed to be realized in a method for realizing the program logic of the target software, and the development efficiency is improved; the idempotent identifier to be processed is added with distributed lock processing, so that the capability of preventing repeated submission of idempotent call requests is achieved; the target idempotent computing result is stored by adopting the cache and the database, so that the idempotent query efficiency is improved, and the data loss is prevented.
The target software is software that requires idempotent calculation for S1. The target software can be a front-end page, a software module or a software system.
The annotation is a characteristic in the Spring framework which is convenient for a developer to use, and the functions which can be realized by configuring a plurality of xml (extensible markup language) are realized in an annotation mode.
For example, the idempotent calculation obtained by using the idempotent implementation method according to the application in the method a is needed, and the program file of the method a is only needed to be written with @ Idempotent, and the example is not limited in detail.
For example, the program file of method a is written with @ Idempotent ("#fooreq. Transdid"), "#fooreq. Transdid") as the request annotation parameter, where the request annotation parameter expresses transId attribute of parameter fooReq as an idempotent identifier, and the specific limitation is not given here for example.
And S2, analyzing the request annotation parameters based on SPEL (Spring Expression Language) expression, generating idempotent marks according to the analysis result, and taking the generated idempotent marks as idempotent marks to be processed.
SPEL expression, a Spring expression language, may be used to parse parameters in the annotation.
Idempotent identifiers, i.e., idempotent IDs, idempotent names, etc., uniquely identify an idempotent calculated identifier.
For S3, in order to prevent interference between multiple processes in a distributed system, a distributed coordination technology is needed to schedule the processes, and the core of the distributed coordination technology is to implement the distributed lock.
The distributed lock may be a zookeeper (distributed, open source distributed application coordination service) distributed lock, and it is understood that the distributed lock may be a distributed lock in other implementations, which is not limited herein.
And registering the idempotent identification to be processed on a zookeeper, determining that the distributed lock adding result is successful when the distributed lock is registered successfully, determining the distributed lock identification according to the idempotent identification to be processed, and otherwise, determining that the distributed lock adding result is failed. Registering a distributed lock on a zookeeper has the feature that only one can register successfully at a time, thereby avoiding the problem of repeated execution.
It is understood that the number of distributed locks in the zookeeper may be one or more. The distributed lock identifications of the plurality of distributed locks are different from each other.
And S4, when the distributed lock addition result is failure, the fact that the idempotent identity which is the same as the idempotent identity to be processed exists is that the idempotent computing is carried out, and at the moment, the execution state in the target idempotent computing result corresponding to the idempotent identity to be processed can be determined to be in processing.
Optionally, after determining that the execution state in the target idempotent computing result corresponding to the idempotent identifier to be processed is the step in processing when the distributed lock adding result is failure, the method further includes: and sending the target idempotent computing result to the target software. That is, the information that the execution state of the target idempotent computing result corresponding to the idempotent identifier to be processed is in process is transferred to the target software.
For S5, when the result of the distributed lock addition is successful, it means that there is no idempotent identifier that is the same as the idempotent identifier to be processed in the idempotent calculation, and at this time, the idempotent identifier to be processed may not have been calculated by idempotent, or may have been completed by idempotent calculation. Therefore, the idempotent mark to be processed can be searched in the cache, the searching result of the idempotent mark is determined to be successful when the searching is successful, otherwise, the idempotent mark to be processed is searched in the database, the searching result of the idempotent mark is determined to be successful when the searching of the database is successful, and the searching result of the idempotent mark is determined to be failed when the searching of the database is failed.
Optionally, the cache employs Redis. Redis is an open source Key-Value pair (Key-Value) store database written in ANSIC language, compliant with BSD protocol, supporting network, and based on memory, distributed and optional persistence.
And S6, when the idempotent identification searching result is failure, the idempotent identification to be processed is not calculated by idempotent, at the moment, the idempotent calculation can be carried out according to the idempotent identification to be processed, the data obtained by the idempotent calculation is used as the target idempotent calculation result, and the target idempotent calculation result is updated into the cache and the database, so that the idempotent searching efficiency is improved, and the data loss is prevented.
For S7, when the idempotent identifier search result is successful, it means that the idempotent identifier to be processed has been completed by idempotent calculation, and at this time, the execution state corresponding to the idempotent identifier to be processed may be obtained from the cache; when the execution state corresponding to the idempotent identifier to be processed is successful, the target idempotent computing result can be determined according to the execution state, the return information and the result type corresponding to the idempotent identifier to be processed in the cache; and when the execution state corresponding to the idempotent identifier to be processed is failure, comparing the actual failure times with the target failure times in the request annotation parameters, and determining that the execution state of the target idempotent computing result is the execution failure when the execution state is greater than or equal to the target failure times, otherwise, carrying out idempotent computing again, and taking the data obtained by the idempotent computing as the target idempotent computing result.
And the target idempotent computing result, namely the idempotent computing result corresponding to the idempotent identifier to be processed. The idempotent calculation results include: execution state, result type, return information.
It is understood that steps S1 to S7 may be developed in Java language.
The method of step S1 to step S7 is packaged as an idempotent implementation device. It will be appreciated that the idempotent implementation device may be installed on the same server as the target software or on a different server than the target software.
In one embodiment, the step of parsing and generating the idempotent identifier for the request annotation parameter based on the SPEL expression to obtain the idempotent identifier to be processed includes:
S21: analyzing the request annotation parameters based on the SPEL expression to obtain parameter analysis results;
S22: and acquiring a preset idempotent identifier generation rule, adopting the preset idempotent identifier generation rule, and performing idempotent identifier generation processing according to the parameter analysis result to obtain the idempotent identifier to be processed.
According to the embodiment, the analysis and idempotent identification generation processing of the request annotation parameters based on the SPEL expression is realized, the idempotent identification to be processed is obtained, the state checking is realized in the method for realizing the program logic, the idempotent is realized, and the development efficiency is improved.
And S21, analyzing the request annotation parameters based on the SPEL expression, and taking the analysis result as a parameter analysis result.
For S22, the preset idempotent identifier generation rule may be obtained from the database, or may be obtained from the third party application system, or may be written into a program file implementing the present application.
Optionally, the preset idempotent identifier generation rule is set to be a serial number.
Optionally, the preset idempotent identifier generation rule is set to obtain the idempotent identifier by adopting a combination of dynamic attribute and fixed attribute. For example, the program file of the method a is written with @ Idempotent ("'bill_' + currentDate (yyyyMMdd) + # fooreq.transdd"), where "'bill_' + currentDate (yyyymmdd) + # fooreq.transdd" is a request annotation parameter, and the preset idempotent identifier generation rule is: the transId attribute of the entry fooReq, beginning with the value bill_ of the fixed attribute, middle with the built-in parameter (also dynamic parameter) at the current system year, month and day (expressed in yyyymmdd format), ending with the dynamic parameter method a, is 20210101 at the current system year, month and day, transid parameter value of the entry fooReq is 1001001123, then the idempotent to be processed is identified as: bill_202101011001001123 is not specifically limited in this example.
In one embodiment, the step of adding a distributed lock to the idempotent identifier to be processed to obtain a distributed lock adding result includes:
And performing distributed lock registration on the idempotent identifier to be processed, determining that the distributed lock adding result is successful when registration is successful, determining the distributed lock identifier according to the idempotent identifier to be processed, and determining that the distributed lock adding result is failed when registration fails.
The embodiment adds the distributed lock processing to the idempotent identifier to be processed, so that the capability of preventing repeated submission of the idempotent call request is realized.
The idempotent identification to be processed is used as the distributed lock identification, so that only one distributed lock corresponding to the idempotent identification in the zookeeper is realized, and the capability of preventing repeated submission of idempotent call requests is realized; when registering the distributed lock in the zookeeper fails, determining that the adding result of the distributed lock is failure, wherein the fact that the zookeeper does not have the distributed lock corresponding to the idempotent identification to be processed is meant.
In one embodiment, when the adding result of the distributed lock is successful, the step of determining the searching result of the idempotent identifier according to the idempotent identifier to be processed, the cache and the database includes:
s51: when the distributed lock adding result is successful, searching the idempotent mark to be processed in the cache to obtain a cache searching result;
S52: when the cache searching result is successful, determining that the idempotent identification searching result is successful, otherwise, searching the idempotent identification to be processed in the database to obtain a database searching result;
S53: and when the database searching result is successful, determining that the idempotent identification searching result is successful, searching the idempotent identification to be processed in the database to obtain idempotent identification data to be updated in a supplementing mode, and storing the idempotent identification data to be updated in the cache, otherwise, determining that the idempotent identification searching result is failed.
The embodiment realizes that searching is firstly carried out in the cache, and then searching is carried out from the database when searching fails, and the searching efficiency of the cache is higher, so that the idempotent searching efficiency is further improved, and the data loss is prevented.
For S51, when the distributed lock addition result is successful, it means that no idempotent identifier identical to the idempotent identifier to be processed is in idempotent calculation, at this time, the idempotent identifier to be processed may be searched in the cache, the cache search result is determined to be successful when the idempotent identifier identical to the idempotent identifier to be processed is searched in the cache, and the cache search result is determined to be successful when the idempotent identifier identical to the idempotent identifier to be processed is not searched in the cache.
For S52, when the cache lookup result is successful, this means that there is an idempotent calculation result corresponding to the idempotent identifier that is the same as the idempotent identifier to be processed in the cache, and at this time, it may be determined that the idempotent identifier lookup result is successful; when the cache searching result is failure, the fact that the cache does not have the idempotent computing result corresponding to the idempotent identifier which is the same as the idempotent identifier to be processed is meant, and the idempotent identifier to be processed needs to be searched in the database.
For S53, when the database search result is successful, it means that there is an idempotent calculation result corresponding to the idempotent identifier identical to the idempotent identifier to be processed in the database, the idempotent identifier to be processed is searched in the database, the searched idempotent calculation result is used as idempotent identifier data to be updated in a supplementing manner, and the idempotent identifier data to be updated in a supplementing manner is stored in the cache, thereby improving the efficiency of the next query; when the searching result of the database is failure, the database does not have the idempotent computing result corresponding to the idempotent identifier which is the same as the idempotent identifier to be processed, and the idempotent identifier searching result can be determined to be failure.
In an embodiment, when the idempotent identifier search result is failure, performing idempotent calculation according to the idempotent identifier to be processed, determining the target idempotent calculation result, and updating the cache and the database according to the target idempotent calculation result, where the step includes:
S61: when the searching result of the idempotent identification is failure, carrying out idempotent calculation according to the idempotent identification to be processed, and taking the executing state, the result type and the return information obtained by the idempotent calculation as the target idempotent calculation result;
S62: storing the target idempotent computing result into the database, and storing the target idempotent computing result into the cache;
s63: and sending the target idempotent computing result to the target software.
According to the method, when the idempotent identification searching result is failure, idempotent calculation is carried out according to the idempotent identification to be processed, so that the result obtained by executing the same parameters for multiple times is consistent with the result obtained by executing the same parameters once.
For S61, when the idempotent identifier search result is failure, it means that there is no idempotent calculation result corresponding to the same idempotent identifier as the idempotent identifier to be processed in the cache and the database, and at this time, idempotent calculation may be performed according to the idempotent identifier to be processed, and the execution state, the result type and the return information obtained by the idempotent calculation are used as the target idempotent calculation result. That is, the execution state obtained by the idempotent calculation is set as the execution state of the target idempotent calculation result, the result type obtained by the idempotent calculation is set as the result type of the target idempotent calculation result, and the return information obtained by the idempotent calculation is set as the return information of the target idempotent calculation result.
For S62, the target idempotent computing result is first stored in the database, and then stored in the cache, thereby improving the query efficiency of idempotent and preventing data loss.
In one embodiment, the step of storing the target idempotent computing result in the database and storing the target idempotent computing result in the cache includes:
S621: performing Json character string conversion on the returned information of the target idempotent computing result to obtain Json format returned information corresponding to the target idempotent computing result;
S622: storing the execution state, the return information and the result type of the Json format corresponding to the target idempotent computing result into the database, and storing the execution state, the return information and the result type of the Json format corresponding to the target idempotent computing result into the cache.
According to the embodiment, the Json character string conversion is carried out on the returned information of the target idempotent computing result, so that the stored data size is reduced.
And S621, performing Json character string conversion on the return information of the target idempotent computing result, and taking the Json character string obtained through conversion as the return information of the Json format corresponding to the target idempotent computing result.
For S622, the execution state, the return information, and the result type of the Json format corresponding to the target idempotent computing result may be sequentially stored in the database and the cache, or the execution state, the return information, and the result type of the Json format corresponding to the target idempotent computing result may be simultaneously stored in the database and the cache.
In one embodiment, the step of determining the target idempotent computing result according to the execution state corresponding to the idempotent identifier to be processed includes:
S71: when the execution state corresponding to the idempotent identifier to be processed is successful, acquiring the execution state, the return information and the result type of the idempotent identifier to be processed from the cache, and determining the target idempotent calculation result according to the execution state, the return information and the result type of the idempotent identifier to be processed;
S72: when the execution state corresponding to the idempotent identifier to be processed is failure, analyzing the failure times of the request annotation parameters to obtain target failure times, and acquiring the execution times corresponding to the idempotent identifier to be processed from the cache;
S73: when the target failure times are smaller than or equal to the execution times corresponding to the idempotent identifications to be processed, determining that the target idempotent calculation result is the execution failure;
S74: when the target failure times are larger than the execution times corresponding to the idempotent identifications to be processed, idempotent calculation is carried out according to the idempotent identifications to be processed, the execution state, the result type and the return information obtained by the idempotent calculation are used as target idempotent calculation results, the target idempotent calculation results are stored in the database, and the target idempotent calculation results are stored in the cache.
According to the method and the device for performing idempotent computing, when the idempotent identification search result is successful, the target idempotent computing result is determined according to the execution state corresponding to the idempotent identification to be processed, so that the next idempotent computing can be automatically performed when failure occurs, the degree of automation of the method and the device is improved, and the idempotent computing efficiency is further improved.
With S71, when the execution state corresponding to the idempotent identifier to be processed is successful, which means that the idempotent identifier to be processed has been completed by idempotent computation and the execution state is successful, a corresponding idempotent computation result of the same idempotent identifier as the idempotent identifier to be processed may be obtained from the cache, the obtained return information of the idempotent computation result is taken as the return information of the idempotent identifier to be processed, the result type of the obtained idempotent computation result is taken as the result type of the idempotent identifier to be processed, and the execution state of the idempotent identifier to be processed is taken as the execution state of the target idempotent computation result.
For S72, when the execution state corresponding to the idempotent identifier to be processed is failure, it means that the idempotent identifier to be processed has been completed by idempotent calculation and the execution state is failure, performing failure times analysis from the request annotation parameter, and taking the failure times obtained by analysis as a target failure times; and acquiring the execution times of the idempotent marks which are the same as the idempotent marks to be processed from the cache, and taking the acquired execution times as the corresponding execution times of the idempotent marks to be processed.
For S73, when the target failure number is less than or equal to the execution number corresponding to the idempotent identifier to be processed, it means that the actual execution number exceeds the preset number in the request annotation parameter, and at this time, it may be determined that the target idempotent computing result is an execution failure.
For S74, when the number of failure times of the target is greater than the number of executions corresponding to the idempotent identifier to be processed, it means that the number of actual executions does not exceed the number of times preset in the request annotation parameter, performing idempotent computation according to the idempotent identifier to be processed, taking an execution state obtained by the idempotent computation as an execution state of the target idempotent computation result, taking a result type obtained by the idempotent computation as a result type of the target idempotent computation result, and taking return information obtained by the idempotent computation as return information of the target idempotent computation result; the target idempotent computing results can be sequentially stored in the database and the cache, or can be simultaneously stored in the database and the cache. Thus improving the idempotent query efficiency and preventing the data from being lost.
With reference to fig. 2, the application also proposes an idempotent implementation device, comprising:
the request acquisition module 100 is configured to acquire an idempotent call request sent by the target software based on an idempotent annotation, where the idempotent call request carries a request annotation parameter;
The idempotent identifier determining module 200 is configured to parse the request annotation parameter and generate an idempotent identifier based on the SPEL expression, so as to obtain an idempotent identifier to be processed;
the distributed lock adding result determining module 300 is configured to add a distributed lock to the idempotent identifier to be processed, so as to obtain a distributed lock adding result;
The first processing module 400 is configured to determine, when the distributed lock addition result is a failure, that an execution state in a target idempotent calculation result corresponding to the idempotent identifier to be processed is in processing;
the second processing module 500 is configured to determine an idempotent identifier search result according to the idempotent identifier to be processed, the cache and the database when the distributed lock addition result is successful;
the first target idempotent computing result determining module 600 is configured to perform idempotent computing according to the idempotent identifier to be processed when the idempotent identifier search result is failure, determine the target idempotent computing result, and update the cache and the database according to the target idempotent computing result;
and the second target idempotent computing result determining module 700 is configured to obtain an execution state of the idempotent identifier to be processed when the idempotent identifier search result is successful, and determine the target idempotent computing result according to the execution state corresponding to the idempotent identifier to be processed.
According to the method, through the idempotent call request sent by the target software based on the idempotent annotation, a programmer is not required to write codes in the target software which needs to adopt idempotent to realize idempotent, and the idempotent can be realized by only making simple annotations in the target software, so that the post maintenance of the target software is facilitated, repeated development in a plurality of target software is avoided, and the development cost is reduced; the request annotation parameters are analyzed and the idempotent identifications are generated based on the SPEL expression, the idempotent identifications to be processed are obtained, the idempotent identifications are configured by adopting the SPEL expression which is the most familiar to Java developers, the extra learning cost of the developers is reduced, the state checking is not needed to be realized in a method for realizing the program logic of the target software, and the development efficiency is improved; the idempotent identifier to be processed is added with distributed lock processing, so that the capability of preventing repeated submission of idempotent call requests is achieved; the target idempotent computing result is stored by adopting the cache and the database, so that the idempotent query efficiency is improved, and the data loss is prevented.
Referring to fig. 3, in an embodiment of the present application, there is further provided a computer device, which may be a server, and an internal structure thereof may be as shown in fig. 3. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing data such as implementation methods of idempotent and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of implementing idempotent. The idempotent implementation method comprises the following steps: an idempotent call request sent by target software based on idempotent annotation is obtained, wherein the idempotent call request carries request annotation parameters; based on a SPEL expression, analyzing the request annotation parameters and generating and processing idempotent identifications to obtain idempotent identifications to be processed; performing distributed lock adding processing on the idempotent identifiers to be processed to obtain a distributed lock adding result; when the distributed lock addition result is failure, determining that the execution state in the target idempotent computing result corresponding to the idempotent identifier to be processed is in processing; when the distributed lock adding result is successful, determining an idempotent identification searching result according to the idempotent identification to be processed, the cache and the database; when the idempotent identification searching result is failure, carrying out idempotent calculation according to the idempotent identification to be processed, determining the target idempotent calculation result, and updating the cache and the database according to the target idempotent calculation result; and when the idempotent identifier search result is successful, acquiring an execution state of the idempotent identifier to be processed, and determining the target idempotent computing result according to the execution state corresponding to the idempotent identifier to be processed.
According to the method, through the idempotent call request sent by the target software based on the idempotent annotation, a programmer is not required to write codes in the target software which needs to adopt idempotent to realize idempotent, and the idempotent can be realized by only making simple annotations in the target software, so that the post maintenance of the target software is facilitated, repeated development in a plurality of target software is avoided, and the development cost is reduced; the request annotation parameters are analyzed and the idempotent identifications are generated based on the SPEL expression, the idempotent identifications to be processed are obtained, the idempotent identifications are configured by adopting the SPEL expression which is the most familiar to Java developers, the extra learning cost of the developers is reduced, the state checking is not needed to be realized in a method for realizing the program logic of the target software, and the development efficiency is improved; the idempotent identifier to be processed is added with distributed lock processing, so that the capability of preventing repeated submission of idempotent call requests is achieved; the target idempotent computing result is stored by adopting the cache and the database, so that the idempotent query efficiency is improved, and the data loss is prevented.
An embodiment of the present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for realizing idempotent, comprising the steps of: an idempotent call request sent by target software based on idempotent annotation is obtained, wherein the idempotent call request carries request annotation parameters; based on a SPEL expression, analyzing the request annotation parameters and generating and processing idempotent identifications to obtain idempotent identifications to be processed; performing distributed lock adding processing on the idempotent identifiers to be processed to obtain a distributed lock adding result; when the distributed lock addition result is failure, determining that the execution state in the target idempotent computing result corresponding to the idempotent identifier to be processed is in processing; when the distributed lock adding result is successful, determining an idempotent identification searching result according to the idempotent identification to be processed, the cache and the database; when the idempotent identification searching result is failure, carrying out idempotent calculation according to the idempotent identification to be processed, determining the target idempotent calculation result, and updating the cache and the database according to the target idempotent calculation result; and when the idempotent identifier search result is successful, acquiring an execution state of the idempotent identifier to be processed, and determining the target idempotent computing result according to the execution state corresponding to the idempotent identifier to be processed.
According to the implementation method of the idempotent executed, through the idempotent call request sent by the target software based on the idempotent annotation, a programmer is not required to write codes in the target software which needs to adopt the idempotent to realize the idempotent, and the idempotent can be realized only by making simple annotations in the target software, so that the post maintenance of the target software is facilitated, repeated development in a plurality of target software is avoided, and the development cost is reduced; the request annotation parameters are analyzed and the idempotent identifications are generated based on the SPEL expression, the idempotent identifications to be processed are obtained, the idempotent identifications are configured by adopting the SPEL expression which is the most familiar to Java developers, the extra learning cost of the developers is reduced, the state checking is not needed to be realized in a method for realizing the program logic of the target software, and the development efficiency is improved; the idempotent identifier to be processed is added with distributed lock processing, so that the capability of preventing repeated submission of idempotent call requests is achieved; the target idempotent computing result is stored by adopting the cache and the database, so that the idempotent query efficiency is improved, and the data loss is prevented.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided by the present application and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the application, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application or directly or indirectly applied to other related technical fields are included in the scope of the application.

Claims (8)

1. A method for implementing idempotent, the method comprising:
an idempotent call request sent by target software based on idempotent annotation is obtained, wherein the idempotent call request carries request annotation parameters;
Based on a SPEL expression, analyzing the request annotation parameters and generating and processing idempotent identifications to obtain idempotent identifications to be processed;
performing distributed lock adding processing on the idempotent identifiers to be processed to obtain a distributed lock adding result;
When the distributed lock addition result is failure, determining that the execution state in the target idempotent computing result corresponding to the idempotent identifier to be processed is in processing; transmitting the target idempotent computing result to the target software; when the distributed lock addition result is failure, the fact that the idempotent identification which is the same as the idempotent identification to be processed exists is that idempotent calculation is performed;
When the distributed lock adding result is successful, determining an idempotent identification searching result according to the idempotent identification to be processed, the cache and the database; when the distributed lock adding result is successful, the fact that the idempotent identity which is the same as the idempotent identity to be processed is not in the idempotent computing is carried out, and the idempotent identity to be processed is not subjected to the idempotent computing or is subjected to the idempotent computing;
When the idempotent identification searching result is failure, carrying out idempotent calculation according to the idempotent identification to be processed, determining the target idempotent calculation result, and updating the cache and the database according to the target idempotent calculation result;
When the idempotent identifier search result is successful, acquiring an execution state of the idempotent identifier to be processed, and determining the target idempotent calculation result according to the execution state corresponding to the idempotent identifier to be processed;
And when the distributed lock adding result is successful, determining an idempotent identification searching result according to the idempotent identification to be processed, the cache and the database, wherein the step comprises the following steps:
when the distributed lock adding result is successful, searching the idempotent mark to be processed in the cache to obtain a cache searching result;
When the cache searching result is successful, determining that the idempotent identification searching result is successful, otherwise, searching the idempotent identification to be processed in the database to obtain a database searching result;
When the database searching result is successful, determining that the idempotent identification searching result is successful, searching the idempotent identification to be processed in the database to obtain idempotent identification data to be updated in a supplementing mode, and storing the idempotent identification data to be updated in the cache, otherwise, determining that the idempotent identification searching result is failed;
The step of determining the target idempotent computing result according to the executing state corresponding to the idempotent identifier to be processed comprises the following steps:
When the execution state corresponding to the idempotent identifier to be processed is successful, acquiring the execution state, the return information and the result type of the idempotent identifier to be processed from the cache, and determining the target idempotent calculation result according to the execution state, the return information and the result type of the idempotent identifier to be processed;
When the execution state corresponding to the idempotent identifier to be processed is failure, analyzing the failure times of the request annotation parameters to obtain target failure times, and acquiring the execution times corresponding to the idempotent identifier to be processed from the cache;
when the target failure times are smaller than or equal to the execution times corresponding to the idempotent identifications to be processed, determining that the target idempotent calculation result is the execution failure;
when the target failure times are larger than the execution times corresponding to the idempotent identifications to be processed, idempotent calculation is carried out according to the idempotent identifications to be processed, the execution state, the result type and the return information obtained by the idempotent calculation are used as target idempotent calculation results, the target idempotent calculation results are stored in the database, and the target idempotent calculation results are stored in the cache.
2. The idempotent implementation method according to claim 1, wherein the step of parsing and idempotent identification generation processing the request annotation parameters based on a SPEL expression to obtain idempotent identifications to be processed includes:
analyzing the request annotation parameters based on the SPEL expression to obtain parameter analysis results;
And acquiring a preset idempotent identifier generation rule, adopting the preset idempotent identifier generation rule, and performing idempotent identifier generation processing according to the parameter analysis result to obtain the idempotent identifier to be processed.
3. The method for realizing idempotent according to claim 1, wherein the step of adding a distributed lock to the idempotent identifier to be processed to obtain a distributed lock adding result comprises the following steps:
And performing distributed lock registration on the idempotent identifier to be processed, determining that the distributed lock adding result is successful when registration is successful, determining the distributed lock identifier according to the idempotent identifier to be processed, and determining that the distributed lock adding result is failed when registration fails.
4. The method for realizing idempotent according to claim 1, wherein when the idempotent identifier search result is failure, performing idempotent calculation according to the idempotent identifier to be processed, determining the target idempotent calculation result, and updating the cache and the database according to the target idempotent calculation result, wherein the method comprises the following steps:
When the searching result of the idempotent identification is failure, carrying out idempotent calculation according to the idempotent identification to be processed, and taking the executing state, the result type and the return information obtained by the idempotent calculation as the target idempotent calculation result;
storing the target idempotent computing result into the database, and storing the target idempotent computing result into the cache;
And sending the target idempotent computing result to the target software.
5. The method according to claim 4, wherein the step of storing the target idempotent calculation result in the database and storing the target idempotent calculation result in the cache comprises:
Performing Json character string conversion on the returned information of the target idempotent computing result to obtain Json format returned information corresponding to the target idempotent computing result;
Storing the execution state, the return information and the result type of the Json format corresponding to the target idempotent computing result into the database, and storing the execution state, the return information and the result type of the Json format corresponding to the target idempotent computing result into the cache.
6. An apparatus for effecting idempotent, the apparatus comprising:
The request acquisition module is used for acquiring an idempotent call request sent by the target software based on the idempotent annotation, wherein the idempotent call request carries request annotation parameters;
The idempotent identification determining module is used for analyzing the request annotation parameters and generating and processing the idempotent identifications based on the SPEL expression to obtain the idempotent identifications to be processed;
The distributed lock adding result determining module is used for adding distributed lock processing to the idempotent identifier to be processed to obtain a distributed lock adding result;
The first processing module is used for determining that the execution state in the target idempotent computing result corresponding to the idempotent identifier to be processed is in processing when the distributed lock adding result is failure; transmitting the target idempotent computing result to the target software; when the distributed lock addition result is failure, the fact that the idempotent identification which is the same as the idempotent identification to be processed exists is that idempotent calculation is performed;
The second processing module is used for determining an idempotent identification searching result according to the idempotent identification to be processed, the cache and the database when the distributed lock adding result is successful;
the first target idempotent computing result determining module is used for performing idempotent computing according to the idempotent identifier to be processed when the idempotent identifier searching result is failure, and determining the target idempotent; when the distributed lock adding result is successful, the fact that the idempotent identity which is the same as the idempotent identity to be processed is not in the idempotent computing is carried out, and the idempotent identity to be processed is not subjected to the idempotent computing or is subjected to the idempotent computing;
The calculation result is updated according to the target idempotent calculation result;
The second target idempotent computing result determining module is used for acquiring the execution state of the idempotent identifier to be processed when the idempotent identifier searching result is successful, and determining the target idempotent computing result according to the execution state corresponding to the idempotent identifier to be processed;
and when the distributed lock adding result is successful, determining an idempotent identification searching result according to the idempotent identification to be processed, the cache and the database, wherein the idempotent identification searching result comprises the following steps:
when the distributed lock adding result is successful, searching the idempotent mark to be processed in the cache to obtain a cache searching result;
When the cache searching result is successful, determining that the idempotent identification searching result is successful, otherwise, searching the idempotent identification to be processed in the database to obtain a database searching result;
When the database searching result is successful, determining that the idempotent identification searching result is successful, searching the idempotent identification to be processed in the database to obtain idempotent identification data to be updated in a supplementing mode, and storing the idempotent identification data to be updated in the cache, otherwise, determining that the idempotent identification searching result is failed;
The determining the target idempotent computing result according to the executing state corresponding to the idempotent identifier to be processed comprises the following steps:
When the execution state corresponding to the idempotent identifier to be processed is successful, acquiring the execution state, the return information and the result type of the idempotent identifier to be processed from the cache, and determining the target idempotent calculation result according to the execution state, the return information and the result type of the idempotent identifier to be processed;
When the execution state corresponding to the idempotent identifier to be processed is failure, analyzing the failure times of the request annotation parameters to obtain target failure times, and acquiring the execution times corresponding to the idempotent identifier to be processed from the cache;
when the target failure times are smaller than or equal to the execution times corresponding to the idempotent identifications to be processed, determining that the target idempotent calculation result is the execution failure;
when the target failure times are larger than the execution times corresponding to the idempotent identifications to be processed, idempotent calculation is carried out according to the idempotent identifications to be processed, the execution state, the result type and the return information obtained by the idempotent calculation are used as target idempotent calculation results, the target idempotent calculation results are stored in the database, and the target idempotent calculation results are stored in the cache.
7. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 5 when the computer program is executed.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 5.
CN202110435226.4A 2021-04-22 2021-04-22 Idempotent implementation method, device, equipment and medium Active CN113064584B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110435226.4A CN113064584B (en) 2021-04-22 2021-04-22 Idempotent implementation method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110435226.4A CN113064584B (en) 2021-04-22 2021-04-22 Idempotent implementation method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN113064584A CN113064584A (en) 2021-07-02
CN113064584B true CN113064584B (en) 2024-05-07

Family

ID=76567469

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110435226.4A Active CN113064584B (en) 2021-04-22 2021-04-22 Idempotent implementation method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN113064584B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111026465A (en) * 2019-11-15 2020-04-17 北京三快在线科技有限公司 Program processing method, program processing device, electronic device, and storage medium
CN111625301A (en) * 2020-05-25 2020-09-04 泰康保险集团股份有限公司 Idempotent processing method, apparatus, device and storage medium
CN111865970A (en) * 2020-07-17 2020-10-30 北京百度网讯科技有限公司 Method and apparatus for implementing interface idempotency
CN112383402A (en) * 2020-11-13 2021-02-19 中国联合网络通信集团有限公司 Dual idempotent verification method and server

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120102506A1 (en) * 2010-10-20 2012-04-26 Microsoft Corporation Web service patterns for globally distributed service fabric
US9578130B1 (en) * 2012-06-20 2017-02-21 Amazon Technologies, Inc. Asynchronous and idempotent distributed lock interfaces
US10691506B2 (en) * 2018-12-28 2020-06-23 Intel Corporation Distributed lock for data acquisition systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111026465A (en) * 2019-11-15 2020-04-17 北京三快在线科技有限公司 Program processing method, program processing device, electronic device, and storage medium
CN111625301A (en) * 2020-05-25 2020-09-04 泰康保险集团股份有限公司 Idempotent processing method, apparatus, device and storage medium
CN111865970A (en) * 2020-07-17 2020-10-30 北京百度网讯科技有限公司 Method and apparatus for implementing interface idempotency
CN112383402A (en) * 2020-11-13 2021-02-19 中国联合网络通信集团有限公司 Dual idempotent verification method and server

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于微服务架构的数据一致性方法研究;杨成荣 等;《电脑知识与技术》;20200315(第08期);第272-274页 *

Also Published As

Publication number Publication date
CN113064584A (en) 2021-07-02

Similar Documents

Publication Publication Date Title
US8745641B1 (en) Automatic verification and anomaly detection in a representational state transfer (REST) application programming interface
US20040078689A1 (en) Automatically identifying a program error in a computer program
CN111984228B (en) Interface document processing method and device, computer equipment and storage medium
CN109684607B (en) JSON data analysis method and device, computer equipment and storage medium
CN109783742B (en) Page jump method and device for development assistance and computer equipment
CN111309593A (en) JSON interface verification method, device and equipment and computer readable storage medium
WO2020192141A1 (en) Method and device for simulating interface, computer apparatus, and storage medium
CN111736811A (en) Form data verification method, system, server and user terminal
CN111581271A (en) Interface parameter determination method and device, computer equipment and storage medium
CN112181423B (en) Project construction method and device based on configuration file, computer equipment and medium
CN112631701A (en) Page request method and device, computer equipment and storage medium
CN112613993A (en) Transaction data processing method and device, computer equipment and storage medium
CN114610635A (en) Interface test case generation method and device, computer equipment and storage medium
CN112187713A (en) Message conversion method, device, computer equipment and storage medium
CN113126955A (en) Random data generation method and device, intelligent terminal and storage medium
CN111240772A (en) Data processing method and device based on block chain and storage medium
CN113064584B (en) Idempotent implementation method, device, equipment and medium
CN111158642A (en) Data construction method and device, computer equipment and storage medium
CN116974581A (en) Code generation method, device, electronic equipment and storage medium
CN112181822A (en) Test method and test method for starting time consumption of application program
CN116719735A (en) Test case generation method and device
CN115934129A (en) Software project updating method and device, computer equipment and storage medium
CN113918193A (en) Gray level calling method, device, equipment and storage medium suitable for micro-service
CN112800194B (en) Interface change identification method, device, equipment and storage medium
CN115705297A (en) Code call detection method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant