CN106790130B - Message matching method and device - Google Patents

Message matching method and device Download PDF

Info

Publication number
CN106790130B
CN106790130B CN201611229188.2A CN201611229188A CN106790130B CN 106790130 B CN106790130 B CN 106790130B CN 201611229188 A CN201611229188 A CN 201611229188A CN 106790130 B CN106790130 B CN 106790130B
Authority
CN
China
Prior art keywords
message
return
request message
request
packet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611229188.2A
Other languages
Chinese (zh)
Other versions
CN106790130A (en
Inventor
袁琳
成银乾
李蒙
张同虎
刘一鸿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN201611229188.2A priority Critical patent/CN106790130B/en
Publication of CN106790130A publication Critical patent/CN106790130A/en
Application granted granted Critical
Publication of CN106790130B publication Critical patent/CN106790130B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Abstract

The invention provides a message matching method, which comprises the following steps: respectively acquiring a request message data packet and a return message data packet in a set time period; selecting a return message set corresponding to the request message from the return message data packet by using a time window corresponding to the request message for any request message in the request message data packet; searching a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set; and comparing the transaction key field of the request message with the transaction key field of each return message in the second return message set corresponding to the request message to obtain the return message matched with the request message. By adopting the technical scheme of the invention, the matching work of massive messages can be automatically completed on the premise of not influencing the communication efficiency of the system.

Description

Message matching method and device
Technical Field
The invention belongs to the technical field of network communication, and particularly relates to a message matching method and device.
Background
In a duplex network transmission system in the financial field, a request message and a return message are transmitted using two independent network channels, and there is no obvious information for matching the return message with the request message in the messages. For such a system, when performing a function test, a tester needs to match a request message and a return message in the system first to realize simulation of an industrial business scenario in the test process. However, matching the request message and the return message of such a system has been a difficult problem in the industry because of the lack of obvious matching information in the message.
The existing solution in the industry at present mainly relies on manual work to identify and match request messages and return messages one by one from massive messages. This scheme human cost is high, and matches inefficiency. In the prior art, a code for generating a message identifier is inserted into an application source code in a manner of modifying the source code, so that a message carries message identifier information, and a request message and a return message are automatically matched by comparing the message identifier information. However, modifying the application source code increases the data size of a single packet, reducing transmission efficiency.
Disclosure of Invention
Based on the defects and shortcomings of the prior art, the invention provides a message matching method and device, which can automatically complete the matching work of a request message and a return message on the premise of not modifying an application source code and ensuring the transmission efficiency.
A message matching method comprises the following steps:
respectively acquiring a request message data packet and a return message data packet in a set time period;
selecting a return message set corresponding to the request message from the return message data packet by using a time window corresponding to the request message for any request message in the request message data packet;
searching a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set;
and comparing the transaction key field of the request message with the transaction key field of each return message in the second return message set corresponding to the request message to obtain the return message matched with the request message.
Preferably, the obtaining the request packet and the return packet in the set time period respectively includes:
and respectively grabbing request message data packets in a set time period from the request message network channel and grabbing return message data packets in a set time period from the return message network channel.
Preferably, after the capturing the request packet data within the set time period from the request packet network channel and the capturing the return packet data within the set time period from the return packet network channel, respectively, the method further includes:
respectively judging whether the request message data packet and the return message data packet obtained by grabbing are empty or not;
and if the request message data packet is empty or the return message datagram is empty, repeatedly and respectively grabbing the request message data packet in a set time period from the request message network channel and grabbing the return message data packet in the set time period from the return message network channel until the grabbed request message data packet and the return message data packet are not empty.
Preferably, the searching for the return packet with the same transaction type as the request packet from the return packet set corresponding to the request packet to form a second return packet set includes:
for each return message in the return message set corresponding to the request message, transaction type identification information capable of uniquely identifying the transaction type of the return message is respectively extracted;
inputting the transaction type identification information of each returned message in the returned message set into a Hash algorithm, and calculating to obtain the fingerprint information of each returned message;
identifying the transaction type of the request message;
and comparing the fingerprint information of the expected return message corresponding to the transaction type of the request message with the fingerprint information of each return message in the return message set respectively, finding out the return message with the fingerprint information which is the same as the fingerprint information of the expected return message corresponding to the transaction type of the request message, and forming a second return message set.
Preferably, after selecting the return packet set corresponding to the request packet from the return packet data packets by using the time window corresponding to the request packet, the method further includes:
judging whether the return text set is empty or not;
if the returned text set is empty, repeatedly executing the following operations for a set number of times:
amplifying a time window corresponding to the request message, and selecting a return message set corresponding to the request message from the return message data packet by using the amplified time window;
judging whether the selected return message set is empty or not;
if the selected returned text set is judged not to be empty in a certain operation in the set repetition times, stopping repeatedly executing the operation;
if the selected return message set is judged to be empty within the set repetition times, confirming that the return message set corresponding to the request message cannot be obtained, and exiting the message matching process.
Preferably, after the return packet set corresponding to the request packet is searched for a return packet with the same transaction type as the request packet to form a second return packet set, the method further includes:
judging whether the second return message set is empty or not;
if the second returned report text set is empty, repeatedly executing the following operations for a set number of times:
amplifying a time window corresponding to the request message, and selecting a return message set corresponding to the request message from the return message data packet by using the amplified time window;
searching a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set;
judging whether the formed second return message set is empty or not;
if the second returned text set is judged not to be empty in a certain operation in the set repetition times, stopping repeatedly executing the operation;
and if the second return text set is judged to be empty within the set repetition times, confirming that the second return text set corresponding to the arbitrary group of request messages cannot be obtained, and exiting the message matching process.
Preferably, after the return message matched with the request message is obtained by comparing the transaction key field of the request message with the transaction key field of each return message in the second return message set corresponding to the request message, the method further includes:
judging whether a return message matched with the request message is obtained or not;
if the return message matched with the request message is not obtained, the following operations are repeatedly executed for a set number of times:
amplifying a time window corresponding to the request message, and selecting a return message set corresponding to the request message from the return message data packet by using the amplified time window;
searching a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set;
comparing the transaction key field of the request message with the transaction key field of each return message in a second return message set corresponding to the request message to obtain a return message matched with the request message;
judging whether a return message matched with the request message is obtained or not;
if the return message matched with the request message is judged to be obtained in a certain operation in the set repetition times, the repeated execution of the operation is stopped;
and if the return message matched with the request message is not obtained within the set repetition times, confirming that the return message matched with the request message cannot be obtained.
Preferably, after determining that the return message matching with the request message is obtained, the method further includes:
judging whether the return message matched with the request message is unique or not;
and if the return message matched with the request message is not unique, acquiring the unique return message matched with the request message through manual identification.
A message matching apparatus, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for respectively acquiring a request message data packet and a return message data packet in a set time period;
a screening unit, configured to select, for any one request packet in the request packet data packets, a return packet set corresponding to the request packet from the return packet data packets by using a time window corresponding to the request packet;
the second screening unit is used for searching a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set;
and the processing unit is used for comparing the transaction key field of the request message with the transaction key field of each return message in the second return message set corresponding to the request message to obtain a return message matched with the request message.
Preferably, when the obtaining unit obtains the request packet and the return packet in the set time period, the obtaining unit is specifically configured to:
and respectively grabbing request message data packets in a set time period from the request message network channel and grabbing return message data packets in a set time period from the return message network channel.
Preferably, after the obtaining unit captures the request packet in the set time period from the request packet network channel and captures the return packet in the set time period from the return packet network channel, the obtaining unit is further configured to:
respectively judging whether the request message data packet and the return message data packet obtained by grabbing are empty or not;
and if the request message data packet is empty or the return message datagram is empty, repeatedly and respectively grabbing the request message data packet in a set time period from the request message network channel and grabbing the return message data packet in the set time period from the return message network channel until the grabbed request message data packet and the return message data packet are not empty.
Preferably, the second screening unit includes:
the information extraction unit is used for respectively extracting transaction type identification information which can uniquely identify the transaction type of the return message for each return message in the return message set corresponding to the request message;
the calculating unit is used for inputting the transaction type identification information of each return message in the return message set into a Hash algorithm and calculating to obtain the fingerprint information of each return message;
the identification unit is used for identifying the transaction type of the request message;
and the third screening unit is used for comparing the fingerprint information of the expected return message corresponding to the transaction type of the request message with the fingerprint information of each return message in the return message set respectively, finding out the return message with the fingerprint information identical to that of the expected return message corresponding to the transaction type of the request message, and forming a second return message set.
Preferably, the apparatus further comprises:
a first judgment processing unit, configured to judge whether the return packet set is empty or not after the screening unit selects the return packet set corresponding to the request packet from the return packet data packet by using the time window corresponding to the request packet;
if the returned text set is empty, repeatedly executing the following operations for a set number of times:
amplifying a time window corresponding to the request message, and calling the screening unit to select a return message set corresponding to the request message from the return message data packet by using the amplified time window;
judging whether the selected return message set is empty or not;
if the selected returned text set is judged not to be empty in a certain operation in the set repetition times, stopping repeatedly executing the operation;
if the selected return message set is judged to be empty within the set repetition times, confirming that the return message set corresponding to the request message cannot be obtained, and exiting the message matching process.
Preferably, the apparatus further comprises:
a second judgment processing unit, configured to, after the second screening unit searches for a return packet of the same transaction type as the request packet from a return packet set corresponding to the request packet to form a second return packet set, judge whether the second return packet set is empty;
if the second returned report text set is empty, repeatedly executing the following operations for a set number of times:
amplifying a time window corresponding to the request message, and calling the screening unit to select a return message set corresponding to the request message from the return message data packet by using the amplified time window; so that the second screening unit searches for a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set;
judging whether the formed second return message set is empty or not;
if the second returned text set is judged not to be empty in a certain operation in the set repetition times, stopping repeatedly executing the operation;
and if the second return text set is judged to be empty within the set repetition times, confirming that the second return text set corresponding to the arbitrary group of request messages cannot be obtained, and exiting the message matching process.
Preferably, the apparatus further comprises:
a third judgment processing unit, configured to judge whether a return message matched with the request message is obtained after the processing unit obtains a return message matched with the request message by comparing a transaction key field of the request message with a transaction key field of each return message in a second return message set corresponding to the request message;
if the return message matched with the request message is not obtained, the following operations are repeatedly executed for a set number of times:
amplifying a time window corresponding to the request message, and calling the screening unit to select a return message set corresponding to the request message from the return message data packet by using the amplified time window; so that the second screening unit searches for a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set; further, the processing unit obtains a return message matched with the request message by comparing the transaction key field of the request message with the transaction key field of each return message in a second return message set corresponding to the request message;
judging whether a return message matched with the request message is obtained or not;
if the return message matched with the request message is judged to be obtained in a certain operation in the set repetition times, the repeated execution of the operation is stopped;
and if the return message matched with the request message is not obtained within the set repetition times, confirming that the return message matched with the request message cannot be obtained.
Preferably, the apparatus further comprises:
a fourth judgment processing unit, configured to judge whether the return packet matching the request packet is unique after the third judgment processing unit judges that the return packet matching the request packet is obtained;
and if the return message matched with the request message is not unique, displaying all the return messages matched with the request message so as to obtain the unique return message matched with the request message through manual identification.
The message matching method provided by the invention comprises the steps of firstly, respectively obtaining a request message data packet and a return message data packet in a set time period; selecting a return message set corresponding to the request message from the return message data packet by using a time window corresponding to the request message for any request message in the request message data packet; then, searching a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set; and finally, comparing the transaction key field of the request message with the transaction key field of each return message in a second return message set corresponding to the request message to obtain a return message matched with the request message. According to the technical scheme, the application source code does not need to be modified, and the matching work of the request message and the return message can be automatically completed on the premise of ensuring the transmission efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flowchart of a message matching method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a message matching apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of another packet matching apparatus according to an embodiment of the present invention.
Detailed Description
In the financial field, there are some transaction systems that use duplex network transmission protocols, such as Tuxedo protocol. The request message and the return message of such systems are transmitted using two independent network channels, and there is no pairing information, such as a transaction code, that is obviously used to match the return message with the request message in the messages. For such a system, when performing a function test, a tester needs to match a request message and a return message in the system first, so as to realize simulation of an industrial business scenario in a test playback process. However, matching request messages and return messages for such systems has been a difficult problem in the industry because the messages in such systems do not have obvious pairing information for matching request messages and return messages.
In the prior art, the industry usually relies on manual work to perform recognition piece by piece in the massive system messages, and to match the request messages with the return messages. However, the manual matching method has high labor cost and low matching efficiency.
In order to solve the above problem, in the prior art, a technician inserts a code for generating a message identifier into an application source code, so that a message in a system carries identifier information for identifying the message. And matching the request message with the return message by matching the identification information of the request message with the identification information of the return message. However, inserting a code into an application source code increases the data size of a single message, reduces transmission efficiency, and affects transaction performance.
In order to solve the defects and shortcomings of the prior art, embodiments of the present invention provide a method and an apparatus for matching a message, which can automatically complete matching between a request message and a return message without modifying an application source code or affecting transmission efficiency.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a method for matching a packet provided in an embodiment of the present invention includes the following steps:
s101, respectively grabbing request message data packets in a set time period from a request message network channel and grabbing return message data packets in the same set time period from a return message network channel through a network switch;
in the financial field, there are some transaction systems that use duplex network transmission protocols, such as Tuxedo protocol. The request message and the return message of the system are transmitted by two independent network channels, and the two independent network channels are divided into a request message network channel for transmitting the request message and a return message network channel for transmitting the return message according to different types of the transmitted messages. The two network channels forward the data packet through the same network switch, and on the network switch, the data packets within the same set time period are captured from the two network channels, for example, the data packets within several days, several weeks, or several months are captured.
S102, respectively judging whether the captured data packets are empty, if the captured request message data packets are empty or the returned message data packets are empty, repeatedly and respectively capturing the request message data packets from the request message network channel and capturing the returned message data packets from the returned message network channel, and respectively judging whether the captured data packets are empty until the captured data packets are judged to be non-empty;
the system sends the request message and the return message at random, so that when the network switch captures the data packet, the network switch may not capture the data packet due to accidental factors. Based on the above situation, in the embodiment of the present invention, after the network switch performs the action of capturing the data packet, it is determined whether the captured data packet is empty, and if the captured data packet is empty, the data packet is repeatedly captured until the captured data packet is not empty.
S103, selecting a return message set corresponding to any request message in the request message data packet from the return message data packet by using a time window corresponding to the request message;
for each transaction process, a period of response time is set between the time when the request message is sent and the time when the return message is received. Specifically, for a group of request messages or a request message, the return message corresponding to the group of request messages or the request message is determined to appear in a time window from the moment when the group of request messages or the request message is sent to the moment after the longest response time. Therefore, for a group of request messages or a request message, the return messages in the return message data packet are filtered by using the corresponding time window, and the return messages which are not in the range of the time window are filtered, so that a return message set corresponding to the group of request messages or the request message can be selected from the captured return messages.
For example, assume that an embodiment of the present invention defines a set of request messages for transactions as Qj (j represents a different transaction type )>1), the transmission time of Qj is T0The transaction maximum response time is T. The return message corresponding to the set of request messages must appear at T0,T]Within a time window. Pressing the massive return messages according to [ T ]0,T]And filtering the time window to select a returned text set P. For each group of request messages or each request message, the corresponding returned message set can be selected according to the method.
It should be noted that, in the embodiment of the present invention, after the step S101 is executed, the data packets are respectively captured from the request packet network channel and the return packet network channel, and then a plurality of request packets and return packets are obtained. At this time, when step S103 is executed, for each group of request messages or each request message obtained by capturing, a corresponding return message set is selected by using the time window. The specific selection sequence can be that each group of request messages or a return message set corresponding to each group of request messages are respectively selected from multiple groups of request messages according to the sequence; or according to actual needs, a specific sequence can be specified, and a corresponding return message set is selected for each group of request messages or each request message in the multiple groups of request messages; obviously, the corresponding return text set can also be selected for a plurality of groups of request messages or a plurality of request messages at the same time. The embodiment of the invention only proposes to select the corresponding return message set for the request message by using the time window, and does not limit the specific selection form, and any available selection form can be adopted by the embodiment of the invention.
Furthermore, after selecting the corresponding return message set for each group of request messages or each group of request messages, the subsequent processing steps are respectively continuously executed to find the corresponding return messages until the corresponding return messages are found for all the request messages.
S104, judging whether the selected return message set of the request message is empty, if so, repeatedly executing the following operation for a set number of times: amplifying the time window, and selecting a return text set corresponding to the request message from the captured return messages by using the amplified time window; judging whether the selected return message set is empty, if the selected return message set is judged not to be empty in a certain operation in the set repetition times, stopping repeatedly executing the operation; if the selected return message set is judged to be empty within the set repetition times, confirming that the return message set corresponding to the request message cannot be obtained, and exiting the message matching process;
due to the influence of uncertain factors such as network communication quality, a return message corresponding to a certain group of request messages or a certain request message may not be returned within an expected response time, but may be returned after a period of time, which results in that a return message set corresponding to the request message cannot be selected according to an expected time window, that is, the selected return message set is empty. If the selected return text set is empty, the embodiment of the invention firstly amplifies the time window for selecting the return text set to enlarge the selection range, and then selects the return text set corresponding to the request message from the captured return text again by utilizing the amplified time window. Further, judging whether the selected return message set is empty again, if the selected return message set is still empty, amplifying the time window again, selecting the return message set corresponding to the request message by using the amplified time window, and if the selected return message set is judged not to be empty in a certain operation in the set repetition times, stopping repeatedly executing the operation; if the operation is repeatedly executed for the set times and the selected return message sets are all empty, the return message set corresponding to the request message cannot be obtained, and the message matching process exits.
For example, assume that a set of request messages defining a transaction is Qj (j represents a different transaction type, j)>1), the transmission time of Qj is T0The transaction maximum response time is T. The return message corresponding to the set of request messages should appear at T0,T]Within a time window. Pressing the massive return messages according to [ T ]0,T]Filtering the time window to select a returned message set P, if the selected returned message set P is empty, repeatedly amplifying the time window to be [ T0,(1+n)T]And using a time window [ T ]0,(1+n)T]And selecting a return text set from the return message again. Where n is a positive integer representing the number of times the time window is repeatedly enlarged.
S105, for each return message in the return message set corresponding to the request message, respectively extracting transaction type identification information capable of uniquely identifying the transaction type of the return message;
in a financial system, each set or each return message corresponds to a type of transaction, for example: deposit transactions, withdrawal transactions, transfer transactions, etc. For different types of transactions, information capable of uniquely identifying the type of transaction, namely transaction type identification information, can be extracted from a return message corresponding to a request message of the transaction. The embodiment of the invention respectively extracts the information which can uniquely identify the transaction type corresponding to the return message from the return messages in the return message set so as to carry out type matching on the return message and the request message through the information which uniquely identifies the transaction type of the message.
S106, inputting the transaction type identification information of each return message in the return message set into a Hash algorithm, and calculating to obtain the fingerprint information of each return message;
in general, the transaction type identification information extracted from the return message in step S105 is a character string, and the request message and the return message are directly subjected to type matching by comparing the character strings, which results in large workload and low efficiency. After the transaction type identification information of the return message is obtained, the identification information of the return message is input into a hash algorithm, a hash value is obtained through calculation, and the hash value is used as the fingerprint information of the return message. The fingerprint information is a numerical value, and the type matching of the return message and the request message can be rapidly carried out by comparing the fingerprint information of the return message and the fingerprint information of the request message.
The two types of financial transaction messages, the XML message and the 8583 message, are taken as an example for illustration. And for the XML message, extracting all labels in the message and sequencing the labels into a character string as transaction type identification information of the XML message. Inputting the character string into a Hash algorithm to obtain a Hash value, namely the fingerprint information of the message. For 8583 messages, all message identification bit information is extracted and a character string is formed to serve as transaction type identification information of the 8583 messages, and the character string is input into a hash algorithm to obtain a hash value, namely fingerprint information of the messages.
S107, identifying the transaction type of the request message;
s108, comparing the fingerprint information of the expected return message corresponding to the transaction type of the request message with the fingerprint information of each return message in the return message set respectively, finding out the return message with the fingerprint information same as that of the expected return message corresponding to the transaction type of the request message, and forming a second return message set;
in the software system executing the technical scheme of the embodiment of the invention, an expected return message format template which is calculated in advance and corresponds to the transaction type of the request message is stored, and the fingerprint information of the expected return message is calculated by utilizing a Hash algorithm according to the expected return message format template.
After the transaction type of the request message is identified and obtained, the fingerprint information of the expected return message corresponding to the transaction type is directly called from the database. The fingerprint information of the expected return message is compared with the fingerprint information of the return message in the return message set calculated in step S106, and a new return message set, called a second return message set, is formed by the fingerprint information of the expected return message and the return message with the same fingerprint information of the expected return message. In the second return packet set, the fingerprint information of all return packets is the same as the fingerprint information of the expected return packet, so that the return packets in the second return packet set are matched with the transaction type of the request packet. That is, by step S108, the embodiment of the present invention further selects a return packet with a transaction type matching the request packet from the return packet set.
It should be noted that, in the embodiment of the present invention, transaction type identification information is extracted from a return message, fingerprint information of the return message is obtained through hash algorithm calculation, and the fingerprint information of the return message is compared with fingerprint information of an expected return message corresponding to a request message, so as to find out a return message matching the transaction type of the request message from a return message set through comparison. Theoretically, by comparing any information capable of identifying the transaction type of the message, the return message matched with the transaction type of the request message can be found from the return message set. The method disclosed by the embodiment of the invention is only the most convenient and most common method in practice. The embodiment of the invention does not limit the information used for comparison, and similarly, does not limit the information processing and comparison method, and any information, information processing method and comparison method which can find the return message matched with the transaction type of the request message through comparison are within the protection scope of the embodiment of the invention.
S109, judging whether the second returned message set is empty, if so, repeating the following operations for a set number of times: enlarging the time window, executing the steps S103-S109 again, and stopping executing the operations repeatedly if the second return text set is judged not to be empty in a certain operation in the set repetition times; if the second return text set is judged to be empty within the set repetition times, confirming that the second return text set corresponding to the request message cannot be obtained, and quitting the message matching process;
the second return message set is empty, which indicates that no return message matched with the transaction type of the request message is found from the return message set. At this time, the embodiment of the present invention increases the number of return messages included in the return message set, so that the return message matching the transaction type of the request message can be found from the return message set. Specifically, the time window for selecting the return message set is enlarged, so that the number of return messages contained in the selected return message set is increased. Then, step S103 to step S109 are executed again, and it is determined whether the second returned packet set found from the returned packet set is empty, if the second returned packet set is empty, the time window is enlarged again, and step S103 to step S109 … … are executed, if the time window is enlarged for a certain time within the set number of times, and in the process of step S103 to step S109, it is determined that the selected second returned packet set is not empty, and the above-mentioned operations are stopped from being repeatedly executed; if the selected second return text set is still judged to be empty after the operations are repeatedly executed for the set times, the second return text set corresponding to the request message can be confirmed to be unavailable, and the message matching process is exited.
S110, comparing the transaction key field of the request message with the transaction key field of each return message in a second return message set corresponding to the request message to obtain a return message matched with the request message;
the request message and the return message respectively carry transaction key fields, such as a card number, a customer number, an identification number and the like. For a certain transaction process, the transaction key fields of the request message and the return message are the same. Based on the above principle, due to the previous processing steps in the embodiment of the present invention, the return messages matching the transaction type of the request message in the time window corresponding to the request message are found from a large number of return messages, and a second return message set is formed. Therefore, in this step, the return message that is the same as the transaction key field of the request message, i.e., the return message corresponding to the request message, is found from the second return message set. Further, for a group of request messages, transaction keyword matching is performed on each request message in the group of request messages and the return message in the second return message set, so that the return message corresponding to each request message in the group of request messages can be obtained.
S111, judging whether a return message matched with the request message is obtained or not, and if the return message matched with the request message is not obtained, repeating the following operation for a set number of times: amplifying the time window, and executing the steps S103-S111 again, if judging that the return message matched with the request message is obtained in a certain operation in the set repetition times, stopping executing the operation repeatedly; if the return message matched with the request message is not obtained within the set repetition times, confirming that the return message matched with the request message cannot be obtained, and exiting the message matching process;
if the return message matched with the request message is not found, the number of the return messages contained in the return message set is increased so that the return message matched with the request message can be found from the return message set. Specifically, the time window for selecting the return message set is enlarged, so that the number of return messages contained in the selected return message set is increased. Then, executing steps S103 to S111 again, and determining whether a return packet matching the request packet is found, if a return packet matching the request packet is not found, amplifying the time window again, executing steps S103 to S111 … …, if the time window is amplified for a certain time within the set number of times, and during executing steps S103 to S111, determining that a return packet matching the request packet is obtained, and stopping repeatedly executing the above operations; if the operation is repeatedly executed for a set number of times, and the return message matched with the request message is still judged not to be obtained, the return message matched with the request message can be confirmed to be obtained after the matching is not confirmed, and the message matching process is exited.
And S112, judging whether the return message matched with the request message is unique, and if the return message matched with the request message is not unique, acquiring the unique return message matched with the request message through manual identification.
In each transaction process, each request message is uniquely corresponding to one return message. If the technical scheme of the embodiment of the invention is executed, the only return message matched with the request message is found, which indicates that the correct return message matched with the request message is found. If multiple return messages matched with the request message are found by executing the technical scheme of the embodiment of the invention aiming at one request message, the characteristics of the multiple return messages and the request message are extremely similar, at the moment, the unique return message matched with the request message cannot be found by utilizing the technical scheme of the embodiment of the invention, and only manual identification is needed to identify the unique return message matched with the request message according to the full-looking information of the message.
It should be noted that, through experimental data, only 0.01% of request messages need to be identified and matched manually after matching return messages by using the technical solution of the embodiment of the present invention. That is to say, the technical scheme of the embodiment of the invention has higher identification accuracy.
In the embodiment of the present invention, a time window is first used to select a return text set corresponding to a request message from return messages; then, selecting a return message with the transaction type matched with the request message from the return message set to form a second return message set; and finally, selecting the return message matched with the request message from the second return message set through the transaction key field. The embodiment of the invention can automatically complete the matching of the request message and the return message without modifying the application source code.
Fig. 2 is a schematic structural diagram of a message matching apparatus, which includes an obtaining unit 201, a screening unit 202, a second screening unit 203, and a processing unit 204. The acquiring unit 201 is configured to acquire a request packet and a return packet within a set time period, respectively; a screening unit 202, configured to select, for any one request packet in the request packet data packets, a return packet set corresponding to the request packet from the return packet data packets by using a time window corresponding to the request packet; a second screening unit 203, configured to search a return packet with the same transaction type as the request packet from a return packet set corresponding to the request packet, so as to form a second return packet set; the processing unit 204 is configured to obtain a return message matched with the request message by comparing the transaction key field of the request message with the transaction key field of each return message in the second return message set corresponding to the request message.
Fig. 3 is a schematic structural diagram of another message matching apparatus, in which the second filtering unit 203 includes an information extracting unit 2031, a calculating unit 2032, an identifying unit 2033, and a third filtering unit 2034. The information extracting unit 2031 is configured to extract, for each return packet in the return packet set corresponding to the request packet, transaction type identification information capable of uniquely identifying a transaction type of the return packet; a calculating unit 2032, configured to input the transaction type identification information of each return packet in the return packet set into a hash algorithm, and calculate to obtain fingerprint information of each return packet; an identifying unit 2033, configured to identify a transaction type of the request packet; the third screening unit 2034 is configured to compare the fingerprint information of the expected return packet corresponding to the transaction type of the request packet with the fingerprint information of each return packet in the return packet set, find a return packet whose fingerprint information is the same as the fingerprint information of the expected return packet corresponding to the transaction type of the request packet, and form a second return packet set.
For the specific working contents of each unit of the message matching apparatus shown in fig. 2 and fig. 3, please refer to the contents of the corresponding method embodiment, which is not described herein again.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (14)

1. A message matching method is characterized by comprising the following steps:
respectively acquiring a request message data packet and a return message data packet in a set time period;
selecting a return message set corresponding to the request message from the return message data packet by using a time window corresponding to the request message for any request message in the request message data packet; selecting a return packet set corresponding to the request packet from the return packet data packets using the time window corresponding to the request packet includes assigning a number of return packets as [ T ]0,T]Filtering the time window to select a returned text set; wherein, T is0Representing the sending time of the request message, wherein T represents the longest response time of the transaction;
searching a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set;
comparing the transaction key field of the request message with the transaction key field of each return message in a second return message set corresponding to the request message to obtain a return message matched with the request message;
the searching for the return message with the same transaction type as the request message from the return message set corresponding to the request message to form a second return message set, including:
for each return message in the return message set corresponding to the request message, transaction type identification information capable of uniquely identifying the transaction type of the return message is respectively extracted;
inputting the transaction type identification information of each returned message in the returned message set into a Hash algorithm, and calculating to obtain the fingerprint information of each returned message;
identifying the transaction type of the request message;
and comparing the fingerprint information of the expected return message corresponding to the transaction type of the request message with the fingerprint information of each return message in the return message set respectively, finding out the return message with the fingerprint information which is the same as the fingerprint information of the expected return message corresponding to the transaction type of the request message, and forming a second return message set.
2. The method according to claim 1, wherein the separately obtaining the request packet and the return packet within the set time period comprises:
and respectively grabbing request message data packets in a set time period from the request message network channel and grabbing return message data packets in a set time period from the return message network channel.
3. The method of claim 2, wherein after fetching the request packet within the set time period from the request packet network channel and the return packet within the set time period from the return packet network channel, respectively, the method further comprises:
respectively judging whether the request message data packet and the return message data packet obtained by grabbing are empty or not;
and if the request message data packet is empty or the return message datagram is empty, repeatedly and respectively grabbing the request message data packet in a set time period from the request message network channel and grabbing the return message data packet in the set time period from the return message network channel until the grabbed request message data packet and the return message data packet are not empty.
4. The method of claim 1, wherein after selecting the set of return packets corresponding to the request packet from the return packet data packets using the time window corresponding to the request packet, the method further comprises:
judging whether the return text set is empty or not;
if the returned text set is empty, repeatedly executing the following operations for a set number of times:
amplifying a time window corresponding to the request message, and selecting a return message set corresponding to the request message from the return message data packet by using the amplified time window;
judging whether the selected return message set is empty or not;
if the selected returned text set is judged not to be empty in a certain operation in the set repetition times, stopping repeatedly executing the operation;
if the selected return message set is judged to be empty within the set repetition times, confirming that the return message set corresponding to the request message cannot be obtained, and exiting the message matching process.
5. The method of claim 1, wherein after forming a second set of return messages by searching for return messages of the same transaction type as the request message from the set of return messages corresponding to the request message, the method further comprises:
judging whether the second return message set is empty or not;
if the second returned report text set is empty, repeatedly executing the following operations for a set number of times:
amplifying a time window corresponding to the request message, and selecting a return message set corresponding to the request message from the return message data packet by using the amplified time window;
searching a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set;
judging whether the formed second return message set is empty or not;
if the second returned text set is judged not to be empty in a certain operation in the set repetition times, stopping repeatedly executing the operation;
and if the second return text set is judged to be empty within the set repetition times, confirming that the second return text set corresponding to the request message cannot be obtained, and quitting the message matching process.
6. The method of claim 1, wherein after obtaining the return message matching the request message by comparing the transaction key field of the request message with the transaction key field of each return message in the second set of return messages corresponding to the request message, the method further comprises:
judging whether a return message matched with the request message is obtained or not;
if the return message matched with the request message is not obtained, the following operations are repeatedly executed for a set number of times:
amplifying a time window corresponding to the request message, and selecting a return message set corresponding to the request message from the return message data packet by using the amplified time window;
searching a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set;
comparing the transaction key field of the request message with the transaction key field of each return message in a second return message set corresponding to the request message to obtain a return message matched with the request message;
judging whether a return message matched with the request message is obtained or not;
if the return message matched with the request message is judged to be obtained in a certain operation in the set repetition times, the repeated execution of the operation is stopped;
if the return message matched with the request message is not obtained within the set repetition times, confirming that the return message matched with the request message cannot be obtained, and exiting the message matching process.
7. The method of claim 6, wherein after determining that a return message matching the request message has been obtained, the method further comprises:
judging whether the return message matched with the request message is unique or not;
and if the return message matched with the request message is not unique, acquiring the unique return message matched with the request message through manual identification.
8. A message matching apparatus, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for respectively acquiring a request message data packet and a return message data packet in a set time period;
a screening unit, configured to select, for any one request packet in the request packet data packets, a return packet set corresponding to the request packet from the return packet data packets by using a time window corresponding to the request packet; selecting a return packet set corresponding to the request packet from the return packet data packets using the time window corresponding to the request packet includes assigning a number of return packets as [ T ]0,T]Filtering the time window to select a returned text set; wherein, T is0Representing the sending time of the request message, wherein T represents the longest response time of the transaction;
the second screening unit is used for searching a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set;
the processing unit is used for comparing the transaction key field of the request message with the transaction key field of each return message in a second return message set corresponding to the request message to obtain a return message matched with the request message;
the second screening unit includes:
the information extraction unit is used for respectively extracting transaction type identification information which can uniquely identify the transaction type of the return message for each return message in the return message set corresponding to the request message;
the calculating unit is used for inputting the transaction type identification information of each return message in the return message set into a Hash algorithm and calculating to obtain the fingerprint information of each return message;
the identification unit is used for identifying the transaction type of the request message;
and the third screening unit is used for comparing the fingerprint information of the expected return message corresponding to the transaction type of the request message with the fingerprint information of each return message in the return message set respectively, finding out the return message with the fingerprint information identical to that of the expected return message corresponding to the transaction type of the request message, and forming a second return message set.
9. The apparatus according to claim 8, wherein the obtaining unit, when obtaining the request packet and the return packet in the set time period, is specifically configured to:
and respectively grabbing request message data packets in a set time period from the request message network channel and grabbing return message data packets in a set time period from the return message network channel.
10. The apparatus according to claim 9, wherein the obtaining unit is further configured to, after fetching the request packet data within the set time period from the request packet network channel and fetching the return packet data within the set time period from the return packet network channel, respectively:
respectively judging whether the request message data packet and the return message data packet obtained by grabbing are empty or not;
and if the request message data packet is empty or the return message datagram is empty, repeatedly and respectively grabbing the request message data packet in a set time period from the request message network channel and grabbing the return message data packet in the set time period from the return message network channel until the grabbed request message data packet and the return message data packet are not empty.
11. The apparatus of claim 8, further comprising:
a first judgment processing unit, configured to judge whether the return packet set is empty or not after the screening unit selects the return packet set corresponding to the request packet from the return packet data packet by using the time window corresponding to the request packet;
if the returned text set is empty, repeatedly executing the following operations for a set number of times:
amplifying a time window corresponding to the request message, and calling the screening unit to select a return message set corresponding to the request message from the return message data packet by using the amplified time window;
judging whether the selected return message set is empty or not;
if the selected returned text set is judged not to be empty in a certain operation in the set repetition times, stopping repeatedly executing the operation;
if the selected return message set is judged to be empty within the set repetition times, confirming that the return message set corresponding to the request message cannot be obtained, and exiting the message matching process.
12. The apparatus of claim 8, further comprising:
a second judgment processing unit, configured to, after the second screening unit searches for a return packet of the same transaction type as the request packet from a return packet set corresponding to the request packet to form a second return packet set, judge whether the second return packet set is empty;
if the second returned report text set is empty, repeatedly executing the following operations for a set number of times:
amplifying a time window corresponding to the request message, and calling the screening unit to select a return message set corresponding to the request message from the return message data packet by using the amplified time window; so that the second screening unit searches for a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set;
judging whether the formed second return message set is empty or not;
if the second returned text set is judged not to be empty in a certain operation in the set repetition times, stopping repeatedly executing the operation;
and if the second return text set is judged to be empty within the set repetition times, confirming that the second return text set corresponding to the arbitrary group of request messages cannot be obtained, and exiting the message matching process.
13. The apparatus of claim 8, further comprising:
a third judgment processing unit, configured to judge whether a return message matched with the request message is obtained after the processing unit obtains a return message matched with the request message by comparing a transaction key field of the request message with a transaction key field of each return message in a second return message set corresponding to the request message;
if the return message matched with the request message is not obtained, the following operations are repeatedly executed for a set number of times:
amplifying a time window corresponding to the request message, and calling the screening unit to select a return message set corresponding to the request message from the return message data packet by using the amplified time window; so that the second screening unit searches for a return message with the same transaction type as the request message from a return message set corresponding to the request message to form a second return message set; further, the processing unit obtains a return message matched with the request message by comparing the transaction key field of the request message with the transaction key field of each return message in a second return message set corresponding to the request message;
judging whether a return message matched with the request message is obtained or not;
if the return message matched with the request message is judged to be obtained in a certain operation in the set repetition times, the repeated execution of the operation is stopped;
and if the return message matched with the request message is not obtained within the set repetition times, confirming that the return message matched with the request message cannot be obtained.
14. The apparatus of claim 13, further comprising:
a fourth judgment processing unit, configured to judge whether the return packet matching the request packet is unique after the third judgment processing unit judges that the return packet matching the request packet is obtained;
and if the return message matched with the request message is not unique, displaying all the return messages matched with the request message so as to obtain the unique return message matched with the request message through manual identification.
CN201611229188.2A 2016-12-27 2016-12-27 Message matching method and device Active CN106790130B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611229188.2A CN106790130B (en) 2016-12-27 2016-12-27 Message matching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611229188.2A CN106790130B (en) 2016-12-27 2016-12-27 Message matching method and device

Publications (2)

Publication Number Publication Date
CN106790130A CN106790130A (en) 2017-05-31
CN106790130B true CN106790130B (en) 2020-05-22

Family

ID=58922800

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611229188.2A Active CN106790130B (en) 2016-12-27 2016-12-27 Message matching method and device

Country Status (1)

Country Link
CN (1) CN106790130B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111010447A (en) * 2019-12-23 2020-04-14 北京奇艺世纪科技有限公司 Data communication method and device
CN111709217A (en) * 2020-06-22 2020-09-25 上海通联金融服务有限公司 Method for self-defining return message for different banks
CN115277494B (en) * 2022-08-01 2024-02-02 太原鼎向科技有限公司 New energy power station communication message comparison monitoring system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1987925A (en) * 2006-12-29 2007-06-27 中国建设银行股份有限公司 Complex front platform of financial system and transfering method transaction data
CN103634184A (en) * 2013-07-29 2014-03-12 北京汇能精电科技有限公司 Network scheduling algorithm for CAN (controller area network) bus master-slave answer mode protocol
CN102881091B (en) * 2012-07-25 2015-03-25 北京数码视讯软件技术发展有限公司 Device, method and system for controlling load credit over air, and user terminal
US9480082B2 (en) * 2012-02-16 2016-10-25 Telefonaktiebolaget Lm Ericsson (Publ) Methods of transmitting access requests using reduced response intervals and related mobile stations and base station subsystems
CN106130910A (en) * 2016-08-29 2016-11-16 桂林浩新科技服务有限公司 A kind of message matching method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1987925A (en) * 2006-12-29 2007-06-27 中国建设银行股份有限公司 Complex front platform of financial system and transfering method transaction data
US9480082B2 (en) * 2012-02-16 2016-10-25 Telefonaktiebolaget Lm Ericsson (Publ) Methods of transmitting access requests using reduced response intervals and related mobile stations and base station subsystems
CN102881091B (en) * 2012-07-25 2015-03-25 北京数码视讯软件技术发展有限公司 Device, method and system for controlling load credit over air, and user terminal
CN103634184A (en) * 2013-07-29 2014-03-12 北京汇能精电科技有限公司 Network scheduling algorithm for CAN (controller area network) bus master-slave answer mode protocol
CN106130910A (en) * 2016-08-29 2016-11-16 桂林浩新科技服务有限公司 A kind of message matching method and system

Also Published As

Publication number Publication date
CN106790130A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN109033471B (en) Information asset identification method and device
CN106790130B (en) Message matching method and device
CN110807085B (en) Fault information query method and device, storage medium and electronic device
WO2017186090A1 (en) Communication number processing method and apparatus
WO2015143970A1 (en) Information collecting system and method based on two-dimensional code
CN111104521B (en) Anti-fraud detection method and detection system based on graph analysis
CN107347016B (en) Signaling flow model identification method and abnormal signaling flow identification method
JP2019536122A (en) Method and apparatus for information interaction
CN105096023A (en) System and method for pushing data relevant to working standard
CN111628896A (en) IT operation and maintenance management method, device, equipment and computer storage medium
CN111553241A (en) Method, device and equipment for rejecting mismatching points of palm print and storage medium
CN114221792A (en) Internet data transmission encryption system
CN112486977B (en) Method and system for forging block by chain type mobile terminal
CN107784588A (en) Insurance user information merging method and device
CN111046077A (en) Data acquisition method and device, storage medium and terminal
CN109214846B (en) Information storage method and device
CN112579833B (en) Service association relation acquisition method and device based on user operation data
CN110287699B (en) Application program feature extraction method and device
CN101247358B (en) Method and device for computing instant communication valid time
CN114221883A (en) Message testing method, device, server and storage medium
CN112766254A (en) Automatic testing method and device for voucher information input
CN112492021A (en) Service calling relation path detection method based on network data
CN114362982A (en) Flow subdivision identification method, system, electronic device and storage medium
CN116938999B (en) GRPC-based multiparty information transmission and state synchronization method, system and medium
CN112950372B (en) Method and system for automatic transaction association

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant