CN-122027169-A - Distributed asynchronous communication method, device, computer equipment and storage medium
Abstract
The application provides a distributed asynchronous communication method, a device, computer equipment and a storage medium, which are applied to the field of financial or medical health, wherein the method comprises the steps that a first entity receives a task instruction, generates or updates an instance file according to preset resource information and the task instruction, and submits the instance file to a shared warehouse, wherein the instance file comprises an expected state field and an observed state field, and the first entity only modifies the expected state field; the method comprises the steps of obtaining an analysis result by pulling and analyzing an instance file from a shared warehouse when a second entity monitors that the shared warehouse is changed, generating an execution result after executing a task according to the analysis result, modifying an observation state field according to the execution result, and submitting the modified instance file to the shared warehouse, and obtaining the execution result by pulling the modified instance file from the shared warehouse when a first entity monitors that the shared warehouse is changed. The loose coupling asynchronous communication which can carry out two-way service communication and is cross-network and cross-organization is realized.
Inventors
- LI JIANQIANG
Assignees
- 平安科技(深圳)有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260302
Claims (10)
- 1. A method of distributed asynchronous communication, for use in a distributed system comprising a first entity, a second entity, and a shared repository, the method comprising: A first entity receives a task instruction, generates or updates an instance file according to preset resource information and the task instruction, and submits the instance file to a shared warehouse, wherein the instance file comprises an expected state field and an observed state field, and the first entity only modifies the expected state field; the second entity monitors that the shared warehouse is changed, and pulls and analyzes the instance file from the shared warehouse to obtain an analysis result; The second entity executes the task according to the analysis result to generate an execution result, modifies the observation state field according to the execution result, and submits the modified instance file to a shared warehouse; The first entity monitors that the shared warehouse is changed, pulls the modified instance file from the shared warehouse, and analyzes and obtains the execution result.
- 2. The method of claim 1, wherein the first entity receives a task instruction, generates or updates an instance file according to preset resource information and the task instruction, and submits the instance file to a shared repository, wherein the instance file includes a desired status field and an observed status field, and wherein the step of the first entity modifying only the desired status field comprises: the first entity encrypts the modified expected state field to generate a first digital signature; verifying whether a first entity modifies only the expected state field according to the first digital signature, the instance file and metadata in a shared warehouse through a preset security verification gateway; if the verification is passed, pushing the instance file to a sharing warehouse; and if the verification is not passed, sending verification failure information to the first entity.
- 3. The method of claim 1, wherein the step of the second entity performing a task and generating an execution result based on the parsing result, and modifying the observation state field based on the execution result, and submitting the modified instance file to a shared repository comprises: The second entity encrypts the modified observation state field to generate a second digital signature; Verifying whether a second entity modifies only the observation state field according to the second digital signature, the modified instance file and metadata in a shared warehouse through a preset security verification gateway; If the verification is passed, pushing the modified instance file to a sharing warehouse; and if the verification is not passed, sending information of verification failure to the second entity.
- 4. The method of claim 1, wherein the second entity performs a task and generates an execution result according to the parsing result, and wherein the step of modifying the observation state field according to the execution result comprises: The second entity creates a temporary branch when executing the task according to the analysis result, generates an execution result in the temporary branch, and sends the execution result to a rechecking end; Manually rechecking the execution result by a staff at a rechecking end; And if the check passes, sending a notification of the pass to a second entity, and modifying the observation state field by the second entity according to the execution result.
- 5. The method according to claim 1, wherein the method further comprises: triggering a verification mechanism when detecting that a first entity or a second entity sends a submitting request for submitting the instance file, and acquiring a currently pushed user ID and the pushed instance file by a preset safety verification gateway; the security check gateway judges whether the current submitting request is a first entity or a second entity according to the user ID; If the user ID is a first entity, judging whether the observation state field of the currently submitted instance file and the latest observation state field of the instance file in a shared warehouse are changed, if not, pushing the current instance file to the shared warehouse, otherwise, refusing to push; If the user ID is the second entity, judging whether the expected state field of the currently submitted instance file and the expected state field of the latest instance file in the shared warehouse are changed, if not, pushing the current instance file to the shared warehouse, otherwise, refusing to push.
- 6. The method of claim 5, wherein the step of triggering a verification mechanism when it is detected that the shared repository is submitted to the instance file, and the preset verification model obtains a current pushed user ID and the pushed instance file comprises: The verification mechanism enforces checking field modification rights when the shared warehouse is committed through an automated trigger script or CI pipeline.
- 7. The method of claim 1, wherein the step of the second entity monitoring the shared repository for changes, pulling and parsing the instance file from the shared repository to obtain a parsed result comprises: The second entity monitors whether the shared warehouse is changed by periodically polling the shared warehouse or by receiving a network hook event notification triggered by the shared warehouse.
- 8. A distributed asynchronous communication device comprising means for performing the method according to any of claims 1-7.
- 9. A computer device, characterized in that it comprises a memory on which a computer program is stored and a processor which, when executing the computer program, implements the method according to any of claims 1-7.
- 10. A storage medium storing a computer program comprising program instructions which, when executed by a processor, implement the method of any one of claims 1-7.
Description
Distributed asynchronous communication method, device, computer equipment and storage medium Technical Field The present invention relates to the field of communications technologies, and in particular, to a distributed asynchronous communication method, apparatus, computer device, and storage medium. Background With the popularization of micro-service architecture and cloud native technology, modern distributed systems need to frequently exchange information among different service entities, organizations and network domains, and higher requirements are put on the reliability, safety and suitability of a communication mechanism. The traditional communication mechanism is divided into synchronous and asynchronous types, and has the obvious defects that synchronous communication such as RESTful API and RPC requires a requester and a responder to be simultaneously on line, so that the system is tightly coupled and is easily influenced by faults or network fluctuation, potential safety hazards of API exposure can be brought by opening a firewall in a cross-organization or physical isolation scene, and asynchronous message queues such as Kafka, rabbitMQ realize decoupling, but have heavy operation and maintenance burden and lack of system state persistence description, so that long-period tamper-proof audit records are difficult to provide. In the fields of financial transactions, insurance claims, medical data sharing and the like, regulatory authorities have strict requirements on data ownership, operation marking and interpretability. The existing GitOps operation and maintenance paradigm is configured by means of a Git management infrastructure, but is limited to unidirectional deployment from Git to a cluster, and cannot meet the requirement of bidirectional service communication. Disclosure of Invention The embodiment of the invention provides a distributed asynchronous communication method, a distributed asynchronous communication device, computer equipment and a storage medium, which aim to solve the problem that a communication system is tightly coupled and cannot meet the communication requirement of bidirectional service. The embodiment of the invention provides a distributed asynchronous communication method which is applied to a distributed system comprising a first entity, a second entity and a shared warehouse, wherein the first entity receives a task instruction, generates or updates an instance file according to preset resource information and the task instruction and submits the instance file to the shared warehouse, the first entity only modifies an expected state field and an observation state field, the second entity monitors that the shared warehouse changes, pulls and analyzes the instance file from the shared warehouse to obtain an analysis result, the second entity executes a task according to the analysis result and then generates an execution result, modifies the observation state field according to the execution result and submits the modified instance file to the shared warehouse, the first entity monitors that the shared warehouse changes, pulls the modified instance file from the shared warehouse, analyzes and obtains the execution result. In a second aspect, an embodiment of the present invention also provides a distributed asynchronous communication device, which includes a unit for performing the above method. In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the method when executing the computer program. In a fourth aspect, embodiments of the present invention also provide a computer readable storage medium storing a computer program comprising program instructions which, when executed by a processor, implement the above-described method. The application provides a distributed asynchronous communication method, a device, equipment and a medium, which utilize a version control warehouse as a shared medium and adopt a Custom Resource (CR) mode to strictly separate a data structure into a desired state field (Spec) describing a desired state and an observation state field (Status) describing an observation state. The first entity (publisher) modifies only the expected state field (Spec) declaration intent, the second entity (consumer) modifies only the observed state field (Status) feedback result after performing the task, and both parties digitally sign the submission. The application realizes the loose coupling asynchronous communication of cross networks and cross organizations through the original version control capability of the field-level read-write separation and version control system, and the first entity and the second entity can carry out bidirectional business communication, and the two communication parties only need to interact with a shared warehouse without opening ports, so as to support ferry communicat