Method for determining correspondence between message fields, and method and device for converting message

By automatically determining the field correspondence relationship using the historical message conversion data of the target gateway, the problem of inefficient determination of field correspondence relationships in the message conversion service of the gateway system in the prior art is solved, and efficient and flexible field correspondence relationship management is achieved.

CN119484261APending Publication Date: 2025-02-18BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411603391.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the prior art, in the packet conversion service of the gateway system, the field correspondence relationship is less efficient and requires manual configuration, resulting in inefficient efficiency when adding a new gateway or gateway upgrade.

Method used

By obtaining the historical message conversion data of the target gateway, the field correspondence relationship is automatically determined, and the field correspondence relationship is dynamically determined using historical data to adapt to the diversity of message formats between different gateways.

Benefits of technology

It improves the efficiency of determining the field correspondence relationship, saves manual configuration costs, realizes flexibility and scalability, and adapts to changes in gateway message formats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484261A_ABST
    Figure CN119484261A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a message field corresponding relation determination method, a message conversion method and equipment. The method can be used in financial or other fields. The method comprises the following steps: acquiring at least one pair of historical message conversion data of a target gateway; wherein each pair of historical message conversion data comprises a historical message before conversion and a historical message after conversion during mutual conversion processing of the external message and the internal message; determining a field corresponding relation of the target gateway according to the historical message conversion data; wherein the field corresponding relation represents the corresponding relation between the internal message field and the external message field during mutual conversion processing of the external message and the internal message. The method is used for achieving the effect of improving the determination efficiency of the field corresponding relation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the financial field or other fields, and in particular to a method for determining a correspondence relationship between message fields, a method for converting messages, and a device. Background Art

[0002] The transaction processing of banks is inseparable from the gateway system. The gateway system is a message processing system located between the external system and the internal microservices. It can convert the transaction requests sent by the external system into the messages required by the internal microservices, and then reference the internal microservices to process the messages, and convert the processing results of the internal microservices into the messages (responses) required by the external system.

[0003] At present, in order to ensure the message conversion service of the gateway system, it is necessary to manually configure the correspondence of the fields required for message conversion so that the gateway system can perform correct message conversion based on the correspondence, but the efficiency of determining the field correspondence in this way is low. Summary of the invention

[0004] The embodiments of the present application provide a method for determining a correspondence relationship between message fields, a method for converting messages, and a device for converting messages, so as to achieve the effect of improving the efficiency of determining a correspondence relationship between fields.

[0005] In a first aspect, an embodiment of the present application provides a method for determining a correspondence relationship between message fields, including:

[0006] Acquire at least one pair of historical message conversion data of the target gateway; wherein each pair of historical message conversion data includes a historical message before conversion and a historical message after conversion when the external message and the internal message are converted to each other;

[0007] The field correspondence of the target gateway is determined according to the historical message conversion data; wherein the field correspondence represents the correspondence between the internal message field and the external message field when the external message and the internal message are converted to each other.

[0008] In a possible implementation manner, determining the field correspondence of the target gateway according to the historical message conversion data includes:

[0009] For each pair of historical message conversion data, determine the field corresponding to the first target field in the historical message before conversion in the historical message after conversion according to the pair of historical message conversion data, and obtain the candidate second target field corresponding to the first target field in the pair of historical message conversion data;

[0010] Determine, according to the candidate second target fields corresponding to the first target fields in each pair of historical message conversion data, the second target field corresponding to the first target field after the conversion processing;

[0011] A field correspondence relationship of the target gateway is determined according to the first target field and the second target field.

[0012] In a possible implementation, determining, based on the pair of historical message conversion data, a field corresponding to a first target field in the historical message before conversion in the historical message after conversion, and obtaining a candidate second target field corresponding to the first target field in the pair of historical message conversion data includes:

[0013] Determine whether there is a field value in the converted historical message that is consistent with the field value of the first target field in the historical message before the conversion;

[0014] If so, the field in the converted historical message having the same field value as the first target field in the historical message before the conversion is used as a candidate second target field of the first target field in the pair of historical message conversion data.

[0015] In a possible implementation manner, determining the second target field corresponding to the first target field after the conversion processing according to the candidate second target field corresponding to the first target field in each pair of historical message conversion data includes:

[0016] Determine an intersection of candidate second target fields corresponding to the first target field in each pair of historical message conversion data;

[0017] If it is determined that the number of candidate second target fields included in the intersection is equal to 1, then the candidate second target field is determined to be the second target field corresponding to the first target field after conversion processing.

[0018] In a possible implementation, the method further includes:

[0019] If it is determined that the number of candidate second target fields included in the intersection is not equal to 1, determining a union of candidate second target fields corresponding to the first target field in each pair of historical message conversion data;

[0020] For each candidate second target field in the union, determining a conditional probability of the candidate second target field under the condition of the first target field;

[0021] According to the conditional probability of the candidate second target field, the second target field corresponding to the first target field after conversion is determined.

[0022] In a possible implementation manner, determining the conditional probability of the candidate second target field under the condition of the first target field includes:

[0023] Determine a first quantity of candidate second target fields corresponding to the first target field in each pair of historical message conversion data, wherein the first target field corresponds to the candidate second target field;

[0024] Determine that the total number of pairs of the historical message conversion data is a second number;

[0025] A ratio of the first number to the second number is determined as the conditional probability of the candidate second target field.

[0026] In a possible implementation manner, the field correspondence relationship is a functional relationship or a table.

[0027] In a second aspect, an embodiment of the present application provides a method for converting a message, including:

[0028] Obtaining a field correspondence relationship of a target gateway; wherein the field correspondence relationship represents a correspondence relationship between an internal message field and an external message field when an external message and an internal message are converted to each other;

[0029] Receiving a message to be converted; and converting the message to be converted according to the field correspondence to obtain a converted message;

[0030] Sending the converted message;

[0031] The field correspondence relationship is determined by using any one of the methods described in the first aspect.

[0032] In a possible implementation, the field correspondence relationship includes a first field correspondence relationship and a second field correspondence relationship, wherein the first field correspondence relationship represents a correspondence relationship between an external message field and an internal message field when an external message is converted into an internal message, and the second field correspondence relationship represents a correspondence relationship between an internal message field and an external message field when an internal message is converted into an external message;

[0033] The converting process is performed on the message to be converted according to the field correspondence to obtain the converted message, including:

[0034] If it is determined that the message to be converted is an external message, the message to be converted is converted according to the first field correspondence relationship to obtain a converted internal message;

[0035] If it is determined that the message to be converted is an internal message, the message to be converted is converted according to the corresponding relationship of the second field to obtain a converted external message.

[0036] In a third aspect, an embodiment of the present application provides a device for determining a correspondence relationship between message fields, including:

[0037] An acquisition module, used to acquire at least one pair of historical message conversion data of a target gateway; wherein each pair of historical message conversion data includes a historical message before conversion and a historical message after conversion when an external message and an internal message are converted to each other;

[0038] The determination module is used to determine the field correspondence of the target gateway according to the historical message conversion data; wherein the field correspondence represents the correspondence between the internal message field and the external message field when the external message and the internal message are converted into each other.

[0039] In a fourth aspect, an embodiment of the present application provides a message conversion device, including:

[0040] An acquisition module, used to acquire a field correspondence relationship of a target gateway; wherein the field correspondence relationship represents a correspondence relationship between an internal message field and an external message field when an external message and an internal message are converted to each other;

[0041] A processing module, used for receiving a message to be converted; and performing conversion processing on the message to be converted according to the field correspondence relationship to obtain a converted message;

[0042] A sending module is used to send the converted message.

[0043] In a fifth aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;

[0044] The memory stores computer-executable instructions;

[0045] The processor executes the computer-executable instructions stored in the memory, so that the processor executes various possible implementations of the first aspect or the second aspect as described above.

[0046] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement various possible implementations of the first aspect or the second aspect as above.

[0047] In a seventh aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements various possible implementation methods of the first aspect or the second aspect as described above.

[0048] The method for determining the correspondence between message fields, the method for converting messages, and the device provided in the embodiments of the present application can extract the correspondence between the fields of the target gateway based on the historical message conversion data of the target gateway. In this way, in the above-mentioned scenario of adding a new gateway or upgrading a gateway, the electronic device can automatically extract the correspondence between the fields of the target gateway based on the historical message conversion data of the target gateway, without the need for manual configuration, thereby improving the efficiency of determining the correspondence between the gateway fields and saving labor costs. At the same time, this method allows the field correspondence to be determined dynamically based on the actual historical message conversion data, so it can adapt to the diversity of message formats between different gateways. For example, when the message format of the gateway changes, it only needs to update the historical message conversion data to redetermine the correspondence between the fields, thereby improving the flexibility and scalability of determining the correspondence between the fields. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0050] Figure 1 A schematic diagram of an application scenario provided for this application;

[0051] Figure 2 Schematic diagram of the process of determining the corresponding relationship of message fields provided in this application Figure 1 ;

[0052] Figure 3 Schematic diagram of the process of determining the corresponding relationship of message fields provided in this application Figure 2 ;

[0053] Figure 4 Schematic diagram of the message conversion method provided in this application Figure 1 ;

[0054] Figure 5 A schematic diagram of the structure of a device for determining a correspondence between message fields provided in the present application;

[0055] Figure 6 A schematic diagram of the structure of the message conversion device provided in this application;

[0056] Figure 7 A schematic diagram of the structure of the electronic device provided in this application.

[0057] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0058] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0059] Figure 1 A schematic diagram of an application scenario provided for this application, such as Figure 1 As shown, the specific application scenarios of the present application include a gateway system, an external system, and an internal system, wherein microservices are deployed in the internal system, and the three are communicated with each other.

[0060] The external system is used to provide a user interface (such as a web page, APP, etc.) for users to input transaction information and submit transaction requests. The external system can be an electronic device with a client for transaction processing, such as a mobile phone, tablet computer, computer, wearable device, etc.

[0061] The above-mentioned internal system is used to process transaction requests and return transaction processing results. The internal system can be a server cluster. It should be noted that this application does not limit the deployment method of the internal system. It can be an integrated deployment or a distributed deployment. The above-mentioned internal system can split the transaction processing process into multiple independent microservices, such as user services, account services, transaction services, payment services, etc., and then the internal system can process specific parts of the transaction request based on the responsibilities of each microservice, such as verifying user information, checking account balances, executing transaction logic, updating databases, etc.

[0062] The above-mentioned gateway system is used to receive transaction requests from external systems, and route the requests to the corresponding microservices of the internal system according to the content, type or destination of the requests, and return the processing results fed back by the microservices to the external system. The gateway system can be an electronic device with processing capabilities, such as a server or a server cluster, which is not limited in this application. It should be noted that the meaning of the gateway system and the gateway in this application are the same and no distinction is made.

[0063] In combination with the above scenario, it can be seen that the gateway can convert the transaction request sent by the external system into the message required by the internal microservice, and then reference the internal microservice to process the message, and convert the processing result of the internal microservice into the message (response) required by the external system. In the prior art, in order to ensure the message conversion service of the gateway, when the gateway is deployed, the correspondence between the fields required for message conversion can be manually configured based on the message format of the external system and the message format of the internal system, so that the gateway can perform correct message conversion based on the correspondence.

[0064] However, in some scenarios, for example, as the business develops and changes, it is necessary to add a new gateway between the external system and the internal system, or upgrade the gateway to a new version or model. At this time, it is necessary to configure the field correspondence required by the gateway. However, if there are multiple message conversions between external systems and internal systems, the field correspondence between the messages is complicated, and the determination efficiency using manual configuration is low.

[0065] The method for determining the correspondence between message fields provided in the present application automatically determines the correspondence between gateway fields by processing the historical message conversion data of the gateway system without manual configuration, thereby improving the efficiency of determining the correspondence between field fields and saving labor costs.

[0066] It should be noted that the method for determining the correspondence between message fields, the method for converting messages, and the device provided in the present application can be used in the financial field or other fields, and can also be used in any field other than the financial field or other fields. The application field of the method for determining the correspondence between message fields, the method for converting messages, and the device provided in the present application is not limited.

[0067] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and corresponding operation entrances shall be provided for users to choose to authorize or refuse.

[0068] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0069] The execution subject of the following embodiments may be an electronic device with processing capabilities, such as a computer, a server, a server cluster, a laptop computer, etc., or a gateway, which is not limited in this application.

[0070] Figure 2 Schematic diagram of the process of determining the corresponding relationship of message fields provided in this application Figure 1 ,like Figure 2 As shown, the method includes:

[0071] S201: The electronic device obtains at least one pair of historical message conversion data of a target gateway.

[0072] For example, taking the example of adding a new gateway between the external system and the internal system, the target gateway can be the original gateway with the same architecture as the new gateway. For example, the original gateway 1 is connected to the external system 1 and the internal system 1, and the new gateway is also connected to the external system 1 and the internal system 1. The original gateway 1 can be used as the target gateway. In this scenario, the new gateway can be used as an electronic device to obtain the historical message conversion data of the target gateway, or it can be a server or other electronic device to obtain the historical message conversion data of the target gateway. After determining the corresponding relationship of the message field of the target gateway according to the historical message conversion data, it is sent to the new gateway for configuration.

[0073] Taking gateway upgrade as an example, the above-mentioned target gateway can be the gateway to be upgraded. In this scenario, the target gateway can be an electronic device to obtain historical message conversion data, or it can be an electronic device such as a server to obtain the historical message conversion data of the target gateway. After determining the corresponding relationship of the message fields of the target gateway according to the historical message conversion data, it is sent to the target gateway for configuration.

[0074] Each pair of historical message conversion data mentioned above includes the historical messages before conversion and the historical messages after conversion when the external messages and the internal messages are converted to each other. Among them, the external message refers to the message transmitted between the external system and the gateway, and the internal message refers to the message transmitted between the gateway and the internal system. It should be noted that the external message or internal message mentioned here refers to different types of messages. For example, the external message may include multiple types of messages, or include multiple messages transmitted between the external system and the gateway.

[0075] Exemplarily, a pair of historical conversion message data may include the historical message before conversion (external message) and the historical message after conversion (internal message) when an external message is converted into an internal message, or may include the historical message before conversion (internal message) and the historical message after conversion (external message) when an internal message is converted into an external message.

[0076] In some possible implementations, the electronic device may send a data acquisition request to a storage device such as a database, and the data acquisition request includes identification information of the target gateway, so as to obtain the historical message conversion data of the target gateway from the storage device. Alternatively, the electronic device may communicate with the target gateway to directly obtain the historical message conversion data of the target gateway. Alternatively, the electronic device may receive the historical message conversion data of the target gateway imported by an external device, and the external device may be, for example, a USB flash drive.

[0077] S202: The electronic device determines the field correspondence of the target gateway according to the historical message conversion data.

[0078] Exemplarily, the above-mentioned field correspondence relationship represents the correspondence relationship between the internal message field and the external message field when the external message and the internal message are converted to each other, and the field correspondence relationship includes a first field correspondence relationship between the internal message field and the external message field when the external message is converted to the internal message, and a second field correspondence relationship between the internal message field and the external message field when the internal message is converted to the external message. Optionally, it should be noted that the present application does not limit the form of expression of the field correspondence relationship. For example, the above-mentioned field correspondence relationship can be a function relationship or a table, or it can be other forms of expression, such as a key-value pair.

[0079] In some possible implementations, the electronic device first needs to pre-process the historical messages before conversion and the historical messages after conversion in the historical message conversion data, for example, including parsing the message format (such as XML, JSON, binary, etc.), extracting the fields in the message, and cleaning and formatting the field content (such as removing spaces, converting data types, etc.). Then, the electronic device can compare the field contents one by one based on the fields of the pre-processed historical message before conversion and the fields of the pre-processed historical message after conversion, and determine the correspondence between the fields of the historical message before conversion and the fields of the historical message after conversion. For example, the electronic device can determine the correspondence between the fields based on the field contents such as the field name, type, format or field value.

[0080] Exemplarily, if in the historical message conversion data, the fields in the historical messages before and after the conversion have the same field name, the same field value, or the same format, the electronic device can directly identify them as having a corresponding relationship; it can also be that the fields with the same field name, the same field value, or the same format are statistically analyzed in all the historical message conversion data, and then it is determined whether they have a corresponding relationship, so as to improve the accuracy of the corresponding relationship.

[0081] If in the historical message conversion data, the field names in the historical messages before and after the conversion are different, but the field names are highly similar in semantics (such as "customer name" and "user name"), the electronic device can also semantically match the field names of the fields in the historical messages before the conversion with the field names in the historical messages after the conversion to determine whether they have a corresponding relationship with the field names before the conversion. This application does not limit the method of semantic matching, for example, a convolutional neural network model can be used.

[0082] Optionally, through the above method, the electronic device can convert historical message data, determine the correspondence between the fields in the historical message before conversion and the fields in the historical message after conversion, and construct a field correspondence table based on the correspondence. The field correspondence table may include the correspondence between each internal message field and the external message field, including the field name, field type, field format and any related conversion rules, and then store the field correspondence table locally or in a database.

[0083] The method for determining the correspondence between message fields provided in the embodiment of the present application is such that the electronic device can extract the correspondence between the fields of the target gateway based on the historical message conversion data of the target gateway. In this way, in the above-mentioned scenario of adding a new gateway or upgrading a gateway, the electronic device can automatically extract the correspondence between the fields of the target gateway based on the historical message conversion data of the target gateway, without the need for manual configuration, thereby improving the efficiency of determining the correspondence between the gateway fields and saving labor costs. At the same time, this method allows the field correspondence to be dynamically determined based on the actual historical message conversion data, so it can adapt to the diversity of message formats between different gateways. For example, when the message format of the gateway changes, it only needs to update the historical message conversion data to redetermine the field correspondence, thereby improving the flexibility and scalability of determining the field correspondence.

[0084] Figure 3 Schematic diagram of the process of determining the corresponding relationship of message fields provided in this application Figure 2 ,like Figure 3 As shown, in this embodiment Figure 2 Based on the embodiment, a method for determining the correspondence between message fields is described in detail, and the method includes:

[0085] S301: The electronic device obtains at least one pair of historical message conversion data of a target gateway.

[0086] It should be noted that this step is similar to the aforementioned step S201 and will not be repeated here.

[0087] S302. The electronic device determines, for each pair of historical message conversion data, a field corresponding to the first target field in the historical message before conversion in the historical message after conversion based on the pair of historical message conversion data, and obtains a candidate second target field corresponding to the first target field in the pair of historical message conversion data.

[0088] Exemplarily, the first target field represents a field in the historical message before conversion, and the first target field may be, for example, every field in the historical message before conversion, or may be some preset fields in the historical message before conversion, which is not limited in this application. The candidate second target field represents a field in the historical message after conversion.

[0089] As mentioned above, each pair of historical message conversion data includes the historical message before conversion and the historical message after conversion. The first target field in the historical message before conversion can be used to determine the candidate second target field corresponding to the first target field in the historical message after conversion. For example, if the field value or field name of the first target field is consistent with a field in the historical message after conversion, the consistent field can be determined as a candidate second target field. Alternatively, if the semantic match between the field name of the first target field and the field name of a field in the historical message after conversion exceeds a preset threshold, the field exceeding the preset threshold is determined as a candidate second target field.

[0090] Specifically, the electronic device can determine whether there is a field value in the converted historical message that is consistent with the field value of the first target field in the historical message before the conversion; if so, the field in the converted historical message that is consistent with the field value of the first target field in the historical message before the conversion will be used as a candidate second target field for the first target field in the pair of historical message conversion data.

[0091] S303: The electronic device determines the second target field corresponding to the first target field after the conversion process according to the candidate second target field corresponding to the first target field in each pair of historical message conversion data.

[0092] Exemplarily, the second target field represents the final field corresponding to the first target field in the converted historical message. For example, the electronic device can determine the candidate second target field corresponding to the first target field in each pair of historical message conversion data for each first target field, and if there is a unique intersection among the candidate second target fields, then determine the candidate second target field as the second target field corresponding to the first target field; if there is no unique intersection among the candidate second target fields, probability statistics can be performed to take the candidate second target field with the highest probability as the second target field.

[0093] Specifically, the electronic device can first determine the intersection of the candidate second target fields corresponding to the first target field in each pair of historical message conversion data; if it is determined that the number of candidate second target fields included in the intersection is equal to 1, then the candidate second target field is determined to be the second target field corresponding to the first target field after conversion processing.

[0094] Optionally, if it is determined that the number of candidate second target fields included in the intersection is not equal to 1, then the union of the candidate second target fields corresponding to the first target field in each pair of historical message conversion data is determined; then for each candidate second target field in the union, the conditional probability of the candidate second target field under the condition of the first target field is determined; finally, based on the conditional probability of the candidate second target field, the second target field corresponding to the first target field after conversion processing is determined.

[0095] For example, the electronic device can determine the first target field in each pair of historical message conversion data corresponding to the candidate second target field, the first target field corresponds to the first number of candidate second target fields; determine the total number of logarithms of historical message conversion data as the second number; determine the ratio of the first number to the second number as the conditional probability of the candidate second target field. For example, the total number of logarithms of historical message conversion data is N pairs, among which there are M pairs of historical message conversion data in which the first target field corresponds to the candidate second target field, then the conditional probability of the candidate second target field is expressed as M / N. After determining the conditional probabilities of the candidate second target fields, the candidate second target field with the largest probability value can be used as the second target field.

[0096] In some possible implementations, the second number is greater than or equal to a preset number threshold, which can be determined based on Chebyshev's inequality to ensure that the sample size of historical message conversion data is large enough so that the conditional probability calculated based on the data has sufficient statistical reliability. For example, the following steps may be included:

[0097] (1) Determine a random variable X as a first quantity; and determine an expected value E(X) of the random variable X. For example, the expected value may be an average quantity of matches between all candidate second target fields and the first target field.

[0098] (2) Determine the variance D(X) of the random variable X. This application does not limit how to determine the variance.

[0099] (3) Chebyshev’s inequality can be expressed as follows:

[0100]

[0101] Where k is a positive real number, indicating the allowable deviation range; P(|XE(X)|≥k) represents the probability that the deviation between the random variable X and its expected value E(X) exceeds k, abbreviated as P.

[0102] From the above formula, we can get that the probability that the deviation between the random variable X and its expected value E(X) exceeds k does not exceed In order to ensure that the probability of deviation within the range of k does not exceed P, a sufficient sample size n is required, that is, the second quantity. Rearranging the above Chebyshev inequality can obtain the following formula:

[0103]

[0104] The second number n is determined by the above formula, so that the calculated conditional probability has sufficient statistical reliability, thereby ensuring that the determined field correspondence relationship is more accurate.

[0105] S304: The electronic device determines a field correspondence relationship of a target gateway according to the first target field and the second target field.

[0106] For example, a field correspondence table can be constructed based on the correspondence to obtain the field correspondence of the target gateway. Alternatively, the field correspondence of the target gateway can be constructed as a function relationship, wherein the independent variable is the first target field, the dependent variable is the second target field, and the function value corresponding to each first target field is represented as the field in the message before conversion corresponding to the field in the converted message. Then, the field correspondence of the target gateway can be cached in redis, which can include the field correspondence of multiple gateways. When the gateway is in use, it can obtain the corresponding field correspondence from redis based on the identification information of the gateway.

[0107] The method for determining the correspondence between message fields provided in the embodiment of the present application is that the electronic device can determine the corresponding candidate second target fields in the converted historical message one by one based on the historical message conversion data, for the first target field of the historical message before conversion, and then determine the conditional probability of each candidate second target field, determine the second target field based on the conditional probability, obtain the correspondence between the first target field and the second target field, and form the field correspondence of the target gateway. In this way, the accuracy of the determined second target field can be guaranteed in the form of conditional probability, and the accuracy of the field correspondence can be improved.

[0108] After obtaining the field correspondence of the target gateway based on the method of the aforementioned embodiment, the gateway configured with the field correspondence can perform message conversion based on the field correspondence. The execution subject of the following embodiment can be a first gateway, which represents a gateway with the same architecture as the target gateway, for example, it can be the aforementioned newly added gateway or an upgraded gateway.

[0109] Figure 4 Schematic diagram of the message conversion method provided in this application Figure 1 ,like Figure 4 As shown, the method includes:

[0110] S401: The first gateway obtains a field correspondence relationship of a target gateway.

[0111] Exemplarily, the above field correspondence relationship represents the correspondence between the internal message field and the external message field when the external message and the internal message are converted into each other.

[0112] Optionally, the field correspondence includes a first field correspondence and a second field correspondence, the first field correspondence represents the correspondence between the external message field and the internal message field when the external message is converted into the internal message, and the second field correspondence represents the correspondence between the internal message field and the external message field when the internal message is converted into the external message.

[0113] In some possible implementations, the first gateway may obtain the field correspondence of the target gateway from a preset data source, which may be, for example, redis; or, the first gateway locally stores the field correspondence of the target gateway and directly extracts the field correspondence of the target gateway; or, the first gateway receives the field correspondence of the target gateway imported by an external device, which may be, for example, a USB flash drive.

[0114] It should be noted that this step can be executed in advance before receiving the message to be converted, or it can be executed regularly, and this application does not limit this.

[0115] S402: The first gateway receives a message to be converted; and performs conversion processing on the message to be converted according to the field correspondence relationship to obtain a converted message.

[0116] Exemplarily, the first gateway monitors a designated network port or channel, and receives a message to be converted from an external system, or a message to be converted from an internal system. In other words, the message to be converted can be an internal message or an external message. The message to be converted can be binary data, text data, or a message in a specific format (such as XML, JSON, etc.), which is not limited in this application. Then, according to the preset message format and protocol, the first gateway parses the received message to be converted. Finally, according to the field correspondence relationship obtained previously, the first gateway performs conversion processing on the parsed message to be converted to obtain a converted message. The converted message can be an internal message or an external message, which is specifically related to the type of message to be converted.

[0117] In some possible implementations, if it is determined that the message to be converted is an external message, the message to be converted is converted according to the correspondence between the first field and a converted internal message is obtained; if it is determined that the message to be converted is an internal message, the message to be converted is converted according to the correspondence between the second field and a converted external message is obtained.

[0118] Exemplarily, taking the case where the order of fields in the converted message is fixed, the first gateway presets a first stack and a second stack for temporarily storing sequence pairs (key-value pairs) of fields and field values ​​for subsequent processing. It should be understood that after receiving the message to be converted, the first gateway can determine the format of the converted message corresponding to the message to be converted, that is, the fields included in the converted message, based on the preset routing table.

[0119] Therefore, the first gateway can add each field of the converted message to the first stack in sequence; and determine each field and field value of the received message to be converted, and then can determine the field in the message to be converted corresponding to the field name based on the field at the top of the stack popped out of the first stack, according to the field correspondence, and the field value, and form a sequence pair with the popped field at the top of the stack and the corresponding field value in the message to be converted, and store them in the second stack until the first stack is empty, and pop the sequence pairs in the second stack in sequence, and generate the converted message according to the popped sequence pairs and the popping order.

[0120] In this way, the field order of the converted message can be guaranteed, thereby improving the accuracy of the converted message.

[0121] S403: The first gateway sends the converted message.

[0122] For example, the first gateway may send the converted message to other gateways, internal systems, or external systems through a designated network port or channel.

[0123] The message conversion method provided in the embodiment of the present application can obtain the required field correspondence relationship, and realize the conversion processing of the received message to be converted through the field correspondence relationship to obtain the converted message. In this way, the gateway can ensure that the field correspondence relationship used is the latest or correct when converting the message, thereby improving the accuracy of the field correspondence relationship. At the same time, since the field correspondence relationship is dynamically determined based on the historical message conversion data, the gateway only needs to obtain the field correspondence relationship. Therefore, this method can support flexible expansion of a variety of different message protocols and formats, so that the gateway can flexibly communicate and exchange data with different external systems or internal systems, which is convenient for the maintenance and management of the gateway.

[0124] Figure 5 A schematic diagram of the structure of the apparatus for determining the correspondence between message fields provided in this application, such as Figure 5 As shown, the apparatus 50 for determining the correspondence relationship of message fields provided in this embodiment includes:

[0125] The acquisition module 501 is used to acquire at least one pair of historical message conversion data of the target gateway; wherein each pair of historical message conversion data includes the historical message before conversion and the historical message after conversion when the external message and the internal message are converted to each other;

[0126] The determination module 502 is used to determine the field correspondence of the target gateway according to the historical message conversion data; wherein the field correspondence represents the correspondence between the internal message field and the external message field when the external message and the internal message are converted into each other.

[0127] In a possible implementation, the determination module 502 is specifically configured to:

[0128] For each pair of historical message conversion data, determine the field corresponding to the first target field in the historical message before conversion in the historical message after conversion according to the pair of historical message conversion data, and obtain the candidate second target field corresponding to the first target field in the pair of historical message conversion data;

[0129] Determine, according to the candidate second target fields corresponding to the first target fields in each pair of historical message conversion data, the second target field corresponding to the first target field after the conversion processing;

[0130] A field correspondence relationship of the target gateway is determined according to the first target field and the second target field.

[0131] In a possible implementation, the determination module 502 is specifically configured to:

[0132] Determine whether there is a field value in the converted historical message that is consistent with the field value of the first target field in the historical message before the conversion;

[0133] If so, the field in the converted historical message having the same field value as the first target field in the historical message before the conversion is used as a candidate second target field of the first target field in the pair of historical message conversion data.

[0134] In a possible implementation, the determination module 502 is specifically configured to:

[0135] Determine an intersection of candidate second target fields corresponding to the first target field in each pair of historical message conversion data;

[0136] If it is determined that the number of candidate second target fields included in the intersection is equal to 1, then the candidate second target field is determined to be the second target field corresponding to the first target field after conversion processing.

[0137] In a possible implementation, the determination module 502 is specifically configured to:

[0138] If it is determined that the number of candidate second target fields included in the intersection is not equal to 1, determining a union of candidate second target fields corresponding to the first target field in each pair of historical message conversion data;

[0139] For each candidate second target field in the union, determining a conditional probability of the candidate second target field under the condition of the first target field;

[0140] According to the conditional probability of the candidate second target field, the second target field corresponding to the first target field after conversion is determined.

[0141] In a possible implementation, the determination module 502 is specifically configured to:

[0142] Determine a first quantity of candidate second target fields corresponding to the first target field in each pair of historical message conversion data, wherein the first target field corresponds to the candidate second target field;

[0143] Determine that the total number of pairs of the historical message conversion data is a second number;

[0144] A ratio of the first number to the second number is determined as the conditional probability of the candidate second target field.

[0145] In a possible implementation manner, the field correspondence relationship is a functional relationship or a table.

[0146] The device for determining the correspondence relationship between message fields provided in this embodiment can execute the method provided in the above method embodiment, and its implementation principle and technical effect are similar, which will not be described in detail in this embodiment.

[0147] Figure 6 A schematic diagram of the structure of the message conversion device provided in this application, such as Figure 6 As shown, the message conversion device 60 provided in this embodiment includes:

[0148] The acquisition module 601 is used to acquire the field correspondence of the target gateway; wherein the field correspondence represents the correspondence between the internal message field and the external message field when the external message and the internal message are converted into each other;

[0149] The processing module 602 is used to receive the message to be converted; and according to the field correspondence, the message to be converted is converted to obtain a converted message;

[0150] The sending module 603 is used to send the converted message.

[0151] In a possible implementation, the field correspondence relationship includes a first field correspondence relationship and a second field correspondence relationship, wherein the first field correspondence relationship represents a correspondence relationship between an external message field and an internal message field when an external message is converted into an internal message, and the second field correspondence relationship represents a correspondence relationship between an internal message field and an external message field when an internal message is converted into an external message;

[0152] The processing module 602 is specifically configured to:

[0153] If it is determined that the message to be converted is an external message, the message to be converted is converted according to the first field correspondence relationship to obtain a converted internal message;

[0154] If it is determined that the message to be converted is an internal message, the message to be converted is converted according to the corresponding relationship of the second field to obtain a converted external message.

[0155] The message conversion device provided in this embodiment can execute the method provided in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be described in detail here.

[0156] Figure 7 This is a schematic diagram of the structure of the electronic device provided in this application. Figure 7 As shown, the electronic device 70 provided in this embodiment includes: at least one processor 701 and a memory 702. Optionally, the device 70 also includes a communication component 703. The processor 701, the memory 702 and the communication component 703 are connected via a bus 704. The electronic device may be the aforementioned gateway.

[0157] In a specific implementation process, at least one processor 701 executes the computer-executable instructions stored in the memory 702, so that at least one processor 701 executes the above method.

[0158] The specific implementation process of the processor 701 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0159] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0160] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0161] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0162] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0163] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0164] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0165] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0166] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0167] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0168] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0169] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0170] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0171] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A method for determining a correspondence relationship between message fields, characterized in that: include: Acquire at least one pair of historical message conversion data of the target gateway; wherein each pair of historical message conversion data includes a historical message before conversion and a historical message after conversion when the external message and the internal message are converted to each other; The field correspondence of the target gateway is determined according to the historical message conversion data; wherein the field correspondence represents the correspondence between the internal message field and the external message field when the external message and the internal message are converted to each other.

2. The method according to claim 1, characterized in that The determining the field correspondence of the target gateway according to the historical message conversion data includes: For each pair of historical message conversion data, determine the field corresponding to the first target field in the historical message before conversion in the historical message after conversion according to the pair of historical message conversion data, and obtain the candidate second target field corresponding to the first target field in the pair of historical message conversion data; Determine, according to the candidate second target fields corresponding to the first target fields in each pair of historical message conversion data, the second target field corresponding to the first target field after the conversion processing; A field correspondence relationship of the target gateway is determined according to the first target field and the second target field.

3. The method according to claim 2, characterized in that The step of determining, based on the pair of historical message conversion data, a field corresponding to the first target field in the historical message before conversion in the historical message after conversion, and obtaining a candidate second target field corresponding to the first target field in the pair of historical message conversion data includes: Determine whether there is a field value in the converted historical message that is consistent with the field value of the first target field in the historical message before the conversion; If so, the field in the converted historical message having the same field value as the first target field in the historical message before the conversion is used as a candidate second target field of the first target field in the pair of historical message conversion data.

4. The method according to claim 2, characterized in that: The determining, according to the candidate second target field corresponding to the first target field in each pair of historical message conversion data, the second target field corresponding to the first target field after the conversion processing includes: Determine an intersection of candidate second target fields corresponding to the first target field in each pair of historical message conversion data; If it is determined that the number of candidate second target fields included in the intersection is equal to 1, then the candidate second target field is determined to be the second target field corresponding to the first target field after conversion processing.

5. The method according to claim 4, characterized in that The method further comprises: If it is determined that the number of candidate second target fields included in the intersection is not equal to 1, determining a union of candidate second target fields corresponding to the first target field in each pair of historical message conversion data; For each candidate second target field in the union, determining a conditional probability of the candidate second target field under the condition of the first target field; According to the conditional probability of the candidate second target field, the second target field corresponding to the first target field after conversion is determined.

6. The method according to claim 5, characterized in that Determining the conditional probability of the candidate second target field under the condition of the first target field includes: Determine a first quantity of candidate second target fields corresponding to the first target field in each pair of historical message conversion data, wherein the first target field corresponds to the candidate second target field; Determine that the total number of pairs of the historical message conversion data is a second number; A ratio of the first number to the second number is determined as the conditional probability of the candidate second target field.

7. The method according to any one of claims 1 to 6, characterized in that: The field correspondence relationship is a function relationship or a table.

8. A message conversion method, characterized in that: include: Obtaining a field correspondence relationship of a target gateway; wherein the field correspondence relationship represents a correspondence relationship between an internal message field and an external message field when an external message and an internal message are converted to each other; Receiving a message to be converted; and converting the message to be converted according to the field correspondence to obtain a converted message; Sending the converted message; The field correspondence relationship is determined by using the method described in any one of claims 1-7.

9. The method according to claim 8, characterized in that The field correspondence relationship includes a first field correspondence relationship and a second field correspondence relationship, wherein the first field correspondence relationship represents a correspondence relationship between an external message field and an internal message field when an external message is converted into an internal message, and the second field correspondence relationship represents a correspondence relationship between an internal message field and an external message field when an internal message is converted into an external message; The converting process is performed on the message to be converted according to the field correspondence to obtain the converted message, including: If it is determined that the message to be converted is an external message, the message to be converted is converted according to the first field correspondence to obtain a converted internal message; If it is determined that the message to be converted is an internal message, the message to be converted is converted according to the corresponding relationship of the second field to obtain a converted external message.

10. An electronic device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor executes the method for determining the correspondence relationship between message fields as described in any one of claims 1-7, or the method for converting messages as described in any one of claims 8-9.