Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings. Embodiments of the present disclosure and features of embodiments may be combined with each other without conflict.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is a schematic diagram of one application scenario of a method for parsing a message according to some embodiments of the present disclosure.
As shown in the application scenario of fig. 1, an execution subject of the method for parsing a message may be the server 101. First, the server 101 may determine whether the save path 105 of the interface file corresponding to the message type 104 of the target message 103 is included in the database mapping table 102; the database mapping table 102 is obtained by associating and storing the message type and the storage path of the corresponding interface file. In response to determining the save path 105 of the interface file corresponding to the message type 104 of the target message 103 in the database mapping table 102, the target message 103 is parsed by using the first command 106 generated based on the save path 105, so as to obtain a parsed message 107 corresponding to the target message.
The execution body may be hardware or software. When the execution body is hardware, the execution body may be implemented as a distributed cluster formed by a plurality of servers or terminal devices, or may be implemented as a single server or a single terminal device. When the execution body is embodied as software, it may be implemented as a plurality of software or software modules, for example, for providing distributed services, or as a single software or software module. The present invention is not particularly limited herein.
It should be understood that the number of servers in fig. 1 is merely illustrative. There may be any number of servers, as desired for implementation.
With continued reference to fig. 2, a flow 200 of some embodiments of a method for parsing a message according to the present disclosure is shown. The method for parsing a message comprises the steps of:
step 201, determining whether the database mapping table includes a save path of an interface file corresponding to a message type of the target message.
In some embodiments, the execution body of the method for parsing a message (e.g., server 101 shown in fig. 1) may first determine whether the save path of the interface file corresponding to the message type of the target message is included in the database mapping table. The target message may be information for interaction between the server side and the client side. The message types mentioned above may be TextMessage, mapMessage, objectMessage, bytesMessage and StreamMessage. The database mapping table is obtained by associating and storing the message type and the storage path of the corresponding interface file.
Step 202, in response to determining the save path of the interface file corresponding to the message type including the target message in the database mapping table, performing an parsing operation on the target message by using a first command generated based on the save path, so as to obtain a parsed message corresponding to the target message.
In some embodiments, when determining the save path of the interface file corresponding to the message type of the target message in the database mapping table, the execution body may parse the target message by using a first command generated based on the save path to obtain a parsed message corresponding to the target message. The first command may be a shell command, for example, "protoc-Ipath/to/include-decode [ message type ] < [ save path ]".
In some alternative implementations of some embodiments, the first command is obtained by: and adding the saved path to a predefined position in the command to be added to generate a first command. The command to be added may be a shell command, for example, "protoc-ipth/to/include-decode [ message type ] < [ xxxx ]". The predefined location may be preset. As an example, a save path may be obtained from a database mapping table, and the save path is added to a predefined location in the command to be added to generate a first command, e.g., "protoc-I path/to/include-decode [ message type ] < [ save path ]".
In some optional implementations of some embodiments, the method further includes: and responding to the determination that the database mapping table does not comprise the storage path of the interface file corresponding to the message type of the target message, and analyzing the target message by utilizing a second command to obtain an analyzed message corresponding to the target message. The second command may be a shell command, for example, "protoc-decode_raw < im.
As can be seen from the above examples, first, it is determined whether the database mapping table includes a save path of an interface file corresponding to a message type of a target message; and responding to the determination of the storage path of the interface file corresponding to the message type of the target message in the database mapping table, and analyzing the target message by utilizing a first command generated based on the storage path to obtain the analyzed message corresponding to the target message. It is achieved that the message content can be parsed even without an interface file.
With continued reference to fig. 3, a flow 300 of further embodiments of a method for parsing a message according to the present disclosure is shown. The method for parsing a message comprises the steps of:
step 301, determining whether the database mapping table includes a save path of an interface file corresponding to a message type of the target message.
Step 302, in response to determining the save path of the interface file corresponding to the message type including the target message in the database mapping table, performing an parsing operation on the target message by using a first command generated based on the save path, to obtain a parsed message corresponding to the target message.
In some embodiments, the specific implementation of steps 301 to 302 and the technical effects thereof may refer to steps 201 to 202 in those embodiments corresponding to fig. 2, and will not be described herein.
Step 303, determining whether the target version information exists in the target warehouse at intervals of a predetermined time period.
In some embodiments, an execution body of a method for parsing a message may first determine whether target version information exists in a target repository every predetermined period of time. The predetermined period of time may be a predetermined period of time, for example, may be 10 seconds. The above-described target version information is typically the version information of the latest version.
In some optional implementations of some embodiments, the target version information is obtained by: responding to the detection of the submitting operation aiming at the codes in the target warehouse, and packaging the interface files in the target warehouse to obtain an interface file compression package; version information is added to the interface file compression package. The destination repository may be a repository for storing interface files, for example, the destination repository may be a gitlab repository. Wherein, the target warehouse has a hook function. The commit operation described above generally refers to commit behavior in the warehouse code. The interface file may be an IDL (Interface description language ) file. The version information may be version identification information.
Step 304, in response to determining that the target version information exists in the target repository, saving the interface file compression package corresponding to the target version information to a local place, and performing decompression operation on the interface file compression package to obtain the interface file corresponding to the target version information.
In some embodiments, the execution body may determine that the target repository has target version information, store an interface file compression packet corresponding to the target version information to a local location, and decompress the interface file compression packet to obtain an interface file corresponding to the target version information. The above-described local may be a computer term. The above-described local generally refers to a computer directly connected to a user, or to a device (e.g., printer) or process under the direct control of a user as opposed to a remote host, device, and process.
Some embodiments of the present disclosure disclose a method for querying data, first, determining whether target version information exists in a target warehouse every predetermined period of time. And finally, in response to determining that the target version information exists in the target warehouse, storing the interface file compression package corresponding to the target version information to the local, and decompressing the interface file compression package to obtain the interface file corresponding to the target version information. The mapping relation between the message type and the corresponding interface file is randomly adjusted, and online is not needed.
With further reference to fig. 4, as an implementation of the method described above for the various figures, the present disclosure provides some embodiments of an apparatus for parsing a message, which apparatus embodiments correspond to those described above for fig. 2, and which apparatus is particularly applicable in a variety of electronic devices.
As shown in fig. 4, an apparatus 400 for parsing a message of some embodiments includes: a determining unit 401 and a deriving unit 402. Wherein, the determining unit 401 is configured to determine whether the database mapping table includes a save path of the interface file corresponding to the message type of the target message; and an obtaining unit 402 configured to, in response to determining the save path of the interface file corresponding to the message type including the target message in the database mapping table, perform an parsing operation on the target message using a first command generated based on the save path, and obtain a parsed message corresponding to the target message.
In some optional implementations of some embodiments, the means 400 for parsing a message is further configured to: and responding to the determination that the database mapping table does not comprise the storage path of the interface file corresponding to the message type of the target message, and analyzing the target message by utilizing a second command to obtain an analyzed message corresponding to the target message.
In some alternative implementations of some embodiments, the first command is obtained by: and adding the saved path to a predefined position in the command to be added to generate a first command.
In some optional implementations of some embodiments, the database mapping table is obtained by associating and storing a message type and a storage path of a corresponding interface file.
In some optional implementations of some embodiments, the means 400 for parsing a message is further configured to: determining whether target version information exists in a target warehouse every preset time period; and in response to determining that the target version information exists in the target warehouse, storing an interface file compression packet corresponding to the target version information to a local place, and decompressing the interface file compression packet to obtain an interface file corresponding to the target version information.
In some optional implementations of some embodiments, the target version information is obtained by: responding to the detection of the submitting operation aiming at the codes in the target warehouse, and packaging the interface files in the target warehouse to obtain an interface file compression package; version information is added to the interface file compression package.
It will be appreciated that the elements described in the apparatus 400 correspond to the various steps in the method described with reference to fig. 2. Thus, the operations, features and resulting benefits described above with respect to the method are equally applicable to the apparatus 400 and the units contained therein, and are not described in detail herein.
Referring now to fig. 5, a schematic diagram of an electronic device (e.g., server in fig. 1) 500 suitable for use in implementing some embodiments of the present disclosure is shown. Terminal devices in some embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), car terminals (e.g., car navigation terminals), and the like, as well as stationary terminals such as digital TVs, desktop computers, and the like. The terminal device shown in fig. 5 is only one example and should not impose any limitation on the functionality and scope of use of the embodiments of the present disclosure.
As shown in fig. 5, the electronic device 500 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 501, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data required for the operation of the electronic apparatus 500 are also stored. The processing device 501, the ROM 502, and the RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
In general, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; a storage device 508 including, for example, a memory card or the like; and communication means 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 shows an electronic device 500 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 5 may represent one device or a plurality of devices as needed.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communications device 509, or from the storage device 508, or from the ROM 502. The above-described functions defined in the methods of some embodiments of the present disclosure are performed when the computer program is executed by the processing device 501.
It should be noted that, in some embodiments of the present disclosure, the computer readable medium may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: determining whether a database mapping table comprises a storage path of an interface file corresponding to the message type of the target message or not; and responding to the determination of the storage path of the interface file corresponding to the message type of the target message in the database mapping table, and analyzing the target message by utilizing a first command generated based on the storage path to obtain an analyzed message corresponding to the target message.
Computer program code for carrying out operations for some embodiments of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, described as: a processor includes a determination unit and an obtaining unit. The names of these units do not constitute a limitation on the unit itself in some cases, and for example, the determining unit may also be described as "a unit that determines whether the save path of the interface file corresponding to the message type of the target message is included in the database mapping table".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
According to one or more embodiments of the present disclosure, there is provided a method for parsing a message, comprising: determining whether a database mapping table comprises a storage path of an interface file corresponding to the message type of the target message or not; and responding to the determination of the storage path of the interface file corresponding to the message type of the target message in the database mapping table, and analyzing the target message by utilizing a first command generated based on the storage path to obtain an analyzed message corresponding to the target message.
According to one or more embodiments of the present disclosure, the above method further comprises: and responding to the determination that the database mapping table does not comprise the storage path of the interface file corresponding to the message type of the target message, and analyzing the target message by utilizing a second command to obtain an analyzed message corresponding to the target message.
According to one or more embodiments of the present disclosure, the first command is obtained by: and adding the saved path to a predefined position in the command to be added to generate a first command.
According to one or more embodiments of the present disclosure, the database mapping table is obtained by associating and storing a message type and a storage path of a corresponding interface file.
According to one or more embodiments of the present disclosure, the above method further comprises: determining whether the target version information exists in the target warehouse every a preset time period; and in response to determining that the target version information exists in the target warehouse, storing the interface file compression package corresponding to the target version information to the local, and decompressing the interface file compression package to obtain the interface file corresponding to the target version information.
According to one or more embodiments of the present disclosure, the above-mentioned target version information is obtained by: responding to the detection of the submitting operation aiming at the codes in the target warehouse, and packaging the interface files in the target warehouse to obtain an interface file compression package; version information is added to the interface file compression package.
According to one or more embodiments of the present disclosure, there is provided an apparatus for parsing a message, comprising: a determining unit configured to determine whether a save path of an interface file corresponding to a message type of the target message is included in the database mapping table; and an obtaining unit configured to, in response to determining the save path of the interface file corresponding to the message type including the target message in the database mapping table, perform an parsing operation on the target message using a first command generated based on the save path, and obtain a parsed message corresponding to the target message.
According to one or more embodiments of the present disclosure, the above-described apparatus is further configured to: and responding to the determination that the database mapping table does not comprise the storage path of the interface file corresponding to the message type of the target message, and analyzing the target message by utilizing a second command to obtain an analyzed message corresponding to the target message.
According to one or more embodiments of the present disclosure, the first command is obtained by: and adding the saved path to a predefined position in the command to be added to generate a first command.
According to one or more embodiments of the present disclosure, the database mapping table is obtained by associating and storing a message type and a storage path of a corresponding interface file.
According to one or more embodiments of the present disclosure, the above-described apparatus is further configured to: determining whether the target version information exists in the target warehouse every a preset time period; and in response to determining that the target version information exists in the target warehouse, storing the interface file compression package corresponding to the target version information to the local, and decompressing the interface file compression package to obtain the interface file corresponding to the target version information.
According to one or more embodiments of the present disclosure, the above-mentioned target version information is obtained by: responding to the detection of the submitting operation aiming at the codes in the target warehouse, and packaging the interface files in the target warehouse to obtain an interface file compression package; version information is added to the interface file compression package.
According to one or more embodiments of the present disclosure, there is provided an electronic device including: one or more processors; and a storage device having one or more programs stored thereon, which when executed by the one or more processors, cause the one or more processors to implement the method as described in any of the embodiments above.
According to one or more embodiments of the present disclosure, there is provided a computer readable medium having stored thereon a computer program, wherein the program, when executed by a processor, implements a method as described in any of the embodiments above.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above technical features, but encompasses other technical features formed by any combination of the above technical features or their equivalents without departing from the spirit of the invention. Such as the above-described features, are mutually substituted with (but not limited to) the features having similar functions disclosed in the embodiments of the present disclosure.