CN-121984864-A - Method for real-time configuration forwarding of dynamic data of commercial vehicle
Abstract
The invention provides a method for real-time configuration and forwarding of dynamic data of a commercial vehicle, which comprises a forwarding adaptive service program, a visual configuration page and a mysql database, and comprises the steps of S1, configuring dynamic forwarding rules, S2, accessing data, S3, initializing and reading to obtain forwarding configuration information in the mysql database, S4, processing the accessed data, and S5, distributing the data converted into a target format to a demand party. The invention carries out configuration forwarding on the gateway real-time data and the big data statistical data, and simultaneously supports various forwarding middleware and various serialization modes. In various data butt joints, all data are summarized and forwarded, and the previous one-to-one linear structure is changed into a one-to-many net structure, so that all parties are liberated in complex data butt joints, and efficient communication is realized.
Inventors
- ZHANG YU
Assignees
- 鱼快创领智能科技(南京)有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260108
Claims (8)
- 1. A method for real-time configuration and forwarding of dynamic data of a commercial vehicle is characterized by comprising a forwarding adaptive service program, a visual configuration page and a mysql database; The method comprises the following steps: S1, configuring dynamic forwarding rules; The user inputs forwarding configuration information through the visual configuration page interaction, submits the forwarding configuration information and stores the forwarding configuration information into the mysql database; S2, accessing data; starting a forwarding adpt service program to receive real-time data output by a gateway and statistical data output by big data; S3, initializing and reading to obtain forwarding configuration information in a mysql database; S4, processing access data; Analyzing and filtering the real-time data and the big data statistical data output by the consumption gateway, and converting the real-time data and the big data statistical data into data in a target format required by users at all sides; And S5, distributing the data converted into the target format to a demander.
- 2. The method for real-time configuration forwarding of dynamic data of a commercial vehicle according to claim 1, wherein the forwarding adaptive service program comprises a group of forwarding adaptive service interfaces, the forwarding adaptive service interfaces comprise forwarding tasks, forwarding formats, receiving fields, forwarding kafka information and interfaces of forwarding vehicles, the visualized configuration page receives forwarding configuration information input by a user, and the forwarding configuration information corresponds to the forwarding adaptive service interfaces.
- 3. The method for real-time configuration forwarding of commercial vehicle dynamic data according to claim 2, wherein the step S1 comprises the following steps: s11, a user creates or edits a forwarding task on a visual configuration page, and designates a task name and a data source; s12, configuring a receiving field list, wherein the receiving field list comprises vehicle speed, mileage, vehicle ID and GPS time; s13, configuring a serialization format, wherein the serialization format comprises a JSON character string, a Protobuf binary and a custom byte array; S14, configuring an output protocol and configuring corresponding parameters; If the configuration output protocol is the Kafka protocol, configuring a target Kafka cluster address, a Topic name and authentication information; if the configuration output protocol is TCP protocol, configuring the IP address and port number of the target server; s15, binding a forwarding vehicle, configuring a vehicle ID of the forwarding vehicle, and associating the forwarding vehicle with a task; And S16, after the configuration is completed, forwarding configuration information is submitted, a forwarding adapter service interface is called through an HTTP request, and the configured forwarding configuration information is stored in a mysql database in a structuring mode.
- 4. The method for real-time configuration forwarding of commercial vehicle dynamic data according to claim 3, wherein the step S2 is: Respectively writing the real-time data and the statistic data output by the big data of the gateway into a data source Topic according to the data source, and subscribing the data sources Topic of the two types of data through the Kafka client after the forwarding adpt service program is started; the real-time data comprises vehicle ID, GPS time and speed, and the statistical data of big data output comprises mileage and average speed.
- 5. The method for real-time configuration forwarding of commercial vehicle dynamic data according to claim 4, wherein step S3 comprises the steps of: S31, loading initial configuration; The forwarding adapter service program is started, triggers initialization and reads forwarding configuration information of all effective states in the mysql database; For each task, initializing a forwarding processor, namely loading a received field list as a field filtering rule, initializing a corresponding serializer according to a serialization format, judging an output protocol, initializing a Kafka connection pool if the output protocol is Kafka, connecting to a configured target Kafka cluster, initializing a TCP connection pool if the output protocol is TCP, and attempting to establish long connection with a target server; s32, configuring timing update; After initialization is completed, configuring a fixed period for updating the background at regular time, scanning whether the mysql database is updated or not every fixed period, and dynamically rebuilding or updating a corresponding forwarding processor when detecting that forwarding configuration information is changed, wherein the steps comprise reestablishing connection and loading field filtering rules.
- 6. The method for real-time configuration forwarding of commercial vehicle dynamic data according to claim 5, wherein step S4 comprises the steps of: S41, analyzing access data; When the forwarding processor consumes the message, firstly analyzing the format of the message to obtain a structured data object; S42, filtering the analyzed data; filtering twice based on the forwarding configuration information, firstly, only reserving the analyzed data object corresponding to the vehicle ID in the configuration according to the forwarding vehicle configuration, then, extracting the designated field from the reserved data object according to the configured receiving field list, discarding the unconfigured field, and obtaining the filtered field data; S43, format conversion; And converting the filtered field data according to the configured serialization format.
- 7. The method for real-time configuration forwarding of commercial vehicle dynamic data according to claim 1, wherein step S5 comprises writing the converted data into different topics according to the configured Topic name if the output protocol is Kafka according to the configured output protocol, directly forwarding the data in Kafka for intranet Kafka consumption users, and synchronizing information into an externally opened Kafka cluster for extranet Kafka consumption users (third party clients) by mirrormaker before being consumed by clients. If the output protocol is TCP, a TCP link is established first, and after the TCP connection is successful, the data in the target format is directly forwarded.
- 8. The method for real-time configuration forwarding of commercial vehicle dynamic data according to claim 7, wherein S5 comprises: The kafka protocol forwards the data in the target format to the demander; S511, writing the data in the target format into different topics; For the kafka protocol, the forwarding processor sends the data converted into the target format to the designated Topic according to the configured Topic name; S512, judging the type of the consuming user according to the demand party; The consumption user types comprise intranet kafka consumption users or intranet kafka consumption users; s513, distributing data by the kafka intranet; The intranet kafka consumption user directly subscribes to the appointed Topic to acquire the forwarded data in the target format; s514, kafka extranet distribution data; The data in the appointed Topic is mirrored to the Kafka cluster which is open to the outside in a one-way and real-time way through MirrorMaker tools; s52, the TCP forwards the data in the target format to the requiring party; the output protocol is TCP protocol, the forwarding processor obtains the established long connection from the TCP connection pool, and the converted data in the target format is pushed to the client of the demander in real time through the long connection.
Description
Method for real-time configuration forwarding of dynamic data of commercial vehicle Technical Field The invention relates to the technical field of internet of vehicles data communication, in particular to a method for real-time configuration and forwarding of dynamic data of a commercial vehicle. Background And the visual forwarding platform collects data of the terminal and the platform statistics analysis result. The complex data resources in the Internet of vehicles are truly changed into data assets, so that timely, accurate and visual data flows are provided for business departments and third party clients, business, research personnel and the like are released from tedious data flow butt joint, management and maintenance, and more attention is paid to the business butt joint. However, the visual forwarding platform needs to interface with a plurality of internal business departments or external third party clients, and the traditional data interfacing mode is usually implemented by one-to-one custom development, i.e. developing an independent data interface for each data demander. The data providing modes are not uniform, the outlets are not uniform, the butt joint of all parties is disordered, and the follow-up maintenance is not facilitated. Disclosure of Invention The invention aims to solve the defects in the prior art, and provides a method for real-time configuration and forwarding of dynamic data of a commercial vehicle. In order to achieve the above purpose, the invention adopts the following technical scheme: A real-time configuration forwarding method for dynamic data of a commercial vehicle comprises a forwarding adaptive service program, a visual configuration page, a mysql database and the like, wherein the forwarding adaptive service program is used for deploying a plurality of nodes, the forwarding adaptive service program is packaged into an executable JAR packet, and the forwarding adaptive service program is deployed to a plurality of server nodes through a Jenkins 2.190.1 pipeline and simultaneously supports kafka forwarding and tcp forwarding. And when a single node fails, the single node is automatically switched to a healthy node, so that service continuity is ensured. The forwarding adaptive service program comprises a group of forwarding adaptive service interfaces, and the forwarding adaptive service interfaces comprise related interfaces such as forwarding tasks, forwarding formats, receiving fields, forwarding kafka information, forwarding vehicles and the like. The forwarding task interface is used to create forwarding tasks. The forwarding format interface updates forwarding formats, including serialization formats, field mapping rules, etc., and the receiving field interface is used for obtaining a receiving field list. The forwarding Kafka information interface is used for configuring Kafka clusters and Topic information, and the forwarding vehicle is used for binding vehicles and forwarding tasks. The visual configuration page is a form type interactive interface developed based on the Vue framework and used for receiving forwarding configuration information input by a user, and the forwarding configuration information corresponds to a forwarding adaptive service interface and comprises forwarding task configuration, forwarding format configuration, receiving field configuration, forwarding kafka information configuration, forwarding vehicle configuration and the like. The forwarding task configuration comprises forwarding task identification, a data source and the like, wherein the forwarding task identification comprises task ID, task name and the like, and the data source comprises gateway real-time data, big data statistical results and the like. The forwarding format configuration selects a serialization format. The serialization format includes JSON, protobuf, custom byte arrays, and the like. The field mapping rules are configured. The receive field configuration includes configuring a receive field list including vehicle speed, mileage, vehicle ID, GPS time, and the like. The forwarding Kafka information configuration selects an output protocol and configures corresponding connection parameters, the output protocol includes Kafka, TCP, HTTP, and the connection parameters include a target Kafka cluster address, a Topic name, authentication information, a target server IP address, a port number, and the like. The forwarding vehicle configuration includes a vehicle ID, which is a vehicle VIN code, which is a unique identification of the vehicle. The mysql database is used for storing forwarding configuration information input by the visual configuration page. The method comprises the following steps: S1, configuring dynamic forwarding rules; the user inputs the forwarding configuration information through the visual configuration page interaction, submits the forwarding configuration information and stores the forwarding configuration information into the mysql da