CN116977048A - State machine system, transaction state management method and bank transaction system - Google Patents

State machine system, transaction state management method and bank transaction system Download PDF

Info

Publication number
CN116977048A
CN116977048A CN202311235717.XA CN202311235717A CN116977048A CN 116977048 A CN116977048 A CN 116977048A CN 202311235717 A CN202311235717 A CN 202311235717A CN 116977048 A CN116977048 A CN 116977048A
Authority
CN
China
Prior art keywords
state machine
state
transition
transaction
instance
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
CN202311235717.XA
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.)
Tianjin Jincheng Bank Ltd By Share Ltd
Original Assignee
Tianjin Jincheng Bank Ltd By Share 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 Tianjin Jincheng Bank Ltd By Share Ltd filed Critical Tianjin Jincheng Bank Ltd By Share Ltd
Priority to CN202311235717.XA priority Critical patent/CN116977048A/en
Publication of CN116977048A publication Critical patent/CN116977048A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/02Banking, e.g. interest calculation or account maintenance
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • G06F9/4856Task life-cycle, e.g. stopping, restarting, resuming execution resumption being on a different machine, e.g. task migration, virtual machine migration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Development Economics (AREA)
  • Technology Law (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a state machine system, a transaction state management method and a bank transaction system, comprising the following steps: the system comprises a template management module, an instance management module and a transition log management module; the template management module is used for creating a state machine template; each state machine template corresponds to different transaction business processes, and comprises a plurality of states of the transaction business processes and transition conditions among the states; the instance management module is used for creating a state machine instance according to a transaction request initiated by the service system and a state machine template corresponding to the transaction request, and carrying out transition on the state of the state machine instance based on a state transition trigger event; the transition log management module is used for recording the state transition log of the state machine instance. The invention improves the stability and reliability of the system.

Description

State machine system, transaction state management method and bank transaction system
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a state machine system, a transaction state management method, and a banking transaction system.
Background
In modern banking, liability business is an important component of banks, and involves problems of multiple transaction types, large transaction scale, high risk and the like. The traditional liability business system adopts a centralized transaction control mode, has the problems of low system efficiency, poor expandability, easiness in single-point fault occurrence and the like, and has poor system stability and reliability.
Disclosure of Invention
In view of the above, the present invention is directed to a state machine system, a transaction state management method and a banking transaction system, so as to improve the stability and reliability of the system.
In order to achieve the above object, the technical scheme adopted by the embodiment of the invention is as follows:
in a first aspect, an embodiment of the present invention provides a state machine system, including: the system comprises a template management module, an instance management module and a transition log management module; the template management module is used for creating a state machine template; each state machine template corresponds to different transaction business processes, and comprises a plurality of states of the transaction business processes and transition conditions among the states; the instance management module is used for creating a state machine instance according to a transaction request initiated by the service system and a state machine template corresponding to the transaction request, and carrying out transition on the state of the state machine instance based on a state transition trigger event; the transition log management module is used for recording the state transition log of the state machine instance.
In one embodiment, the system further comprises: the event management module is used for determining a state transition trigger event for performing state transition by the state machine instance; wherein, the state transition triggering event comprises: event notification and timing tasks.
In one embodiment, the system further comprises: the fixed node management module and the operation record query module; the fixed node management module is used for performing wind control management before the state transition of the state machine instance; the operation record inquiring module is used for inquiring the operation record of the transaction business flow.
In a second aspect, an embodiment of the present invention provides a transaction state management method, where the method is applied to the state machine system provided in any one of the first aspect, and the method includes: receiving a transaction request initiated by a service system; inquiring a state machine template corresponding to the transaction request, and creating a state machine instance based on the state machine template; and acquiring a state transition trigger event, and performing transition on the state of the state machine instance based on the state transition trigger event.
In one embodiment, querying a state machine template corresponding to a transaction request includes: inquiring whether a state machine template corresponding to the cached transaction request exists in a Redis cluster based on the transaction request; if the Redis cluster has a state machine template corresponding to the cached transaction request, acquiring the state machine template cached in the Redis cluster; and if the Redis cluster does not have the state machine template corresponding to the cached transaction request, inquiring the state machine template corresponding to the transaction request from the Mysql cluster.
In one embodiment, the state transition trigger event comprises: event notification and timing tasks; based on the state transition trigger event, the state transition of the state machine instance comprises the following steps: acquiring event notification in response to user operation; and if the event notification meets the transition condition of the state transition of the state machine instance, carrying out the state transition on the state machine instance.
In one embodiment, the state transition of the state machine instance based on the state transition trigger event further comprises: based on the timing task, the state machine instance is subjected to state transition at a preset time point.
In one embodiment, after the state of the state machine instance is transitioned based on the state transition trigger event, the method further comprises: updating the transition log of the state machine instance.
In a third aspect, an embodiment of the present invention provides a banking transaction system, including the state machine system provided in any one of the first aspects, further including: business system and data layer.
In one embodiment, a business system includes: triggering a calling interface SDK and a triggering transition interface SDK; triggering a call interface SDK for callback after state transition of the state machine instance; the trigger transition interface SDK is used for sending a state transition trigger event; the data layer comprises: mysql cluster, redis cluster, and mongo cluster; the Mysql cluster is used for storing a state machine template; the Redis cluster is used for caching the state machine template; the mongo cluster is used to store a log of transitions of state machine instances.
The embodiment of the invention has the following beneficial effects:
the state machine system, the transaction state management method and the bank transaction system provided by the embodiment of the invention comprise the following steps: the system comprises a template management module, an instance management module and a transition log management module; the template management module is used for creating a state machine template; each state machine template corresponds to different transaction business processes, and comprises a plurality of states of the transaction business processes and transition conditions among the states; the instance management module is used for creating a state machine instance according to a transaction request initiated by the service system and a state machine template corresponding to the transaction request, and carrying out transition on the state of the state machine instance based on a state transition trigger event; the transition log management module is used for recording the state transition log of the state machine instance. The system abstracts the transaction service state machine, manages and controls the transaction service state machine as an independent service, and improves the expandability and maintainability of the system; and the state machine examples of the different state machine templates are created by carrying out transaction on the service system through the different state machine templates, and the state transition of the state machine examples is carried out according to the state transition trigger event of the state machine examples, so that the stability and the reliability of the system are improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the above objects, features and advantages of the present invention more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a state machine system according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of another state machine system according to an embodiment of the present invention;
FIG. 3 is a transaction flow chart according to an embodiment of the present invention;
FIG. 4 is a flowchart of a transaction state management method according to an embodiment of the present invention;
FIG. 5 is an interactive flow chart of a banking transaction system provided by an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
At present, the traditional liability business system adopts a centralized transaction control mode, and has the problems of low system efficiency, poor expandability, easiness in single-point fault and the like. To address these issues, banking systems began to abstract and state manage business logic using distributed architecture and high availability techniques. However, existing liability business systems still have problems in terms of transaction control, such as: an attack form that the intermediate state or the necessary state of the transaction jump directly reaches the final state, etc. In addition, existing systems are prone to errors under high loads and unexpected failures, and are difficult to expand and maintain, failing to provide adequate system stability and reliability.
Based on the above, the state machine system, the transaction state management method and the bank transaction system provided by the embodiment of the invention can improve the stability and reliability of the system.
For the sake of understanding the present embodiment, first, a state machine system disclosed in the present embodiment will be described in detail, referring to a schematic structure of a state machine system shown in fig. 1, the system is shown to mainly include the following parts: template management module 10, instance management module 20, and migration log management module 30.
Wherein the template management module 10 is used for creating a state machine template; each state machine template corresponds to different transaction business processes, and comprises a plurality of states of the transaction business processes and transition conditions among the states. In one embodiment, the template management module 10 is configured to initialize a state machine template, program state machine flows (i.e., states of a transaction business flow) and transition events (i.e., transition conditions between states), and define transition nodes.
The instance management module 20 is configured to create a state machine instance according to a transaction request initiated by the service system and a state machine template corresponding to the transaction request, and transition the state of the state machine instance based on a state transition trigger event. In one embodiment, the instance management module 20 is configured to trigger and create a specific state machine instance, a transition state machine instance, during a transaction business process. Each state machine instance has a corresponding instance ID, and functions such as the state machine instance can be checked in real time.
The transition log management module 30 is configured to record a state transition log of the state machine instance. In one embodiment, the transition log management module 30 is used for development and business investigation, recording data changes generated in the transition process of the state machine and conditions of transition occurrence, such as transaction failure reasons, and the like, and recording the state transition log.
According to the state machine system provided by the embodiment of the invention, the transaction service state machine is abstracted, and is managed and controlled as an independent service, so that the expandability and maintainability of the system are improved; and the state machine examples of the different state machine templates are created by carrying out transaction on the service system through the different state machine templates, and the state transition of the state machine examples is carried out according to the state transition trigger event of the state machine examples, so that the stability and the reliability of the system are improved.
Referring to the schematic structure of another state machine system shown in fig. 2, it is shown that the system further includes, on the basis of fig. 1: an event management module 40, a fixed node management module 50, and an operation record query module 60.
Specifically, the event management module 40 is configured to determine a state transition trigger event for performing a state transition by the state machine instance; wherein, the state transition triggering event comprises: event notification and timing tasks. In one embodiment, the event management module 40 is configured to manage state machine instance transition states, where state machine instance state transitions need to be triggered by a state transition trigger event defined inside a state machine template, such as a pin event, that will trigger all intermediate state machine instances to reach a failed end state.
The fixed node management module 50 is configured to perform wind control management prior to state transition by the state machine instance. In one embodiment, in a banking system, wind control management is mainly performed, for example, a fixed node must be added in front of a transaction and is a fixed flow, and if wind control management cannot pass, a state machine instance cannot be migrated.
The operation record querying module 60 is configured to query operation records of the transaction business processes.
In order to facilitate understanding, the embodiment of the invention also provides a transaction processing mode based on the state machine system, which mainly comprises the following processes:
first, a liability service high-availability abstract state machine is built as a separate service.
Specifically, the liability service high-availability state machine is abstracted into a single service, an interface is provided for the outside, and decoupling is carried out on the interface and other service systems, so that the expandability and the stability of the system are realized.
And secondly, abstracting the transaction state by means of event notification, timing tasks and the like, and establishing a state machine template.
Specifically, the transaction state is abstracted by means of event notification, timing tasks and the like, and a state machine template is established, so that automatic control and management of the system are realized.
The state machine system defines a state machine template, wherein important components in the state machine template comprise: each state of the business transaction flow, an entering state action, an exiting state action and a transition event.
Creating a state machine instance from a state machine template, the created state machine instance will not be changed by a change in the state machine template. Wherein each state machine instance has a respective instance ID.
State transitions of state machine instances will be triggered by transition events; the entering state machine executes the entering state action of the state machine template, wherein the entering state action can be the executing condition of the state; the out-of-state action may be a verify action after the state is performed.
Then, when the business system transacts, a transaction request is initiated, and state machine instances of different state machine templates are created through the different state machine templates. The transaction state abstraction process is to abstract the same business flow, such as recharging, presenting, and the like, namely, abstract the business flow into a recharging state machine template and a presenting state machine template.
Specifically, a transaction request is initiated during transaction of a service system, and state machine instances of different state machine templates are created through different state machine templates, so that self-adaptive control and management of the system are realized.
Finally, the state of the state machine instance is transited by timing tasks and sending different generalized transaction events, and the state transited state is strictly controlled.
Specifically, for example, the recharging service may be divided into: initialization state, short message sending state, wind control state, substitute buckling state, substitute paying state, success state and failure state. The user triggers a short message sending state, sends a short message when entering action, then has an mq to inform that the air control state is reached, and can reach a substitute buckling state and a substitute paying state when the air control state passes; if the substitute deduction state and the substitute payment state do not respond for a long time, the substitute deduction state and the substitute payment state result notification can be triggered by the timing task, so that the final state is reached.
In this step, the state of the state machine instance is migrated by timing tasks and sending different generalized transaction events (i.e., event notifications), and the state migration state is strictly controlled, thereby realizing the automatic control and management of the system.
In the embodiment of the invention, in a high-availability abstract state machine system of the liability service, the high-availability abstract state machine of the liability service is established as a single service, the final state of the transaction is abstracted, a state machine template is established, and the state of the transaction and migration conditions among the states are described through the state machine template, so that the state management of the liability service is realized.
In the template management module, state machine instances of different state machine templates are created by means of event notification, timing tasks and the like and are bound to transactions of the liability business system. Different state machine templates can be used for different types of business transaction flows, and state management of different types of transactions is achieved by binding different state machine instances to different transactions.
In the instance management module, the state of the state machine instance is migrated through timing tasks and sending different generalized transaction events, and the legality of the state migration is strictly controlled. The module transfers the state of the state machine instance from one state to another state, and ensures the validity and the safety of state transfer by limiting the transfer conditions.
In the state machine result collection module, the complex transaction processing results are subjected to centralized processing by adopting a state machine mode and a tool, so that the reliability of the collection result of each transaction is ensured. The module collects transaction processing results and processes the transaction processing results according to a state machine mode, and accuracy and integrity of the results are ensured.
Further, the present invention also provides a transaction process based on the state machine system, referring to a transaction flow chart shown in fig. 3, in order to achieve high availability of the system, a plurality of state machine service nodes may be deployed, and when one state machine node receives a transaction request, the service system initiates a transaction request, and the transaction request is routed to the closest node first. The node then sends a pre-commit request to the other nodes to ensure that all nodes have granted the transaction request. The transaction request will be submitted if most nodes agree to the transaction request, otherwise the transaction request will be revoked. Meanwhile, in the transaction request processing process, if a certain state machine node cannot process the transaction request due to the problems of power failure and the like, the other state machine nodes can process the transaction request, so that the normal processing of the transaction flow is ensured.
The invention provides a high-availability state machine system for bank liability transaction, which solves the problems of opaque transaction process, low transaction efficiency, insufficient risk control and the like in the traditional liability transaction system by managing and optimizing transaction flow. By introducing a state machine technology and a process management technology, the system realizes the automatic control and optimization of the transaction process, improves the liability transaction efficiency and reliability, and enhances the risk control capability. By realizing key technologies such as a multi-copy mechanism, quick switching and data consistency, the problems of high availability, data consistency, system performance and the like in the prior art can be effectively solved, and the method has the following advantages and effects:
(1) The high-availability abstract state machine of liability business is established as independent service, the final state of the transaction is abstracted through the modes of event notification, timing tasks and the like, and a state machine template is established, so that the reliability of transaction processing is ensured.
(2) Through different state machine templates, state machine instances of different models are initiated and created during business system transaction, and support for complex transaction processing is realized.
(3) The state of the state machine instance is transited by timing tasks and sending different generalized transaction events, the state transition state is strictly controlled, and the risk that the transaction jumps to the intermediate state or directly reaches the final state is avoided.
(4) For the relative decoupling of the liability business system, the centralized processing is carried out on the complex transaction processing result collection by adopting a state machine mode and a tool, so that the reliability and the efficiency of the system are improved.
For the state machine system, the embodiment of the invention provides a transaction state management method, which is applied to the state machine system. Referring to the flowchart of a transaction state management method shown in fig. 4, it is shown that the method mainly includes the following steps S401 to S403:
step S401: and receiving a transaction request initiated by the service system.
In one embodiment, the state machine system may obtain the transaction request when the business system initiates the transaction request.
Step S402: querying a state machine template corresponding to the transaction request, and creating a state machine instance based on the state machine template.
In one embodiment, the state machine system creates and maintains different state machine templates, each corresponding to a different type of transaction. After receiving the transaction request of the service system, the state machine system can query the corresponding state machine template according to the transaction type corresponding to the transaction request and create the corresponding state machine instance.
Step S403: and acquiring a state transition trigger event, and performing transition on the state of the state machine instance based on the state transition trigger event.
In one embodiment, the state machine system may state transition the state machine instance during transaction processing based on a state transition trigger event.
According to the method provided by the embodiment of the invention, the state machine examples of the different state machine templates are created by carrying out transaction on the business system through the different state machine templates, and the state transition of the state machine examples is carried out according to the state transition triggering event of the state machine examples, so that the reliability of transaction processing is ensured, and the risk that the transaction jumps to the intermediate state or directly reaches the final state is avoided.
In one embodiment, for the aforementioned step S402, that is, when querying the state machine template corresponding to the transaction request, the following manners may be adopted, including but not limited to: inquiring whether a state machine template corresponding to the cached transaction request exists in a Redis cluster based on the transaction request; if the Redis cluster has a state machine template corresponding to the cached transaction request, acquiring the state machine template cached in the Redis cluster; and if the Redis cluster does not have the state machine template corresponding to the cached transaction request, inquiring the state machine template corresponding to the transaction request from the Mysql cluster.
In specific implementation, the state machine templates created by the state machine system are stored in the Mysql cluster, and in order to increase the loading speed of the model, the state machine templates with higher use frequency or higher importance are generally cached in the Redis cluster. Based on the above, in the embodiment of the invention, when the state machine template corresponding to the transaction request is queried, whether the cached state machine template exists in the Redis cluster can be queried, and if so, the state machine template corresponding to the cached transaction request is directly obtained from the Redis cluster; if not, inquiring and acquiring a state machine template corresponding to the transaction request from the Mysql cluster.
In one embodiment, the state transition trigger event comprises: event notification and timing tasks; for the aforementioned step S403, that is, when the state of the state machine instance is transited based on the state transition trigger event, the following two ways may be adopted, including but not limited to:
mode 1: acquiring event notification in response to user operation; and if the event notification meets the transition condition of the state transition of the state machine instance, carrying out the state transition on the state machine instance.
In implementations, the user may trigger event notifications by clicking a button of the page, such as: sending a short message, the next step and the like; after receiving the event notification, the state machine system needs to judge whether the event can trigger state transition or not, and if so, the state machine instance carries out state transition. For example: the triggering event of the state machine instance from the current state to the next state is event 1, if the event notification received by the state machine system is event 2, the state transition of the state machine instance cannot be triggered, and only when the event 1 is received, the state transition of the state machine instance can be triggered.
Mode 2: based on the timing task, the state machine instance is subjected to state transition at a preset time point.
In the implementation, a timing task for triggering state transition can be set in the state model, and state transition is performed on the state machine instance at a preset time point.
Further, after the state of the state machine instance is transitioned based on the state transition trigger event, the method further comprises: updating the transition log of the state machine instance.
According to the method provided by the embodiment of the invention, the state machine examples of the different state machine templates are created by carrying out transaction on the business system through the different state machine templates, and the state transition of the state machine examples is carried out according to the state transition trigger event of the state machine examples, so that the reliability of transaction processing is ensured; the state of the state machine instance is transited by timing tasks and sending different generalized transaction events, so that the risk of the transaction jumping to an intermediate state or directly reaching a final state is avoided.
The embodiment of the invention provides a banking transaction system, which comprises the state machine system provided by the previous embodiment, and further comprises: business system and data layer.
In one embodiment, a business system includes: triggering a calling interface SDK and a triggering transition interface SDK; triggering a call interface SDK for callback after state transition of the state machine instance; the trigger transition interface SDK is used for sending a state transition trigger event; the data layer comprises: mysql cluster, redis cluster, and mongo cluster; the Mysql cluster is used for storing a state machine template; the Redis cluster is used for caching the state machine template; the mongo cluster is used to store a log of transitions of state machine instances.
For easy understanding, an embodiment of the present invention provides an interactive flowchart of a banking transaction system, referring to fig. 5, a service system initializes a state machine, and the state machine system may save and create a state machine template, where contents of the state machine template include: node (state) definition, node transition event definition, transition state callback method definition and the like, and after the creation of the state machine template is completed, the state machine template can be stored in the Mysql cluster.
When a user starts a transaction at a service system, the service is initialized and triggered, and a state machine system queries a state machine template and creates a state machine instance according to the service trigger. When inquiring the state machine template, firstly inquiring whether the cached state machine template exists in the Redis cluster, and inquiring the state machine template in the Mysql cluster if the cached state machine template does not exist; if the cache exists, loading a cached state machine template; and the service system returns a template result of the state machine so as to enable the service system to perform service processing.
Triggering state transition of a state machine instance after the service system receives an asynchronous triggering event; the state system firstly judges whether the state machine transits, namely judges whether an asynchronous triggering event can trigger the state transition of the state machine instance, if so, the state transition is carried out on the state machine instance, and a transition log is recorded after the transition is completed.
Further, the state machine system can call back the service processing state of the service system, and record a call back result and record a state machine instance transition record; if the service callback fails, the service callback can be reinitiated; and if the service callback is successful, updating the transition record.
According to the system provided by the embodiment of the invention, the liability business state machine is abstracted, and is managed and controlled as the independent service, so that the state machine in the liability business system can be effectively decoupled, and the expandability and maintainability of the system are improved; the final state of the transaction in the liability business system is abstracted through the modes of event notification, timing tasks and the like, and a state machine model is built, so that the transaction flow in the liability business system can be effectively managed and controlled, and the attack form that the intermediate state or the necessary state of the transaction is directly reached to the final state is avoided; and managing and controlling the transaction flow in the liability business system through different state machine models, strictly controlling the state transition state according to the state transition rule of the state machine instance, and simultaneously relatively decoupling the liability business system so as to ensure the reliability and the safety.
The system provided by the embodiment of the present invention has the same implementation principle and technical effects as those of the previous embodiment, and for the sake of brief description, reference may be made to the corresponding content in the previous embodiment where this embodiment is not mentioned.
The embodiment of the invention also provides electronic equipment, which comprises a processor and a storage device; the storage means has stored thereon a computer program which, when run by a processor, performs the method according to any of the above embodiments.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where the electronic device 100 includes: a processor 61, a memory 62, a bus 63 and a communication interface 64, the processor 61, the communication interface 64 and the memory 62 being connected by the bus 63; the processor 61 is arranged to execute executable modules, such as computer programs, stored in the memory 62.
The memory 62 may include a high-speed random access memory (RAM, random Access Memory), and may further include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. The communication connection between the system network element and at least one other network element is implemented via at least one communication interface 64 (which may be wired or wireless), and may use the internet, a wide area network, a local network, a metropolitan area network, etc.
Bus 63 may be an ISA bus, a PCI bus, an EISA bus, or the like. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 6, but not only one bus or type of bus.
The memory 62 is configured to store a program, and the processor 61 executes the program after receiving an execution instruction, and the method executed by the apparatus for flow defining disclosed in any of the foregoing embodiments of the present invention may be applied to the processor 61 or implemented by the processor 61.
The processor 61 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 61 or by instructions in the form of software. The processor 61 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a digital signal processor (Digital Signal Processing, DSP for short), application specific integrated circuit (Application Specific Integrated Circuit, ASIC for short), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA for short), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory 62 and the processor 61 reads the information in the memory 62 and in combination with its hardware performs the steps of the above method.
The computer program product of the readable storage medium provided by the embodiment of the present invention includes a computer readable storage medium storing a program code, where the program code includes instructions for executing the method described in the foregoing method embodiment, and the specific implementation may refer to the foregoing method embodiment and will not be described herein.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the above examples are only specific embodiments of the present invention, and are not intended to limit the scope of the present invention, but it should be understood by those skilled in the art that the present invention is not limited thereto, and that the present invention is described in detail with reference to the foregoing examples: any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or perform equivalent substitution of some of the technical features, while remaining within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A state machine system, comprising: the system comprises a template management module, an instance management module and a transition log management module;
the template management module is used for creating a state machine template; wherein, each state machine template corresponds to different transaction business processes, and comprises a plurality of states of the transaction business processes and transition conditions among the states;
the instance management module is used for creating a state machine instance according to a transaction request initiated by a service system and a state machine template corresponding to the transaction request, and carrying out transition on the state of the state machine instance based on a state transition trigger event;
the transition log management module is used for recording the state transition log of the state machine instance.
2. The system of claim 1, wherein the system further comprises: the event management module is used for determining a state transition trigger event for performing state transition by the state machine instance; wherein the state transition trigger event comprises: event notification and timing tasks.
3. The system of claim 1, wherein the system further comprises: the fixed node management module and the operation record query module;
the fixed node management module is used for performing wind control management before the state machine instance performs state transition;
the operation record inquiring module is used for inquiring the operation record of the transaction business process.
4. A transaction state management method, characterized in that the method is applied to the state machine system of any one of claims 1 to 3, comprising:
receiving a transaction request initiated by a service system;
inquiring the state machine template corresponding to the transaction request, and creating a state machine instance based on the state machine template;
and acquiring a state transition trigger event, and performing transition on the state of the state machine instance based on the state transition trigger event.
5. The method of claim 4, wherein querying the state machine template corresponding to the transaction request comprises:
inquiring whether a cached state machine template corresponding to the transaction request exists in a Redis cluster based on the transaction request;
if the Redis cluster has the cached state machine template corresponding to the transaction request, acquiring the cached state machine template in the Redis cluster;
and if the Redis cluster does not have the cached state machine template corresponding to the transaction request, inquiring the state machine template corresponding to the transaction request from the Mysql cluster.
6. The method of claim 4, wherein the state transition trigger event comprises: event notification and timing tasks;
based on the state transition trigger event, performing transition on the state of the state machine instance, including:
acquiring the event notification in response to a user operation;
and if the event notification meets the transition condition of the state transition of the state machine instance, carrying out the state transition on the state machine instance.
7. The method of claim 6, wherein transitioning the state of the state machine instance based on the state transition trigger event further comprises:
and based on the timing task, carrying out state transition on the state machine instance at a preset time point.
8. The method of claim 4, wherein after transitioning the state of the state machine instance based on the state transition trigger event, the method further comprises:
updating the transition log of the state machine instance.
9. A banking transaction system, comprising: the state machine system of any of claims 1 to 3, further comprising: business system and data layer.
10. A banking system according to claim 9, wherein the business system comprises: triggering a calling interface SDK and a triggering transition interface SDK;
the triggering call interface SDK is used for callback after state transition of the state machine instance;
the trigger transition interface SDK is used for sending a state transition trigger event;
the data layer includes: mysql cluster, redis cluster, and mongo cluster;
the Mysql cluster is used for storing a state machine template;
the Redis cluster is used for caching the state machine template;
the mongo cluster is used for storing the transition log of the state machine instance.
CN202311235717.XA 2023-09-25 2023-09-25 State machine system, transaction state management method and bank transaction system Pending CN116977048A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311235717.XA CN116977048A (en) 2023-09-25 2023-09-25 State machine system, transaction state management method and bank transaction system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311235717.XA CN116977048A (en) 2023-09-25 2023-09-25 State machine system, transaction state management method and bank transaction system

Publications (1)

Publication Number Publication Date
CN116977048A true CN116977048A (en) 2023-10-31

Family

ID=88477126

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311235717.XA Pending CN116977048A (en) 2023-09-25 2023-09-25 State machine system, transaction state management method and bank transaction system

Country Status (1)

Country Link
CN (1) CN116977048A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101958897A (en) * 2010-09-27 2011-01-26 北京***工程研究所 Correlation analysis method of security incident and system
WO2012113336A1 (en) * 2011-02-23 2012-08-30 运软网络科技(上海)有限公司 System for managing resources in virtualized environment and implementation method therefor
CN110580155A (en) * 2019-07-31 2019-12-17 苏宁云计算有限公司 Implementation method and device of state machine engine, computer equipment and storage medium
CN111142975A (en) * 2019-12-12 2020-05-12 贝壳技术有限公司 State machine persistence method and state machine persistence system
CN112860354A (en) * 2021-01-29 2021-05-28 宝宝巴士股份有限公司 Modeling method and terminal of state machine based on Laravel framework
CN114971506A (en) * 2021-02-26 2022-08-30 ***通信集团广东有限公司 System and method for separating process engine and business event processing
CN115375134A (en) * 2022-08-19 2022-11-22 平安国际融资租赁有限公司 Service processing method and system based on state machine

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101958897A (en) * 2010-09-27 2011-01-26 北京***工程研究所 Correlation analysis method of security incident and system
WO2012113336A1 (en) * 2011-02-23 2012-08-30 运软网络科技(上海)有限公司 System for managing resources in virtualized environment and implementation method therefor
CN110580155A (en) * 2019-07-31 2019-12-17 苏宁云计算有限公司 Implementation method and device of state machine engine, computer equipment and storage medium
CN111142975A (en) * 2019-12-12 2020-05-12 贝壳技术有限公司 State machine persistence method and state machine persistence system
CN112860354A (en) * 2021-01-29 2021-05-28 宝宝巴士股份有限公司 Modeling method and terminal of state machine based on Laravel framework
CN114971506A (en) * 2021-02-26 2022-08-30 ***通信集团广东有限公司 System and method for separating process engine and business event processing
CN115375134A (en) * 2022-08-19 2022-11-22 平安国际融资租赁有限公司 Service processing method and system based on state machine

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
曹锋: "区块链知识技术普及版", 北京理工大学出版社, pages: 178 - 181 *

Similar Documents

Publication Publication Date Title
CN101452400B (en) Method and system for processing transaction buffer overflow in multiprocessor system
US9274798B2 (en) Multi-threaded logging
CN103647669A (en) System and method for guaranteeing distributed data processing consistency
CN110941502B (en) Message processing method, device, storage medium and equipment
US10630566B1 (en) Tightly-coupled external cluster monitoring
CN112988683A (en) Data processing method and device, electronic equipment and storage medium
CN111049904A (en) Method and equipment for monitoring multiple public cloud resources
CN103020003A (en) Multi-core program determinacy replay-facing memory competition recording device and control method thereof
CN110162344A (en) A kind of method, apparatus, computer equipment and readable storage medium storing program for executing that current limliting is isolated
US7484116B2 (en) Apparatus, system, and method for accessing redundant data
CN112732427B (en) Data processing method, system and related device based on Redis cluster
CN110286852A (en) Dual control framework distributed memory system, method for reading data, device and storage medium
CN116977048A (en) State machine system, transaction state management method and bank transaction system
CN110309224B (en) Data copying method and device
CN114218303B (en) Transaction data processing system, processing method, medium and equipment
CN115470041A (en) Data disaster recovery management method and device
US11656972B1 (en) Paginating results obtained from separate programmatic interfaces
CN113900840A (en) Distributed transaction final consistency processing method and device
US20170132094A1 (en) Technologies for analyzing persistent memory programs
CN113010495A (en) Database optimization method and device
CN109032835B (en) Software regeneration method and device
CN111752911A (en) Data transmission method, system, terminal and storage medium based on Flume
CN113448513B (en) Data reading and writing method and device of redundant storage system
US11868204B1 (en) Cache memory error analysis and management thereof
CN117907812B (en) Circuit detection method and device, electronic device, storage medium, and program product

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