CN112631795A - Method, device, equipment and storage medium for automatically synchronizing service application information - Google Patents

Method, device, equipment and storage medium for automatically synchronizing service application information Download PDF

Info

Publication number
CN112631795A
CN112631795A CN202011475297.9A CN202011475297A CN112631795A CN 112631795 A CN112631795 A CN 112631795A CN 202011475297 A CN202011475297 A CN 202011475297A CN 112631795 A CN112631795 A CN 112631795A
Authority
CN
China
Prior art keywords
transaction
service
logic
rollback
section
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011475297.9A
Other languages
Chinese (zh)
Inventor
白冰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011475297.9A priority Critical patent/CN112631795A/en
Publication of CN112631795A publication Critical patent/CN112631795A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/543User-generated data transfer, e.g. clipboards, dynamic data exchange [DDE], object linking and embedding [OLE]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a method, a device, equipment and a storage medium for automatically synchronizing service application information, wherein the method comprises the following steps: encapsulating the cross service logic of the service project into a tangent plane based on a tangent plane-oriented programming technology, and weaving the tangent plane into the main service logic of the service project; executing a main service logic of the weaving-in section in a service system; judging whether the main service logic of the woven-in section is successfully executed; if not, rolling back the affairs and re-executing the main service logic of the woven-in section until the execution is successful; if the operation is successful, executing section-oriented programming logic based on the section; matching custom configuration services according to the section-oriented programming logic; messages generated in the business system are synchronized to other business systems corresponding to the custom configuration service. The method reduces the code compiling amount, realizes most of information synchronization through configuration, solves the problems of code redundancy and various code compiling problems, reduces the code repetition rate and shortens the requirement realizing period.

Description

Method, device, equipment and storage medium for automatically synchronizing service application information
Technical Field
The invention relates to the field of software monitoring, in particular to a method, a device, equipment and a storage medium for automatically synchronizing service application information of a multi-service system.
Background
With the continuous improvement of enterprise informatization level, the continuous increase of enterprise customers and the continuous emergence of new services, and the rapid development of computer application level, more and more computer application systems put forward higher requirements in the aspects of concurrent processing, key service online transaction processing, cross-platform, cross-wide area network, multiple data sources and the like. The business process implemented by the computer program can be thought of as being comprised of various business logic and workflows (Workflow). Business logic means logic that is adapted to a specific business, such as implementation of business rules, processing of business data, and the like. Workflow refers to the order between the various business logic. Workflows are part of computer-supported collaborative work. A workflow framework (also referred to as a workflow engine) refers to a program that can identify a workflow and execute the workflow steps, which acts as a dispatcher of the workflow, monitors the execution of each workflow process, and sends the process operations to the next step.
In some business projects, multiple business systems are involved, and each business system needs to synchronize application related information to other business systems of the business project under different states of different nodes. The service project supports a user to synchronize different information according to custom configuration at a specified stage and state. The section-oriented programming technology is widely applied in the process of developing project software. In the prior art, the information synchronization process by the section-oriented programming technology has the following defects:
only field attributes and information synchronization of code query in a specific class are supported, and the code reuse rate is low; the single tangent plane realizes the synchronization of a single system, and the synchronization of other systems needs to be realized by newly adding codes, so that the code repetition rate is higher; when the synchronous information is different access logics, the internal judgment of the code is needed, and the realization through configuration cannot be realized; and after the section synchronization information fails, only the reprocessing of the information is supported, and when the system concurrency is large, the system resources are occupied, so that the performance is greatly reduced.
Disclosure of Invention
Therefore, it is necessary to provide a method, an apparatus, a device and a storage medium for automatically synchronizing service application information, which are directed to the problems that technicians need to manually write a large amount of codes, the workload is large, the code repetition rate is high, and the required implementation period is long when the service application information of a multi-service system is automatically synchronized.
A method for automatically synchronizing service application information comprises the following steps:
encapsulating cross service logic of a service project into a tangent plane based on a tangent plane-oriented programming technology, and weaving the tangent plane into main service logic of the service project by utilizing a tangent plane-oriented programming container;
executing a main service logic of the weaving-in section in a service system;
judging whether the main service logic of the woven-in section is successfully executed;
if the execution is not successful, performing transaction rollback, and re-executing the main service logic of the woven-in tangent plane until the execution is successful;
if the execution is successful, executing the section-oriented programming logic based on the section;
matching custom configuration service according to the section-oriented programming logic;
synchronizing messages generated in the business system to other business systems corresponding to the custom configuration service.
In one embodiment, the synchronizing the message generated in the business system to the other business system corresponding to the custom configuration service includes: forming a message queue by the messages generated in the service system, and synchronizing the message queue to other service systems corresponding to the self-defined configuration service;
after the synchronizing messages generated in the business system to other business systems corresponding to the custom configuration service, the method further comprises:
judging whether the message generated in the service system is successfully synchronized to other service systems corresponding to the user-defined configuration service;
if not, the message in the message queue is dropped;
the synchronization failure message is fished through the timing task of the database of the main service system, and the message synchronization is carried out again until the synchronization is successful; the main service system is a service system for executing the main service logic of the weaving-in tangent plane.
In one embodiment, the timing tasks include data tables, fishing functions, and events; the fetching of the synchronization failure message through the timing task of the database of the main service system comprises:
the data table records the fishing time;
the fishing function catches and stores the synchronous failed message;
and implementing a storage process in the timing execution function in the event.
In one embodiment, the performing transaction rollback includes:
initiating, with a transaction manager, a commit request for a branch transaction of a first transaction to a resource manager of a database node associated with the first transaction;
when the transaction manager receives a message which is sent by any resource manager and used for committing the branch transaction of the first transaction, the transaction manager initiates a rollback request of the branch transaction of the first transaction to other resource managers which are committing the branch transaction of the first transaction or successfully commit the branch transaction of the first transaction.
In one embodiment, before initiating, by the transaction manager, a commit request of a branch transaction of the first transaction to a resource manager of a database node associated with the first transaction, the performing transaction rollback further includes: generating a globally unique transaction identifier for the first transaction using the transaction manager;
after the rollback request of the branch transaction initiating the first transaction, the performing transaction rollback further comprises: utilizing the transaction manager to carry the transaction identifier of the first transaction in the submission request of the branch transaction of the first transaction; and carrying the transaction identifier of the first transaction in the rollback request of the branch transaction of the first transaction, and initiating the time of submitting the request of the branch transaction of the first transaction.
In one embodiment, after the initiating, by the transaction manager, a rollback request of a branch transaction of the first transaction to other resource managers that are committing the branch transaction of the first transaction or that are committing the branch transaction of the first transaction successfully, the method further includes:
summarizing a rollback result fed back by the resource manager by using the transaction manager;
judging whether a resource manager with rollback failure exists in the rollback result;
if the resource manager exists, the database node corresponding to the resource manager with the rollback failure is connected, and the table related to the rollback failure is locked.
In one embodiment, the main business logic comprises:
the domain entity is used for defining an object in the service, and the object has attributes and behaviors;
a business rule defining conditions that must be satisfied to complete an action;
data integrity for determining necessary data;
and the workflow is used for defining the interactive relation among the domain entities.
An automatic synchronization device for service application information, comprising:
the encapsulation and weaving module is used for encapsulating the cross service logic of the service project into a tangent plane based on a tangent plane-oriented programming technology, and weaving the tangent plane into the main service logic of the service project by utilizing a tangent plane-oriented programming container;
the execution module is used for executing the main business logic of the weaving-in section in a business system;
the judging module is used for judging whether the main service logic of the woven-in section is successfully executed;
the rollback module is used for performing transaction rollback if the execution is not successful, and re-executing the main service logic of the woven-in tangent plane until the execution is successful;
the execution module is further configured to execute a facet-oriented programming logic based on the facet if the execution is successful;
the matching module is used for matching the user-defined configuration service according to the section-oriented programming logic;
and the synchronization module is used for synchronizing the messages generated in the business system to other business systems corresponding to the self-defined configuration service.
A computer device comprising a memory and a processor, the memory having stored therein computer-readable instructions, which, when executed by the processor, cause the processor to perform the steps of the above-mentioned service application information automatic synchronization method.
A storage medium storing computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the above-described method for automatic synchronization of business application information.
The method, the device, the equipment and the storage medium for automatically synchronizing the service application information adopt a section-oriented programming technology to weave a section into the main service logic of a service project; executing main service logic of the weaving-in tangent plane and tangent plane programming logic; matching custom configuration services according to the section-oriented programming logic; the method and the system synchronize the messages generated in the service system to other service systems corresponding to the user-defined configuration service, reduce code compiling amount, realize most of information synchronization through configuration, solve the problems of code redundancy and code compiling, reduce code repetition rate, shorten the requirement realizing period and improve working efficiency.
Drawings
Fig. 1 is a flowchart of a method for automatically synchronizing service application information of a multi-service system according to an embodiment;
FIG. 2 is a flowchart of step S40 in the embodiment shown in FIG. 1;
fig. 3 is a flowchart of a method for automatically synchronizing service application information of a multi-service system according to another embodiment;
FIG. 4 is a flowchart of step S80 in the embodiment shown in FIG. 3;
fig. 5 is a block diagram illustrating a structure of an apparatus for automatically synchronizing service application information of a multi-service system according to an embodiment;
fig. 6 is a block diagram illustrating a structure of an apparatus for automatically synchronizing service application information of a multi-service system according to another embodiment;
FIG. 7 is a block diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another.
As shown in fig. 1, in an embodiment, an automatic synchronization method for service application information of a multi-service system is provided, where the automatic synchronization method for service application information of a multi-service system may be applied to a computer device, and specifically may include the following steps:
s10, encapsulating the cross service logic of the service project into a tangent plane based on the tangent plane-oriented programming technology, and weaving the tangent plane into the main service logic of the service project by using the function of the tangent plane-oriented programming container.
Specifically, the AOP technology is utilized to extract the cross service logic (affairs, log) code in the service project program, encapsulate the cross service logic into the section, and dynamically weave the encapsulated section into the specific service logic at the proper time (position) by the section-oriented programming container. In programming, the section is divided into an object, a method and a method, and a module. In the web level design, a web layer- > a gateway layer- > a service layer- > a data layer, and a tangent plane is arranged between each layer.
The method is characterized in that the method for organizing the cut planes into the main service logic of the service project by using the function of the cut plane-oriented programming container is organized at the time of compiling, namely, the cut plane codes are integrated at the time of code compiling, and a Java compiler such as AspectJ is used for generating Java byte codes with complete functions.
Aspect Oriented Programming, called AOP for short, is a technology for implementing unified maintenance of program functions through a pre-compiling mode and a dynamic proxy during running. AOP is a continuation of OOP, is an important content in Spring framework, and is a derivative paradigm of functional programming. OOP, Object Oriented Programming, i.e., Object Oriented Programming. By utilizing the AOP, all parts of the business logic can be isolated, so that the coupling degree between all parts of the business logic is reduced, the reusability of a program is improved, and the development efficiency is improved. The characteristics common to all classes belong to the section, and the section-oriented programming is to program the common characteristics of all classes or a part of classes. The weaving of the cut planes into the main business logic can be achieved by using the function of the AOP.
Cross-business logic refers to generic, independent code from the main business logic, such as security checks, transactions, logs, caches, etc. For example, the transfer service needs cross service logics such as authority control, log recording, transaction loading, transaction ending and the like before and after the real transfer service logic, and the service logics have no direct relation with the main service logic. But their code amounts can account for up to half or even more of the total code amount. Their presence not only creates a large number of "redundant" codes, but also greatly interferes with the main service transfer logic.
In the business project development process, functionality that is spread across multiple places in an application is referred to as cross-cut concerns. These cross-cut concerns are separate from the business logic of the application, but in practice they are nested directly in the business logic layer. The facet-oriented programming is intended to separate these concerns, from the business logic layer. The transection concerns can be modularized into special classes, i.e., cut surfaces. The operation of a cut is called notification. The notification defines what the profile is and when it is used. The connection point is a point that can cut into the tangent plane during application execution. The cut point definition will match the one or more connection points that the notification is to be woven into (defining where the cut is to be performed). The tangent points and notifications define the full contents of the tangent plane. Introduction (introduction) new methods and properties can be added to classes without modifying the active classes. Weaving refers to the process of applying a slice to a target object and creating a new proxy object. The connection points are all points to which notifications can be applied, and the tangent points are the specific location (which connection points) to which notifications are applied. In other words, the tangent points define which specific connection points are to be notified.
S20, executing the main service logic of the weaving-in section in a service system.
A business project will generally include a plurality of business systems, each of which implements a business logic; business logic refers to the rules and procedures that one entity unit should have in order to provide services to another entity unit.
A main service system is generally designated from the plurality of service systems, and the service logic executed in the main service system is the main service logic.
Software system architecture is generally divided into three levels: a presentation layer, a business logic layer, and a data access layer. The presentation layer is used for being responsible for interfaces and interactions; the business logic layer is used for defining business logic (rules, workflow, data integrity and the like), receiving a data request from the presentation layer, submitting the request to the data access layer after logic judgment, and transmitting a data access result, and the business logic layer is actually a middleware and plays an important role in starting and stopping; the data access layer is used for being responsible for data reading.
The content of the business logic includes four parts: the domain entity is used for defining an object in the service, and the object has attributes and behaviors; business rules are used to define the conditions that must be met to complete an action; data integrity is used to determine certain data that is indispensable; workflows are used to define the interaction relationships between domain entities.
Specifically, taking e-commerce website service items as an example, the service logic of the transaction of online trousers purchase by the user includes:
domain entities: user, fund account, order, trousers, invoice
And (4) business rules: the user clicks on the purchase to generate an order, but the user must pay money to deliver the goods to generate an invoice.
Data integrity: an account number is required to be registered when an order is placed on the E-commerce website, and the order cannot be successfully purchased without the account number.
Workflow: search pants-find desirable pants-place order purchase-pay-receive.
And (3) service logic: search for "pants" -find desirable pants-place order-must register account number-settle-pay-receive.
And S30, judging whether the main business logic of the weaving-in section is successfully executed.
If the preset interceptor detects that the preset exception capturing mechanism throws the exception, determining that the main service logic of the weaving-in section is not successfully executed, otherwise determining that the execution is successful.
And an exception capture mechanism is configured in the data access layer and the business logic layer in advance.
The exception capture mechanism is a try-catch interception mechanism; and carrying out exception detection through a try statement in the exception capturing mechanism, and if an exception is detected in the try statement, throwing the exception to the interceptor through the throw statement.
The Data Access layer is a DAO (Data Access Object) layer in a three-layer framework of Java, is located between business logic and persistent Data, and realizes Access to the persistent Data.
The Service logic layer is a Service layer in the three-layer framework of Java, and performs corresponding data processing after acquiring data from the DAO layer and transmits a UI layer in the three-layer framework of Java to face a client.
The exception capture mechanism configured in the data access layer and the service logic layer is a try-catch interception mechanism, that is, the interception mechanism is set on the architecture level of the system, so that various exceptions of the system are effectively captured. In the try-catch interception mechanism, three keys of try, throw and catch are used for realizing exception handling. the compound statement after the try is called a protected segment, and the code of the protected segment is likely to have an exception, so that exception detection is performed in the try part. If an exception is detected, the exception is thrown by a throw statement. Exceptions may also be detected and thrown in the function called by the protected segment. The thrown exception can be an integer, a string, a variable, or even a class object. That is, there are different types of anomalies. The catch portion functions to capture and handle exceptions. Within each bracket after catch, an "exception type" is specified, indicating which type of exception it may capture. Once an exception is captured, processing is performed by an exception handling statement. The program execution flow has two types: 1) no abnormality: try → protected statement → other statement; 2) there is an anomaly: try → protected words → throw exceptions → catch exception handling statements. That is, if the try-catch interception mechanism is not set, the program crash will be caused by the exception occurring in the program, and try can ensure the normal operation of the program and output the cause of the crash in the program.
If the abnormal throwing-out in the abnormal capturing mechanism is detected through a pre-configured interceptor, determining that the main service logic of the woven-in section is not successfully executed, otherwise, determining that the execution is successful.
An interceptor in Java is an object for dynamically intercepting an Action call (the Action layer is used for referring to a corresponding Service layer, and here, in combination with a configuration file of Struts, jumps to a specified page, can also receive request data transmitted by the page, and can also perform some calculation processing, where Struts is an open source framework). The method provides a mechanism which can enable a developer to define codes executed before and after execution of an Action layer, can also prevent the execution of the Action before the execution of the Action, and also provides a mode which can extract reusable parts in the Action.
S40, if the main service logic of the woven-in section is not successfully executed, the transaction is rolled back, and the main service logic of the woven-in section is re-executed until the main service logic of the woven-in section is successfully executed; and if the execution of the main business logic of the woven-in section is successful, executing section-oriented programming logic based on the woven-in section.
A transaction is a set of operations that are combined into a logical unit of work, and although errors may occur in the system, the transaction will control and maintain the consistency and integrity of each operation in the transaction.
A Transaction (Transaction) is a unit of concurrency control and is a sequence of operations defined by a user. These operations are either all done or none done, and are an indivisible unit of work.
For example, in a banking application where funds are transferred from one account to another, one account credits an amount to one database table while another account debits the same amount to another database table. Because a computer may fail due to a power outage, network outage, etc., it is possible that a row in one table is updated, but not another table. If the database supports transactions, the database operations may be grouped into one transaction to prevent inconsistencies in the database due to these events. If a failure occurs at some point in the transaction, all updates may be rolled back to the state before the transaction started. If no failure has occurred, the update is completed by committing the transaction in a completion state.
Using the NET Framework development as an example, in the network, the Connection and Transaction objects can be used to control transactions. Beginntransaction may be initiated using connection. Once a Transaction is started, commands may be registered in the Transaction using the Transaction attribute of the Command object. The modifications made in the data source can then be committed or rolled back using the Transaction object based on the success or failure of the transactional component. The connection. endistdistributedtranction can also be used to register in existing distributed transactions. Registering in an existing distributed transaction may ensure that when the entire distributed transaction is committed or rolled back, code modifications made to the data source are also committed or rolled back.
As shown in FIG. 2, in some embodiments, a transaction rollback is performed, including:
s401, initiating a submission request of a branch transaction of a first transaction to a resource manager of a database node related to the first transaction by using a transaction manager; the method of two-stage submission is abandoned, and a direct submission mode is adopted;
s402, when the transaction manager receives a message that the branch transaction of the first transaction sent by any one of the resource managers fails to be submitted, the transaction manager is used for initiating a rollback request of the branch transaction of the first transaction to other resource managers which are submitting the branch transaction of the first transaction or submit the branch transaction of the first transaction successfully.
Currently, the most used for Transaction rollback is the Distributed Transaction Processing (DTP) model defined by the X/Open organization. The model includes a business layer, a resource manager, and a transaction manager. And the Transaction Manager (TM) is used for receiving the Transaction request, managing the global Transaction and managing the Transaction branch state.
In this embodiment, if the transaction manager receives a response that all resource managers submit the branch transaction of the first transaction successfully, it determines that the whole first transaction is successfully submitted.
In some embodiments, before initiating, with the transaction manager, a commit request of a branch transaction of the first transaction to a resource manager of a database node associated with the first transaction, performing a transaction rollback further comprises: generating a globally unique transaction ID (identification) for the first transaction with the transaction manager.
In some embodiments, after the rollback request of the branch transaction initiating the first transaction, the performing the transaction rollback further comprises: utilizing the transaction manager to carry the transaction ID of the first transaction in the submission request of the branch transaction of the first transaction; and carrying the transaction identifier of the first transaction in the rollback request of the branch transaction of the first transaction, and initiating the time of submitting the request of the branch transaction of the first transaction.
In some embodiments, step S302 is followed by: and S303, summarizing the rollback result fed back by the resource manager by using the transaction manager, and feeding back the rollback result to the client after summarizing.
The transaction manager collects the rollback result fed back by the resource manager (only the resource manager which receives the rollback request feeds back the rollback result), and judges whether the rollback result contains a resource manager which fails in rollback; if all rollback is successful, returning a result indicating that the rollback is successful to the client, and ending the flow; if the resource manager with the rollback failure exists, the transaction manager locks the table related to the rollback failure by connecting the database nodes corresponding to the resource manager with the rollback failure, and waits for manual intervention so as to ensure the consistency of the transaction.
And S50, matching the custom configuration service according to the section-oriented programming logic.
The query logic can be executed by a custom configuration service.
The user-defined synchronous configuration service supports the acquisition of synchronous information, and the supported synchronous information acquisition comprises the types of access parameter acquisition, simple sql acquisition, complex sql acquisition, bean acquisition, nested query acquisition and the like, so that the requirements of developers are met, and the problems of code redundancy and code compiling are solved.
The user-defined configuration service can provide various access logics, can be directly realized through configuration, and can add new query information and the like with less code amount even without code change.
And S60, synchronizing the message generated in the business system to other business systems corresponding to the self-defined configuration service.
Specifically, messages generated in the business system form a message queue, and the message queue is synchronized to other business systems corresponding to the custom configuration service.
The self-defining configuration service matches the corresponding title topic and the tag through the configured message identifier msgId, and configures a plurality of sets of msgIds when a plurality of service systems need to be synchronized.
As shown in fig. 3, in some embodiments, after synchronizing the message queue generated in the business system to other business systems corresponding to the custom configuration service, the method further comprises:
s70, judging whether the message generated in the service system is successfully synchronized to other service systems corresponding to the self-defined configuration service.
S80, if the synchronization of the message generated in the service system to other service systems corresponding to the self-defined configuration service is not successful, the message in the message queue is stored.
The user-defined configuration service supports the switch control to store the synchronous information, records the consumption state, and if the consumption of a consumer fails, namely the synchronous information fails, the synchronous information falls into a reprocessing synchronous information table, the reprocessing synchronous information table is triggered by the timing jobs, the jobId can be configured in a user-defined mode to realize the retransmission logic, the common logic can also be used, and the jobs are triggered and then processed in a unified mode.
And S90, fishing the synchronization failed message through the timing task of the database of the main service system, and synchronizing the message again until the synchronization is successful. The main service system is a service system for executing the main service logic of the weaving-in section.
In the process of project development, data needs to be regularly fetched from databases of other business systems, and the process can be completed by using a timing task of the database MySQL.
The timing task includes three parts:
1) data table: the data table is used for recording the fishing time, the fishing time is used as a query condition to prevent repeated fishing when the data is fished each time, and the data table is updated by obtaining the current time after the data is fished each time;
for example, a data table structure is as follows
sysName updateTime
DH 2020-08-20 15:05:39
2) A fishing function: the device is used for fishing and storing the messages of synchronization failure;
3) event: used for realizing the storage process in the timing execution function.
As shown in fig. 4, the timing task salvages the synchronization failure message, which includes:
and S901, recording the fishing time by a data table. And taking the time of each fishing as a query condition to prevent repeated fishing, and updating the data table by obtaining the current time after each time of fishing.
And S902, the fishing function fishes and stores the synchronization failure message.
And S903, realizing a storage process in the timing execution function through the event.
The automatic synchronization method for the service application information of the multi-service system reduces the code compiling amount, most information synchronization can be realized through configuration, the problems of code redundancy and various code compiling problems are solved, the code repetition rate is reduced, the requirement realization period is shortened, the project development quality is improved, and the performance of the service system is also improved by a mode of processing the retransmission in batches.
As shown in fig. 5, another embodiment of the present application provides an apparatus for automatically synchronizing service application information of a multi-service system, including:
the encapsulation and weaving module 10 is used for encapsulating the cross service logic of the service project into a section based on a section-oriented programming technology, and weaving the section into the main service logic of the service project by using an AOP container;
an execution module 20, configured to execute a main service logic of the weave-in section in a service system;
a judging module 30, configured to judge whether the execution of the main service logic of the woven-in section is successful;
a rollback module 40, configured to perform transaction rollback if the execution is not successful, and re-execute the main service logic of the weave-in tangent plane until the execution is successful;
the execution module 20 is further configured to execute a facet-oriented programming logic based on the facet if the execution is successful;
a matching module 50, configured to match a custom configuration service according to the profile-oriented programming logic;
a synchronization module 60, configured to synchronize the message generated in the business system to another business system corresponding to the custom configuration service.
As shown in fig. 6, in some embodiments, the apparatus for automatically synchronizing service application information of a multi-service system further includes:
a judging module 70, configured to judge whether to successfully synchronize the message generated in the business system to another business system corresponding to the custom configuration service.
A database falling module 80, configured to, if the synchronizing of the message generated in the service system to another service system corresponding to the custom configuration service is unsuccessful, fall the message in the message queue;
a fishing synchronization module 90, configured to fish a synchronization failure message through a timing task of a database of the main service system, and perform message synchronization again until synchronization is successful; the main service system is a service system for executing the main service logic of the weaving-in tangent plane.
In some embodiments, the timing tasks include data tables, fishing functions, and events; the fishing synchronization module comprises a fishing unit and a synchronization unit, the fishing unit is used for fishing the messages which fail in synchronization, and the synchronization unit is used for synchronizing the messages again until the synchronization is successful. The fishing unit is specifically configured to perform the following steps:
the data table records the fishing time;
the fishing function catches and stores the synchronous failed message;
and implementing a storage process in the timing execution function in the event.
The step of performing transaction rollback performed by the rollback module includes:
initiating, with a transaction manager, a commit request for a branch transaction of a first transaction to a resource manager of a database node associated with the first transaction;
when the transaction manager receives a response sent by any resource manager and indicating that the branch transaction of the first transaction fails to be submitted, the transaction manager initiates a rollback request of the branch transaction of the first transaction to other resource managers which are submitting the branch transaction of the first transaction or submit the branch transaction of the first transaction successfully.
In some embodiments, the apparatus further includes a generation module configured to generate a globally unique transaction identifier for a first transaction with a transaction manager before the rollback module initiates a commit request of a branch transaction of the first transaction with the transaction manager to a resource manager of a database node associated with the first transaction. The device further comprises a carrying module for: utilizing the transaction manager to carry the transaction identifier of the first transaction in the submission request of the branch transaction of the first transaction; and carrying the transaction identifier of the first transaction in the rollback request of the branch transaction of the first transaction, and initiating the time of submitting the request of the branch transaction of the first transaction.
In certain embodiments, the apparatus further comprises an aggregation module to: after the rollback module initiates a rollback request of the branch transaction of the first transaction to other resource managers which are submitting the branch transaction of the first transaction or submit the branch transaction of the first transaction successfully by using the transaction manager, summarizing rollback results fed back by the resource managers by using the transaction manager; and if the resource manager with the rollback failure exists, locking the table related to the rollback failure by connecting the database nodes corresponding to the resource manager with the rollback failure.
As shown in fig. 7, in one embodiment, a computer device is proposed, which comprises a memory, a processor and a computer program stored on the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
the method comprises the steps that cross service logic of a service project is packaged into a section based on a section-oriented programming technology, and the section is woven into main service logic of the service project by utilizing an AOP container;
executing a main service logic of the weaving-in section in a service system;
judging whether the main service logic of the woven-in section is successfully executed;
if the execution is not successful, performing transaction rollback, and re-executing the main service logic of the woven-in tangent plane until the execution is successful;
if the execution is successful, executing the section-oriented programming logic based on the section;
matching custom configuration service according to the section-oriented programming logic;
synchronizing messages generated in the business system to other business systems corresponding to the custom configuration service.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
if the synchronization of the message generated in the service system to other service systems corresponding to the user-defined configuration service is not successful, the message in the message queue is stored;
the synchronization failure message is fished through the timing task of the database of the main service system, and the message synchronization is carried out again until the synchronization is successful; the main service system is a service system for executing the main service logic of the weaving-in tangent plane.
In one embodiment, the timing tasks include data tables, fishing functions, and events; the message that the fishing synchronization fails, which is realized when the processor executes the computer program, comprises:
the data table records the fishing time;
the fishing function catches and stores the synchronous failed message;
and implementing a storage process in the timing execution function in the event.
In one embodiment, the transacting rollback, as implemented by the processor when executing the computer program, comprises:
initiating, with a transaction manager, a commit request for a branch transaction of a first transaction to a resource manager of a database node associated with the first transaction;
when the transaction manager receives a response sent by any resource manager and indicating that the branch transaction of the first transaction fails to be submitted, the transaction manager initiates a rollback request of the branch transaction of the first transaction to other resource managers which are submitting the branch transaction of the first transaction or submit the branch transaction of the first transaction successfully.
In one embodiment, before initiating a commit request of a branch transaction of a first transaction to a resource manager of a database node associated with the first transaction with a transaction manager implemented when the processor executes a computer program, the steps implemented when the processor executes the computer program further include: generating a globally unique transaction identifier for the first transaction using the transaction manager; the steps implemented when the processor executes the computer program further include: utilizing the transaction manager to carry the transaction identifier of the first transaction in the submission request of the branch transaction of the first transaction; and carrying the transaction identifier of the first transaction in the rollback request of the branch transaction of the first transaction, and initiating the time of submitting the request of the branch transaction of the first transaction.
After the resource manager that initiated the rollback request of the branch transaction of the first transaction to the other resource manager that was committing the branch transaction of the first transaction or that succeeded in committing the branch transaction of the first transaction, which is implemented when the processor executes the computer program, the steps implemented when the processor executes the computer program further include:
summarizing a rollback result fed back by the resource manager by using the transaction manager; and if the resource manager with the rollback failure exists, locking the table related to the rollback failure by connecting the database nodes corresponding to the resource manager with the rollback failure.
In one embodiment, a storage medium is provided that stores computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of:
the method comprises the steps that cross service logic of a service project is packaged into a section based on a section-oriented programming technology, and the section is woven into main service logic of the service project by utilizing an AOP container;
executing a main service logic of the weaving-in section in a service system;
judging whether the main service logic of the woven-in section is successfully executed;
if the execution is not successful, performing transaction rollback, and re-executing the main service logic of the woven-in tangent plane until the execution is successful;
if the execution is successful, executing the section-oriented programming logic based on the section;
matching custom configuration service according to the section-oriented programming logic;
synchronizing messages generated in the business system to other business systems corresponding to the custom configuration service.
In one embodiment, the one or more processors further perform the steps of:
if the synchronization of the message generated in the service system to other service systems corresponding to the user-defined configuration service is not successful, the message in the message queue is stored;
the synchronization failure message is fished through the timing task of the database of the main service system, and the message synchronization is carried out again until the synchronization is successful; the main service system is a service system for executing the main service logic of the weaving-in tangent plane.
In one embodiment, the timing tasks include data tables, fishing functions, and events; the message that the fishing synchronization fails, as executed by the one or more processors, comprises:
the data table records the fishing time;
the fishing function catches and stores the synchronous failed message;
and implementing a storage process in the timing execution function in the event.
In one embodiment, the transacting rollback performed by the one or more processors includes:
initiating, with a transaction manager, a commit request for a branch transaction of a first transaction to a resource manager of a database node associated with the first transaction;
when the transaction manager receives a response sent by any resource manager and indicating that the branch transaction of the first transaction fails to be submitted, the transaction manager initiates a rollback request of the branch transaction of the first transaction to other resource managers which are submitting the branch transaction of the first transaction or submit the branch transaction of the first transaction successfully.
In one embodiment, before a commit request of a branch transaction of a first transaction is initiated by a transaction manager to a resource manager of a database node associated with the first transaction, the one or more processors perform steps further comprising: generating a globally unique transaction identifier for the first transaction using the transaction manager; the one or more processors performing steps further comprising: utilizing the transaction manager to carry the transaction identifier of the first transaction in the submission request of the branch transaction of the first transaction; and carrying the transaction identifier of the first transaction in the rollback request of the branch transaction of the first transaction, and initiating the time of submitting the request of the branch transaction of the first transaction.
After the one or more processors initiate a rollback request of a branch transaction of the first transaction to other resource managers that are committing or have succeeded in committing the branch transaction of the first transaction by using the transaction manager, the one or more processors perform steps further comprising:
summarizing a rollback result fed back by the resource manager by using the transaction manager; and if the resource manager with the rollback failure exists, locking the table related to the rollback failure by connecting the database nodes corresponding to the resource manager with the rollback failure.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for automatically synchronizing service application information is characterized by comprising the following steps:
encapsulating cross service logic of a service project into a tangent plane based on a tangent plane-oriented programming technology, and weaving the tangent plane into main service logic of the service project by utilizing a tangent plane-oriented programming container;
executing a main service logic of the weaving-in section in a service system;
judging whether the main service logic of the woven-in section is successfully executed;
if the execution is not successful, performing transaction rollback, and re-executing the main service logic of the woven-in tangent plane until the execution is successful;
if the execution is successful, executing the section-oriented programming logic based on the section;
matching custom configuration service according to the section-oriented programming logic;
synchronizing messages generated in the business system to other business systems corresponding to the custom configuration service.
2. The method of claim 1, wherein synchronizing messages generated in the business system to other business systems corresponding to the custom configuration service comprises: forming a message queue by the messages generated in the service system, and synchronizing the message queue to other service systems corresponding to the self-defined configuration service;
after the synchronizing messages generated in the business system to other business systems corresponding to the custom configuration service, the method further comprises:
judging whether the message generated in the service system is successfully synchronized to other service systems corresponding to the user-defined configuration service;
if not, the message in the message queue is dropped;
the synchronization failure message is fished through the timing task of the database of the main service system, and the message synchronization is carried out again until the synchronization is successful; the main service system is a service system for executing the main service logic of the weaving-in tangent plane.
3. The method of claim 2, wherein the timing tasks include data tables, fishing functions, and events; the fetching of the synchronization failure message through the timing task of the database of the main service system comprises:
the data table records the fishing time;
the fishing function catches and stores the synchronous failed message;
and implementing a storage process in the timing execution function in the event.
4. The method of claim 1, wherein the performing transaction rollback comprises:
initiating, with a transaction manager, a commit request for a branch transaction of a first transaction to a resource manager of a database node associated with the first transaction;
when the transaction manager receives a message that the branch transaction of the first transaction sent by any resource manager fails to be submitted, the transaction manager is used for initiating a rollback request of the branch transaction of the first transaction to other resource managers which are submitting the branch transaction of the first transaction or submit the branch transaction of the first transaction successfully.
5. The method of claim 4, wherein prior to said initiating, with the transaction manager, a commit request for a branch transaction of the first transaction to a resource manager of a database node associated with the first transaction, said rolling back transactions further comprises: generating a globally unique transaction identifier for the first transaction using the transaction manager;
after the rollback request of the branch transaction initiating the first transaction, the performing transaction rollback further comprises: utilizing the transaction manager to carry the transaction identifier of the first transaction in the submission request of the branch transaction of the first transaction; and carrying the transaction identifier of the first transaction in the rollback request of the branch transaction of the first transaction, and initiating the time of submitting the request of the branch transaction of the first transaction.
6. The method of claim 4, wherein after initiating a rollback request for a branch transaction of a first transaction with the transaction manager to other resource managers that are committing or that succeed the branch transaction of the first transaction, the method further comprises:
summarizing a rollback result fed back by the resource manager by using the transaction manager;
judging whether a resource manager with rollback failure exists in the rollback result;
if the resource manager exists, the database node corresponding to the resource manager with the rollback failure is connected, and the table related to the rollback failure is locked.
7. The method of claim 1, wherein the main business logic comprises:
the domain entity is used for defining an object in the service, and the object has attributes and behaviors;
a business rule defining conditions that must be satisfied to complete an action;
data integrity for determining necessary data;
and the workflow is used for defining the interactive relation among the domain entities.
8. An apparatus for automatically synchronizing service application information, comprising:
the encapsulation and weaving module is used for encapsulating the cross service logic of the service project into a tangent plane based on a tangent plane-oriented programming technology, and weaving the tangent plane into the main service logic of the service project by utilizing a tangent plane-oriented programming container;
the execution module is used for executing the main business logic of the weaving-in section in a business system;
the judging module is used for judging whether the main service logic of the woven-in section is successfully executed;
the rollback module is used for performing transaction rollback if the execution is not successful, and re-executing the main service logic of the woven-in tangent plane until the execution is successful;
the execution module is further configured to execute a facet-oriented programming logic based on the facet if the execution is successful;
the matching module is used for matching the user-defined configuration service according to the section-oriented programming logic;
and the synchronization module is used for synchronizing the messages generated in the business system to other business systems corresponding to the self-defined configuration service.
9. A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the method of automatically synchronizing service application information according to any of claims 1 to 7.
10. A storage medium storing computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the method for automatic synchronization of service application information according to any of claims 1 to 7.
CN202011475297.9A 2020-12-15 2020-12-15 Method, device, equipment and storage medium for automatically synchronizing service application information Pending CN112631795A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011475297.9A CN112631795A (en) 2020-12-15 2020-12-15 Method, device, equipment and storage medium for automatically synchronizing service application information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011475297.9A CN112631795A (en) 2020-12-15 2020-12-15 Method, device, equipment and storage medium for automatically synchronizing service application information

Publications (1)

Publication Number Publication Date
CN112631795A true CN112631795A (en) 2021-04-09

Family

ID=75313742

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011475297.9A Pending CN112631795A (en) 2020-12-15 2020-12-15 Method, device, equipment and storage medium for automatically synchronizing service application information

Country Status (1)

Country Link
CN (1) CN112631795A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113269554A (en) * 2021-05-12 2021-08-17 河北幸福消费金融股份有限公司 Data comparison method, system and storage medium
CN113282318A (en) * 2021-05-21 2021-08-20 中国邮政储蓄银行股份有限公司 Service implementation method and device
CN113672205A (en) * 2021-08-25 2021-11-19 广州方舟信息科技有限公司 Workflow framework based on business event driving
CN117056116A (en) * 2023-10-11 2023-11-14 荣耀终端有限公司 Flow management method and electronic equipment

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113269554A (en) * 2021-05-12 2021-08-17 河北幸福消费金融股份有限公司 Data comparison method, system and storage medium
CN113269554B (en) * 2021-05-12 2022-11-18 河北幸福消费金融股份有限公司 Data comparison method, system and storage medium
CN113282318A (en) * 2021-05-21 2021-08-20 中国邮政储蓄银行股份有限公司 Service implementation method and device
CN113672205A (en) * 2021-08-25 2021-11-19 广州方舟信息科技有限公司 Workflow framework based on business event driving
CN113672205B (en) * 2021-08-25 2022-06-03 广州方舟信息科技有限公司 Workflow framework based on business event driving
CN117056116A (en) * 2023-10-11 2023-11-14 荣耀终端有限公司 Flow management method and electronic equipment
CN117056116B (en) * 2023-10-11 2024-04-02 荣耀终端有限公司 Flow management method and electronic equipment

Similar Documents

Publication Publication Date Title
CN112631795A (en) Method, device, equipment and storage medium for automatically synchronizing service application information
US8365185B2 (en) Preventing execution of processes responsive to changes in the environment
US10942823B2 (en) Transaction processing system, recovery subsystem and method for operating a recovery subsystem
US20020161859A1 (en) Workflow engine and system
CN103782574B (en) Idempotence for database transactions
US8775591B2 (en) Real-time information technology environments
US7343364B2 (en) Rules-based system architecture and systems using the same
US9558459B2 (en) Dynamic selection of actions in an information technology environment
US7519614B2 (en) Data verification systems and methods using business objects
US8484167B2 (en) Data verification systems and methods based on messaging data
US20110078500A1 (en) Processing transactions in graph-based applications
US9612923B1 (en) High-availability data center
US9015533B1 (en) Error handling for asynchronous applications
US9170915B1 (en) Replay to reconstruct program state
CN114090198A (en) Distributed task scheduling method and device, electronic equipment and storage medium
US9152533B1 (en) Asynchronous programming system
US20100153778A1 (en) Transient Transaction Execution With On-Demand Persistency
Schäfer et al. Replication schemes for highly available workflow engines
CN111538491B (en) Data event processing method, device, equipment and storage medium
EP2601627B1 (en) Transaction processing system and method
CN113900840A (en) Distributed transaction final consistency processing method and device
CN112685142A (en) Distributed data processing system
Nylund Comparing Transaction Management Methods in Microservice Architecture
Haapakoski IMPLEMENTING ASYNCHRONOUS SAGAS IN A MICROSERVICE ARCHITECTURE
Whitmire Make Your Life Easier Down the Road

Legal Events

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