Business processing system, medium and electronic device
By adopting a domain-driven design interface model in a microservice architecture, unified processing and standardized development of business requests are achieved, solving the complexity problem of business processing in a microservice architecture and simplifying the business development process.
Patent Information
- Application Number
- CN202311133890.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2043-09-04
AI Technical Summary
In existing technologies, domain-driven design in microservice architectures makes it difficult to achieve unified access and standardized development in business processes, resulting in high complexity in business development.
The interface model based on domain-driven design is adopted, which includes a first interface for initialization methods, a second interface for constructing entity objects, and a third interface for executing business logic. Through these interfaces, the system communicates with the engine layer to process business requests.
It simplifies business development, provides a unified access engine layer interface and common business processes, standardizes the domain-driven design development model, and reduces the complexity of business development.
Smart Images

Figure CN117149176B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, in particular, to a business processing system, a medium and an electronic device. BACKGROUND
[0002] With the continuous development of computer technology, the application of microservices is becoming more and more widespread. At present, domain-driven design is the core and the most important foundation of microservice architecture. Therefore, how to design microservice architecture based on domain-driven design to achieve business processing is crucial. SUMMARY
[0003] This summary is provided to introduce a selection of concepts that are further described below in the detailed description. This summary is not intended to identify key or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
[0004] In a first aspect, the present disclosure provides a business processing system, comprising:
[0005] an application layer, the application layer comprising a first interface, a second interface and a third interface modeled based on a domain-driven design, the first interface being configured to execute an initialization method in response to a business request when invoked, the initialization method being configured to perform a preliminary action of constructing an entity object corresponding to the business request; the second interface being configured to construct the entity object when invoked; the third interface being configured to execute a business logic of the entity object when invoked;
[0006] an engine layer, the engine layer being in communication with the application layer through the first interface, the second interface and the third interface, the engine layer being configured to process the business request based on the first interface, the second interface, the third interface and a business flow modeled based on the domain-driven design.
[0007] In a second aspect, the present disclosure provides a computer-readable medium having stored thereon a computer program, which, when executed by a processing device, implements the steps performed by the application layer and the engine layer in the first aspect.
[0008] In a third aspect, the present disclosure provides an electronic device, the operating system of the electronic device comprising the application layer and the engine layer in the first aspect, the electronic device comprising:
[0009] a storage device having stored thereon a computer program;
[0010] a processing device configured to execute the computer program in the storage device to implement the steps performed by the application layer and the engine layer.
[0011] By the technical solution, the general application layer interface, i.e., the first interface, the second interface and the third interface, is modeled based on the domain driven design, for the business party, the business party only needs to focus on the functions implemented by the first interface, the second interface and the third interface, and the engine layer can be accessed through the first interface, the second interface and the third interface; on this basis, the general business process is modeled based on the domain driven design to process the business request, in the development of the business, the interface of the unified access engine layer and the general business process are provided for the business party, and the development mode of the domain driven design is standardized.
[0012] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF DRAWINGS
[0013] The above and other features, advantages and aspects of embodiments of the present disclosure will become more apparent by describing in detail preferred embodiments thereof with reference to the attached drawings in which:
[0014] Figure 1 is an architecture diagram of a business processing system according to an embodiment of the present disclosure.
[0015] Figure 2 is a flowchart of implementing a business request based on a business processing system according to an embodiment of the present disclosure.
[0016] Figure 3 is a block diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0017] Embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings. While several embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be construed as being limited to the embodiments set forth herein; rather, these embodiments are provided so that the present disclosure can be more thoroughly and completely understood. It should be understood that the drawings of the present disclosure are only for illustrative purposes and should not be construed as limiting the scope of protection of the present disclosure.
[0018] It should be understood that each of the steps recited in the method embodiments of the present disclosure can be executed in different orders and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the execution of the steps shown. The scope of the present disclosure is not limited in this respect.
[0019] As used herein, the term "includes" and its variants are to be read to be analogous to "comprises," or "comprising." The term "based on" is to be read as "based, at least in part, on." The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments." Related terms have corresponding meanings.
[0020] It should be noted that the terms "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not intended to limit the order or interdependence of the functions performed by these devices, modules or units.
[0021] It should be noted that the modification of "one" or "multiple" mentioned in the present disclosure is illustrative rather than limiting, and those skilled in the art should understand that "one or more" should be understood unless otherwise explicitly indicated in the context.
[0022] The names of the messages or information exchanged between the plurality of devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of the messages or information.
[0023] It can be understood that, before using the technical solutions disclosed in the embodiments of the present disclosure, the type, use range, use scenario, etc. of the personal information involved in the present disclosure should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.
[0024] For example, in response to receiving the active request of the user, prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed will require obtaining and using the personal information of the user. Thus, the user can voluntarily choose whether to provide personal information to the electronic device, application program, server or storage medium, etc. software or hardware performing the operation of the technical solutions of the present disclosure according to the prompt information.
[0025] As an optional but not limiting implementation manner, in response to receiving the active request of the user, the manner of sending prompt information to the user may, for example, be a pop-up window manner, and the prompt information may, for example, be presented in the form of text in the pop-up window. In addition, the pop-up window may, for example, also carry a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0026] It can be understood that the above notification and user authorization process is only illustrative, and does not limit the implementation manner of the present disclosure, and other manners meeting the relevant laws and regulations can also be applied to the implementation manner of the present disclosure.
[0027] Meanwhile, it can be understood that the data involved in the technical solution (including but not limited to the data itself, acquisition or use of the data) should comply with the requirements of the corresponding laws, regulations and relevant provisions.
[0028] Figure 1 is an architecture diagram of a business processing system according to an embodiment of the present disclosure. Referring to Figure 1 , the system includes an application layer and an engine layer.
[0029] The application layer includes a first interface, a second interface and a third interface based on domain-driven design modeling, the first interface is used to execute an initialization method in response to a business request when called, the initialization method is used to execute a preliminary action of constructing an entity object corresponding to the business request; the second interface is used to construct the entity object when called; the third interface is used to execute a business logic of the entity object when called.
[0030] The engine layer communicates with the application layer through the first interface, the second interface and the third interface, the engine layer is configured with a business process based on domain-driven design modeling, and the engine layer processes the business request based on the first interface, the second interface, the third interface and the business process based on domain-driven design modeling.
[0031] It is worth noting that the first interface, the second interface and the third interface are encapsulations of methods of respective implemented functions, and through the calling of the first interface, the second interface and the third interface, the calling of the methods of the corresponding functions is respectively implemented.
[0032] In a possible manner, the business request can be a request related to an order service, such as creation of an order, modification of an order, etc. Correspondingly, the business logic can be a business logic for implementing creation of an order and modification of an order, and the business logic is developed by a business party.
[0033] In a possible manner, the preliminary action can be a verification and query action before the execution of the business logic, and in the above instance of creation of an order, the goods in the order can be verified, the quantity of the goods can be queried, the goods in the order can be verified to confirm whether the goods exist, and the quantity of the goods can be queried to confirm whether the quantity of the goods in the inventory meets the quantity of the goods required in the order.
[0034] In a possible manner, when the second interface is called, the engine layer can pass an entity construction tool to the second interface as an input parameter of a method of a function implemented by the second interface to assist the second interface in implementing construction of the entity object.
[0035] By the technical solution, the general application layer interface, i.e., the first interface, the second interface and the third interface, is modeled based on the domain-driven design, for the business party, the business party only needs to focus on the functions implemented by the first interface, the second interface and the third interface, and the engine layer can be accessed through the first interface, the second interface and the third interface; on this basis, the general business process is modeled to process the business request based on the domain-driven design, and in the development of the business, the interface for accessing the engine layer and the general business process are provided for the business party, and the development mode of the domain-driven design is standardized.
[0036] In a possible manner, the business process comprises: the engine layer calling the first interface to execute an initialization method, to obtain a key-value pair of a distributed lock returned by the application layer, and to execute locking of the distributed lock; the engine layer starting a transaction; the engine layer calling the second interface to create an entity object and to generate a snapshot of the entity object; the engine layer calling the third interface to execute business logic of the entity object, and generating a persistence action in a case where the entity object after executing the business logic is different from the snapshot; the engine layer executing the persistence action and obtaining a domain event triggered by executing the business logic; the engine layer sending the domain event and committing the transaction; and the engine layer releasing the distributed lock and executing a callback related to the domain event.
[0037] In the execution of the initialization method, the key-value pair of the distributed lock is returned after verification and query, the key-value pair of the distributed lock corresponds to a shared resource, and the shared resource is locked to realize access, thereby realizing business processing; and after the end of the business processing, the corresponding distributed lock can be released, facilitating occupation of the shared resource by other processes. In addition, the initialization method is executed before locking and starting a transaction.
[0038] It is worth noting that, when the database transaction is initiated by multi-thread concurrent in the traditional software system or the micro-service system, the data table resources processed in each transaction are different in sequence, and the data table to be processed in a transaction can be locked by another transaction, thereby causing the problem of transaction deadlock. Therefore, the engine layer needs to sort the key-value pairs of the distributed locks involved in the database transaction initiated by multi-thread concurrent, to prevent the problem of transaction deadlock. According to the sorting result, when it is the turn to execute access to the shared resource required by the business processing, the key-value pair of the distributed lock corresponding to the shared resource is locked.
[0039] Wherein, the transaction is a database operation sequence defined by a user, and the operations are either all done or all not done, which is an indivisible work unit. After starting the transaction, the database can be operated, and if no abnormal condition occurs during the operation process, the transaction is committed; if an abnormal condition occurs during the operation process, the transaction is rolled back to restore the database to the state before the transaction is started. The abnormal condition can mean that any operation in the database operation sequence is abnormal.
[0040] Wherein, the engine layer can pass a tool to the first interface, which is used to assist the second interface in constructing the entity object. In the domain-driven design, the construction of the entity can be understood as the construction of the domain model, which includes the construction of the entity object, the construction of the aggregate root, the construction of the value object, and the like. The domain model is constructed by accessing the data in the database, and the specific entity object, aggregate root, and value object can refer to the explanation and description in the related art. The function implemented by the second interface is executed after locking and starting the transaction.
[0041] Wherein, the snapshot of the entity object can be understood as a data copy of the current entity object. It is worth noting that the attribute value of the entity object can change after the business logic is executed, so the snapshot is executed when the entity object is constructed, thereby facilitating the comparison of the entity object before and after the execution of the business logic to determine whether the entity changes, and in the case that the entity object after the execution of the business logic is different from the entity object in the snapshot, a persistence action is generated and executed, thereby accessing the database to make corresponding data changes.
[0042] It is worth noting that since the domain model usually represents a domain (for example, the domain model corresponding to the order service corresponds to an order), and the change of an entity in a domain model usually also affects the change of an entity object in other domains (for example, the logistics domain, the inventory domain, and the like). For example, in the e-commerce domain, based on the domain-driven design, the order domain, the user domain, the inventory domain, and the logistics domain can be divided, and in the order domain, after the order is created, the logistics information of the goods in the order in the logistics domain can be tracked. Therefore, the domain event triggered by the execution of the business logic can be obtained, and the callback related to the domain event is triggered. The callback here can implement the operation of changing the entity object in other domain models, and according to the above example, for example, after the order is created, the order is added in the system corresponding to the logistics domain and the tracking display of the logistics information is implemented. In addition, the callback here can also implement the function of displaying information to the user interface.
[0043] From the above, in the operation of changing the entity object in other domain models, it can be understood that another business request is generated, and the first interface, the second interface and the third interface corresponding to another business request are called to realize the corresponding functions.
[0044] In the above manner, the universal business process is modeled based on the domain-driven design, so that different business requests access the unified engine layer, and the business party only needs to focus on the business logic and does not need to focus on the underlying implementation, thereby simplifying the development difficulty of the business.
[0045] In a possible manner, the engine layer further includes a distributed lock component, and the distributed lock component is configured to implement operations related to the distributed lock, and the operations include locking and releasing of the distributed lock.
[0046] In a possible manner, the engine layer further includes a persistence component, and the persistence component is configured to implement starting of a transaction, execution of a persistence action and submission of the transaction.
[0047] In a possible manner, the engine layer further includes an event bus component, and the event bus component is configured to implement sending of a domain event and callback related to the domain event. The development in the form of the component can isolate the business and the technical complexity.
[0048] In a possible manner, when the engine layer is constructed, the implementation of a specified component can be specified, and the specified component includes at least one of the distributed lock component, the persistence component and the event bus component. For example, the distributed lock component can be implemented based on redis and memory, the persistence component can be implemented based on MySQL, and the event bus component can be implemented based on MySQL and memory.
[0049] In a possible manner, the specified component can access the engine layer through a defined interface, and the interface is defined by Interface to support flexible expansion and dynamic configuration.
[0050] In the above manner, the engine layer has good expansibility, and can cope with different requirements of different businesses on the infrastructure. The infrastructure can be understood as the distributed lock component, the persistence component and the event bus component and the like.
[0051] Figure 2 is a flowchart of implementing a business request based on a business processing system according to an embodiment of the present disclosure. Referring to Figure 2 , first of all, it should be noted that the first interface 11, the second interface 21 and the third interface 31 correspond to the business request 1, and the first interface 12, the second interface 22 and the third interface 32 correspond to the business request 2. The business request 2 can be a callback corresponding to a domain event triggered in the business request 1.
[0052] Referring toFigure 2 In the implementation of the business request 1, first, the first interface 11 is called to execute the initialization method, return the key-value pair, and the distributed component locks the key-value pair; the transaction is started; the transaction module in the persistence component calls the second interface 21, and a tool is passed in when the second interface is called, which is used to assist the construction of entity objects (for example Figure 2 entity 1 and entity 2 in the entity 1 and entity 2). After the construction is completed, the snapshot is executed to store the currently constructed entity object; the third interface 31 is called to execute the business logic corresponding to the business request 1; in the case where it is determined that there is a difference between the currently constructed entity object and the entity object after the execution of the business logic when the snapshot is stored, the persistence action is generated, the persistence component executes the persistence action, and the update to the database is implemented; the domain event is obtained and sent to the event bus component, the domain event is distributed by the event router, and the event registration command is executed to implement the processing of the business request 2 by the first interface 12, the second interface 22 and the third interface 32 accessing the engine layer and jointly providing the business process provided by the engine layer, and the event registration command can be understood as the domain event corresponding to the business request 2 that the domain corresponding to the business request 1 is interested in is agreed in advance, and the interest can be understood as the change of the entity in the domain corresponding to the business request 1 affecting the change of the entity object in the domain corresponding to the business request 2.
[0053] In addition, with reference to the processing of the business request 1, the processing of the business request 2 by the first interface 12, the second interface 22 and the third interface 32 accessing the engine layer and jointly providing the business process provided by the engine layer can be understood, and the embodiment will not be repeated here.
[0054] Based on the same inventive concept, the embodiment of the disclosure also provides a computer readable medium, which stores a computer program, and the program is executed by a processing device to implement the steps executed by the application layer and the engine layer in the business processing system.
[0055] Based on the same inventive concept, the embodiment of the disclosure also provides an electronic device, and the operating system of the electronic device is the application layer and the engine layer in the business processing system, and the electronic device comprises:
[0056] a storage device storing a computer program;
[0057] a processing device configured to execute the computer program in the storage device to implement the steps executed by the application layer and the engine layer in the business processing system.
[0058] The following refers to Figure 3This diagram illustrates a structural schematic of an electronic device 300 suitable for implementing embodiments of the present disclosure. The terminal devices in these embodiments may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 3 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0059] like Figure 3 As shown, the electronic device 300 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 into a random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the electronic device 300. The processing unit 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0060] Typically, the following devices can be connected to I / O interface 305: input devices 306 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 307 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 308 including, for example, magnetic tapes, hard disks, etc.; and communication devices 309. Communication device 309 allows electronic device 300 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 3 An electronic device 300 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0061] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 309, or installed from storage device 308, or installed from ROM 302. When the computer program is executed by processing device 301, it performs the functions defined in the methods of embodiments of this disclosure.
[0062] It should be noted that the computer-readable medium described above can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium, for example, can be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the foregoing. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program used or used in conjunction with an instruction execution system, apparatus or device. In the present disclosure, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the foregoing. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained in the computer-readable medium can be transmitted by any suitable medium, including but not limited to a wire, a cable, a RF (radio frequency) or the like, or any suitable combination of the foregoing.
[0063] In some embodiments, the electronic device can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with digital data communication (e.g., a communication network) of any form or medium, such as a LAN (Local Area Network), a WAN (Wide Area Network), an Internet (e.g., the Internet), and an end-to-end network (e.g., an ad hoc end-to-end network), as well as any currently known or future developed network.
[0064] The computer-readable medium described above can be included in the electronic device described above; or can exist separately, without being assembled into the electronic device.
[0065] The computer-readable medium described above carries one or more programs, which, when executed by the electronic device, cause the electronic device to: implement service processing through the application layer and the engine layer.
[0066] Computer program code for carrying out operations of the present disclosure can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0067] The computer program instructions can also be loaded onto a computer or other programmable information processing apparatus to cause a series of operations to be performed on the computer or other programmable information processing apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable information processing apparatus implement the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0068] The modules involved in the embodiments of the present disclosure can be implemented in the manner of software or hardware. Among them, the name of the module does not constitute a limitation to the module itself in some cases.
[0069] The functions described in the foregoing description can be implemented, at least in part, by one or more hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Program-specific Integrated Circuits (ASICs), Program-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc.
[0070] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0071] The above description is only preferred embodiments of the present disclosure and a description of principles of applied technology. It should be understood by those skilled in the art that the disclosed scope of the present disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and also covers other technical solutions formed by the combinations of the above technical features or equivalent features without departing from the above disclosed concept. For example, the technical solutions formed by the mutual replacement of the above features and the technical features disclosed in the present disclosure (but not limited to) having similar functions.
[0072] In addition, although each operation is described in a particular order, this should not be understood as requiring the operations to be performed in the specific order shown or in a sequential order. In certain circumstances, multitasking and parallel processing can be advantageous. Similarly, although several implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Certain features described in the context of separate embodiments can also be combined in a single embodiment. Conversely, various features described in the context of a single embodiment can also be implemented separately or in any suitable subcombination.
[0073] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims. With respect to the devices in the above-described embodiments, in which various modules perform operations, the specific manner in which the operations are performed by the various modules has been described in detail in the embodiments related to the method, and will not be described in detail here.
Claims
1. A business processing system, characterized by, The application layer comprises a first interface, a second interface and a third interface based on a domain-driven design modeling, the first interface is used to execute an initialization method in response to a business request when called, the initialization method is used to execute a preliminary action of constructing an entity object corresponding to the business request; The second interface is used to construct the entity object when called; the third interface is used to execute business logic of the entity object when called; The engine layer communicates with the application layer through the first interface, the second interface and the third interface, and processes the business request based on the first interface, the second interface, the third interface and a business flow based on the domain-driven design modeling; The business flow comprises: the engine layer calls the first interface to execute the initialization method, to obtain a key-value pair of a distributed lock returned by the application layer, and to execute locking of the distributed lock; the engine layer starts a transaction; the engine layer calls the second interface to create the entity object, and to generate a snapshot of the entity object; the engine layer calls the third interface to execute the business logic of the entity object, and to generate a persistence action in a case where the entity object after executing the business logic is different from the snapshot; the engine layer executes the persistence action, and obtains a domain event triggered by executing the business logic; the engine layer sends the domain event, and commits the transaction; and the engine layer releases the distributed lock, and executes a callback related to the domain event. The engine layer further comprises a distributed lock component, which is used to implement operations related to the distributed lock, the operations comprising locking and releasing of the distributed lock.
2. The system of claim 1, wherein, The engine layer further comprises a persistence component, which is used to implement starting of a transaction, execution of a persistence action and committing of the transaction.
3. The system of claim 1, wherein, The engine layer further comprises an event bus component, which is used to implement sending of the domain event and the callback related to the domain event.
4. The system of claim 1, wherein, When the engine layer is constructed, implementation of a specified component is specified, the specified component comprising at least one of the distributed lock component, the persistence component and the event bus component.
5. The system according to any of claims 2-4, characterized in that, The specified component accesses the engine layer through a defined interface, the interface being defined by Interface.
6. The system of claim 5, wherein, The distributed lock component is implemented based on redis and memory, the persistence component is implemented based on MySQL, and the event bus component is implemented based on MySQL and memory.
7. The system of claim 5, wherein, The program, when executed by a processing apparatus, implements steps executed by the application layer and the engine layer in the system of any one of claims 1-7.
8. A computer readable medium having stored thereon a computer program, characterized in that, An operating system of the electronic device comprises the application layer and the engine layer of any one of claims 1-7, and the electronic device comprises:
9. An electronic device, comprising: a storage device having a computer program stored thereon; a processing apparatus configured to execute the computer program in the storage device to implement steps executed by the application layer and the engine layer in the system of any one of claims 1-7.
Citation Information
Patent Citations
System optimization method and device based on domain driving, medium and equipment
CN115934050A
Micro-service architecture processing method and system
CN116501300A