Service contract changes to testing methods, devices, storage media and processors

By detecting the consistency of contract component versions and content between service consumers and providers, the problem of inaccurate service contract change detection in microservice architecture is solved, enabling fast and accurate contract change detection and synchronous upgrades, thus ensuring system stability.

CN119583348BActive Publication Date: 2026-01-06CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411619508.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-13
Publication Date
2026-01-06
Estimated Expiration
2044-11-13

AI Technical Summary

Technical Problem

In a microservices architecture, the failure of service consumers to update in a timely manner can lead to malfunctions in the distributed system. Existing methods for detecting these issues through service contract documents are not accurate enough, affecting the assessment of the scope of impact of service contract changes.

Method used

By receiving the service contract component reference version and verification information from the service consumer, the system obtains the operating version and compatibility information of the contract management platform, performs version and content consistency checks, and triggers alarms to determine whether the service provider has made contract changes.

Benefits of technology

Rapid and accurate detection of service contract changes reduces the impact of erroneous judgments, ensures timely upgrades for service consumers, and avoids system anomalies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583348B_ABST
    Figure CN119583348B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a service contract change detection method and device, a storage medium and a processor. The method comprises: after any service consumer references a service contract component of any service provider, receiving a reference version of the service contract component and first verification information sent by the service consumer; obtaining a running version of the service contract component, first compatibility information of the reference version and the running version, second verification information and second compatibility information of the running version in a contract management platform; comparing the reference version and the running version to obtain a first detection result of whether the versions are consistent; determining a second detection result of whether the versions are compatible according to the reference version and the second compatibility information; and / or determining a third detection result of whether the contents are consistent according to the first verification information and the second verification information; and quickly and accurately detecting whether the service contract of the service provider has changed according to at least one of the first detection result, the second detection result and the third detection result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a method, apparatus, storage medium, and processor for detecting changes in service contracts. Background Technology

[0002] Microservice architecture is one of the most popular application architectures today. In microservice architecture, a traditional monolithic application is broken down into multiple microservice applications, typically defined by business domains. A system using microservice architecture is a distributed system. When the service contract of a service provider changes, the corresponding service consumer cannot proactively detect this change. If the service consumer fails to update synchronously with the service provider, it can easily lead to functional abnormalities in the distributed system.

[0003] Currently, service contract documents that maintain the call relationships between services are primarily used to detect changes to service contracts provided by service providers, thereby identifying service consumers that need to upgrade their service contracts. However, recording call relationships through service contract documents can be problematic. If these documents are not updated in a timely manner, or if the maintained service contract documents are inconsistent with the actual operational situation, the detection of service contract changes by service providers may be inaccurate. This can affect subsequent assessments of the scope of impact of service contract changes and hinder timely upgrades for affected service consumers. Summary of the Invention

[0004] The purpose of this application is to provide a service contract change detection method, apparatus, storage medium, processor, and computer program product.

[0005] To achieve the above objectives, the first aspect of this application provides a method for detecting changes to service contracts, comprising:

[0006] After any service consumer references any service provider's service contract component, it receives the referenced version of the service contract component and the first verification information sent by the service consumer.

[0007] Obtain the running version and referenced version of the service contract components maintained in the contract management platform, as well as the second verification information and second compatibility information of the running version;

[0008] Compare the referenced version and the runtime version to obtain the first detection result of whether the referenced version and the runtime version are consistent;

[0009] The second detection result determines whether the running version is compatible with the referenced version based on the referenced version and second compatibility information; and / or

[0010] The third detection result determines whether the content of the service contract component in the running version is consistent with that of the contract component in the referenced version, based on the first and second verification information.

[0011] Based on the first test result, and at least one of the second and third test results, determine whether the service provider has changed its service contract.

[0012] In this embodiment of the application, the third detection result for determining whether the content of the service contract component in the running version is consistent with the content of the contract component in the referenced version, based on the first verification information and the second verification information, includes: comparing the first verification information and the second verification information; if the first verification information and the second verification information are consistent, determining that the third detection result is that the content of the service contract component in the running version is consistent with the content of the contract component in the referenced version; if the first verification information and the second verification information are inconsistent, determining that the third detection result is that the content of the service contract component in the running version is inconsistent with the content of the contract component in the referenced version.

[0013] In this embodiment of the application, it is determined that the service provider has not changed the service contract if all of the following conditions are met: the first detection result is that the reference version and the running version are inconsistent; the second detection result is that the running version is compatible with the reference version; and the third detection result is that the content of the service contract component of the running version is consistent with the content of the contract component of the reference version.

[0014] In this application embodiment, it is determined that the service provider has not changed the service contract if all of the following conditions are met: the first detection result is that the referenced version and the running version are consistent; the third detection result is that the content of the service contract component of the running version is consistent with the content of the contract component of the referenced version.

[0015] In this embodiment of the application, a service contract change by the service provider is determined when all of the following conditions are met: the first detection result is that the referenced version and the running version are inconsistent; the second detection result is that the running version is incompatible with the referenced version.

[0016] In this embodiment of the application, a service contract change by the service provider is determined to occur when all of the following conditions are met: the first detection result is that the reference version and the running version are inconsistent; the second detection result is that the running version is compatible with the reference version; and the third detection result is that the content of the service contract component of the running version is inconsistent with the content of the contract component of the reference version.

[0017] In this embodiment of the application, a service contract change by the service provider is determined to be occurring if all of the following conditions are met: the first detection result is that the referenced version and the running version are consistent; the third detection result is that the content of the service contract component in the running version is inconsistent with the content of the contract component in the referenced version.

[0018] In this embodiment of the application, the method further includes: triggering an alarm when it is determined that the service provider has changed its service contract, so as to prompt the user terminal to determine the scope of the impact of the service provider's service contract change.

[0019] In this embodiment of the application, the service contract component is referenced by the service consumer from the central repository, and the service contract component is constructed by the service provider based on the entity class of the service contract request and return parameters and published to the central repository.

[0020] A second aspect of this application provides a service contract change detection device, comprising:

[0021] The information receiving module is used to receive the reference version and first verification information of the service contract component sent by the service consumer after any service consumer references the service contract component of any service provider.

[0022] The information acquisition module is used to acquire the running version, the first compatibility information of the referenced version, and the second verification information and second compatibility information of the running version of the service contract component maintained in the contract management platform.

[0023] The version detection module is used to compare the referenced version and the running version to obtain the first detection result of whether the referenced version and the running version are consistent;

[0024] The compatibility detection module is used to determine whether the running version is compatible with the referenced version based on the first compatibility information and the second compatibility information; and / or

[0025] The verification information detection module is used to determine, based on the first verification information and the second verification information, a third detection result to determine whether the content of the service contract component in the running version is consistent with that of the contract component in the referenced version;

[0026] The contract change detection module is used to determine whether the service provider has changed its service contract based on the first detection result and at least one of the second and third detection results.

[0027] A third aspect of this application provides a processor configured to perform the service contract change detection method described above.

[0028] A fourth aspect of this application provides a machine-readable storage medium storing instructions that, when executed by a processor, configure the processor to perform the aforementioned service contract change detection method.

[0029] The fifth aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the above-described service contract change detection method.

[0030] The above technical solution detects whether the versions of the service contract components of the service consumer and the service provider are consistent, whether the content of the service contract components is consistent, and whether the versions of the service contract components are compatible. This avoids affecting the detection results of service contract changes due to inconsistencies or incompatibilities in the service contracts. It can quickly and accurately detect whether the service provider has changed its service contract, thereby reducing the error rate in determining the scope of impact of the service contract changes. This facilitates the timely discovery and synchronous upgrading of microservices that need to be upgraded in their service contracts.

[0031] Other features and advantages of the embodiments of this application will be described in detail in the following detailed description section. Attached Figure Description

[0032] The accompanying drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the following detailed description to explain the embodiments of this application, but do not constitute a limitation on the embodiments of this application. In the drawings:

[0033] Figure 1 This illustration schematically shows an application environment diagram of the service contract change detection method according to an embodiment of this application;

[0034] Figure 2 The schematic diagram illustrates a flowchart of a service contract change detection method according to an embodiment of this application;

[0035] Figure 3 This illustration schematically depicts a process diagram of a service provider publishing a service contract component according to an embodiment of this application;

[0036] Figure 4 A schematic diagram of a contract management platform according to an embodiment of this application is shown;

[0037] Figure 5 This illustration schematically shows a flowchart of the calculation of verification information according to an embodiment of this application;

[0038] Figure 6 This illustration schematically shows a service provider updating a version of a service contract component according to an embodiment of this application;

[0039] Figure 7 The illustration shows a flowchart of another service contract change detection method according to an embodiment of this application;

[0040] Figure 8 A timing diagram illustrating a service contract change detection method according to an embodiment of this application is shown schematically.

[0041] Figure 9This schematic diagram illustrates the structural block diagram of a service contract change detection device according to an embodiment of this application;

[0042] Figure 10 The diagram illustrates the internal structure of a computer device according to an embodiment of this application. Detailed Implementation

[0043] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only for illustration and explanation of the embodiments of this application and are not intended to limit the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0044] It should be noted that if the embodiments of this application involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.

[0045] The acquisition, transmission, storage, use, and processing of data in this application comply with relevant national laws and regulations. Furthermore, it should be noted that existing industry solutions such as software, components, and models may be mentioned in the embodiments of this application. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solution of this application, and do not imply that the applicant has already used or necessarily used such solutions.

[0046] The service contract change detection method provided in this application can be applied to, for example... Figure 1 In the application environment shown, the contract management platform 101 communicates with the service provider 102 and the service consumer 103. The contract management platform 101 can obtain version information of the corresponding contract components from the service provider 102. The contract management platform 101 maintains the running version of the service contract components corresponding to the service provider 102, which is sent to the contract management platform 101 by the service consumer 103. The service provider 102 can publish its service contract components to the central repository 104, and the service consumer 103 can reference the service contract components of the service provider 102 from the central repository 104.

[0047] Figure 2 A schematic flowchart illustrating a service contract change detection method according to an embodiment of this application is shown. Figure 2 As shown, in one embodiment of this application, a service contract change detection method is provided. This embodiment mainly applies this method to the above-mentioned... Figure 1 Taking the contract management platform 101 in the example, the following steps are included:

[0048] Step 202: After any service consumer references any service provider's service contract component, receive the referenced version of the service contract component and the first verification information sent by the service consumer.

[0049] Step 204: Obtain the running version, the first compatibility information of the referenced version, and the second verification information and second compatibility information of the running version of the service contract component maintained in the contract management platform.

[0050] A microservice application cluster comprises multiple microservice applications, each typically including a service provider and a service consumer. A service provider can correspond to at least one service consumer. A service provider is a service that provides interfaces for other services to call. A service consumer is a service that calls the interfaces provided by the service provider. The service contract component of the service provider includes the entity classes for the request and return parameters of the service contract.

[0051] In this embodiment of the application, the service contract component is referenced by the service consumer from the central repository, and the service contract component is constructed by the service provider based on the entity class of the service contract request and return parameters and published to the central repository.

[0052] Before any service consumer can reference any service provider's service contract component, the service provider's service contract component needs to be published first. The service provider can extract the entity classes of the service contract request and return parameters, compile and build them to obtain a JAR file containing the entity classes of the service contract request and return parameters, which is its service contract component. Afterwards, the service provider publishes its service contract component to the central repository.

[0053] like Figure 3The diagram illustrates a process for a service provider to publish a service contract component. The service provider (Service A in the diagram) includes a controller layer module, a business layer module, and a database layer module. The controller layer module interacts with the application frontend, receiving requests from the service consumer (Service B in the diagram). Based on these requests, it extracts entity classes related to the request's return parameters and stores them in the contract module. Compiling and building this contract module yields a JAR file containing the request and its return parameter entity classes—the Service A contract component. The service provider publishes its Service A contract component to a central repository (Maven in the diagram). The service consumer can send a call or import request, carrying the name, version, and organization ID of the Service A contract component. Based on this request, the Service A contract component can be imported into the central repository. The controller layer module calls the business layer module, which implements the specific business logic. The business layer module also calls the database layer module, which implements the logic for interacting with the database.

[0054] The central repository also maintains reference and version information for service contract components. Reference information may include the project organization or team identifier (groupId) and the project or module identifier (artifactId). Version information may include the version number of the service contract component. Service consumers can reference service contract components from service providers in the central repository. The central repository can be various project management and build tools, such as Maven and Gradle.

[0055] The above solution uses a service contract component abstracted by the service provider and publishes it to a central repository. Then, the service consumer can connect with the service provider by introducing the contract component. This eliminates the need for the service consumer to repeatedly build the service contract structure when calling the service provider, greatly reducing the possibility of errors in building complex contracts.

[0056] The contract management platform can manage the service contract components of service providers. The platform maintains information about these service contract components, including but not limited to reference information, version information, compatibility information between different versions, and verification information. For example, ... Figure 4 The diagram illustrates a contract management platform. This platform (the central service contract management platform shown in the diagram) maintains information on service A contract components, service B contract components, and service contract components from other service providers. The service A contract component information includes reference information, version number, verification information, and compatibility details for each version.

[0057] The reference information for Service A contract component includes the identifier of the project organization or team (groupId in the diagram) and the identifier of the project or module (artifactId in the diagram). When using Maven, the version number of Service A contract component corresponds to the version number in the Maven reference. Version compatibility is used to characterize the compatibility of a newer version of the service contract component with older versions. For example, in the diagram, version v1.1 of Service A contract component is compatible with version v1.0, while version v1.5 is incompatible with versions v1.0 and v1.1, but compatible with version v1.4.

[0058] If the new version of the service contract component is compatible with the old version, the service consumer does not need to upgrade. If the new version of the service contract component is incompatible with the old version, the service consumer needs to upgrade. For example, if the service provider adds a new interface, and the corresponding service contract adds entity classes for the request and return parameters of the new interface, but the service consumer does not call this new interface, then the service consumer does not need to upgrade, and the new version of the service contract component is compatible with the old version. If the service provider changes the name, structure, or type of the request or return parameters of the old interface, the service consumer needs to upgrade; otherwise, the interface call will fail, and the new version of the service contract is incompatible with the old version.

[0059] After a service contract component is published to the central repository, it can be configured with the identifier of the organization or team to which it belongs, the identifier of the project or module, and its version number. If a service provider publishes a service contract component but fails to update its version number, the service consumer will still assume it is referencing the latest version, even though the content has changed. This can lead to API calls that fail. Therefore, to avoid situations where service contract components have the same version but different content, verification information for the service contract components can be maintained in the contract management platform. This verification information ensures the consistency of content for service contract components of the same version. Each version of the service contract component corresponds to verification information, which can be calculated based on MD5.

[0060] For example, such as Figure 5The diagram illustrates a flowchart for calculating verification information. The contract management platform (i.e., the central management platform for service contracts in the diagram) maintains information about service contract component A. This information includes the version number, verification information, and reference information (not shown in the diagram) of service contract component A. The version number can include multiple iteratively updated versions, such as from the initial version V1.0 to the latest version V1.5. When calculating the verification information for version V1.5, the automatic verification information calculation module of the contract management platform can obtain the reference information and version information of service contract component A. The automatic verification information calculation module can retrieve the corresponding JAR file from the central repository based on the reference information and version information of service contract component A, and perform MD5 calculation on the retrieved JAR file to obtain the MD5 value. The MD5 value is the verification information for service contract component A version V1.5.

[0061] After referencing a service contract component from a service provider, the service consumer can send the referenced version of the service contract component and its first verification information to the contract management platform. The contract management platform can receive the referenced version and the first verification information. The first verification information can be calculated using MD5. The contract management platform can obtain the running version of the service contract component it maintains, the first compatibility information of the referenced version, and the second verification and second compatibility information of the running version. The running version of the service contract component refers to the version of the service contract component currently running by the service provider, which is generally the latest version. The second verification information can be calculated using MD5 by the contract management platform.

[0062] Service providers can interact with the contract management platform via heartbeat detection. They can obtain version information for their service contract components and send this information to the contract management platform to update the version identifier of the corresponding service contract component. This version identifier identifies the version number of the service contract component actually running within the current microservice cluster. For example, ... Figure 6 The diagram illustrates a service provider updating the version of a service contract component. Service provider A in the diagram can obtain its own contract component version information and update the running version marker of the corresponding contract component information in the central management platform for service contracts, i.e., the version number of service A's contract component information.

[0063] Step 206: Compare the referenced version and the running version to obtain the first detection result of whether the referenced version and the running version are consistent.

[0064] The contract management platform can compare the referenced version and the runtime version to determine if the referenced and runtime versions of the service contract component are consistent. If the referenced version and the runtime version are different, the first detection result is a version inconsistency. In this case, it indicates that the service provider has updated and released a new version of the service contract component, but there may still be compatibility or incompatibility issues between the runtime version and the referenced version. If the referenced version and the runtime version are the same, the first detection result is a version consistency. In this case, although the version of the service contract component provided by the service provider has not changed, the content of the service contract component may or may not have changed.

[0065] Step 208: Determine whether the running version is compatible with the second detection result of the referenced version based on the referenced version and the second compatibility information.

[0066] The contract management platform can determine the second detection result regarding whether the running version is compatible with the referenced version based on the first and second compatibility information. For example, the contract management platform can iterate through the second compatibility information to find versions compatible with the running version of the service contract component. Then, it can check whether the referenced version of the service contract component exists among the found compatible versions. If the referenced version of the service contract component exists among the found compatible versions, the second detection result is that the running version is compatible with the referenced version. If the referenced version of the service contract component does not exist among the found compatible versions, the second detection result is that the running version is incompatible with the referenced version.

[0067] Step 210: Determine the third detection result based on the first and second verification information to determine whether the content of the service contract component of the running version is consistent with that of the contract component of the referenced version.

[0068] The contract management platform can determine a third detection result based on the first and second verification information to determine whether the content of the running version of the service contract component is consistent with that of the referenced version of the contract component. The third detection result can be either that the content of the running version of the service contract component is consistent with that of the referenced version, or that the content of the running version of the service contract component is inconsistent with that of the referenced version of the contract component.

[0069] In this embodiment of the application, the third detection result for determining whether the content of the service contract component in the running version is consistent with the content of the contract component in the referenced version, based on the first verification information and the second verification information, includes: comparing the first verification information and the second verification information; if the first verification information and the second verification information are consistent, determining that the third detection result is that the content of the service contract component in the running version is consistent with the content of the contract component in the referenced version; if the first verification information and the second verification information are inconsistent, determining that the third detection result is that the content of the service contract component in the running version is inconsistent with the content of the contract component in the referenced version.

[0070] The contract management platform can compare the first and second verification information. If the first and second verification information are inconsistent, the third detection result is that the content of the running version of the service contract component is inconsistent with the content of the referenced version of the contract component. If the first and second verification information are consistent, the third detection result is that the content of the running version of the service contract component is consistent with the content of the referenced version of the contract component.

[0071] Step 212: Determine whether the service provider has changed its service contract based on the first test result and at least one of the second and third test results.

[0072] The contract management platform can determine whether the service provider has changed its service contract based on the first detection result and at least one of the second and third detection results.

[0073] In this embodiment of the application, it is determined that the service provider has not changed the service contract if all of the following conditions are met: the first detection result is that the reference version and the running version are inconsistent; the second detection result is that the running version is compatible with the reference version; and the third detection result is that the content of the service contract component of the running version is consistent with the content of the contract component of the reference version.

[0074] If the contract management platform determines that the first detection result indicates a discrepancy between the referenced version and the runtime version, it suggests that the service provider has updated and released a new version of the service contract component. However, there may still be compatibility or incompatibility issues between the runtime version and the referenced version. In this case, a second detection result is needed for further judgment. If the second detection result indicates that the runtime version is compatible with the referenced version, to avoid situations where the content of a referenced version with the same version number as the runtime version has changed, but the version number of the referenced version remains unchanged, and to further ensure the consistency of content between the runtime version and the referenced version, the third detection result indicates that the content of the service contract component in the runtime version is consistent with the content of the contract component in the referenced version. In this case, it can be determined that the service provider has not made any changes to the service contract.

[0075] The above solution, when the running version and the referenced version are inconsistent, combines the compatibility of the running version and the verification information of the running version and the referenced version to check whether the service contract of the service provider has changed. It ensures the consistency of the content of service contract components that are compatible with different versions, and avoids the impact of the service contract change detection results on the content of service contract components that are compatible with different versions.

[0076] In this application embodiment, it is determined that the service provider has not changed the service contract if all of the following conditions are met: the first detection result is that the referenced version and the running version are consistent; the third detection result is that the content of the service contract component of the running version is consistent with the content of the contract component of the referenced version.

[0077] If the contract management platform determines that the referenced version and the running version are consistent in the first detection result, then although the version of the service contract component of the service provider has not changed, the content of the service contract component may or may not have changed. In this case, it is necessary to combine the third detection result for judgment. If the third detection result shows that the content of the service contract component in the running version is consistent with the content of the contract component in the referenced version, then it can be determined that the service provider has not changed the service contract.

[0078] The above solution, when the running version and the referenced version are the same, combines the verification information of the running version and the referenced version to check whether the service contract of the service provider has changed, ensuring the consistency of the content of service contract components of the same version, and avoiding the impact of the service contract change detection results due to the inconsistency of the content of service contract components of the same version.

[0079] In this embodiment of the application, a service contract change by the service provider is determined when all of the following conditions are met: the first detection result is that the referenced version and the running version are inconsistent; the second detection result is that the running version is incompatible with the referenced version.

[0080] If the contract management platform determines that the first detection result is an inconsistency between the referenced version and the runtime version, it indicates that the service provider has updated and released a new version of the service contract component, but there may still be compatibility or incompatibility issues between the runtime version and the referenced version. In this case, it is necessary to combine the second detection result for judgment. If the second detection result is that the runtime version is incompatible with the referenced version, it can be determined that the service provider has changed the service contract.

[0081] The above solution, when the running version and the referenced version are inconsistent, checks whether the service contract of the service provider has been changed based on the compatibility of the running version, ensuring the compatibility of service contract components of different versions, and avoiding the impact of service contract change detection results due to incompatibility of service contract components of different versions.

[0082] In this embodiment of the application, a service contract change by the service provider is determined to occur when all of the following conditions are met: the first detection result is that the reference version and the running version are inconsistent; the second detection result is that the running version is compatible with the reference version; and the third detection result is that the content of the service contract component of the running version is inconsistent with the content of the contract component of the reference version.

[0083] If the contract management platform determines that the first detection result is an inconsistency between the referenced version and the runtime version, it indicates that the service provider has updated and released a new version of the service contract component, but there may still be compatibility or incompatibility issues between the runtime version and the referenced version. In this case, a second detection result is needed for further judgment. If the second detection result indicates that the runtime version is compatible with the referenced version, to avoid situations where the content of a referenced version with the same version number as the runtime version has changed, but the version number of the referenced version remains unchanged, and to further ensure the consistency of content between the runtime version and the referenced version, a third detection result indicates that the content of the service contract component in the runtime version is inconsistent with the content of the contract component in the referenced version. This confirms that the service provider has changed the service contract.

[0084] The above solution, when the running version and the referenced version are inconsistent, combines the compatibility of the running version and the verification information of the running version and the referenced version to check whether the service contract of the service provider has changed. It ensures the consistency of the content of service contract components that are compatible with different versions, and avoids the impact of the service contract change detection results on the content of service contract components that are compatible with different versions.

[0085] In this embodiment of the application, a service contract change by the service provider is determined to be occurring if all of the following conditions are met: the first detection result is that the referenced version and the running version are consistent; the third detection result is that the content of the service contract component in the running version is inconsistent with the content of the contract component in the referenced version.

[0086] If the contract management platform determines that the referenced version and the running version are consistent in the first detection result, then although the version of the service contract component of the service provider has not changed, the content of the service contract component may or may not have changed. In this case, it is necessary to combine the third detection result for judgment. If the third detection result shows that the content of the service contract component in the running version is inconsistent with the content of the contract component in the referenced version, then it can be determined that the versions of the service contract components are the same, but the content has changed. In this case, the contract management platform can determine that the service provider has made a service contract change.

[0087] The above solution, when the running version and the referenced version are the same, combines the verification information of the running version and the referenced version to check whether the service contract of the service provider has changed, ensuring the consistency of the content of service contract components of the same version, and avoiding the impact of the service contract change detection results due to the inconsistency of the content of service contract components of the same version.

[0088] In this embodiment of the application, the method further includes: triggering an alarm when it is determined that the service provider has changed its service contract, so as to prompt the user terminal to determine the scope of the impact of the service provider's service contract change.

[0089] If a service provider changes its service contract, the contract management platform can trigger an alert to prompt the user terminal to determine the scope of impact of the service provider's service contract change. The scope of impact refers to the service consumers affected by the changes to the service provider's service contract components.

[0090] The above solution can promptly issue an alarm when it is determined that the service provider's service contract has changed. This allows for timely determination of the scope of impact of the service provider's service contract change, enabling the service consumer to upgrade their service contract in a timely manner and ensuring the normal operation of the distributed systems of both the service provider and the service consumer.

[0091] like Figure 7 The diagram shows a flowchart of another service contract change detection method.

[0092] The service consumer sends the version number and verification information of the referenced contract component to the central service contract management platform. The central service contract management platform can determine whether the version number of the contract component referenced by the service consumer matches the version number of the service contract component actually running on the service provider's machine. If the version numbers match, it can determine whether the verification information of the referenced contract component's version matches the verification information of the service contract component actually running on the service provider's machine. If the verification information matches, it is determined that the service provider has not changed the service contract, and an alarm is triggered. If the verification information does not match, it is determined that the service provider has not changed the service contract, and an alarm is triggered.

[0093] If the version numbers match, it is determined whether the version of the service contract component actually running by the service provider is compatible with the version of the referenced contract component. If the versions are incompatible, it is determined that the service provider has not changed the service contract, and an alarm is triggered. If the versions are compatible, it is determined whether the verification information of the referenced contract component version is consistent with the verification information of the service contract component version actually running by the service provider. If the verification information is consistent, it is determined that the service provider has not changed the service contract, and an alarm is triggered. If the verification information is inconsistent, it is determined that the service provider has not changed the service contract, and an alarm is triggered.

[0094] like Figure 8 As shown, a timing diagram of a service contract change detection method is provided.

[0095] The service provider (Service A) extracts the entity classes related to the service contract request return parameters, abstracts these entity classes into a service contract module, compiles and builds the service contract module to obtain a JAR package containing the request and return parameter entity classes, i.e., the Service A contract component. The service provider sets the reference information and version information of the Service A contract component and publishes the service contract component to the central repository.

[0096] The service provider sends the reference information and version information of Service A contract component to the service contract central management platform. The service contract central management platform retrieves the JAR file of the service contract component from the central repository based on the reference and version information. The service contract central management platform performs an MD5 hash on the retrieved JAR file to obtain the verification information corresponding to the version information of Service A contract component, and writes the verification information into the component information of the corresponding Service A contract component.

[0097] Service consumer (Service B) references the contract component of Service A from the central repository and sends the version information and verification information of the contract component of Service A to the central service contract management platform. Service provider sends the version information of the contract component actually running in the microservice cluster to the central service contract management platform. The central service contract management platform compares the version information of the contract component referenced by Service B with the version information of the contract component actually running in the microservice cluster to see if they are consistent.

[0098] If the version information is consistent, the service contract central management platform compares the version verification information of the service A contract component referenced by the service consumer with the verification information of the same version recorded by the service contract central management platform. If the version information and verification information are consistent, the detection ends; if the version information is consistent but the verification information is inconsistent, service A updates the service contract component, triggering an alarm.

[0099] If the version information is inconsistent, the service contract central management platform checks whether the version of the contract component running in the current microservice cluster is compatible with the version of the contract component referenced by service B, based on the version compatibility information from the service contract central management platform. If the version information is inconsistent, the versions are compatible, and the verification information is consistent, the check ends; if the version information is inconsistent, the versions are compatible, but the verification information is inconsistent, an alarm is triggered. If the version information is inconsistent and the versions are incompatible, an alarm is triggered, and the check ends.

[0100] The above technical solution detects whether the versions of the service contract components of the service consumer and the service provider are consistent, whether the content of the service contract components is consistent, and whether the versions of the service contract components are compatible. This avoids affecting the detection results of service contract changes due to inconsistencies or incompatibilities in the service contracts. It can quickly and accurately detect whether the service provider has changed its service contract, thereby reducing the error rate in determining the scope of impact of the service contract changes. This facilitates the timely discovery and synchronous upgrading of microservices that need to be upgraded in their service contracts.

[0101] Figure 2 and 6 This is a flowchart illustrating a service contract change detection method in one embodiment. It should be understood that, although... Figure 2 and6 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 and 6 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0102] In one embodiment, such as Figure 9 As shown, a service contract change detection device 900 is provided, including an information receiving module 902, an information acquisition module 904, a version detection module 906, a compatibility detection module 908, a verification information detection module 910, and a contract change detection module 912, wherein:

[0103] The information receiving module 902 is used to receive the reference version of the service contract component and the first verification information sent by the service consumer after any service consumer references the service contract component of any service provider.

[0104] The information acquisition module 904 is used to acquire the running version and the first compatibility information of the referenced version of the service contract component maintained in the contract management platform, as well as the second verification information and the second compatibility information of the running version.

[0105] Version detection module 906 is used to compare the referenced version and the running version to obtain the first detection result of whether the referenced version and the running version are consistent.

[0106] The compatibility detection module 908 is used to determine whether the running version is compatible with the referenced version based on the first compatibility information and the second compatibility information.

[0107] The verification information detection module 910 is used to determine, based on the first verification information and the second verification information, the third detection result of whether the content of the service contract component of the running version is consistent with that of the contract component of the referenced version.

[0108] The contract change detection module 912 is used to determine whether the service provider has changed its service contract based on the first detection result and at least one of the second and third detection results.

[0109] A microservice application cluster comprises multiple microservice applications, each typically including a service provider and a service consumer. A service provider can correspond to at least one service consumer. A service provider is a service that provides interfaces for other services to call. A service consumer is a service that calls the interfaces provided by the service provider. The service contract component of the service provider includes the entity classes for the request and return parameters of the service contract.

[0110] After referencing a service contract component from a service provider, the service consumer can send the referenced version of the service contract component and the first verification information to the information receiving module 902. The information receiving module 902 can receive the referenced version of the service contract component and the first verification information. The first verification information can be calculated using MD5.

[0111] The information acquisition module 904 can acquire the running version and first compatibility information of the referenced version of the service contract component maintained by the contract management platform, as well as the second verification information and second compatibility information of the running version. The running version of the service contract component refers to the version of the service contract component currently being run by the service provider, which is generally the latest version. The second verification information can be obtained through MD5 calculation by the contract management platform.

[0112] The version detection module 906 compares the referenced version and the runtime version to determine if the referenced version and runtime version of the service contract component are consistent. If the referenced version and runtime version are different, the first detection result is a version mismatch. In this case, it indicates that the service provider has made changes to the service contract, meaning the service contract component has been modified. If the referenced version and runtime version are the same, the first detection result is a version match. In this case, although the version of the service provider's service contract component has not changed, the content of the service contract component may or may not have changed.

[0113] The compatibility detection module 908 can determine whether the running version is compatible with the referenced version based on the first compatibility information and the second compatibility information. For example, the compatibility detection module 908 can traverse the second compatibility information to find versions compatible with the running version of the service contract component. Then, it can detect whether the referenced version of the service contract component exists among the found compatible versions. If the referenced version of the service contract component exists among the found compatible versions, the second detection result is that the running version is compatible with the referenced version. If the referenced version of the service contract component does not exist among the found compatible versions, the second detection result is that the running version is incompatible with the referenced version.

[0114] The verification information detection module 910 can determine a third detection result based on the first verification information and the second verification information to determine whether the content of the service contract component in the running version is consistent with that of the referenced version. The third detection result can be that the content of the service contract component in the running version is consistent with that of the referenced version, or it can be that the content of the service contract component in the running version is inconsistent with that of the referenced version. Specifically, the verification information detection module 910 can compare the first verification information and the second verification information. If the first verification information and the second verification information are inconsistent, the third detection result is that the content of the service contract component in the running version is inconsistent with that of the referenced version. If the first verification information and the second verification information are consistent, the third detection result is that the content of the service contract component in the running version is consistent with that of the referenced version.

[0115] The contract change detection module 912 can determine whether the service provider has changed its service contract based on the first detection result and at least one of the second and third detection results. If the contract change detection module 912 determines that the first detection result is that the reference version and the running version are inconsistent, it indicates that the service provider has updated and released a new version of the service contract component, but there are still cases where the running version and the reference version are compatible or incompatible. In this case, it is necessary to combine the second detection result for judgment. If the second detection result is that the running version is compatible with the reference version, in order to avoid the situation where the content of the reference version with the same version number as the running version has changed, but the version number of the reference version remains unchanged, it also further ensures the consistency of the content between the running version and the reference version. If the third detection result is that the content of the service contract component in the running version is consistent with the content of the contract component in the reference version, it can be determined that the service provider has not changed its service contract.

[0116] If the contract change detection module 912 determines that the first detection result shows the referenced version and the running version are consistent, then although the version of the service contract component of the service provider has not changed, the content of the service contract component may or may not have changed. In this case, it is necessary to combine the third detection result for judgment. If the third detection result shows that the content of the service contract component in the running version is consistent with the content of the contract component in the referenced version, then it can be determined that the service provider has not changed the service contract.

[0117] If the contract change detection module 912 determines that the first detection result is that the referenced version and the runtime version are inconsistent, it indicates that the service provider has updated and released a new version of the service contract component, but there are still cases where the runtime version and the referenced version are compatible or incompatible. In this case, it is necessary to combine the second detection result for judgment. If the second detection result is that the runtime version is incompatible with the referenced version, it can be determined that the service provider has changed the service contract.

[0118] If the contract change detection module 912 determines that the first detection result is an inconsistency between the referenced version and the runtime version, it indicates that the service provider has updated and released a new version of the service contract component, but there are still cases where the runtime version and the referenced version are compatible or incompatible. In this case, it is necessary to combine the second detection result for judgment. If the second detection result is that the runtime version is compatible with the referenced version, to avoid situations where the content of a referenced version with the same version number as the runtime version has changed, but the version number of the referenced version remains unchanged, it further ensures the consistency of content between the runtime version and the referenced version. If the third detection result is that the content of the service contract component in the runtime version is inconsistent with the content of the contract component in the referenced version, it can be determined that the service provider has changed the service contract.

[0119] If the contract change detection module 912 determines that the referenced version and the running version are consistent in the first detection result, then although the version of the service contract component of the service provider has not changed, the content of the service contract component may or may not have changed. In this case, it is necessary to combine the third detection result for judgment. If the third detection result shows that the content of the service contract component in the running version is inconsistent with the content of the contract component in the referenced version, then it can be determined that the versions of the service contract components are the same, but the content has changed. In this case, the contract change detection module 912 can determine that the service provider has changed its service contract.

[0120] In one embodiment, the service contract change detection device 900 further includes an alarm module 914. The alarm module 914 is used to trigger an alarm on the contract management platform when a service contract change by the service provider is determined, prompting the user terminal to determine the scope of impact of the service contract change. The scope of impact of the service contract change refers to the service consumers affected by the change in the service contract components of the service provider.

[0121] The above technical solution detects whether the versions of the service contract components of the service consumer and the service provider are consistent, whether the content of the service contract components is consistent, and whether the versions of the service contract components are compatible. This avoids affecting the detection results of service contract changes due to inconsistencies or incompatibilities in the service contracts. It can quickly and accurately detect whether the service provider has changed its service contract, thereby reducing the error rate in determining the scope of impact of the service contract changes. This facilitates the timely discovery and synchronous upgrading of microservices that need to be upgraded in their service contracts.

[0122] The service contract change detection device 900 includes a processor and a memory. The aforementioned information receiving module 902, information acquisition module 904, version detection module 906, compatibility detection module 908, verification information detection module 910, contract change detection module 912, and alarm module 914 are all stored in the memory as program units. The processor executes the aforementioned program modules stored in the memory to implement the corresponding functions.

[0123] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and the service contract change detection method can be implemented by adjusting kernel parameters.

[0124] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0125] This application provides a storage medium on which a program is stored, which, when executed by a processor, implements the above-described service contract change detection method.

[0126] This application provides a processor for running a program, wherein the program executes the above-described service contract change detection method during runtime.

[0127] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10 As shown. The computer device includes a processor A01, a network interface A02, a memory (not shown), and a database (not shown) connected via a system bus. The processor A01 provides computing and control capabilities. The memory includes internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02, and a database (not shown). The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 stored in the non-volatile storage medium A04. The database is used to store data such as service contract change detection results. The network interface A02 is used to communicate with external terminals via a network connection. When the computer program B02 is executed by the processor A01, it implements a service contract change detection method.

[0128] Those skilled in the art will understand that Figure 10The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0129] This application provides an apparatus, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of the service contract change detection method.

[0130] This application also provides a computer program product that, when executed on a data processing device, is suitable for executing a program that initializes a service contract change detection method step.

[0131] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0132] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0133] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0134] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0135] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0136] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0137] Computer-readable media include both permanent and non-permanent, removable and non-removable media, which can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

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

[0139] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A service contract change detection method characterized by comprising: The method is applied to a contract management platform, and comprises the following steps: After any service consumer references a service contract component of any service provider, receiving a reference version and first check information of the service contract component sent by the service consumer; Obtaining a running version of the service contract component maintained in the contract management platform, first compatibility information of the reference version, and second check information and second compatibility information of the running version; Comparing the reference version and the running version to obtain a first detection result of whether the reference version and the running version are consistent; According to the reference version and the second compatibility information, determining a second detection result of whether the running version is compatible with the reference version; and / or According to the first check information and the second check information, determining a third detection result of whether the content of the service contract component of the running version is consistent with the content of the contract component of the reference version; According to the first detection result, and at least one of the second detection result and the third detection result, determining whether the service contract of the service provider is changed.

2. The service contract change detection method according to claim 1, characterized by, The third detection result of whether the content of the service contract component of the running version is consistent with the content of the contract component of the reference version according to the first check information and the second check information comprises: Comparing the first check information and the second check information; In the case where the first check information and the second check information are consistent, determining that the third detection result is that the content of the service contract component of the running version is consistent with the content of the contract component of the reference version; In the case where the first check information and the second check information are inconsistent, determining that the third detection result is that the content of the service contract component of the running version is inconsistent with the content of the contract component of the reference version.

3. The service contract change detection method of claim 1, wherein In the case where all the following conditions are met, it is determined that the service contract of the service provider is not changed: The first detection result is that the reference version and the running version are inconsistent; The second detection result is that the running version is compatible with the reference version; The third detection result is that the content of the service contract component of the running version is consistent with the content of the contract component of the reference version.

4. The service contract change detection method of claim 1, wherein In the case where all the following conditions are met, it is determined that the service contract of the service provider is not changed: The first detection result is that the reference version and the running version are consistent; The third detection result is that the content of the service contract component of the running version is consistent with the content of the contract component of the reference version.

5. The service contract change detection method of claim 1, wherein In the case where all the following conditions are met, it is determined that the service contract of the service provider is changed: The first detection result is that the reference version and the running version are inconsistent; The second detection result is that the running version is not compatible with the reference version.

6. The service contract change detection method of claim 1, wherein, In the case where all the following conditions are met, it is determined that the service contract of the service provider is changed: The first detection result is that the reference version and the running version are inconsistent; The second detection result is that the running version is compatible with the reference version; The third detection result is that the content of the service contract component of the running version is inconsistent with the content of the contract component of the referenced version.

7. The service contract change detection method of claim 1, wherein The service provider is determined to have a service contract change when all of the following conditions are met: The first detection result is that the referenced version and the running version are consistent; The third detection result is that the content of the service contract component of the running version is inconsistent with the content of the contract component of the referenced version.

8. The service contract change detection method according to any one of claims 1 to 7, characterized by, The method further comprises: In the case where the service provider is determined to have a service contract change, triggering an alarm to prompt a user terminal to determine the impact range of the service contract change of the service provider.

9. The service contract change detection method according to any one of claims 1 to 7, characterized by, The service contract component is referenced by the service consumer from a central repository, and the service contract component is constructed by the service provider based on the entity class of the service contract request and the return parameter, and is published to the central repository.

10. A service contract change detecting apparatus characterized by comprising: The apparatus comprises: An information receiving module configured to receive the referenced version and the first check information of the service contract component sent by the service consumer after any one service consumer references the service contract component of any one service provider; An information obtaining module configured to obtain the running version of the service contract component, the first compatibility information of the referenced version, and the second check information and the second compatibility information of the running version maintained in the contract management platform; A version detection module configured to compare the referenced version and the running version to obtain a first detection result of whether the referenced version and the running version are consistent; A compatibility detection module configured to determine a second detection result of whether the running version is compatible with the referenced version according to the first compatibility information and the second compatibility information; and / or A check information detection module configured to determine a third detection result of whether the content of the service contract component of the running version is consistent with the content of the contract component of the referenced version according to the first check information and the second check information; A contract change detection module configured to determine whether the service provider has a service contract change according to the first detection result, and at least one of the second detection result and the third detection result.

11. A computer device, comprising: comprise: a memory configured to store instructions; a processor configured to invoke the instructions from the memory and enable the service contract change detection method according to any one of claims 1 to 9 to be implemented when the instructions are executed.

12. A machine-readable storage medium having stored thereon instructions, the instructions being executable by a machine to cause the machine to perform operations comprising: The instructions, when executed by the processor, cause the processor to be configured to implement the service contract change detection method according to any one of claims 1 to 9.

13. A computer program product comprising a computer program, characterized in that, The computer program, when executed by the processor, implements the service contract change detection method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Configuration file processing method, device, equipment, storage medium and system

    CN112416456A

  • Data change detection method and device, equipment, storage medium and product

    CN117555772A