Interface protocol verification method, device and system and storage medium
By introducing kafka message queue and preset protocol library into the business system, business data is obtained and verified asynchronously, the business system pressure and information leakage caused by interface protocol verification in the existing technology is solved, and efficient and secure interface protocol verification is achieved.
Patent Information
- Application Number
- CN202411723434.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-21
AI Technical Summary
In the prior art, the output of key fields through log printing is used to verify the interface protocol, resulting in high pressure on the service system server, which may be paralyzed, and there are security issues such as sensitive information leakage.
The asynchronous acquisition mechanism based on the kafka message queue is adopted to obtain the current business data from the business system, and select the target protocol rules associated with the target interface protocol from the preset protocol library to verify the current business data and determine the standardization of the interface protocol.
Without blocking the normal business processing of the business system, intelligent verification of the interface protocol is realized, the business processing efficiency and information security performance of the business system are improved, and the pressure of log printing on the server is avoided and sensitive information leakage is leaked.
Smart Images

Figure CN119676127A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to an interface protocol verification method, device, system and storage medium. Background Art
[0002] As the business demands in various business fields such as smart medical care and finance become higher and higher, the types of business become more and more complex, and the amount of business handled by business systems becomes more and more cumbersome, the reasonable calling of application interfaces by business systems has become the key to realizing business functions. In order to ensure the business processing efficiency of the business system, the interface protocol (such as the input and output parameter request protocol) that calls the application interface is verified correctly. In the related art, the interface protocol verification method is implemented by verifying the key fields output by log printing. This verification method has the following two problems: First, a large amount of log output puts great pressure on the business system server, and may even cause the business system server storage to be full, causing the business system to paralyze and reduce business processing efficiency; second, the printing of logs will cause some sensitive information to be printed, which will lead to information leakage and security issues. Summary of the invention
[0003] The present invention provides an interface protocol verification method, device, system and storage medium to at least solve the problems of low business processing efficiency, log information leakage and low business system security caused by performing interface protocol verification on key fields output by log printing. The technical solution of the present invention is as follows:
[0004] According to a first aspect of an embodiment of the present invention, an interface protocol verification method is provided, which is applied to an interface protocol verification system, and the method includes: based on a kafka message queue, asynchronously obtaining current business data from a business system; selecting, from a preset protocol library, a target protocol rule associated with a target interface protocol based on which current business data is processed in the business system; verifying the current business data according to the target protocol rule; and determining whether the target interface protocol complies with the specification according to the verification result.
[0005] In one implementation, the interface protocol verification system includes a flink stream computing platform for data verification and kafka for message transmission; the current business data is asynchronously obtained from the business system based on the kafka message queue, including: kafka receives the current business data published to kafka by the business system through the first thread; the current business data is the business data processed by the business system through the second thread; the flink stream computing platform obtains the current business data from kafka.
[0006] In one implementation, a target protocol rule associated with a target interface protocol based on which current business data is processed in a business system is selected from preset protocols, including: the flink stream computing platform determines the target interface protocol based on which the current business data is based based on a mapping relationship between the business type of the current business data and the interface protocol; and determines the target protocol rule associated with the target interface protocol based on an association relationship between the interface protocol and the protocol rule.
[0007] In one implementation, the current business data is verified according to the target protocol rules, including one or more of the following: verifying whether the current data type of the current business data is consistent with the target data type; verifying whether the current data format of the current business data is consistent with the target data format; verifying whether the current data length of the current business data is consistent with the target data length; verifying whether the current data range of the current business data is consistent with the target data range; verifying whether the current business node corresponding to the current business data is consistent with the target business node. Exemplarily, verifying whether the business nodes are consistent includes the following examples. First, verifying whether the authentication information (such as Token, API Key, etc.) requested by the business data is valid. Second, verifying whether there are security threats such as SQL injection, XSS attacks, etc. that are inconsistent with the target business nodes.
[0008] The following situations indicate that the current data is abnormal: verify that the current data type of the current business data is inconsistent with the target data type, and / or verify that the current data format of the current business data is inconsistent with the target data format, and / or verify that the current data length of the current business data is inconsistent with the target data length, and / or verify that the current data range of the current business data is inconsistent with the target data range, and / or verify that the current business node corresponding to the current business data is inconsistent with the target business node.
[0009] The following situations describe the current data specifications: verify that the current data type of the current business data is inconsistent with the target data type, or verify that the current data format of the current business data is inconsistent with the target data format, or verify that the current data length of the current business data is inconsistent with the target data length, or verify that the current data range of the current business data is inconsistent with the target data range, or verify that the current business node corresponding to the current business data is inconsistent with the target business node.
[0010] In one implementation, the method also includes: Kafka determines the target business type and target release time of the current business data, and stores the received current business data in the target partition corresponding to the target business type in the order of the target release time; the Flink stream computing platform subscribes to the subscription rules of the latest business data from Kafka in the order of the release time, and obtains the current business data from the target partition of Kafka.
[0011] In one implementation, determining whether the target interface protocol complies with the specification is based on the verification result, including: when the verification result indicates that the current business data is abnormal data, determining that the target interface protocol does not comply with the specification, and identifying the current business data and storing it in an abnormal database; when the verification result indicates that the current business data is standard data, determining that the target interface protocol complies with the specification.
[0012] In one implementation, the method also includes: when monitoring the business system to update the interface protocol, obtaining the updated interface protocol from the business system; or; receiving the updated interface protocol fed back by the business system, and when the updated interface protocol of the business system is updated, the business system sends the updated interface protocol to the interface protocol verification system; storing the updated interface protocol in a preset protocol library, and configuring associated preset protocol rules for the updated interface protocol.
[0013] According to the second aspect of an embodiment of the present invention, an interface protocol verification device is provided, which is applied to an interface protocol verification system, and the device includes: an acquisition unit, which is used to asynchronously obtain current business data from a business system based on a kafka message queue; a determination unit, which is used to select, from a preset protocol library, a target protocol rule associated with a target interface protocol based on which the current business data is processed in the business system; a verification unit, which is used to verify the current business data according to the target protocol rule; and the verification unit is also used to determine whether the target interface protocol complies with the specification based on the verification result.
[0014] According to a third aspect of an embodiment of the present invention, there is provided an interface protocol verification system, which is configured to execute the interface protocol verification method of the first aspect and any possible implementation thereof.
[0015] According to a fourth aspect of an embodiment of the present invention, a business system is provided, which is configured to perform the following operations while performing business processing on business data: when the business system processes the current business data through the second thread, it publishes the current business data to the kafka of the interface protocol verification system through the first thread, so that kafka can asynchronously obtain the current business data; the business system updates the interface protocol, and when the interface protocol update is completed, sends the updated interface protocol to the interface protocol verification system, so as to update the interface protocol in the preset interface protocol library in the interface protocol verification system.
[0016] According to a fifth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which instructions are stored. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute an interface protocol verification method such as the first aspect and any possible implementation thereof.
[0017] According to a sixth aspect of an embodiment of the present disclosure, a computer program product is provided, the computer program product comprising computer instructions, which, when executed on an electronic device, enables the electronic device to execute the interface protocol verification method of the first aspect and any possible implementation thereof.
[0018] The technical solution provided by the embodiment of the present invention brings at least the following beneficial effects: based on the kafka message queue, the current business data is asynchronously obtained from the business system, which can ensure that the normal business processing of the business system will not be blocked during the process of transmitting data from the business system to the interface protocol verification system. In order to further improve the verification efficiency and reduce the number of invalid verifications using invalid protocol rules, the target protocol rules are determined based on the association between the interface protocol and the protocol rules based on the current data, so as to quickly and accurately verify the current business data based on the target protocol rules, and determine the standardization of the target interface protocol based on the verification results.
[0019] Through the above verification method, the interface protocol verification system is based on the kafka message queue and preset protocol rules, and realizes intelligent verification of the interface protocol without the business system's perception. The verification process does not interfere with the business system, does not occupy the storage of the business system server, avoids the log printing output in the related technology, occupies the business system server storage, reduces the probability of business system paralysis, and improves the business processing efficiency of the business system; at the same time, it avoids the output of sensitive information in the process of printing logs, thereby reducing the risk of sensitive information leakage and improving the information security performance of the business system. At the same time, this verification method can ensure the real-time nature of the acquired business data, thereby ensuring real-time verification of the business data. Compared with the keyword verification of log output, it reduces the lag of verification, ensures the timeliness of verification, and improves the verification efficiency.
[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0022] Figure 1is a schematic diagram of an interface protocol verification system according to an exemplary embodiment;
[0023] Figure 2 is a flow chart of an interface protocol verification method according to an exemplary embodiment;
[0024] Figure 3 is a block diagram of an interface protocol verification device according to an exemplary embodiment;
[0025] Figure 4 The figure is a schematic diagram of an interface protocol verification device according to an exemplary embodiment. DETAILED DESCRIPTION
[0026] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0028] Before introducing in detail the interface protocol verification method provided in the embodiment of the present application, a brief introduction is first given to the application scenarios and implementation architecture involved in the embodiment of the present application.
[0029] First, a brief introduction to the application scenarios involved in this application is given.
[0030] As the business demands in various business fields such as smart medical care and finance become higher and higher, the types of business become more and more complex, and the amount of business handled by business systems becomes more and more cumbersome, the reasonable calling of application interfaces by business systems has become the key to realizing business functions. In order to ensure the business processing efficiency of the business system, the interface protocol (such as the input and output parameter request protocol) that calls the application interface is verified correctly. In the related art, the interface protocol verification method is implemented by verifying the key fields output by log printing. This verification method has the following two problems: First, a large amount of log output puts great pressure on the business system server, and may even cause the business system server storage to be full, causing the business system to paralyze and reduce business processing efficiency; second, the printing of logs will cause some sensitive information to be printed, which will lead to information leakage and security issues.
[0031] In response to the above problems, this application proposes an interface protocol verification method, which asynchronously obtains current business data from the business system based on the kafka message queue, and can ensure that the normal business processing of the business system will not be blocked during the process of transmitting data from the business system to the interface protocol verification system. In order to further improve the verification efficiency and reduce the number of invalid verifications using invalid protocol rules, the target protocol rules are determined based on the association between the interface protocol and the protocol rules based on the current data, so as to quickly and accurately verify the current business data based on the target protocol rules, and determine the standardization of the target interface protocol based on the verification results.
[0032] Through the above verification method, the interface protocol verification system is based on the kafka message queue and preset protocol rules, and realizes intelligent verification of the interface protocol without the business system's perception. The verification process does not interfere with the business system, does not occupy the storage of the business system server, avoids the log printing output in the related technology, occupies the business system server storage, reduces the probability of business system paralysis, and improves the business processing efficiency of the business system; at the same time, it avoids the output of sensitive information in the process of printing logs, thereby reducing the risk of sensitive information leakage and improving the information security performance of the business system. At the same time, this verification method can ensure the real-time nature of the acquired business data, thereby ensuring real-time verification of the business data. Compared with the keyword verification of log output, it reduces the lag of verification, ensures the timeliness of verification, and improves the verification efficiency.
[0033] Secondly, the implementation architecture involved in this application is briefly introduced below.
[0034] Figure 1 Schematic diagram of an interface protocol verification system provided by the present disclosure. Figure 1 As shown, the interface protocol verification system includes a data reporting module 101, a protocol management module 102, a protocol verification module 103 and an early warning module 104. The data reporting module 101, the protocol management module 102, the protocol verification module 103 and the early warning module 104 are connected through communication.
[0035] The data reporting module 101 is used to asynchronously report data through Kafka according to the provided SDK timing after the application interface is called or called. This asynchronous method can reduce the intrusion into the business logic and will not affect the normal business. At the same time, there will not be a large fluctuation in the time consumption of system functions.
[0036] Specifically, the data reporting process is as follows: the application system introduces the SDK and accesses the interface protocol check function. The SDK package encapsulates the data reporting module, which supports the system to asynchronously upload the messages generated during the operation process to Kafka. Independent thread processing is used, which does not affect the normal business of the system.
[0037] The protocol management module 102 is used to collect and summarize the interface protocols in the system and enter them into the protocol management platform. The protocols include but are not limited to the mandatory input and output parameter fields, field types, and non-empty fields. The subsequent protocol check function is based on the protocol of the protocol management module 102 for checking and verification. Whether it is the provider or the caller, in the development process, the first link must include the definition of the interface. At the same time, for the functions that have been put into use online, most of the interface documents are missing. A complete interface protocol is more conducive to the subsequent maintenance of the system.
[0038] The protocol verification module 103 is used to perform various protocol content checks on the reported message data according to the protocol in the protocol management module 102, including but not limited to one-to-one comparison of the basic input and output parameter fields, whether the field types match, whether the fields are not empty, etc. If any field fails any check, it is marked as failed.
[0039] Specifically, the protocol verification process is as follows: On the Flink stream processing platform, receive messages from Kafka and verify the accuracy of the reported data and the predetermined protocol, including data completeness, format accuracy, value range, etc.
[0040] The protocol verification module 103 is also used for protocol configuration reflux. Specifically, it mainly targets the interface protocols that have not been entered in the online history. Through the actual request input and output parameter messages, the corresponding interface protocols are generated and entered into the interface protocol management platform to facilitate subsequent function maintenance and upgrade transformation. At the same time, it can also prevent the upstream and downstream interface field adjustment protocols from being updated synchronously to ensure that the actual online use is consistent with the interface protocol. The manual update of the interface protocol for protocol maintenance has high labor costs and is prone to errors. The above-mentioned automatic matching and verification of the protocol and the system operation message improves the correctness of the interface protocol and greatly reduces the cost of manual maintenance.
[0041] If the agreement does not match or is not entered, the relevant person in charge will be notified via email or quick messaging to facilitate timely discovery and handling of online anomalies.
[0042] The early warning module 104 is used to record and warn abnormal data, retain the content of the verification failed record data and abnormal items, and notify the contact person through email, SMS, etc., which is helpful for system optimization and troubleshooting.
[0043] The above interface protocol verification system collects and summarizes the interfaces called online by the system and uniformly enters them into the interface protocol management platform, which makes it easier for subsequent developers to quickly get familiar with related business functions, and is also conducive to the management of system interfaces and subsequent function maintenance and upgrades. At the same time, data packets are asynchronously reported through kafka+flink, and then automatically compared and checked according to the protocol, and alarms are sent to the relevant person in charge for abnormal interfaces. Compared with the conventional process of manually troubleshooting and locating problems after manually discovering them, problems can be discovered more promptly.
[0044] For ease of understanding, the interface protocol verification method provided by the present application is specifically introduced below with reference to the accompanying drawings.
[0045] Figure 2 is a flow chart of an interface protocol verification method according to an exemplary embodiment. Figure 2 As shown, the interface protocol verification method includes the following steps.
[0046] S11, based on the Kafka message queue, asynchronously obtains current business data from the business system.
[0047] S12, selecting a target protocol rule associated with a target interface protocol based on which current business data is processed in the business system from a preset protocol library.
[0048] In some implementations, the interface protocol in the business system is mirrored to a preset protocol library of the interface protocol verification system.
[0049] Specifically, the preset protocol library of the interface protocol verification system stores the interface protocols of different application interfaces in the business system, and sets different protocol rules for each interface protocol, which are used to verify the business data under the corresponding interface protocol.
[0050] S13, verify the current business data according to the target protocol rules.
[0051] Based on the above implementation manner, different target interface protocols correspond to different preset protocol rules.
[0052] If the data volume of the current business data is less than the preset data volume or the data type types of the current business data are greater than the preset types, it means that the verification process is simple or the verification process is based on more rules. Compared with the verification process, the process of determining the target protocol rules from the preset protocol rules takes up a larger proportion of time and has a lower impact on improving the verification speed. In order to improve the verification efficiency, all preset protocol rules are directly used to verify the current business data, that is, the target protocol rules are directly the preset protocol rules.
[0053] If the data volume of the current business data is greater than or equal to the preset data volume, or the data type type of the current business data is less than the preset type type, it means that the verification process is complicated or the rules based on the verification process are relatively small, and the time proportion occupied by the process of determining the target protocol rules from the preset protocol rules is relatively small, which can greatly improve the verification speed. In order to improve the verification efficiency, the target protocol rules that match the current business data are screened out from the preset protocol rules, that is, the target protocol rules are the protocol rules determined from the preset protocol rules, and then the target protocol rules are used to verify the current business data.
[0054] S14, determining whether the target interface protocol complies with the specification according to the verification result.
[0055] In this implementation, based on the kafka message queue, the current business data is asynchronously obtained from the business system, which can ensure that the normal business processing of the business system will not be blocked during the process of transmitting data from the business system to the interface protocol verification system. In order to further improve the verification efficiency and reduce the number of invalid verifications using invalid protocol rules, the target protocol rules are determined based on the association between the interface protocol and the protocol rules based on the current data, so as to quickly and accurately verify the current business data based on the target protocol rules, and determine the standardization of the target interface protocol based on the verification results.
[0056] Through the above verification method, the interface protocol verification system is based on the kafka message queue and preset protocol rules, and realizes intelligent verification of the interface protocol without the business system's perception. The verification process does not interfere with the business system, does not occupy the storage of the business system server, avoids the log printing output in the related technology, occupies the business system server storage, reduces the probability of business system paralysis, and improves the business processing efficiency of the business system; at the same time, it avoids the output of sensitive information in the process of printing logs, thereby reducing the risk of sensitive information leakage and improving the information security performance of the business system. At the same time, this verification method can ensure the real-time nature of the acquired business data, thereby ensuring real-time verification of the business data. Compared with the keyword verification of log output, it reduces the lag of verification, ensures the timeliness of verification, and improves the verification efficiency.
[0057] As a refinement and extension of the specific implementation method of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, the embodiment of the present application provides another interface protocol verification method.
[0058] As an implementation mode, the interface protocol verification system includes a flink stream computing platform for data verification and a kafka for message transmission. The above step S11 obtains the current specific process as follows.
[0059] First, Kafka receives the current business data published to Kafka by the business system through the first thread; the current business data is the business data processed by the business system through the second thread.
[0060] Second, the Flink stream computing platform obtains current business data from Kafka.
[0061] In this implementation mode, the business system completes business data processing and business data publishing respectively based on different threads to ensure that the two do not interfere with each other while also ensuring business processing efficiency and business data publishing efficiency.
[0062] Further, as another implementation, the above step S11 obtains the current specific process as follows.
[0063] First, Kafka determines the target business type and target release time of the current business data, and stores the received current business data in the target partition corresponding to the target business type in the order of the target release time.
[0064] Second, the Flink stream computing platform subscribes to the latest business data from Kafka in the order of release time, and obtains the current business data from the target partition of Kafka.
[0065] In this implementation, the received service data is smoothly distributed in each partition according to the service type and release time, so that the interface protocol verification system can quickly and accurately locate the current service data.
[0066] As an implementation manner, the specific process of determining the target protocol rule in the above step S12 is as follows.
[0067] First, the Flink stream computing platform determines the target interface protocol based on the mapping relationship between the business type of the current business data and the interface protocol.
[0068] Secondly, based on the association relationship between the interface protocol and the protocol rule, the target protocol rule associated with the target interface protocol is determined.
[0069] Optionally, in one implementation, the current business data is verified in the above step S13, including one or more of the following.
[0070] First, check whether the current data type of the current business data is consistent with the target data type.
[0071] Second, verify whether the current data format of the current business data is consistent with the target data format.
[0072] Third, check whether the current data length of the current business data is consistent with the target data length.
[0073] Fourth, verify whether the current data range of the current business data is consistent with the target data range.
[0074] Fifth, verify whether the current business node corresponding to the current business data is consistent with the target business node.
[0075] Exemplarily, checking whether the business nodes are consistent includes the following examples: First, verifying whether the authentication information (such as Token, API Key, etc.) of the business data request is valid. Second, verifying whether there are security threats such as SQL injection, XSS attack, etc. that are inconsistent with the target business node.
[0076] The following situations indicate that the current data is abnormal: verify that the current data type of the current business data is inconsistent with the target data type, and / or verify that the current data format of the current business data is inconsistent with the target data format, and / or verify that the current data length of the current business data is inconsistent with the target data length, and / or verify that the current data range of the current business data is inconsistent with the target data range, and / or verify that the current business node corresponding to the current business data is inconsistent with the target business node.
[0077] The following situations describe the current data specifications: verify that the current data type of the current business data is inconsistent with the target data type, or verify that the current data format of the current business data is inconsistent with the target data format, or verify that the current data length of the current business data is inconsistent with the target data length, or verify that the current data range of the current business data is inconsistent with the target data range, or verify that the current business node corresponding to the current business data is inconsistent with the target business node.
[0078] Based on the above implementation, the above step S14 determines whether the target interface protocol complies with the specification according to the verification result, which specifically includes the following steps.
[0079] First, when the verification result indicates that the current business data is abnormal data, it is determined that the target interface protocol does not conform to the specification, and the current business data is marked and stored in the abnormal database.
[0080] Secondly, when the verification result indicates that the current business data is standard data, it is determined that the target interface protocol complies with the standard.
[0081] In some embodiments, the current business data is abnormal data, and an early warning message is sent to indicate the abnormality.
[0082] In this implementation, abnormal current business data is identified and stored in an abnormal database to facilitate user query.
[0083] In one embodiment, when it is monitored that the business system updates the interface protocol, the updated interface protocol is obtained from the business system; or; the updated interface protocol is fed back by the business system, and the updated interface protocol is sent by the business system to the interface protocol verification system when the update of the business system interface protocol is completed; the updated interface protocol is stored in a preset protocol library, and the associated preset protocol rules are configured for the updated interface protocol.
[0084] In some implementations, the interface protocol verification system polls or monitors the interface protocol preset in the business system in real time according to a preset period to determine whether the interface protocol in the business system is updated.
[0085] In other implementations, when the business system updates the interface protocol in the preset protocol library, the business system publishes the updated interface protocol to the preset protocol library of the interface protocol verification system through a third thread based on Kafka.
[0086] In this embodiment, it is ensured that the interface protocol verification system is consistent with the interface protocol included in the business system, so as to ensure that the interface protocol and protocol rules used in the verification process are sufficient and complete, so as to ensure that the verification process of the current business data is completely sufficient, thereby avoiding the problem of insufficient verification of the current business data due to insufficient interface protocol rules.
[0087] In order to realize the above functions, the interface protocol verification device includes hardware structures and / or software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0088] The present disclosure also provides a Figure 3 The interface protocol verification device shown is applied to an interface protocol verification system, and the device includes: an acquisition unit 301, a determination unit 302, and a verification unit 303.
[0089] The acquisition unit 301 is used to asynchronously acquire current business data from the business system based on the Kafka message queue.
[0090] The determination unit 302 is used to select, from a preset protocol library, a target protocol rule associated with a target interface protocol based on which the current business data is processed in the business system.
[0091] The verification unit 303 is used to verify the current service data according to the target protocol rule, and determine whether the target interface protocol complies with the specification according to the verification result.
[0092] In one embodiment, the interface protocol verification system includes a flink stream computing platform for data verification and a kafka for message transmission.
[0093] The acquisition unit 301 is specifically used for: Kafka receives the current business data published to Kafka by the business system through the first thread; the current business data is the business data processed by the business system through the second thread; the Flink stream computing platform obtains the current business data from Kafka.
[0094] In one embodiment, the determination unit 302 is specifically used for: the flink stream computing platform determines the target interface protocol based on the mapping relationship between the business type of the current business data and the interface protocol; and, based on the association relationship between the interface protocol and the protocol rule, determines the target protocol rule associated with the target interface protocol.
[0095] In one embodiment, the verification unit 303 is specifically used to perform one or more of the following: verifying whether the current data type of the current business data is consistent with the target data type; verifying whether the current data format of the current business data is consistent with the target data format; verifying whether the current data length of the current business data is consistent with the target data length; verifying whether the current data range of the current business data is consistent with the target data range; verifying whether the current business node corresponding to the current business data is consistent with the target business node.
[0096] In one embodiment, the acquisition unit 301 is also specifically used for: Kafka determines the target business type and target release time of the current business data, and stores the received current business data in the target partition corresponding to the target business type in the order of the target release time; the Flink stream computing platform subscribes to the subscription rules of the latest business data from Kafka in the order of the release time, and obtains the current business data from the target partition of Kafka.
[0097] In one embodiment, the verification unit 303 is specifically used to: when the verification result indicates that the current business data is abnormal data, determine that the target interface protocol does not comply with the specification, and store the current business data in the abnormal database after identifying it; when the verification result indicates that the current business data is standard data, determine that the target interface protocol complies with the specification.
[0098] In one embodiment, the acquisition unit 301 is also specifically used to: acquire an updated interface protocol from the business system when monitoring that the business system updates the interface protocol; or; receive an updated interface protocol fed back by the business system, the updated interface protocol being sent by the business system to the interface protocol verification system when the update of the interface protocol is completed; store the updated interface protocol in a preset protocol library, and configure associated preset protocol rules for the updated interface protocol.
[0099] Regarding the device in the above embodiment, the specific manner in which each unit module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0100] Figure 4 This is a schematic diagram of an interface protocol verification device provided by this application. Figure 4 The interface protocol verification device 50 may include at least one processor 501 and a memory 503 for storing processor executable instructions. The processor 501 is configured to execute instructions in the memory 503 to implement the interface protocol verification method in the following embodiments.
[0101] In addition, the interface protocol verification device 50 may also include a communication bus 502 , at least one communication interface 504 , an input device 506 and an output device 505 .
[0102] The processor 501 may be a central processing unit (CPU), a microprocessing unit, an ASIC, or one or more integrated circuits for controlling the execution of the program of the present application.
[0103] Communication bus 502 may include a pathway for transmitting information between the above-mentioned components.
[0104] The communication interface 504 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.
[0105] The input device 506 is used to receive input signals and the output device 505 is used to output signals.
[0106] The memory 503 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory may be independent and connected to the processing unit via a bus. The memory may also be integrated with the processing unit.
[0107] The memory 503 is used to store instructions for executing the solution of the present application, and the execution is controlled by the processor 501. The processor 501 is used to execute the instructions stored in the memory 503, so as to realize the functions in the method of the present application.
[0108] In a specific implementation, as an embodiment, the processor 501 may include one or more CPUs, such as Figure 4 CPU0 and CPU1 in.
[0109] In a specific implementation, as an embodiment, the interface protocol verification device 50 may include multiple processors, such as Figure 4 501 and processor 507 in the embodiment of the present invention. Each of these processors may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0110] The interface protocol verification device is as follows Figure 4 The system shown includes: a processor 501 and a memory 503 for storing executable instructions of the processor 501; wherein the processor 501 is configured to execute the executable instructions to implement the interface protocol verification method of any possible implementation method described above. And the same technical effect can be achieved, so it will not be repeated here to avoid repetition.
[0111] The embodiment of the present application also provides a computer-readable storage medium, when the instructions in the computer-readable storage medium are executed by the processor of the interface protocol verification device or the interface protocol verification device, the interface protocol verification device or the interface protocol verification device can execute the interface protocol verification method of any possible implementation method as described above. And the same technical effect can be achieved, so it will not be repeated here to avoid repetition.
[0112] An embodiment of the present application also provides a business system, which is configured to perform the following operations while performing business processing on business data: when the business system processes the current business data through the second thread, it publishes the current business data to the Kafka of the interface protocol verification system through the first thread, so that Kafka asynchronously obtains the current business data; the business system updates the interface protocol, and when the interface protocol update is completed, sends the updated interface protocol to the interface protocol verification system to update the interface protocol in the preset interface protocol library in the interface protocol verification system.
[0113] The embodiment of the present application also provides a computer program product, including a computer program or instruction, which is executed by a processor as an interface protocol verification method of any possible implementation method described above. And the same technical effect can be achieved, so it will not be repeated here to avoid repetition.
[0114] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0115] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. An interface protocol verification method, characterized in that: Applied to an interface protocol verification system, the method comprises: Based on the Kafka message queue, asynchronously obtain current business data from the business system; Selecting, from a preset protocol library, a target protocol rule associated with a target interface protocol according to which the current business data is processed in the business system; Verifying the current service data according to the target protocol rule; Determine whether the target interface protocol complies with the specification based on the verification result.
2. The interface protocol verification method according to claim 1, characterized in that: The interface protocol verification system includes a flink stream computing platform for data verification and a kafka for message transmission; The method of asynchronously obtaining current business data from the business system based on the kafka message queue includes: The kafka receives the current business data published by the business system to the kafka through the first thread; The current business data is business data processed by the business system through the second thread; The flink stream computing platform obtains the current business data from the kafka.
3. The interface protocol verification method according to claim 2, characterized in that: The selecting, from the preset protocols, a target protocol rule associated with a target interface protocol according to which the current business data is processed in the business system comprises: The flink stream computing platform determines the target interface protocol based on the current business data based on the mapping relationship between the business type of the current business data and the interface protocol; And, based on the association relationship between the interface protocol and the protocol rule, the target protocol rule associated with the target interface protocol is determined.
4. The interface protocol verification method according to claim 2, characterized in that: The verifying the current service data according to the target protocol rule may include one or more of the following: Verify whether the current data type of the current business data is consistent with the target data type; Verifying whether the current data format of the current business data is consistent with the target data format; Checking whether the current data length of the current service data is consistent with the target data length; Verify whether the current data range of the current business data is consistent with the target data range; Verify whether the current service node corresponding to the current service data is consistent with the target service node.
5. The interface protocol verification method according to claim 2, characterized in that: The method further comprises: The kafka determines the target business type and target release time of the current business data, and stores the received current business data in the target partition corresponding to the target business type in the order of the target release time; The flink stream computing platform subscribes to the subscription rule of the latest business data from the kafka in the order of publishing time, and obtains the current business data from the target partition of the kafka.
6. The interface protocol verification method according to claim 2, characterized in that: Determining whether the target interface protocol complies with the specification according to the verification result includes: In the case where the verification result indicates that the current service data is abnormal data, determining that the target interface protocol does not conform to the specification, and identifying the current service data and storing it in an abnormal database; In a case where the verification result indicates that the current service data is standard data, it is determined that the target interface protocol complies with the standard.
7. The interface protocol verification method according to any one of claims 1 to 6, characterized in that: The method further comprises: In the case of monitoring that the business system updates the interface protocol, obtaining the updated interface protocol from the business system; or; receiving the updated interface protocol fed back by the business system, the updated interface protocol is sent by the business system to the interface protocol verification system when the update of the business system interface protocol is completed; The updated interface protocol is stored in the preset protocol library, and associated preset protocol rules are configured for the updated interface protocol.
8. An interface protocol verification device, characterized in that: Applied to an interface protocol verification system, the device comprises: The acquisition unit is used to asynchronously obtain current business data from the business system based on the Kafka message queue; A determination unit, configured to select, from a preset protocol library, a target protocol rule associated with a target interface protocol according to which the current business data is processed in the business system; A verification unit, configured to verify the current service data according to the target protocol rule; The verification unit is also used to determine whether the target interface protocol complies with the specification according to the verification result.
9. An interface protocol verification system, characterized in that: The interface protocol verification system is configured to execute the interface protocol verification method according to any one of claims 1 to 7.
10. A business system, characterized in that: The business system is configured to perform the following operations while performing business processing on the business data: when the business system processes the current business data through the second thread, the business system publishes the current business data to the Kafka of the interface protocol verification system through the first thread, so that the Kafka asynchronously obtains the current business data; The business system updates the interface protocol, and when the interface protocol update is completed, sends the updated interface protocol to the interface protocol verification system to update the interface protocol in the preset interface protocol library in the interface protocol verification system.
11. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an interface protocol verification device, the interface protocol verification device is enabled to execute the interface protocol verification method according to any one of claims 1 to 7.