Crossing integrated machine and crossing software architecture method and system based on distributed state machine
By adopting a distributed state machine and service registration and discovery mechanism in the road entrance software, the problem of insufficient reliability of the road entrance software under the traditional single architecture is solved, and higher stability and reliability are achieved, ensuring the terminal traffic efficiency and operation continuity.
Patent Information
- Application Number
- CN202510253118.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-05
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-03-05
AI Technical Summary
Traditional road crossing software adopts a single-unit architecture, resulting in insufficient system reliability, which is prone to a significant reduction in traffic efficiency due to single-point failures, and even impaired traffic, affecting dock operations and social life.
Adopt the road crossing software architecture based on distributed state machines, through the service registration and discovery mechanism of the distributed service cluster, it ensures that only one service instance of the same road crossing ID is in the activated state at the same time, realizes service transparency, and automatically switches to other service containers to activate when the service crashes.
It significantly improves the stability and reliability of the intelligent crossing software system, ensures the service quality and operation continuity of the crossings in and out of the dock, and avoids the reduction in traffic efficiency caused by single point failure.
Smart Images

Figure CN119739569B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information technology, and in particular to a road crossing integrated machine and a road crossing software architecture method and system based on a distributed state machine. Background Art
[0002] Container terminals always have the highest requirements for the passing capacity of the gates in and out of the terminal. The direct indicator for measuring the gate is the gate traffic efficiency, which directly reflects the operating efficiency and external service quality of the container terminal, and directly affects the comprehensive capacity of the terminal. In order to improve the gate traffic efficiency, the terminal generally uses an intelligent gate system to achieve 24-hour unmanned operation, and a single vehicle can pass through the gate in about 30 seconds.
[0003] However, traditional crossing software generally adopts a monolithic architecture. Under this architecture, any failure in any module of the service program can easily lead to the paralysis of the entire system, which greatly reduces the efficiency of crossing traffic, or even completely makes it impossible to pass, causing queues and congestion. Even if a set of active-standby structures is built on the basis of the monolithic architecture, although the recovery time can be shortened, it is still difficult to restore smooth traffic immediately after troubleshooting, and the risk of overall system collapse still exists, and reliability is still insufficient, which not only affects the operation and production of the terminal itself, but also causes troubles and negative impacts on social life.
[0004] Based on this, a new crossing software architecture solution is needed. Summary of the invention
[0005] In view of this, the embodiments of this specification provide a method and system for a level crossing integrated machine and level crossing software architecture based on a distributed state machine, define the level crossing service as a distributed state machine, and utilize the service registration and discovery mechanism of a distributed service cluster, thereby effectively solving the problem of insufficient reliability of existing container intelligent level crossing software based on a monolithic architecture, and significantly improving the stability and reliability of the intelligent level crossing software system, thereby better ensuring the service quality and operation continuity of the terminal entry and exit level crossings.
[0006] The embodiments of this specification provide the following technical solutions:
[0007] The embodiment of this specification provides a road crossing software architecture method based on a distributed state machine, including:
[0008] The crossing service is defined as a distributed state machine, and the states of the state machine include: standby and executing;
[0009] When the crossing service receives an input event, it switches from the current state to another state according to the preset state transition rules, and performs an action corresponding to the state transition; wherein the input event includes: data received by the crossing service;
[0010] Utilize the service registration and discovery mechanism of the distributed service cluster to ensure that only one service instance of the same crossing ID is active at the same time, wherein the distributed service cluster is equipped with at least two servers;
[0011] When the crossing service is activated, the state data of the crossing is extracted from the state library of the distributed service cluster, and the attributes of the crossing object are filled to resume and continue the previously interrupted crossing operation;
[0012] Once the crossing service is activated, it will continue to respond to input events and will not be released actively;
[0013] When a crossing service crashes, the current crossing service will be automatically switched to another service container for activation and continue to respond to input events.
[0014] Furthermore, the input event includes:
[0015] Subscribe to and process data published by external systems, including: license plate recognition data published by the license plate recognition system, box number and box type recognition data published by the box number recognition system, box splicing data published by the box splicing system, and damage recognition data published by the damage recognition system;
[0016] Subscribe to and process the collected data published by the integrated crossing machine, including: weighing equipment data, code scanning equipment data and keyboard data.
[0017] Furthermore, the data released by the external system and the collected data released by the processing road crossing integrated machine also include: data of the reserved plug-in interface, which is used to adapt to the data released by the external system that is not in the agreed format and specification.
[0018] Furthermore, the input event also includes: responding to a service request from a crossing central control client and responding to a service request from a background operation and maintenance client.
[0019] Furthermore, the preset state transition rules include:
[0020] When the crossing service receives an input event, the crossing service status switches from "standby" to "executing", and the received data is converted into crossing object attributes and cached locally, and saved to the distributed service cluster status library;
[0021] According to the preset gate entry conditions, determine whether to allow gate entry; if allowed, generate a lift command and ticket content, and push the processing results to the gate integrated machine, the gate central control client and the backend operation and maintenance client, and the gate status is switched from "executing" to "standby";
[0022] If the crossing central control client manually initiates an emergency forced release command, a barrier lifting command is generated, and the processing result is pushed to the crossing integrated machine, the crossing central control client and the background operation and maintenance client, and the crossing status is switched from "executing" to "standby".
[0023] Furthermore, when the crossing state switches from "executing" to "standby", the crossing object is initialized, and the state data of the crossing is deleted in the distributed service cluster state library to prepare for processing the next gate entry request.
[0024] The embodiment of this specification also provides a road crossing software architecture system based on a distributed state machine, the road crossing software architecture system based on a distributed state machine includes: a road crossing state machine service, a distributed service cluster server and a road crossing integrated machine;
[0025] The crossing state machine service is used to receive input events sent by the crossing integrated machine, switch from a current state to another state according to a preset state transition rule, and execute an action corresponding to the state transition;
[0026] Wherein, the states include: standby and executing; the input events include: data received by the crossing service;
[0027] It is also used to extract the state data of the crossing from the state library of the distributed service cluster and fill the attributes of the crossing object to restore and continue the previously interrupted crossing operation;
[0028] Once the crossing service is activated, it will continue to respond to input events and will not be released actively;
[0029] When a crossing service crashes, the current crossing service is automatically switched to another service container for activation and continues to respond to input events;
[0030] The distributed service cluster server is used to deploy and manage the crossing state machine service instance, and uses the service registration and discovery mechanism to ensure that only one service instance of the same crossing ID is activated at the same time, wherein the distributed service cluster is equipped with at least two servers;
[0031] The road crossing integrated machine is configured at each road crossing and is used to send the collected input events to the road crossing state machine service to activate the road crossing service.
[0032] Furthermore, the road crossing software architecture system based on the distributed state machine also includes: a road crossing central control client;
[0033] The crossing central control client is used to provide an interface for monitoring crossing operations, including defining the monitored crossings, modifying data, initiating emergency forced release instructions, and viewing historical gate-passing data and crossing traffic statistics.
[0034] Furthermore, the road crossing software architecture system based on the distributed state machine also includes: a background operation and maintenance client;
[0035] The backend operation and maintenance client is used to provide an interface for monitoring the operation of the system, including: defining the monitored checkpoints, viewing logs such as messages and events occurring in each link, and the health status of service operation.
[0036] The embodiments of this specification also provide a road crossing integrated machine based on a distributed state machine, and the road crossing integrated machine is configured using any of the road crossing software architecture methods based on a distributed state machine described above.
[0037] Compared with the prior art, the at least one technical solution adopted in the embodiments of this specification can achieve the following beneficial effects:
[0038] By defining the crossing service as a distributed state machine, deploying it in the service container of the distributed service cluster in the form of a distributed service, and using the service registration and discovery mechanism of the distributed service cluster to achieve service transparency, there is only one service instance in the active state for the same crossing ID at the same time, and it will not be actively released after activation, and can be continuously accessed until a crash occurs. When a crash occurs, it will automatically switch to other service containers for reactivation to ensure uninterrupted service. This not only guarantees the automatic recovery and continuous response of crossing operations, but also ensures that the crash of a single service instance will not interfere with the normal operation of other instances, thereby significantly improving the crossing efficiency and the overall stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 This is a single-body architecture diagram under the active-standby structure of the existing solution;
[0041] Figure 2 It is a distributed architecture diagram under the state machine model in this application;
[0042] Figure 3 This is a diagram of the distributed architecture with disaster recovery mechanism in this application;
[0043] Figure 4 This is a diagram of the container crossing software framework based on a distributed state machine in this application. DETAILED DESCRIPTION
[0044] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0045] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that, in the absence of conflict, the following embodiments and the features in the embodiments can be combined with each other. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.
[0046] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein can be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present application, it should be understood by those skilled in the art that an aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number and aspect described herein can be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein can be used to implement this device and / or practice this method.
[0047] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application. The illustrations only show the components related to the present application rather than being drawn according to the number, shape and size of the components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0048] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the examples can be practiced without these specific details.
[0049] The entrance and exit gates of a container terminal are a key link in terminal operations. Their traffic efficiency directly affects the terminal's operating efficiency and service level. With the continuous growth of container transportation business, higher requirements are placed on the gate's throughput capacity.
[0050] Traditional crossing software generally adopts a monolithic architecture. Although this architecture is easy to develop and deploy, low-cost, and only requires one server, it does not fully utilize resources and is difficult to cope with high-concurrency requests during peak hours. In addition, the monolithic architecture has significant risks, that is, any failure in any module in the system can easily cause the entire system to crash, which in turn causes a significant decrease in crossing efficiency and causes vehicle queues and congestion, which not only affects the daily operations of the terminal, but also has a negative impact on the social life of the surrounding communities.
[0051] like Figure 1 As shown, although a backup service can be built for the main service based on the monolithic architecture, the functions of the two are exactly the same, the difference is that usually only the main service provides external service capabilities; the backup service ensures consistency with the main service capabilities through data synchronization, is on standby at any time, and does not provide services to the outside; when the main service fails, the backup service is switched to the main service, and the original main service is switched to the backup service after troubleshooting, that is, when the main service fails, the backup service quickly takes over and continues to provide services. Although this can reduce the system downtime, it still cannot completely solve the risk of single point failures. If the database or the server where the main service is located fails, the entire system will still be affected.
[0052] In view of this, the inventors discovered through research and improvement exploration that in the existing crossing software based on a monolithic architecture, all modules run in the same process. The failure of any module will cause the entire system to crash, and the failure recovery time is long, seriously affecting the normal passage of the crossing. Although the active-standby structure can shorten the system recovery time to a certain extent, it still cannot avoid the impact of system crashes.
[0053] Based on this, the embodiment of this specification proposes a software architecture method for a crossing based on a distributed state machine: the crossing service is split into multiple independent service modules, which are deployed in the service container (Host) of the distributed service cluster in the form of distributed services. Each service module follows the state machine model and manages the state transition of the crossing service through predefined rules to ensure that the system can run stably in different states. In addition, the service registration and discovery mechanism of the distributed service cluster is used to achieve transparent management of services. In this way, when the client accesses the crossing service, it does not need to know the specific address of the service instance, but only needs to use the crossing ID, such as Figure 2 As shown, we can agree to use "Crossing No. 1", "Crossing No. 2", etc. as the crossing ID to complete the naming, identification and addressing of the crossing service instance, which simplifies the client operation and enhances the flexibility and scalability of the system.
[0054] Distributed service clusters can ensure that only one service instance with the same ID is activated at the same time. After activation, the service instance will continue to run and will not be released actively unless a crash occurs. Figure 3 As shown in the figure, the service registration and discovery mechanism in the distributed service cluster will detect the crash of the service instance. Once the service crash is detected, the distributed service cluster will automatically perform a failover, switching the service request from the crashed service instance (such as the No. 1 checkpoint state machine in the A service container) to another healthy service instance (such as the newly activated No. 1 checkpoint state machine in the B service container). Other service instances are not affected by this process.
[0055] In order to restore and continue the previously interrupted crossing operation, the new service instance will extract the status data of the crossing from the status library of the distributed service cluster and fill it into the attributes of the crossing object. The newly activated service instance will continue to respond to input events, such as vehicle arrival signals, weighbridge data, license plate recognition results, etc., to ensure that the service continues to respond to input events, solving the reliability problem of traditional monolithic architecture and significantly improving the stability and reliability of the intelligent crossing software system, thereby better ensuring the service quality and operation continuity of the terminal entrance and exit crossings.
[0056] This application also records detailed logs of service crashes and recoveries, including timestamps, service instance IDs, failure causes, and recovery actions.
[0057] In order to better understand the present invention, the following is an introduction to the relevant definitions involved in the present invention:
[0058] (1) Distributed Architecture:
[0059] It refers to a service architecture that deploys different service modules in multiple servers that make up a cluster, collaborates through remote procedures call protocol (RPC) and publish-subscribe pattern (Pub-Sub) to provide external services.
[0060] (2) Finite State Machine:
[0061] Also known as a finite state machine, it is an abstract computing model used to simulate and represent system behavior. It consists of a set of states, an initial state, a set of input events, and a set of transition rules. The system can transition between different states, and each transition is triggered by a specific event.
[0062] The technical solutions provided by various embodiments of the present application are described below in conjunction with the accompanying drawings.
[0063] The embodiment of this specification provides a road crossing software architecture method based on a distributed state machine, including:
[0064] The crossing service is defined as a distributed state machine, and the states of the state machine include: standby and executing;
[0065] When the crossing service receives an input event, it switches from the current state to another state according to the preset state transition rules, and performs an action corresponding to the state transition; wherein the input event includes: data received by the crossing service;
[0066] Utilize the service registration and discovery mechanism of the distributed service cluster to ensure that only one service instance of the same crossing ID is active at the same time, wherein the distributed service cluster is equipped with at least two servers;
[0067] When the crossing service is activated, the state data of the crossing is extracted from the state library of the distributed service cluster, and the attributes of the crossing object are filled to resume and continue the previously interrupted crossing operation;
[0068] Once the crossing service is activated, it will continue to respond to input events and will not be released actively;
[0069] When a crossing service crashes, the current crossing service will be automatically switched to another service container for activation and continue to respond to input events.
[0070] Specifically, the crossing service is defined as a distributed state machine with two states: "standby" and "executing". The "standby" state means that the crossing service is idle and waiting for input events; the "executing" state means that the crossing service is processing a specific job task.
[0071] When the crossing service receives input events, such as vehicle arrival signals, weighbridge data, license plate recognition results, etc., the crossing state machine service determines whether state transition is required based on the preset transition rules. If necessary, the service switches from the current state to another state, for example, from the "standby" state to the "executing" state.
[0072] Each state transition corresponds to a series of predefined actions. The state machine performs corresponding actions according to the state transition rules, such as data verification, information processing, equipment control (such as lifting the bar, printing receipts, etc.) and notification sending.
[0073] Once the crossing service is activated, it will continue to listen to new input events and prepare for the next round of status evaluation and conversion. If the crossing service fails, the distributed service cluster automatically detects the service anomaly and automatically performs failover operations, switching the service to other healthy service containers. In the new service container, it continues to respond to input events that were interrupted before the failure occurred, providing high-quality service guarantees and operation continuity for the terminal entry and exit crossings.
[0074] In some embodiments, the input events of the state machine include:
[0075] Use MQTT or similar protocols to subscribe to and process data published by external systems:
[0076] For example: subscribing to license plate recognition data published by the license plate recognition system, including photo reading path, etc.
[0077] For example: subscribing to the box number and box type identification data published by the box number identification system, including the photo reading path, etc.
[0078] For example: subscribe to the cabinet splicing data published by the cabinet splicing system, including the image reading path, etc.
[0079] For example: subscribing to the damage identification data published by the damage identification system, including the photo reading path, etc.
[0080] For example, in order to adapt to the situation where the external system does not publish data according to the agreed format and specifications, a plug-in interface is reserved, and an external message translation plug-in can be used.
[0081] Use MQTT protocol or similar protocols to subscribe to the data collected from the COM or USB port of the integrated device published by the integrated device:
[0082] For example: subscribing to the scale equipment data collected by the integrated machine at the road crossing is the weight data of the container truck passing through the gate.
[0083] For example: subscribe to the scanning device data collected by the integrated machine at the road crossing, which is the box pick-up reservation code scanned by the driver passing through the gate.
[0084] For example: subscribe to the keyboard data collected by the integrated machine at the road crossing and manually input data for the driver passing through the gate.
[0085] For example, in order to adapt to the situation where external devices do not publish data according to the agreed format and specifications, a plug-in interface is reserved, and an external message translation plug-in can be used.
[0086] Use gRPC protocol or similar protocols to respond to the service request of the crossing control client:
[0087] For example: provide all data of the current crossing status object so that the client can refresh the complete interface data.
[0088] For example: provide license plate identification photos; provide box number and box type identification photos; provide box splicing photos; provide damage identification photos.
[0089] For example: correct the incorrectly recognized license plate data; correct the incorrectly recognized box number and box type data; confirm or correct the box damage data.
[0090] For example: processing manually entered container pick-up reservation codes; processing manually entered forced release instructions.
[0091] For example: provide historical gate-passing data, such as the last gate-passing situation; provide historical statistical data, such as the traffic efficiency of a certain intersection.
[0092] Use gRPC protocol or similar protocols to respond to service requests from backend operation and maintenance clients:
[0093] For example: providing the parameters and return values of historical calls to the terminal production system.
[0094] For example: providing the original messages received historically from subscribed external systems.
[0095] For example: provide the original data received historically from the COM or USB port of the integrated crossing device.
[0096] For example: provide historical push to the road crossing integrated machine to forward data to the COM or USB port of the specified device.
[0097] For example: provide any exceptions intercepted during the execution of historical code.
[0098] For example: providing current or historical crossing status.
[0099] In some embodiments, the transition rules and execution actions of the state machine are as follows:
[0100] As long as the device data is received, the crossing status is switched to "executing", and the received data is converted into crossing object attributes and cached locally, and saved to the distributed service cluster status library.
[0101] If an empty vehicle enters the gate and the license plate has been recognized, the terminal production system API service is called to confirm whether it is allowed to pass through the gate and obtain the receipt content.
[0102] If the vehicle is empty and the license plate has been identified and there is a container pick-up reservation code, the terminal production system API service is called to confirm whether it is allowed to pass through the gate and obtain the receipt content.
[0103] If it is a heavy vehicle entering the gate and the license plate, container number, container type, damage, and weighing scale have been identified, the terminal production system API service will be called to confirm whether it is allowed to pass through the gate and obtain the receipt content.
[0104] If the terminal production system allows the vehicle to pass through the gate, the barrier lifting instruction and ticket content will be pushed to the level crossing integrated machine, and the level crossing status will switch from "executing" to "standby".
[0105] If the crossing central control client initiates a manual emergency forced release command, a barrier lifting command is pushed to the crossing integrated machine, and the crossing status switches from "executing" to "standby".
[0106] In some embodiments, when the crossing state switches from "executing" to "standby", the crossing object is initialized and the state data of the crossing is deleted in the distributed service cluster state library to prepare for processing the next gate entry request.
[0107] The distributed state machine service pushes the processed data to the integrated crossing machine, including the command to lift the barrier, the content of the receipt printing, the content of the LED screen display, etc., which are forwarded to the designated equipment connected to the integrated crossing machine, such as the gate equipment, the receipt printer, the LED screen, etc. In order to push the data, the state machine service uses the MQTT protocol or a similar lightweight message transmission protocol. In order to adapt to the external device not receiving data in the agreed format and specification, a plug-in interface is reserved, and a message translation plug-in can be plugged in.
[0108] For example, when the state machine service needs to control the barrier device to lift the barrier to release the vehicle, it will send a barrier lifting command to the barrier crossing machine through the MQTT protocol or a similar protocol. After receiving the command, the barrier crossing machine will forward the command to the barrier device through the COM or USB port to complete the barrier lifting and release.
[0109] The distributed state machine service pushes the processed data to the crossing central control client, including the current status of the crossing (such as "standby" or "executing"), vehicle information recognized by the external system (such as license plate number, container number, container type, damage information, etc.), vehicle weight data collected by the crossing integrated machine, container pick-up reservation code, data manually entered by the driver passing through the gate, and control commands issued by the crossing service to the integrated machine (such as barrier lifting commands, receipt printing commands, LED screen display content, etc.).
[0110] Through the MQTT protocol or similar protocols, the crossing control client can receive data updates from the distributed state machine service in real time, so that it can timely understand the latest status and operation progress of the crossing. After receiving this data, the crossing control client will display it on the user interface and dynamically refresh the interface based on the received information.
[0111] For example, when the distributed state machine service pushes a new crossing status, the central control client will update the crossing status display on the interface. When new identification data is pushed, the central control client will refresh the identification results on the interface.
[0112] The crossing control client can also send instructions to the distributed state machine service through the MQTT protocol or similar protocols, such as correcting the data of recognition errors, manually confirming or correcting the damaged box data, manually entering the box pick-up reservation code, initiating a forced release instruction, etc. These instructions will be received and processed by the distributed state machine service, thereby realizing manual intervention and control of the crossing operation.
[0113] The distributed state machine service will push operation and maintenance related information such as the crossing's operating status, event logs, system alarms, etc. to the backend operation and maintenance client, including but not limited to: the crossing service's operating logs, messages and event logs occurring in each link of the system, the health status of the service operation, fault alarms, performance indicators, etc. Through this mechanism, the user interface of the operation and maintenance client can receive and display the latest data in real time, realize dynamic refresh, and provide the operation and maintenance team with a clear and real-time monitoring view, ensuring that the operation and maintenance team can keep abreast of the latest developments of the system.
[0114] By centrally displaying key information in real time through an intuitive interface, potential problems can be quickly identified and responded to, allowing for efficient daily monitoring and troubleshooting to ensure the stable operation of the crossing software system.
[0115] For example: push the results of calling the terminal production system to the backend operation and maintenance client to refresh the log data on the interface.
[0116] For example: push the original message received from the subscribed external system to the backend operation and maintenance client to refresh the log data on the interface.
[0117] For example: push the original data collected by the integrated crossing device from the COM or USB port of the integrated device to the background operation and maintenance client to refresh the log data on the interface.
[0118] For example: push data sent to the road crossing integrated machine to forward the data sent to the specified device COM or USB port to the background operation and maintenance client to refresh the log data on the interface.
[0119] For example: push any exception information intercepted during code execution to the backend operation and maintenance client to refresh the log data on the interface.
[0120] For example: push the state machine to be activated and the change of the attributes of the crossing object to the background operation and maintenance client to refresh the log data on the interface.
[0121] In combination with the above embodiment, at least two servers are provided in the distributed service cluster to achieve physical disaster recovery.
[0122] In this application, the external system can be directly connected through a communication protocol consistent with the crossing service, or it can be connected by adding a service agent in the middle layer. For example, the external system uses the Socket protocol to access the service agent and then the service agent forwards and receives messages through a communication protocol consistent with the crossing service.
[0123] Based on the same inventive concept, the present application also provides a road crossing software architecture system based on a distributed state machine, the road crossing software architecture system based on a distributed state machine includes: a road crossing state machine service, a distributed service cluster server and a road crossing integrated machine;
[0124] The crossing state machine service is used to receive input events sent by the crossing integrated machine, switch from a current state to another state according to a preset state transition rule, and execute an action corresponding to the state transition;
[0125] Wherein, the states include: standby and executing; the input events include: data received by the crossing service;
[0126] It is also used to extract the state data of the crossing from the state library of the distributed service cluster and fill the attributes of the crossing object to restore and continue the previously interrupted crossing operation;
[0127] Once the crossing service is activated, it will continue to respond to input events and will not be released actively;
[0128] When a crossing service crashes, the current crossing service is automatically switched to another service container for activation and continues to respond to input events;
[0129] The distributed service cluster server is used to deploy and manage the crossing state machine service instance, and uses the service registration and discovery mechanism to ensure that only one service instance of the same crossing ID is activated at the same time, wherein the distributed service cluster is equipped with at least two servers;
[0130] The road crossing integrated machine is configured at each road crossing and is used to send the collected input events to the road crossing state machine service to activate the road crossing service.
[0131] In some embodiments, the road crossing software architecture system based on the distributed state machine further includes: a road crossing central control client;
[0132] The crossing central control client is used to provide an interface for monitoring crossing operations, including defining the monitored crossings, modifying data, initiating emergency forced release instructions, and viewing historical gate-passing data and crossing traffic statistics.
[0133] In some embodiments, the road crossing software architecture system based on the distributed state machine further includes: a background operation and maintenance client;
[0134] The backend operation and maintenance client is used to provide an interface for monitoring the operation of the system, including: defining the monitored checkpoints, viewing logs such as messages and events occurring in each link, and the health status of service operation.
[0135] In some embodiments, Figure 4As shown in the figure, the road crossing software architecture system based on the distributed state machine includes the road crossing state machine service, the road crossing central control client, the background operation and maintenance client and the road crossing integrated machine, which are connected through the gRPC protocol or similar remote call mechanism, the MQTT protocol or similar Internet of Things communication technology to complete the gate operation of the container truck entering and leaving the site.
[0136] Crossing state machine service: It is a distributed stateful service. One crossing corresponds to one service instance. If there are M crossings, M service instances can be activated. As the core module of the crossing software, it responds to input events and service requests from various devices, external systems, and system clients at any time and performs corresponding actions. If it is determined that the container truck has entered the gate, it switches to the "executing" crossing state. Once the data is complete, the terminal production system API service is called to confirm whether the gate is allowed. After obtaining the ticket content, the ticket is printed and the gate is lifted to release the vehicle. The crossing state switches from "executing" to "standby" and waits for the next round of gate operations.
[0137] Crossing central control client: an interface provided to the crossing central control personnel to monitor crossing operations. The number of clients N is generally less than the number of crossings M. The number of crossings to be monitored and the dynamically refreshed data of interest can be customized on the same interface. Operators can view the recognition image and modify the incorrectly recognized license plate, container number, and container type data, manually confirm or correct the container damage data, manually enter the container pick-up reservation code, and force release. Historical gate pass data and crossing traffic statistics can be viewed.
[0138] Backend operation and maintenance client: an interface provided to system administrators to monitor system operation. The number of clients N is generally less than the number of checkpoints M. You can customize which checkpoints to monitor and the dynamic refresh logs of interest on the same interface. Operators can view logs such as messages and events occurring in each link of the system, as well as the health status of service operation.
[0139] All-in-one machine at level crossing: Each level crossing is equipped with an all-in-one machine, and there are M all-in-one machines for M level crossings; the all-in-one machine is equipped with a barrier device to control whether the container truck is allowed to pass through the barrier, a weighing device to collect the weight of the container truck, a barcode scanner to collect the container pickup reservation code scanned by the driver passing through the barrier, a receipt printer to print a receipt for the driver, and an LED display and keyboard to provide an interactive operation interface for the driver; the all-in-one machine interface can display the current operation status and data, and prompt the driver on what to do next, such as selection, confirmation, code scanning, and receipt collection.
[0140] The container intelligent crossing software needs to interact with external systems, obtain the license plate and photo through the license plate recognition system, obtain the container number, box type and photo through the container number recognition system, obtain the splicing effect of the damaged picture through the container splicing system, obtain the damage and photo through the damage recognition system, and confirm whether the gate is allowed to pass and obtain the printed receipt through the terminal production system.
[0141] Based on the same inventive concept, the present application also provides a road crossing integrated machine based on a distributed state machine, and the road crossing integrated machine is configured using any of the road crossing software architecture methods based on a distributed state machine described above.
[0142] This application can achieve load balancing, the server is fully utilized, and resource waste is avoided.
[0143] This application can ensure that when the crossing service faces a catastrophic event, it will automatically switch to other service containers for activation. During this period, there is no need to invest operation and maintenance manpower for manual intervention. Only daily regular inspections are required, which greatly reduces operation and maintenance costs.
[0144] This application will not affect the normal operation of other crossings even if a single crossing fails, and can prevent the occurrence of a complete shutdown accident at the dock crossing.
[0145] In this specification, the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiments described later, the description is relatively simple, and the relevant parts can be referred to the partial description of the previous embodiments.
[0146] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A road crossing software architecture method based on a distributed state machine, characterized in that: include: The crossing service is defined as a distributed state machine, and the states of the state machine include: standby and executing; When the crossing service receives an input event, it switches from the current state to another state according to the preset state transition rules, and performs an action corresponding to the state transition; wherein the input event includes: data received by the crossing service; Utilize the service registration and discovery mechanism of the distributed service cluster to ensure that only one service instance of the same crossing ID is active at the same time, wherein the distributed service cluster is equipped with at least two servers; When the crossing service is activated, the state data of the crossing is extracted from the state library of the distributed service cluster, and the attributes of the crossing object are filled to resume and continue the previously interrupted crossing operation; Once the crossing service is activated, it will continue to respond to input events and will not be released actively; When a crossing service crashes, the current crossing service will be automatically switched to another service container for activation and continue to respond to input events.
2. The method for road crossing software architecture based on a distributed state machine according to claim 1 is characterized in that: The input events include: Subscribe to and process data published by external systems, including: license plate recognition data published by the license plate recognition system, box number and box type recognition data published by the box number recognition system, box splicing data published by the box splicing system, and damage recognition data published by the damage recognition system; Subscribe to and process the collected data published by the integrated crossing machine, including: weighing equipment data, code scanning equipment data and keyboard data.
3. The method for road crossing software architecture based on a distributed state machine according to claim 2 is characterized in that: The data released by the external system and the collected data released by the processing road crossing integrated machine also include: data of the reserved plug-in interface, which is used to adapt to the data released by the external system that is not in the agreed format and specifications.
4. The method for road crossing software architecture based on distributed state machine according to claim 2 is characterized in that: The input event also includes: Respond to service requests from the crossing central control client and respond to service requests from the background operation and maintenance client.
5. The method for road crossing software architecture based on distributed state machine according to claim 1 is characterized in that: The preset state transition rules include: When the crossing service receives an input event, the crossing service status switches from "Standby" to "Executing", and converts the received data into crossing object attributes and caches them locally, while saving them to the distributed service cluster status library; According to the preset gate entry conditions, determine whether to allow gate entry; if allowed, generate a lift command and ticket content, and push the processing results to the gate integrated machine, the gate central control client and the backend operation and maintenance client, and the gate status switches from "executing" to "standby"; If the crossing central control client manually initiates an emergency forced release command, a barrier lifting command is generated, and the processing result is pushed to the crossing integrated machine, the crossing central control client and the background operation and maintenance client, and the crossing status switches from "executing" to "standby".
6. The method for road crossing software architecture based on distributed state machine according to claim 5 is characterized in that: When the crossing state switches from "executing" to "standby", the crossing object is initialized and the state data of the crossing is deleted in the distributed service cluster state library to prepare for processing the next gate entry request.
7. A road crossing software architecture system based on a distributed state machine, characterized in that: The road crossing software architecture system based on the distributed state machine includes: a road crossing state machine service, a distributed service cluster server and a road crossing integrated machine; The crossing state machine service is used to receive input events sent by the crossing integrated machine, switch from a current state to another state according to a preset state transition rule, and execute an action corresponding to the state transition; Wherein, the states include: standby and executing; the input events include: data received by the crossing state machine service; It is also used to extract the state data of the crossing from the state library of the distributed service cluster and fill the attributes of the crossing object to restore and continue the previously interrupted crossing operation; Once the crossing service is activated, it will continue to respond to input events and will not be released actively; When a crossing service crashes, the current crossing service is automatically switched to another service container for activation and continues to respond to input events; The distributed service cluster server is used to deploy and manage the crossing state machine service instance, and uses the service registration and discovery mechanism to ensure that only one service instance of the same crossing ID is activated at the same time, wherein the distributed service cluster is equipped with at least two servers; The road crossing integrated machine is configured at each road crossing and is used to send the collected input events to the road crossing state machine service to activate the road crossing service.
8. The road crossing software architecture system based on a distributed state machine according to claim 7 is characterized in that: The road crossing software architecture system based on the distributed state machine also includes: a road crossing central control client; The crossing central control client is used to provide an interface for monitoring crossing operations, including defining the monitored crossings, modifying data, initiating emergency forced release instructions, and viewing historical gate passing data and crossing traffic statistics.
9. The road crossing software architecture system based on a distributed state machine according to claim 8, characterized in that: The road crossing software architecture system based on the distributed state machine also includes: a background operation and maintenance client; The backend operation and maintenance client is used to provide an interface for monitoring the operation of the system, including: defining the monitored checkpoints, viewing the messages and event logs occurring in each link, and the health status of the service operation.
10. A road crossing integrated machine based on a distributed state machine, characterized in that: The road crossing integrated machine is configured by adopting the road crossing software architecture method based on a distributed state machine as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Highly reliable metadata service system of distributed file system
CN115757330A
System and method for realizing network collaborative distributed processing of science and technology service
CN115811546A