Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a routing method based on application method numbering. The routing method comprises the following steps:
the routing controller acquires a protocol template according to the service ID and the interface ID in the service protocol message;
the routing controller calls a protocol analyzer, the protocol analyzer analyzes the service protocol message according to the protocol template, and the analysis result is packaged into a JAVA object;
and the routing controller inquires a routing configuration table according to the service ID and the interface ID, acquires a route corresponding to a processing class and a method, and calls a specific application and an interface to realize route distribution.
In one embodiment, the routing controller instantiates the processing class and method through a reflection mechanism, sends the parsed JAVA object, and processes it.
In one embodiment, the routing configuration table defines a processing class and a processing method corresponding to each service ID and interface ID, and provides a configuration service for the routing controller reflection mechanism.
In one embodiment, the traffic protocol messages are based on the TCP protocol.
In one embodiment, the routing method is applied to communications between the vehicle T-Box and the TSP platform.
The invention also provides a routing system based on the application method number, and the routing system comprises: a routing controller, a protocol parser, and a routing configuration table. Wherein:
the routing controller acquires a protocol template according to the service ID and the interface ID in the service protocol message and calls a protocol analyzer;
the protocol analyzer analyzes the service protocol message according to the protocol template and packages the analysis result into a JAVA object;
and the routing controller inquires the routing configuration table according to the service ID and the interface ID, acquires a route corresponding to a processing class and a processing method, and calls a specific application and an interface to realize route distribution.
In one embodiment, the routing controller instantiates the processing class and method through a reflection mechanism, sends the parsed JAVA object, and processes it.
In one embodiment, the routing configuration table defines a processing class and a processing method corresponding to each service ID and interface ID, and provides a configuration service for the routing controller reflection mechanism.
In one embodiment, the traffic protocol messages are based on the TCP protocol.
In one embodiment, the routing system is applied to communications between the vehicle T-Box and the TSP platform.
Detailed Description
The detailed features and advantages of the present invention are described in detail in the detailed description which follows, and will be sufficient for anyone skilled in the art to understand the technical content of the present invention and to implement the present invention, and the related objects and advantages of the present invention will be easily understood by those skilled in the art from the description, claims and drawings disclosed in the present specification.
The invention divides and configures each service and method in a mode of number (ID), and analyzes, distributes and encapsulates the service and method and the result protocol by using a JAVA reflection mechanism. Meanwhile, the invention also introduces a concept of version for simultaneously supporting and being compatible with multiple T-Box software versions.
The T-Box gateway module is connected with the platform, the communication protocol generally adopts a TCP protocol, and a service protocol message is defined on the basis of the TCP protocol.
The service protocol message contains content data, a service id (aid) and an interface id (mid).
Fig. 1 is a schematic diagram illustrating a processing method when a service protocol packet arrives at a route according to an embodiment of the present invention. The method comprises the following steps:
the routing controller acquires a protocol template according to the service ID and the interface ID; the service ID (e.g., AID A, AID B in fig. 1) corresponds to a corresponding application or service (e.g., application a, application B), and the interface ID (e.g., MID 1, MID 2 in fig. 1) corresponds to a corresponding method (e.g., interface 1, interface 2).
The routing controller calls a protocol analyzer to analyze a service protocol message (TCP message) according to a protocol template, and an analysis result is packaged into a JAVA object;
and the routing controller inquires a routing configuration table according to the service ID and the interface ID to acquire a routing processing class and a routing processing method. In the processing class and method, specific applications and interfaces are called to realize route distribution.
And the routing controller instantiates a processing class and a method through a JAVA reflection mechanism, sends the analyzed JAVA object and processes the JAVA object.
The invention also provides a routing system based on the application method number, which comprises a routing controller, a protocol resolver and a routing configuration table.
The routing controller is the core of the routing device of the invention and is used for controlling the whole life cycle of one session. According to the scene division of the platform and the vehicle T-Box communication, the communication can be divided into an uplink message and a downlink message, and the respective schemes are shown in figures 2 and 3.
Wherein fig. 2 shows a scenario where a T-Box sends a message (i.e., an upstream message) to the platform. FIG. 3 shows a scenario where the platform sends a message to the T-Box (i.e., a downstream message).
The protocol analyzer analyzes the service protocol message according to the protocol template. Specifically, each host factory defines a corresponding protocol template according to different protocol definition modes, such as protocols based on asn.1 or GOOGLE buffer, and the like. The protocol parser decodes a service protocol message (TCP message) according to a specified protocol template and encapsulates the decoded service protocol message into a JAVA object. In addition, the protocol analyzer also encodes the JAVA object to form a TCP message.
The routing configuration table defines the processing classes and methods corresponding to the service IDs (AIDs) and the interface IDs (MIDs), and provides configuration services for the controller reflection mechanism. For ease of reading and configuration, the configuration table is configured based on an XML file.
Meanwhile, in order to distinguish the T-Box software protocol versions, a version configuration item is introduced, as shown in FIG. 4.
The invention has the following beneficial technical effects:
1. the routing configuration readability is strong, the interface method level is achieved accurately, and the control is more accurate;
2. version control is introduced, so that the compatibility is stronger;
3. the embedded protocol analyzer can control the protocol analysis
4. Based on reflection generation processing class and processing method, service clustering calling can be realized by utilizing feign, rest and the like in the processing method
5. The routing system is stateless, can be transversely expanded and realizes high throughput.
Fig. 5 is a flowchart illustrating a routing method based on application method numbers according to an embodiment of the present invention. The method comprises the following steps:
step 501: the routing controller acquires a protocol template according to the service ID and the interface ID in the service protocol message;
step 502: the routing controller calls a protocol analyzer, the protocol analyzer analyzes the service protocol message according to the protocol template, and the analysis result is packaged into a JAVA object;
step 503: and the routing controller inquires a routing configuration table according to the service ID and the interface ID, acquires a route corresponding to a processing class and a method, and calls a specific application and an interface to realize route distribution.
In one embodiment, the routing controller instantiates the processing class and method through a reflection mechanism, sends the parsed JAVA object, and processes it.
In one embodiment, the routing configuration table defines a processing class and a processing method corresponding to each service ID and interface ID, and provides a configuration service for the routing controller reflection mechanism.
In one embodiment, the traffic protocol messages are based on the TCP protocol.
In one embodiment, the routing method is applied to communication between the vehicle T-Box and the TSP platform.
The invention also provides a routing system based on the application method number, and the routing system comprises: a routing controller, a protocol parser, and a routing configuration table. Wherein:
the routing controller acquires a protocol template according to the service ID and the interface ID in the service protocol message and calls a protocol analyzer;
the protocol analyzer analyzes the service protocol message according to the protocol template and packages the analysis result into a JAVA object;
and the routing controller inquires the routing configuration table according to the service ID and the interface ID, acquires a route corresponding to a processing class and a processing method, and calls a specific application and an interface to realize route distribution.
In one embodiment, the routing controller instantiates the processing class and method through a reflection mechanism, sends the parsed JAVA object, and processes it.
In one embodiment, the routing configuration table defines a processing class and a processing method corresponding to each service ID and interface ID, and provides a configuration service for the routing controller reflection mechanism.
In one embodiment, the traffic protocol message is based on the TCP protocol.
In one embodiment, the routing system is applied to communications between the vehicle T-Box and the TSP platform.
The terms and expressions which have been employed herein are used as terms of description and not of limitation. The use of such terms and expressions is not intended to exclude any equivalents of the features shown and described (or portions thereof), and it is recognized that various modifications may be made within the scope of the claims. Other modifications, variations, and alternatives are also possible. Accordingly, the claims should be looked to in order to cover all such equivalents.
Also, it should be noted that although the present invention has been described with reference to the current specific embodiments, it should be understood by those skilled in the art that the above embodiments are merely illustrative of the present invention, and various equivalent changes or substitutions may be made without departing from the spirit of the present invention, and therefore, it is intended that all changes and modifications to the above embodiments be included within the scope of the claims of the present application.