CN-121998757-A - Multi-domain linkage state machine system for describing complex service scene
Abstract
The invention discloses a multi-domain linkage state machine system for describing complex business scenes, belonging to the technical field of dealer trading systems. The system loads a state machine and flow definition through a configuration analyzer, converts an external request into an internal event and fills corresponding configuration by a filler, an event queue router routes the event to a fixed work thread queue according to service identification to ensure sequency, a work thread pool concurrently executes the event, a flow execution engine executes the flow in the event, a multi-domain state machine management center drives state circulation, and when a state change triggers a linkage condition, linkage events of an associated state machine are automatically generated and triggered, so that multi-domain state machine linkage is realized. The invention solves the technical problems of complex state machine management, difficult linkage and difficult concurrent performance and sequence consistency in a dealer trading system by combining a modularized and configurable architecture and an assemblable thread queue model, and realizes high development efficiency, high maintainability and high expandability.
Inventors
- SUN DAWEI
- LUO WENHUI
- WANG HUI
- WANG LUNZHANG
- LI HUAJIN
- LI YUANCHANG
- CAO JUN
- LI RUNZHOU
Assignees
- 华泰证券股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20251219
Claims (10)
- 1. A multi-domain linkage state machine system for describing complex business scenarios, comprising: the system comprises a state machine and a flow configuration analyzer, wherein the state machine and the flow configuration analyzer are used for loading and analyzing configuration files to obtain configuration definitions of the state machine and the flow; The state machine and flow filler is used for converting the external service request into an internal event through the internal and external model conversion factory and filling the corresponding state machine and flow for the internal event; An event queue router for routing the internal event to a designated work thread queue according to a service unique number; a working thread pool for concurrently executing internal events in the working thread queue; A flow execution engine for executing the flow filled in the internal event; The multi-domain state machine management center is used for driving state machine circulation and automatically triggering linkage operation of the associated state machine when the state circulation triggering linkage condition is detected.
- 2. The multi-domain linked state machine system of claim 1, wherein the multi-domain state machine management center is configured to perform the steps of: After the process execution engine completes the process execution of an internal event, the internal event is received and the state torsion operation of the associated state machine is carried out; When it is determined that one state twisting operation affects at least one other associated state machine, searching context data corresponding to the associated state machine from a context structure stored in a memory; Encapsulating the searched context data into an internal event for describing the change of the linkage state machine, and sending the event to the event queue router; the event queue router, the working thread pool, the flow execution engine and the multi-domain state machine management center sequentially process the packaged events, execute the filling flow of the events and drive the corresponding state machines to perform state torsion, so that linkage among the multi-domain state machines is completed.
- 3. The system of claim 1, wherein the event queue router uses the unique order number as the routing number, and uses a hash algorithm to route to ensure that events of the same order are routed to the same work thread queue for sequential execution.
- 4. The multi-domain linkage state machine system for describing complex business scenarios of claim 1, further comprising a thread queue model assembler for assembling a thread queue model for the work thread pool, wherein the thread queue model comprises at least one of a single thread queue model, a lock-free queue thread model, a disrupter thread queue model, and a prioritized lock-free queue thread model.
- 5. The multi-domain linked state machine system describing complex traffic scenarios of claim 4, wherein the prioritized lock-free queue thread model employs ConcurrentSkipListSet-based lock-free queues supporting prioritization.
- 6. The multi-domain linked state machine system of claim 1, wherein the state machine and flow configuration parser convert configuration data into internal static data instances for placement in memory.
- 7. A dealer trading system implemented with the multi-domain linked state machine system of any of claims 1-6, wherein the external service requests in the state machine and flow populator are order requests, and wherein the multi-domain state machine management center, the multi-domain includes a quotation request domain and a quotation domain.
- 8. A computer readable storage medium having stored thereon a computer program, wherein the program when executed by a processor performs the operations of the multi-domain linked state machine system of any of claims 1 to 7.
- 9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the computer program when executed performs the operations of the multi-domain linked state-machine system of any of claims 1-7.
- 10. A computer program product comprising computer programs/instructions which when executed by a processor implement the operation of the multi-domain linked state machine system of any of claims 1 to 7.
Description
Multi-domain linkage state machine system for describing complex service scene Technical Field The invention relates to the technical field of dealer trading systems, in particular to a multi-field linkage state machine system for describing complex business scenes. Background The security dealer focuses on the quick realization of complex business scenes, and polishes the security business trade link development framework suitable for the event-driven micro-service architecture. The design and development of the dealer trading system have more difficulties, and have higher requirements on the aspects of product diversity, business complexity, expansion flexibility, high concurrency and low delay of trade and the like. The core system of the trade link is the system for generating and managing orders, and the core point of order management is the life cycle management of the orders. Order lifecycle management includes management of order state machines, and management of a series of processes that an order needs to complete before an external message-driven order state changes. The flow and state machine of different trade varieties have different parts and the same part. If the same parts can be abstracted to form a common modularized assembly, and then various modularized assemblies are combined in a collocation mode to realize state machines and processes of different transaction varieties, the efficiency of constructing new transaction varieties is greatly improved. For complex transaction scenarios, linkage between multiple state machines may be involved, i.e., an external message causes a state machine to change, which in turn affects other associated state machines. The linkage between state machines is also a problem that the system needs to solve. The context of transactions and deployment environments may require that the processing of the system use heterogeneous worker thread queue models, requiring various thread queue models that may be flexibly configured in various contexts. The existing open-source state machine frameworks such as SPRING STATEMACHINE and squirrel-foundation have complete state machine description functions, but have no flow analysis and flow arrangement capabilities, and the existing frameworks and technologies cannot find a scheme which is suitable for complex business scenes of dealer trading systems and supports linkage among state machines in multiple fields. In the field of dealer trading, a service has not only complex state machines but also linkage among a plurality of associated state machines, and a dealer trading system has high requirements on time delay and throughput. Disclosure of Invention The technical problem to be solved by the invention is to provide a multi-domain linkage state machine system for describing complex service scenes. The system needs to meet the following core requirements: (1) The configuration state machine and flow analysis is that an analysis engine with a set of state machine and flow can realize the management of the life cycle of orders in each business scene by a modularization and configuration method; (2) Supporting linkage of state machines in multiple fields, namely supporting linkage operation among multiple state machines; (3) The multithreading technology is used for improving the performance of the system and improving the throughput of the system, but the processing sequence of the same order is required to be consistent with the sequence of receiving external requests; (4) Flexibility and expandability the system should have good flexibility and expandability to adapt to the change of future transaction business scene. In order to solve the problems, the invention adopts the following technical scheme: first, the present invention proposes a multi-domain linkage state machine system for describing complex business scenarios, comprising: the system comprises a state machine and a flow configuration analyzer, wherein the state machine and the flow configuration analyzer are used for loading and analyzing configuration files to obtain configuration definitions of the state machine and the flow; The state machine and flow filler is used for converting the external service request into an internal event through the internal and external model conversion factory and filling the corresponding state machine and flow for the internal event; An event queue router for routing the internal event to a designated work thread queue according to a service unique number; a working thread pool for concurrently executing internal events in the working thread queue; A flow execution engine for executing the flow filled in the internal event; The multi-domain state machine management center is used for driving state machine circulation and automatically triggering linkage operation of the associated state machine when the state circulation triggering linkage condition is detected. Preferably, the multi-domain state machine management center i