Disclosure of Invention
The embodiment of the invention provides a big data disassembly and assembly method and device and a public message management system, which are used for solving the problem of low efficiency of the disassembly and assembly logic of a message in the prior art.
In order to solve the technical problems, the invention provides a big data splitting method which is applied to an application system, wherein the method comprises the following steps: dividing each received message by adopting a preset dividing rule; wherein, each message adopts the same set of preset splitting rules; forming an array from the split messages; wherein the array is provided for local use.
Further, before the splitting operation is performed on each received message, the method further includes: executing queue setting operation on the local text; the local telegram is marked as the received telegram or the telegram to be sent through the queue setting operation; and sending the message to be sent to an opposite-end application system.
Further, the queue setting operation includes: setting a plurality of items of parameter information for each message; wherein, the parameter information at least comprises: queue number, serial number, character key value, character length, character type and coding format; the queue numbers comprise a first queue number and a second queue number, wherein the first queue number is used for identifying messages of different styles, and the second queue number is used for identifying received messages or messages to be sent.
Further, a preset splitting rule is adopted to split each received message, which comprises the following steps: identifying each received message according to the second queue number; in each received message, according to the first queue number, intercepting corresponding characters of each message in the same style according to the set character length in sequence; wherein each segment of characters corresponds to one serial number, and each segment of characters corresponds to one character length; performing type conversion on the intercepted characters according to the set character types, and transcoding the intercepted characters according to the set coding format; wherein each segment of characters corresponds to a coding format.
Further, the method for forming the divided telegrams into an array comprises the following steps: and storing the intercepted characters into an array taking the character key value as a key word.
Further, after performing a queue setting operation on the local text, the method further includes: and storing each received message and generating a message log.
Further, the text log includes at least the following parameters: serial number, queue number, text, identification, attribute; the serial number is a serial number randomly generated for each message, the queue number is used for identifying messages of different styles, the identification comprises a successful receiving identification or a failed receiving identification, and the attribute is a receiver.
Further, the message identified as the failed receiving identifier is re-received at regular time.
Further, the array is a map array.
The invention also provides a big data assembling method which is applied to an application system, wherein the method comprises the following steps: determining parameter information matched with the local array; according to the parameter information, adopting a preset assembly rule to assemble the array into a message; wherein, each array adopts the same set of preset assembly rules; and sending the message to an opposite-end application system.
Further, the parameter information includes at least: queue number, sequence number, character key value, character length, character type, encoding format.
Further, according to the parameter information, the array is assembled into a text by adopting a preset assembly rule, including: taking the character key value corresponding to the serial number as a keyword, and acquiring a character corresponding to the keyword in the array; wherein one of the queue numbers corresponds to one of the arrays; transcoding the characters according to the coding format, and performing type conversion on the characters according to the character types; and assembling the characters after the transcoding and type transformation into a text according to a preset rule.
Further, assembling the characters into a text according to a preset rule, including: adjusting the length of the character to be consistent with the length of the character; and assembling the adjusted characters into a text and storing the text.
Further, adjusting the length of the character to be consistent with the character length includes: if the length of the character is smaller than the character length, adjusting the length of the character to be consistent with the character length in a mode of filling a space character; or if the length of the character is greater than the character length, intercepting part of characters in the characters so that the length of the part of characters is consistent with the character length; or if the character corresponding to the keyword does not exist, filling the character with a space character so that the length of the filled character is consistent with the length of the character.
Further, the method further comprises: and storing the text and generating a text log.
Further, the text log includes at least the following parameters: serial number, queue number, text, identification, attribute; the serial number is a serial number randomly generated for each message, the queue number is used for identifying messages of different styles, the identification comprises a transmission success identification or a transmission failure identification, and the attribute is send.
Further, the method further comprises: and for the message with the identification of failed transmission, retransmitting the message at fixed time.
Further, the array is a map array.
The invention also provides a big data splitting device which is applied to an application system, wherein the device comprises: the splitting module is used for splitting each received message by adopting a preset splitting rule; wherein, each message adopts the same set of preset splitting rules; the array construction module is used for forming an array from the split telegrams; wherein the array is provided for local use.
Further, the apparatus further comprises: the queue setting module is used for executing queue setting operation on the local telegrams; the local telegram is marked as the received telegram or the telegram to be sent through the queue setting operation; and the message sending module is used for sending the message to be sent to the opposite-end application system.
Further, the queue setting module is further configured to set a plurality of parameter information for each message; wherein, the parameter information at least comprises: queue number, serial number, character key value, character length, character type and coding format; the queue numbers comprise a first queue number and a second queue number, wherein the first queue number is used for identifying messages of different styles, and the second queue number is used for identifying received messages or messages to be sent.
Further, the splitting module includes: the identification unit is used for identifying each received message according to the second queue number; the character intercepting unit is used for intercepting corresponding characters of each received message according to the set character length according to the first queue number; wherein each segment of characters corresponds to one serial number, and each segment of characters corresponds to one character length; the conversion unit is used for carrying out type conversion on the intercepted characters according to the set character types and transcoding the intercepted characters according to the set coding formats; wherein each segment of characters corresponds to a coding format.
Further, the array construction module is further configured to store the intercepted character into an array using the character key value as a key word.
Further, the apparatus further comprises: and the storage module is used for storing each received message and generating a message log.
The invention also provides a big data assembling device which is applied to an application system, wherein the device comprises: the information determining module is used for determining parameter information matched with the local array; the message assembly module is used for assembling the array into a message by adopting a preset assembly rule according to the parameter information; wherein, each array adopts the same set of preset assembly rules; and the message sending module is used for sending the message to the opposite-end application system.
Further, the parameter information includes at least: queue number, sequence number, character key value, character length, character type, encoding format.
Further, the text assembling module includes: the character obtaining unit is used for taking the character key value corresponding to the serial number as a keyword and obtaining the character corresponding to the keyword in the array; wherein one of the queue numbers corresponds to one of the arrays; the conversion unit is used for transcoding the characters according to the coding format and performing type conversion on the characters according to the character types; and the text assembling unit is used for assembling the characters subjected to transcoding and type transformation into text according to preset rules.
Further, the text assembling unit includes: an adjustment subunit configured to adjust a length of the character to be consistent with the character length; and the assembling subunit is used for assembling the adjusted characters into a text and storing the text.
Further, the adjusting subunit is further configured to adjust, when the length of the character is smaller than the character length, the length of the character to be consistent with the character length by filling a space symbol; or, in the case that the length of the character is greater than the character length, intercepting part of characters in the characters so that the length of the part of characters is consistent with the character length; or filling the character with a space character when the character corresponding to the keyword does not exist, so that the length of the character after filling is consistent with the length of the character.
Further, the assembling further comprises: and the storage module is used for storing the telegram and generating a telegram log.
The invention also provides a public message management system, wherein the system comprises the big data splitting device and the big data assembling device.
By applying the technical scheme of the invention, the large data disassembly and assembly method, the large data disassembly and assembly device and the public message management system are provided, and uniform disassembly rules and assembly rules can be adopted for disassembly and assembly aiming at messages with various formats (namely, messages with character string formats except json and xml forms), so that the workload of setting corresponding disassembly and assembly logics according to different types of the messages is greatly reduced, the message processing efficiency is improved, and excessive consumption of manpower is avoided.
Detailed Description
The invention will now be described in further detail with reference to the drawings and specific examples, which are not intended to limit the invention thereto.
The invention introduces the message corresponding to the use of big data transfer among a plurality of independent application systems, in particular to the accurate data transfer among the application systems, comprising the steps of receiving the message and sending the message.
The message entity data refers to message content actually applied to the application in the message, and is the core of the application actually applied to the application in the message. For convenience of reading, the text in the present invention refers to text entity data. The formats of the text are numerous, such as XML, JSON, etc. formats for high-level languages, but not all systems use high-level languages, such as: a secondary control system and a primary trigger system. In order to meet the requirement of data transmission among any systems (such as the Internet of things), the data format of the telegraph text in the invention is a character string format.
Example 1
The present embodiment describes message splitting logic. Fig. 1 is a flowchart of a big data splitting method according to an embodiment of the present invention, which is applied to an application system, and as shown in fig. 1, the method includes the following steps (step S101 to step S102):
step S101, adopting a preset splitting rule to split each received message; wherein, each message adopts the same set of preset splitting rules;
Step S102, the divided telegrams are formed into an array; wherein the array is provided for local use.
According to the embodiment, uniform splitting rules can be adopted for splitting aiming at the telegrams with various formats, so that the workload of setting corresponding splitting logics due to different telegram styles is greatly reduced, the telegram processing efficiency is improved, and excessive consumption of manpower is avoided.
Before executing the splitting operation on each received message, the queue setting operation is required to be executed on the local message; the local message can be identified as the received message or the message to be sent through the queue setting operation. And executing subsequent splitting operation on the received message, and transmitting the message to be transmitted to the opposite-end application system. Based on this, the attribute of the message can be explicitly divided into reception or transmission, so that corresponding operations are ready to be performed for the messages of different attributes.
The text of each style corresponds to a specific receiving style and a specific use scene, the corresponding production application is different, and the coding format of the text of each style is also different, so that each text needs to be subjected to queue setting operation. The queue setting operation mainly sets a plurality of parameter information for each message; wherein, the parameter information at least comprises: queue number, serial number, character key value, character length, character type and coding format; may further include: chinese remarks. Table 1 shows various parameters in the queue setting operation.
TABLE 1
| Name of the name | Meaning of |
| QUEID | Queue numbering |
| Seqno | Sequence number |
| Messkey | Character key value |
| MenoCn | Chinese remarks |
| messlength | Character length |
| Messkind | Character type |
| unicode | Coding format |
The queue numbers comprise a first queue number and a second queue number, wherein the first queue number is used for identifying messages of different styles, and the second queue number is used for identifying received messages or messages to be sent. For example: the first queue number is indicated by a number, the second queue number is indicated by an letter, 1A indicates a received message of a first type, 2A indicates a received message of a second type, and 2B indicates a message to be transmitted of a third type. Of course, the first queue number and the second queue number may be represented in other manners, which the present invention is not limited to.
The sequence numbers 1, 2, and 3 … … are key1, key2, and key3 … … are the character key values. The character length is a character length set according to the requirement and corresponding to the serial number one by one, for example, the character length corresponding to the serial number 1 is 1, the length of the first section of character is 1, the character length corresponding to the serial number 2 is 4, the length of the second section of character is 4, etc. The character types described above may be set according to the requirements, for example: number type, letter type, chinese type, etc. The coding format can be set according to the requirement, and the corresponding coding format can be set for each section of intercepted characters, so that independent coding conversion of each section of a message is realized.
After executing the queue setting operation on each message, identifying each received message according to the second queue number, and dividing each received message according to a preset dividing rule to form an array, specifically, according to the first queue number, intercepting corresponding characters according to the set character length message from each message of the same style in turn (for example, according to the sequence from small to large in sequence number Seqno); performing type conversion on the intercepted characters according to a set character type Messkind, and transcoding the intercepted characters according to a set coding format unicode; wherein each segment of characters corresponds to a coding format; then, the intercepted character is stored in an array taking the character key value Messkey as a key word key. In a specific application, the above-mentioned splitting and grouping operations may be performed on all the messages with the first queue number 1, and then the above-mentioned splitting and grouping operations may be performed on all the messages with the first queue number 2, and so on. That is, the above-described splitting and composing array operations are performed on the messages in the order of the first queue numbers, but the rules according to which each message is split and composed are identical, so that the workload of setting the corresponding splitting logic according to the different patterns of the messages can be reduced.
Fig. 2 is a schematic flow chart of splitting and forming an array according to an embodiment of the present invention, as shown in fig. 2, after splitting a text according to a character length message, a sequence number 1 (Seqno 1) corresponds to a segment of a character (Value 1), a sequence number 2 (Seqno 2) corresponds to a segment of a character (Value 2), and a sequence number 3 (Seqno 3) corresponds to a segment of a character (Value 3). After the divided characters of each segment are converted into character types (Messkind) and coding formats (unicode), an array is formed by taking the character key value Messkey as a key word.
In this embodiment, the array may be a map array or another type of array. Taking java as an example, the array may be assembled into the following format:
[{key1=value1,key2=value2,key3=value3,key4=value4,........},
{key1=value1,key2=value2,key3=value3,key4=value4,........},
{key1=value1,key2=value2,key3=value3,key4=value4,........},
{key1=value1,key2=value2,key3=value3,key4=value4,........},
.............................................................]
in this embodiment, each received text may also be stored and a text log may be generated. The text log includes at least the following parameters: serial number, queue number, text, identification, attribute; the serial number is a serial number randomly generated for each message, the queue number is used for identifying messages of different styles, the identification comprises a successful receiving identification or a failed receiving identification, and the attribute is a receiver receiving. The message identified as the failed receipt can be re-received at a fixed time as required. The above-mentioned text log may further include: and the abnormal remarks are used for remarks when abnormal conditions occur. Shown in table 2 are parameters in the text storage operation.
TABLE 2
| Name of the name | Description of the invention |
| UUID | Sequence number |
| QUEID | Queue numbering |
| message | Telegram text |
| Marking | Identification mark |
| Receivesend | Transmitting or receiving |
| Msg | Abnormal remarks |
Example two
The present embodiment describes text assembly logic. Fig. 3 is a flowchart of a big data assembling method according to an embodiment of the present invention, which is applied to an application system, and as shown in fig. 3, the method includes the following steps (step S301 to step S303):
step S301, determining parameter information matched with a local array;
step S302, according to the parameter information, adopting a preset assembly rule to assemble the array into a text; wherein, each array adopts the same set of preset assembly rules;
step S303, the message is sent to the opposite end application system.
According to the embodiment, the unified assembly rule can be adopted for assembly aiming at each array, so that the workload of setting corresponding split logic according to different text styles is greatly reduced, the text processing efficiency is improved, and excessive consumption of manpower is avoided.
The parameter information at least includes: queue number, sequence number, character key value, character length, character type, encoding format. The first embodiment has been described in detail, and the detailed description is omitted herein.
In this embodiment, the method includes the steps of assembling the array into the text by using a preset assembly rule, and specifically includes: taking the character key value corresponding to the serial number as a keyword to obtain the character corresponding to the keyword in the array; wherein, a queue number corresponds to an array; transcoding the characters according to the coding format, and performing type conversion on the characters according to the character types; and assembling the characters after the transcoding and type transformation into a text according to a preset rule. For how to assemble the characters into the text according to the preset rule, the embodiment provides a preferred implementation manner, namely, the length of the characters is adjusted to be consistent with the length of the characters, and the adjusted characters are assembled into the text and stored. And for each array, the same preset rule is adopted to assemble the text, so that the workload of setting corresponding assembly logic due to different text styles is greatly reduced.
FIG. 4 is a schematic diagram of a character adjustment flow according to an embodiment of the present invention, wherein, as shown in FIG. 4, parameter information matched with an array is obtained, a character value in a map array is searched by using a character key value Messkey as a key, and then if the length of a character is smaller than the length of the character, the length of the character is adjusted to be consistent with the length of the character by filling a space character; or if the length of the character is greater than the character length, intercepting part of the characters in the character so that the length of the part of the characters is consistent with the character length; or if the character corresponding to the keyword does not exist, filling the character with a space character so that the length of the filled character is consistent with the character length.
Fig. 5 is a schematic flow chart of message assembly according to an embodiment of the present invention, as shown in fig. 5, a map array is matched with each parameter information in a queue setting operation, then, according to a character key value message corresponding to a sequence number Seqno, a character value corresponding to a key of the key in the map array is obtained, the character value is converted according to a coding format unicode and a character type message, and then, the character is assembled, packaged into a message and then sent to the outside.
In this embodiment, the array may be a map array or another type of array.
In this embodiment, the text may also be stored and a text log may be generated. The text log includes at least the following parameters: serial number, queue number, text, identification, attribute. See table 2 above for details. The serial number is a serial number which is randomly generated for each message, the queue number is used for identifying the messages of different styles, the identification comprises a transmission success identification or a transmission failure identification, and the attribute is send transmission. The message identified as the failed transmission can be received again at fixed time according to the requirement. The above-mentioned text log may further include: and the abnormal remarks are used for remarks when abnormal conditions occur.
Example III
Corresponding to the big data splitting method described in the first embodiment, the present embodiment provides a big data splitting device, which is applied to an application system, and the big data splitting device includes:
the splitting module 10 is configured to split each received message by adopting a preset splitting rule; wherein, each message adopts the same set of preset splitting rules;
an array construction module 12, connected to the splitting module 10, for forming an array from the split messages; wherein the array is provided for local use.
According to the embodiment, uniform splitting rules can be adopted for splitting aiming at the telegrams with various formats, so that the workload of setting corresponding splitting logics due to different telegram styles is greatly reduced, the telegram processing efficiency is improved, and excessive consumption of manpower is avoided.
The device further comprises: the queue setting module is used for executing queue setting operation on the local messages before executing the splitting operation on each received message; the method comprises the steps of marking a local message as a received message or a message to be sent through a queue setting operation; and the message sending module is used for sending the message to be sent to the opposite-end application system. Based on this, the attribute of the message can be explicitly divided into reception or transmission, so that corresponding operations are ready to be performed for the messages of different attributes.
The queue setting module is further used for setting a plurality of parameter information for each message; wherein, the parameter information at least comprises: queue number, serial number, character key value, character length, character type and coding format; the queue numbers comprise a first queue number and a second queue number, wherein the first queue number is used for identifying messages of different styles, and the second queue number is used for identifying received messages or messages to be sent. The meaning of other parameter information is described in detail in the first embodiment, and is not described herein.
In this embodiment, the splitting module 10 includes: the identifying unit is used for identifying each received message according to the second queue number; the character intercepting unit is used for intercepting corresponding characters of each received message according to the set character length in sequence according to the first queue number; wherein each segment of characters corresponds to a serial number, and each segment of characters corresponds to a character length; the conversion unit is used for performing type conversion on the intercepted characters according to the set character types and transcoding the intercepted characters according to the set coding format; wherein each segment of characters corresponds to a coding format. The above-mentioned array construction module 12 is further configured to store the intercepted character into an array using the character key value as a key word. The rule according to which each array is assembled is the same, thereby greatly reducing the workload of setting the corresponding split logic according to different text styles.
Preferably, the apparatus further comprises: and the storage module is used for storing each received message and generating a message log. The text log includes at least the following parameters: serial number, queue number, text, identification, attribute; the serial number is a serial number randomly generated for each message, the queue number is used for identifying messages of different styles, the identification comprises a successful receiving identification or a failed receiving identification, and the attribute is a receiver receiving. The message identified as the failed receipt can be re-received at a fixed time as required. The above-mentioned text log may further include: and the abnormal remarks are used for remarks when abnormal conditions occur. In this embodiment, the array may be a map array or another type of array.
Example IV
Corresponding to the big data assembling method described in the second embodiment, the present embodiment provides a big data assembling apparatus applied to an application system, as shown in the block diagram of the big data assembling apparatus in fig. 7, the apparatus includes:
an information determining module 20, configured to determine parameter information matched with the local array;
the message assembling module 22 is connected to the information determining module 20, and is configured to assemble the array into a message according to the parameter information by adopting a preset assembling rule; wherein, each array adopts the same set of preset assembly rules;
The message sending module 24 is connected to the message assembling module 22, and is used for sending the message to the opposite end application system.
According to the embodiment, the unified assembly rule can be adopted for assembly aiming at each array, so that the workload of setting corresponding split logic according to different text styles is greatly reduced, the text processing efficiency is improved, and excessive consumption of manpower is avoided.
The parameter information at least includes: queue number, sequence number, character key value, character length, character type, encoding format. The first embodiment has been described in detail, and the detailed description is omitted herein.
In this embodiment, the text assembling module 22 includes: the character obtaining unit is used for taking the character key value corresponding to the serial number as a keyword and obtaining the character corresponding to the keyword in the array; wherein, a queue number corresponds to an array; the conversion unit is used for transcoding the characters according to the coding format and performing type conversion on the characters according to the types of the characters; and the text assembling unit is used for assembling the characters subjected to transcoding and type transformation into text according to preset rules. Specifically, the above-mentioned text assembling unit includes: an adjustment subunit for adjusting the length of the character to be consistent with the character length; and the assembling subunit is used for assembling the adjusted characters into a text and storing the text. And for each array, the same preset rule is adopted to assemble the text, so that the workload of setting corresponding assembly logic due to different text styles is greatly reduced.
For the adjustment of the character length, the embodiment provides a preferred implementation manner, namely the adjustment subunit is further configured to adjust the length of the character to be consistent with the character length by filling the space symbol when the length of the character is smaller than the character length; or, under the condition that the length of the character is greater than the length of the character, intercepting part of the characters in the character so as to enable the length of the part of the characters to be consistent with the length of the character; alternatively, when the character corresponding to the keyword does not exist, the character is padded with the space character so that the length of the padded character matches the character length.
Preferably, the apparatus further comprises: and the storage module is used for storing the telegrams and generating a telegram log. The text log includes at least the following parameters: serial number, queue number, text, identification, attribute. See table 2 above for details. The serial number is a serial number which is randomly generated for each message, the queue number is used for identifying the messages of different styles, the identification comprises a transmission success identification or a transmission failure identification, and the attribute is send transmission. The message identified as the failed transmission can be received again at fixed time according to the requirement. The above-mentioned text log may further include: and the abnormal remarks are used for remarks when abnormal conditions occur. In this embodiment, the array may be a map array or another type of array.
Example five
The big data splitting apparatus according to the third embodiment and the big data assembling apparatus according to the fourth embodiment provide a public message management system, such as a block diagram of the public message management system shown in fig. 8, comprising: big data splitting device and big data assembling device. The third and fourth embodiments of the big data splitting device and the big data assembling device have been described in detail, and are not described in detail herein.
FIG. 9 is a flowchart of a utility message management system according to an embodiment of the present invention, as shown in FIG. 9, the utility message management system performs a splitting operation on messages of different styles (message style A, message style B, message style C, message style D) to form a map array for direct use, and then for use by an application system.
FIG. 10 is a functional partitioning schematic flow chart of a utility message management system according to an embodiment of the present invention, as shown in FIG. 10, which may implement the following functions: the method comprises the steps of message storage, common message queue setting, common message splitting, common message assembling and message re-acceptance. And (5) resending the message.
FIG. 11 is a flow chart of message splitting according to an embodiment of the present invention, as shown in FIG. 11, after receiving a message, the public message management system splits the message according to the queue setting, and after splitting, assembles the message into a map array assembled in a key and value form and directly uses the map array. And carrying out local storage while splitting the message so as to prevent the message from being received failure caused by application logic errors. If the message is not split, the message is stored again after being identified.
FIG. 12 is a flow chart of message assembly according to an embodiment of the invention, as shown in FIG. 12, the common message management system assembles the arrays into a message and sends the message to the opposite application system (which may also be an external system). And the message is transmitted and stored at the same time. If the assembly fails, the assembly is carried out again, and if the transmission fails, the text is identified and then stored.
Fig. 13 is a schematic diagram of failure identification according to an embodiment of the present invention, as shown in fig. 13, after a message splitting failure or a message sending failure, searching a corresponding stored message according to a serial number UUID, and modifying an identification Marking in a message log to F (indicating a failure).
In the process of receiving and sending the message, due to communication faults, server maintenance among systems, internal abnormality of the systems and the like, the message can not be normally received and sent, and the message which is not normally transmitted needs to be received or sent again in order to keep the data information of the two parties consistent. The specific method comprises the following steps: the message marked as failure is split in time according to the queue number QUEID, and a map array is assembled for application; and directly sending the message to the outside at fixed time. Fig. 14 is a schematic diagram of timing retransmission according to an embodiment of the present invention, as shown in fig. 14, a timing task is established, a time is set, and the system will start the task at regular time according to a time setting rule, and perform reception and transmission of a message. Thereby ensuring the accuracy of the text interaction between the systems.
As can be seen from the above description, the present invention provides a method and apparatus for splitting and assembling big data and a public message management system, which achieve the following effects: 1) Through sharing the split and assembly logic, after the telegrams with different styles are received by the application system, special logic processing is not needed, and the workload of setting corresponding logic due to different telegram styles is greatly reduced; 2) The timing re-receiving and sending of the abnormal message are realized, and the accuracy of the intersystem message is ensured; 3) The method realizes independent code conversion of each section of a message, and realizes different code assembly and reception for different section codes in the message.
Of course, the above is a preferred embodiment of the present invention. It should be noted that it will be apparent to those skilled in the art that several modifications and adaptations can be made without departing from the general principles of the present invention, and such modifications and adaptations are intended to be comprehended within the scope of the present invention.