[0029] Such as figure 1 As shown, the real-time alarm processing system for this vehicle includes a communication node module ( figure 1 Communication node in), registry module ( figure 1 Registry in), distributed cache module ( figure 1 Distributed cache in ), real-time computing service module ( figure 1 Real-time computing services in the), distributed queue kafka module ( figure 1 Distributed queue kafka); the communication node module is configured to distribute vehicle information; the registration center module is configured to control the connection between the communication node module and the real-time computing service module; the distributed cache module is configured to cache a point of alarm information on the vehicle; real-time The computing service module is configured to calculate the generation of alarms and end alarms; the distributed queue kafka module is configured to store the calculated alarm information; there are multiple communication node modules and real-time computing service modules.
[0030] Such as figure 2 As shown, a real-time alarm processing method for vehicles is also provided, which includes the following steps:
[0031] (1) Start the registry module;
[0032] (2) The real-time computing service module configures the IP and port number of the registry through the specified format, and starts the real-time computing service module to connect to the registry module;
[0033] (3) The communication node module configures the registration center IP and port number through the specified format, and starts the communication node module to connect to the registration center module;
[0034] (4) The communication node module obtains the IP and port number of the real-time computing service module, and connects to the real-time computing service module;
[0035] (5) After the communication node module is started, if a new real-time computing service module is subsequently connected to the registry module, the registry module informs the communication node module, and the communication node module is connected to the new real-time computing service module;
[0036] (6) The communication node module uses the mobile phone number reported by the car machine and the number of nodes connected to the real-time computing service module to perform a hash algorithm, and sends the same mobile number car and machine information to the real-time computing node of the same real-time computing service module;
[0037] (7) The real-time computing node of the real-time computing service module receives the data, uses the mobile phone number to hash the number of processing threads, and distributes the information of the same mobile phone number to the same thread for processing;
[0038] (8) Obtain the last alarm information from the distributed cache module through the mobile phone number, and store the reported alarm decimal information in the distributed cache module, and wait for the next vehicle to report to use;
[0039] (9) Asynchronously distribute the related information of generating and ending alarms to the storage multi-thread;
[0040] (10) The alarm information is written into the distributed queue kafka module in real time.
[0041] In addition, multiple real-time computing service modules are activated in the step (2).
[0042] In addition, multiple communication node modules are activated in the step (3).
[0043] In addition, the specified format is xxxx.properties. The configuration format of xxxx.properties is as follows:
[0044] #Configure all zookeepers connected to the registration center: ip:port
[0045] zookeeper_ip_port=192.168.100.0:2181,192.168.100.1:2181,192.168.100.2:2181
[0046] In addition, such as image 3 As shown, in the step (8): if the last time the alarm information is empty, it means that the vehicle reported the alarm information to the platform for the first time, and the alarm start point is directly calculated; if it is not empty, the alarm decimal number Perform an exclusive OR operation with the reported alarm decimal number. If the result is 0, there is no alarm or end alarm in the reported point. If it is not 0, the result decimal is converted to binary, the binary data is reversed, and the binary data is parsed circularly. The flag bit is 0, which means that the alarm of the flag bit at this reporting point is over, and the flag bit is 1, which means that the flag bit at this reporting point generates the alarm.
[0047] The beneficial effects of the present invention are:
[0048] 1. Use distributed buffering of alarm information on a single point of car and machine, solve multi-machine calculation alarm, single point of failure, high performance, horizontal expansion, improve the platform's ability to handle alarms, and ensure that a single machine can handle 8,000 cars and machines at the same time per second. The alarm handling capacity of the machine platform increased by 80%.
[0049] 2. The cross-language communication framework thrift rpc technology is used between the communication node and the real-time computing service, and the code generator is used to generate different language codes according to the defined data structure, which brings convenience to developers.
[0050] 3. Manage real-time computing services and communication nodes through the registry. The communication node connects to the registry, obtains the real-time computing service IP and port number, and automatically connects to the real-time computing service; the real-time computing service connects to the registry, and the registry informs the communication node that it has registered for real-time computing Service IP and port number, automatically connect to real-time computing services. The communication node automatically discovers the real-time computing service. There is no need to configure the real-time computing service IP and port number through the configuration file. The real-time computing service adds machines and the communication node does not need to modify the configuration. When the real-time computing node is offline, the registration center will notify the communication node in time, and the communication node will automatically Disconnect offline nodes.
[0051] 4. The alarm calculation results are directly stored in the high-performance distributed queue kafka in an asynchronous manner to solve the problem of database storage IO performance.
[0052] The application scenarios of the present invention are given below:
[0053] The process of processing the information reported by the mobile phone number 19199999910 (just as an example) is as follows:
[0054] 1. Start the real-time computing service module of the 192.168.100.1 and 192.168.100.2 machines to connect to the registration center module.
[0055] 2. Start the 192.168.100.3 machine communication node module to connect to the registration center module.
[0056] 3. The communication node module receives the real-time computing service module 192.168.100.1 IP and port number 6665, 192.168.100.2 IP and port number 6665.
[0057] 4. The communication node module is connected to the real-time computing service module with IP 192.168.100.1 port number 6665 and IP192.168.100.2 port number 6665.
[0058] 5. The communication node module sends data to the 192.168.100.2 real-time computing service module through the mobile phone number 19199999910 and 2 hash.
[0059] 6. The real-time computing service module receives the data and distributes it to the processing thread. It obtains the last alarm information from the distributed cache module according to the mobile phone number 19199999910. The query is empty. The current reported decimal alarm information is 3, and the decimal number 3 is the mobile phone number. The key is stored in the distributed cache module. Convert 3 to binary 11, the 0th bit is 1, the current bit means emergency alarm, then an emergency alarm is generated, the first bit is 1, the current bit means overspeed, then an overspeed alarm is generated. Store the data in the distributed queue kafka module.
[0060] 7. When the communication node module sends the mobile phone number 19199999910 information to the 192.168.100.2 real-time computing service module, it obtains the last alarm information from the distributed cache module according to the mobile phone number 19199999910, and performs an exclusive OR operation with the currently reported alarm information 1 to obtain 2. It will be converted to binary 10, 01 after reversal, from right to left for 01, the judgment will be started at the 0th bit. The 0th bit is 1, which means the alarm is not over, the 1st bit is 0, which means the alarm is over, the current bit means overspeed, so the overspeed alarm is over. The decimal number 1 is stored in the distributed cache module with the mobile phone number as the key; the data is stored in the distributed queue kafka module.
[0061] 8. Repeat step 7 to process the alarm information of the mobile phone number 19199999910.
[0062] The above are only the preferred embodiments of the present invention, and do not limit the present invention in any form. Any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention still belong to the present invention. The scope of protection of the technical solution of the invention.