CN116436989A - Message conversion method, device, equipment and storage medium - Google Patents

Message conversion method, device, equipment and storage medium Download PDF

Info

Publication number
CN116436989A
CN116436989A CN202310427583.5A CN202310427583A CN116436989A CN 116436989 A CN116436989 A CN 116436989A CN 202310427583 A CN202310427583 A CN 202310427583A CN 116436989 A CN116436989 A CN 116436989A
Authority
CN
China
Prior art keywords
field
processing
type
instance
target
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.)
Pending
Application number
CN202310427583.5A
Other languages
Chinese (zh)
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.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
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 Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202310427583.5A priority Critical patent/CN116436989A/en
Publication of CN116436989A publication Critical patent/CN116436989A/en
Pending legal-status Critical Current

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/08Protocols for interworking; Protocol conversion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways

Abstract

The application discloses a message conversion method, a device, equipment and a storage medium, wherein the message conversion method comprises the following steps: acquiring the type of a field to be configured and a field processing parameter corresponding to the field to be configured; acquiring an instantiation rule corresponding to a field to be configured based on the type of the field to be configured; carrying out instantiation processing on field processing parameters corresponding to the fields to be configured based on the instantiation rule to obtain instance resources corresponding to each field to be configured; and carrying out message conversion on the network message to be converted based on the instance resources corresponding to each field to be configured. According to the scheme, the injection process of the field processing logic can be unified, the standardization of the field processing logic injection is achieved, the code development efficiency is improved, and the development operation and maintenance cost is reduced.

Description

Message conversion method, device, equipment and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, a device, and a storage medium for message conversion.
Background
A gateway is a computer system or device that acts as a translation re-authority and is used between two systems of different communication protocols, data formats or languages, even with disparate architectures, where the gateway typically assumes the responsibilities of message translation, security authentication, and message forwarding. Wherein the forwarding of the message is the most core and basic function.
The traditional gateway message forwarding generally only relates to message format conversion and field name conversion, however, with the vigorous development of the Internet, the docking scene is increasingly rich, the data dictionary between the systems is different, the field data values are more and more required to be subjected to differential conversion, the common gateway in the industry is very weak in support of field value processing due to the fact that the message format conversion is designed, most of the gateway needs to be subjected to invasive development at a service code layer, the original service code is subjected to continuous superposition conversion logic, and code development can exist in both a gateway system and a service layer system, so that the code is not in charge, the boundary between the systems is blurred, the robustness is poor in operation, and the later maintenance cost is high.
Disclosure of Invention
The application provides at least a message conversion method, a message conversion device, an electronic device and a computer readable storage medium.
The first aspect of the present application provides a method for converting a message, including: acquiring the type of a field to be configured and a field processing parameter corresponding to the field to be configured; determining an instantiation rule corresponding to the field to be configured based on the type of the field to be configured; carrying out instantiation processing on field processing parameters corresponding to the fields to be configured based on the instantiation rule to obtain instance resources corresponding to each field to be configured; and carrying out message conversion on the network message to be converted based on the instance resources corresponding to each field to be configured.
In an embodiment, obtaining a type of a field to be configured and a field processing parameter corresponding to the field to be configured includes: responding to field processing parameter input operation in a configuration data input interface, and obtaining field processing parameters corresponding to the field to be configured; carrying out complexity calculation on the field processing parameters to obtain processing complexity corresponding to the field to be configured; and determining the type of the field to be configured based on the processing complexity.
In one embodiment, the field processing parameters consist of one or more processing steps; the complexity calculation is carried out on the field processing parameters to obtain the processing complexity corresponding to the field to be configured, and the method comprises the following steps: extracting processing steps contained in the field processing parameters, and acquiring the type and the step content of each processing step; respectively acquiring complex weights corresponding to the types of each processing step, and acquiring the step complexity of each processing step based on the step content; and carrying out weighted calculation on the step complexity of each processing step based on the complex weight corresponding to the type of each processing step, and obtaining the processing complexity corresponding to the field to be configured.
In one embodiment, the field processing parameters consist of one or more processing steps; determining an instantiation rule corresponding to the field to be configured based on the type of the field to be configured, including: obtaining a code template matched with the type of the field to be configured from a preset code template set, obtaining a candidate code template corresponding to the field processing parameter, and extracting the step type of each processing step in the field processing parameter; obtaining code templates matched with step types of all processing steps from the candidate code templates to obtain target code templates corresponding to all processing steps; and combining the target code templates corresponding to the processing steps to obtain the instantiation rule corresponding to the field to be configured.
In an embodiment, performing instantiation processing on field processing parameters corresponding to fields to be configured based on instantiation rules to obtain instance resources corresponding to each field to be configured, including: acquiring an instance code template based on the instantiation rule; filling field processing parameters corresponding to the field to be configured into an instance code template to obtain an instance code; and obtaining the instance resource corresponding to the field to be configured based on the instance code.
In one embodiment, a network message is sent by a first communication device to a second communication device; performing message conversion on the network message to be converted based on the instance resource, including: extracting a field to be converted in a network message; mapping the field name of the field to be converted based on a preset field mapping table to obtain a target field name; the field mapping table is used for storing a mapping relation between a field name corresponding to the first communication device and a field name corresponding to the second communication device; obtaining instance resources matched with the names of the target fields from instance resources corresponding to each field to be configured to obtain target instance resources; and carrying out message conversion on the network message to be converted based on the target instance resource.
In an embodiment, performing message conversion on a network message to be converted based on a target instance resource includes: calculating a target field value corresponding to the target field name based on the target instance resource; replacing the field name of the field to be converted based on the target field name, and replacing the field value corresponding to the field to be converted based on the target field value to obtain a replaced target field; and obtaining the converted network message based on the target field.
A second aspect of the present application provides a message conversion device, including: the acquisition module is used for acquiring the type of the field to be configured and the field processing parameters corresponding to the field to be configured; the rule determining module is used for determining an instantiation rule corresponding to the field to be configured based on the type of the field to be configured; the instantiation module is used for carrying out instantiation processing on field processing parameters corresponding to the fields to be configured based on the instantiation rule to obtain instance resources corresponding to each field to be configured; and the conversion module is used for carrying out message conversion on the network message to be converted based on the instance resources corresponding to each field to be configured.
A third aspect of the present application provides an electronic device, including a memory and a processor, where the processor is configured to execute program instructions stored in the memory, so as to implement the foregoing packet conversion method.
A fourth aspect of the present application provides a computer readable storage medium having program instructions stored thereon, which when executed by a processor implement the above-described message conversion method.
According to the scheme, the injection process of the field processing logic is unified, so that the standardization of the field processing logic injection is achieved, the processing logic between each system interface and the field is isolated, different instantiation modes are adopted for different types of fields, the code development efficiency is greatly improved, and the development operation and maintenance cost is reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and, together with the description, serve to explain the technical aspects of the application.
FIG. 1 is a network architecture diagram of an exemplary embodiment of a message conversion method of the present application;
FIG. 2 is a flow chart of an exemplary embodiment of a message conversion method of the present application;
FIG. 3 is a schematic diagram of acquiring a type of a field to be configured and a field processing parameter corresponding to the field to be configured in a message conversion method of the present application;
FIG. 4 is a schematic diagram of an exemplary rule obtained in the message conversion method of the present application;
FIG. 5 is a schematic diagram of obtaining example resources in the message conversion method of the present application;
FIG. 6 is a schematic diagram of message conversion in the message conversion method of the present application;
FIG. 7 is a block diagram of a message conversion device according to an exemplary embodiment of the present application;
FIG. 8 is a schematic diagram of an embodiment of an electronic device of the present application;
fig. 9 is a schematic structural view of an embodiment of the computer-readable storage medium of the present application.
Detailed Description
The following describes the embodiments of the present application in detail with reference to the drawings.
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, interfaces, techniques, etc., in order to provide a thorough understanding of the present application.
The term "and/or" is herein merely an association relationship describing an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship. Further, "a plurality" herein means two or more than two. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
The message conversion method provided in this embodiment may be applied to a gateway device or other server devices, and if applied to a gateway device, a network architecture of the message conversion method provided in this embodiment is shown in fig. 1, and includes at least one first communication device 100, a second communication device 200, and a gateway device 300, where the first communication device 100 and the second communication device 200 communicate with each other through the gateway device 300.
The message conversion method provided in this embodiment is deployed in gateway equipment and integrated with the functions of the gateway equipment, when field processing logic needs to be injected, the addition of the field processing logic can be requested to the gateway equipment, that is, the field processing logic is added according to the acquired field processing parameters corresponding to the field to be configured, an instantiation rule is determined according to the type to which the field to be configured belongs, after the field processing parameters corresponding to the field to be configured are instantiated based on the instantiation rule, the instantiation processing is used to perform message conversion on the network message to be converted, which is received by the gateway equipment, so that the injection process of the field processing logic is unified, the code development efficiency is improved, and the development operation and maintenance cost is reduced.
The first communication device 100 and the second communication device 200 may be terminal devices or servers. The terminal device may be, but is not limited to, a mobile phone, a computer, an intelligent voice interaction device, an intelligent home appliance, a vehicle-mounted terminal, an aircraft, and the like. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), basic cloud computing services such as big data and artificial intelligent platforms, and the like.
Referring to fig. 2, fig. 2 is a flowchart illustrating a message conversion method according to an exemplary embodiment of the present application. The message conversion method can be applied to the implementation environment shown in fig. 1, and is specifically executed by the gateway device in the implementation environment. It should be understood that the method may be adapted to other exemplary implementation environments and be specifically executed by devices in other implementation environments, and the implementation environments to which the method is adapted are not limited by the present embodiment.
The message conversion method provided in the embodiment of the present application is described in detail below with the gateway device as a specific execution body.
As shown in fig. 2, in an exemplary embodiment, the message conversion method at least includes steps S210 to S240, which are described in detail below:
step S210: and acquiring the type of the field to be configured and the field processing parameters corresponding to the field to be configured.
The types of the fields to be configured are obtained by classifying the fields to be configured, and the field processing parameters corresponding to the fields to be configured are logic data required by acquiring the field values of the fields to be configured in the message conversion process, such as steps required by acquiring the field values, specific execution contents of each step and the like. The fields can be classified according to the complexity of the field value acquisition logic corresponding to the fields, so that the appropriate data injection mode can be selected according to the field value acquisition logic with different complexity.
Referring to fig. 3, fig. 3 is a schematic diagram of acquiring a type of a field to be configured and a field processing parameter corresponding to the field to be configured according to an exemplary embodiment of the present application. As shown in fig. 3, a terminal a is a management terminal corresponding to a first network system, a gateway device provides an injection interface for a type to which a field to be configured belongs and a field processing parameter corresponding to the field to be configured for the terminal a, the terminal a initiates a field configuration request to the gateway device by calling the injection interface, and the gateway device displays a configuration data input interface for the terminal a according to the received field configuration request, wherein the configuration data input interface contains configurable fields, and the configurable fields are fields possibly contained in a network message which can be received by the first system.
The selected field is used as the field to be configured by responding to the field selection operation in the configuration data input interface, and the field to be configured comprises a field a and a field b in fig. 3. Then, the field type which can be selected and corresponds to the field to be configured is displayed through the configuration data input interface, the type which the field to be configured belongs to is determined in response to the type selection operation in the configuration data input interface, for example, the field type which can be selected and corresponds to the field a comprises type 1, type 2 and type 3, and if the type selection operation corresponding to the field a indicates that the selected type is type 1, the type which the field a belongs to is type 1. The field types that can be selected and corresponding to each field may be the same or different, if the field b can not be instantiated by using the instantiation rule corresponding to the type 3 relative to the field a, the field types that can be selected and corresponding to the field b include the type 1 and the type 2, so as to avoid the situation of waste of subsequent flows due to type marking errors.
Then, responding to field processing parameter input operation in the configuration data input interface to obtain field processing parameters corresponding to the field to be configured, and responding to submitting operation in the configuration data input interface to obtain the type of the field to be configured and the field processing parameters corresponding to the field to be configured.
In some embodiments, based on the foregoing embodiments, the terminal a may only provide the field processing parameters corresponding to the field to be configured to the gateway device, and the gateway device may automatically allocate the type of the field to be configured to the field to be configured based on the attribute information of the field to be configured (such as the security level corresponding to the field, the network packet type corresponding to the field, etc.), the attribute information of the field processing parameters (such as the parameter number of the field processing parameters, the calculation amount contained in the field processing parameters, etc.), so as to simplify the flow of field processing configuration performed by the terminal side, and improve the development efficiency.
It can be understood that other manners may be used to obtain the type of the field to be configured and the field processing parameter corresponding to the field to be configured, which is not limited in this application.
Step S220: and determining an instantiation rule corresponding to the field to be configured based on the type of the field to be configured.
The instantiation rule refers to a relevant rule parameter required in the process of instantiating the field processing parameter corresponding to the field to be configured.
It can be understood that the logic of obtaining the field value of the fields of different types is different, that is, the complexity of the field processing parameters corresponding to the fields of different types is different, so that the instantiation modes of the field processing parameters of different complexity are different.
The gateway device stores a plurality of code templates in advance, and can extract a required code template from the plurality of code templates stored in advance according to the type of the field to be configured, so as to obtain an instantiation rule corresponding to the field to be configured based on the required code template.
For example, a code template to be used is determined according to field processing parameters corresponding to the field to be configured, a code generating tool generates a frame code of a field value acquisition example corresponding to the field to be configured according to the code template and the field processing parameters to be used, and the frame code is used as an instantiation rule so as to facilitate subsequent instantiation processing according to the field processing parameters and the instantiation rule corresponding to the field to be configured, so that example resources corresponding to each field to be configured are obtained, which not only can improve development efficiency, but also is helpful for enhancing stability and performance of developed services.
Referring to FIG. 4, FIG. 4 illustrates a schematic diagram of the retrieval of instantiation rules by a code generation tool.
As shown in fig. 4, the field processing parameters corresponding to the field to be configured include one or more processing steps, firstly, each processing step is sequentially read, then, the currently read processing step is matched with each code template, and the successfully matched code template is added into the frame code, wherein the successfully matched code template means that the corresponding code template meets the functional requirement of the currently read processing step. If each code template is correspondingly marked with a template label, if the template 1 is marked as an assignment step, the template 2 is marked as a database query step, and the template 3 is marked as a formula 1 calculation step, the function requirement analysis is carried out on the currently read processing step of 'assigning a fixed value theta to the field a', so that the code template matched with the currently read processing step is obtained as the template 1.
And determining a code template for each processing step in the field processing parameters, combining the code templates of each processing step to obtain a frame code, and taking the frame code as an instantiation rule. Note that the code template determination sequence between the individual processing steps in fig. 4 may be performed in a different order than shown.
Step S230: and carrying out instantiation processing on field processing parameters corresponding to the fields to be configured based on the instantiation rule to obtain instance resources corresponding to each field to be configured.
The instantiation process refers to converting field processing parameters corresponding to the fields to be configured into code files, taking the code files obtained by conversion as instance resources corresponding to the fields to be configured, and then executing the corresponding field value acquisition step by directly calling the instance resources.
Illustratively, on the basis of the above embodiment, after obtaining the frame code, parameter filling is performed on the frame code according to the field processing parameters corresponding to the field to be configured, so as to obtain the code file corresponding to the field to be configured. For example, an instance code template is obtained based on an instantiation rule; filling field processing parameters corresponding to the field to be configured into an instance code template to obtain an instance code; and obtaining the instance resource corresponding to the field to be configured based on the instance code.
For example, the field processing parameters of the field a include "a fixed value θ is given to the field a", the field processing parameters of the field a are extracted to obtain the assigned field name parameter "field a", the assigned value parameter "θ" is obtained, the code template corresponding to the field a and corresponding to the "a fixed value θ" is taken as the template 1 in the frame code corresponding to the field a, the template 1 includes the field name parameter filling bit and the value parameter filling bit, the field name parameter filling bit in the template 1 filling the field a "into the frame code, and the value parameter filling bit in the template 1 filling the" θ "into the frame code.
And after the parameter filling of the frame code is completed, a code file is obtained, and the code file is used as an example resource corresponding to the field to be configured.
The process of instantiating the field processing parameters is actually the process of creating the object, and in some embodiments, the field processing parameters may be instantiated based on Spring technology, which is a lightweight Java development framework that uses basic Java beans to create the object. It should be understood that, although Java is used as the programming language in the above examples, in practice, the various methods proposed in the present application may be implemented in various programming languages such as C, C ++, PHP (PHP: hypertext Preprocessor), python, and the like, which are not limited in this application.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating an example resource acquisition according to an exemplary embodiment of the present application. As shown in fig. 5, the field processing parameters corresponding to the type and the field to which the field belongs are used as field configuration data of the field, the field configuration data corresponding to each field is stored in the value processing resource library, the terminal may upload the field configuration data corresponding to the field to be configured to the value processing resource library, and the terminal may delete or modify the field configuration data stored in the value processing resource library, where the value processing resource library may be set independently of the gateway device or may be set integrally with the gateway device, and this application is not limited thereto. The gateway equipment is provided with a change monitor and an instance resource manager, the instance resource manager stores and manages instance resources of each field, the change monitor is used for monitoring data in the value processing resource library, and if the change monitor detects that the change of field configuration data exists in the value processing resource library, a corresponding management more event is triggered, so that the instance resource manager executes the management more event.
Taking a terminal to upload field configuration data corresponding to a field to be configured to a value processing resource library as an example for explanation: for example, the value processing resource library stores field configuration data of a field a uploaded by the terminal, the change monitor detects that the field configuration data is increased in the value processing resource library, the change monitor starts a data increasing event, the instance resource manager acquires the field configuration data of the field a, carries out instantiation processing based on the field configuration data of the field a to obtain instance resources of the field a, and adds the instance resources of the field a to the instance resource manager.
Taking the terminal deleting the field configuration data stored in the value processing resource library as an example for explanation: for example, the terminal deletes the field configuration data of the field b in the value processing resource library, and if the change monitor detects that the deletion of the field configuration data exists in the value processing resource library, the instance resource manager starts a data deletion event, acquires the field name of the field b, and deletes the instance resource of the field b from the instance resource manager.
The description will be made taking as an example that the terminal modifies the field configuration data stored in the value processing resource library: for example, the terminal modifies field configuration data of a field c in the value processing resource library, the change monitor detects that the field configuration data is modified in the value processing resource library, and the instance resource manager starts a data modification event, acquires the field configuration data modified by the field c, performs instantiation processing based on the field configuration data modified to acquire a new instance resource of the field c, and replaces an original instance resource of the field c in the instance resource manager with the new instance resource.
Step S240: and carrying out message conversion on the network message to be converted based on the instance resources corresponding to each field to be configured.
In the practical application process, after receiving the network message to be converted, the gateway equipment obtains field values of the fields by calling example resources of the fields to be converted so as to complete message conversion of the network message to be converted.
The injection process of the field processing logic is unified, so that the standardization of the field processing logic injection is achieved, the processing logic between each system interface and the field is isolated, different instantiation modes are adopted for different types of fields, the code development efficiency is greatly improved, and the development operation and maintenance cost is reduced.
On the basis of the above embodiment, obtaining the type of the field to be configured and the field processing parameter corresponding to the field to be configured includes: responding to field processing parameter input operation in a configuration data input interface, and obtaining field processing parameters corresponding to the field to be configured; carrying out complexity calculation on the field processing parameters to obtain processing complexity corresponding to the field to be configured; and determining the type of the field to be configured based on the processing complexity.
The processing complexity refers to the difficulty of realizing the field value acquisition of the field based on the field processing parameter, and the lower the processing complexity is, the lower the difficulty of realizing the field value acquisition of the field based on the field processing parameter is; the higher the processing complexity, the higher the difficulty of implementing the field value acquisition for the field based on the field processing parameters.
The processing complexity corresponding to the field to be configured may be determined by a parameter type, a parameter number, a calculation amount corresponding to the parameter, and the like contained in the field processing parameter, and a specific implementation manner of calculating the complexity of the field processing parameter may be flexibly selected according to an actual application situation, which is not limited in the application.
For example, a field processing parameter consists of one or more processing steps; the complexity calculation is carried out on the field processing parameters to obtain the processing complexity corresponding to the field to be configured, and the method comprises the following steps: extracting processing steps contained in the field processing parameters, and acquiring the type and the step content of each processing step; respectively acquiring complex weights corresponding to the types of each processing step, and acquiring the step complexity of each processing step based on the step content; and carrying out weighted calculation on the step complexity of each processing step based on the complex weight corresponding to the type of each processing step, and obtaining the processing complexity corresponding to the field to be configured.
The step type of each processing step may be obtained by extracting key information from the step content of the processing step, then matching the extracted key information with a preset step type, and taking the step type with the highest matching degree as the type of the processing step, if the processing step is "assigning a fixed value θ to the field a", the key information obtained by extracting the key information of the processing step is "assigning", matching the key information with each preset step type, and obtaining that the step type with the highest matching degree is "assigning", and the type of the processing step is "assigning". Then, a complex weight corresponding to the type of the processing step is acquired, and the complex weight may be preset for each type of step.
Further, the step complexity of each processing step is obtained based on the step content, such as the calculation amount required to execute the step is obtained from the step content, and the step complexity is obtained from the calculation amount. The greater the calculation amount, the higher the step complexity, for example, the step content "10 times of calculation are performed on the data 1 by using the formula 1" includes 10 times of calculation processes, the step content "50 times of calculation are performed on the data 1 by using the formula 1" includes 50 times of calculation processes, and the calculation amount of the latter is significantly larger than the calculation amount of the former.
And then, carrying out weighted calculation on the step complexity of each processing step based on the complex weight corresponding to the type of each processing step, and obtaining the processing complexity corresponding to the field to be configured.
The processing complexity corresponding to the field to be configured is calculated for the step complexity of each processing step through the complex weight corresponding to the type of each processing step, so that the accuracy of the calculated processing complexity is improved, and the subsequent classification of the field is facilitated.
Determining the type of the field to be configured based on the processing complexity, for example, dividing the processing steps with the processing complexity in different threshold intervals into different types, for example, dividing the processing steps with the processing complexity in 0 to 0.3 into configuration fields; dividing the processing steps with the processing complexity of 0.3 to 0.7 into light-weight fields; dividing the processing steps with the processing complexity of 0.7 to 1 into weight type fields to obtain the types of the fields to be configured and the corresponding field processing parameters.
The complexity calculation is carried out based on the field processing parameters corresponding to the field to be configured, so that automatic field type distribution is carried out on the field to be configured according to the calculated processing complexity corresponding to the field to be configured, the workload of developers is reduced, the situation that judgment errors are caused by manually judging the field types is avoided, and the development efficiency is improved.
On the basis of the above embodiment, the field processing parameters consist of one or more processing steps; the step of obtaining the instantiation rule corresponding to the field to be configured based on the type to which the field to be configured belongs may include: obtaining a code template matched with the type of the field to be configured from the code template set, obtaining a candidate code template corresponding to the field processing parameter, and extracting the step type of each processing step in the field processing parameter; obtaining code templates matched with step types of all processing steps from the candidate code templates to obtain target code templates corresponding to all processing steps; and combining the target code templates corresponding to the processing steps to obtain the instantiation rule corresponding to the field to be configured.
The code templates may be pre-stored in the gateway device.
The process of obtaining the instantiation rule is described by taking the type of the field to be configured as the following three examples:
(1) Configuration field: the calculation step and the service logic processing step are not present, and the acquisition of the field value can be realized by simple parameter configuration, for example, a fixed value is given to the field a.
An example of an instantiation rule for obtaining a configuration field is described below, specifically as follows:
the field a belongs to a configuration type field, and the field processing parameter corresponding to the field a is "a fixed value θ is given to the field a".
The code template which can be used for inquiring the configuration type field contains a template 1 and a template 2, the field processing parameter corresponding to the field a is analyzed, the field value acquisition step contained in the field processing parameter belongs to the assignment step, and the code template which can be used for assignment is selected from the template 1 and the template 2 to be the template 1, so that the template 1 is used as the instantiation rule corresponding to the field a.
Illustratively, the field processing parameter corresponding to the configuration type field may be a configuration file.
(2) A lightweight field; there is a simple calculation step, for example, the original value of the field b is calculated using a specified calculation formula, so as to achieve the acquisition of the field value.
An example of an instantiation rule for obtaining a lightweight field is described below, specifically as follows:
the field b belongs to a lightweight field, the field processing parameter corresponding to the field b is 'the original value of the field b is obtained from the network message to be converted', the original value of the field b is calculated by adopting a formula 1 to obtain an intermediate value, and the intermediate value is calculated by adopting a formula 2 to obtain a final field value.
The code templates which can be used for inquiring the lightweight field comprise a template 3, a template 4 and a template 5, the field processing parameters corresponding to the field b are analyzed, the field value obtaining step in the field processing parameters comprises a formula 1 calculating step and a formula 2 calculating step, and then the code template which can be used for calculating the formula 1 is selected from the template 3, the template 4 and the template 5 to be used as the template 3 and the code template which can be used for calculating the formula 2 to be used as the template 5, so that the template 3 and the template 5 are used as the instantiation rules corresponding to the field b.
Illustratively, the field processing parameter corresponding to the lightweight field may be an expression file.
(3) A weight type field; there are complicated calculation steps or service logic processing steps, for example, the field c needs to query a third party data source (such as a cache, a data file or a third party system) and then determine and process the data source to obtain a field value.
An example of an instantiation rule for obtaining a weight field is described below, as follows:
the field c belongs to a weight type field, and the field processing parameter corresponding to the field c is "the value of the appointed data item is queried from the table 1 of the database", if the value of the appointed data item is greater than 0, the original value of the field c and the value of the appointed data item are calculated by adopting the formula 3, so as to obtain the final field value ".
The code templates which can be used for inquiring the weight type field comprise a template 6, a template 7 and a template 8, the field processing parameters corresponding to the field c are analyzed, the field value obtaining step in the field processing parameters comprises a database table 1 inquiring step and a formula 3 calculating step, the code template which can be used for inquiring the database table 1 is selected from the template 6, the template 7 and the template 8 to be used as the template 7, and the code template which can be used for calculating the formula 3 to be used as the template 8, so that the template 7 and the template 8 are used as the instantiation rules corresponding to the field c.
Illustratively, the field processing parameter corresponding to the weight type field may be a code file, such as JAR (Java Archive File) package.
It can be understood that the specific division of the type of the field to be configured may be set correspondingly according to different application scenarios, which is not limited in the embodiment of the present application.
The code template corresponding to the field to be configured is determined according to the type of the field to be configured, so that automatic code generation is achieved, development cost is reduced, development efficiency is improved, the development process is unified, and subsequent development operation and maintenance are facilitated.
On the basis of the embodiment, the network message is sent to the second communication device by the first communication device; performing message conversion on the network message to be converted based on the instance resource, including: extracting a field to be converted in a network message to be converted; mapping the field name of the field to be converted based on a preset field mapping table to obtain a target field name; the field mapping table is used for storing a mapping relation between a field name corresponding to the first communication device and a field name corresponding to the second communication device; obtaining instance resources matched with the names of the target fields from instance resources corresponding to each field to be configured to obtain target instance resources; and carrying out message conversion on the network message to be converted based on the target instance resource.
The field to be converted in the network message to be converted is a field required by the second communication device, and may be a field required by the second communication device stored in the gateway device, and the field in the network message to be converted is selected through the fields to obtain the field to be converted. Wherein the first communication device and the second communication device are in different networks, respectively.
The field mapping table is used for storing a mapping relationship between a field name corresponding to the first communication device and a field name corresponding to the second communication device, for example, a field name "a1" of a field a contained in a network message generated by the first communication device needs to be mapped into a field name "a2" when the field name "a1" of the field a of the first communication device is stored in the field mapping table.
And mapping all the field names of the fields to be converted through a preset field mapping table to obtain the target field name of each field to be converted.
Then, obtaining the instance resource matched with the name of the target field from the instance resource corresponding to each field to be configured to obtain the target instance resource, and calling the target instance resource to perform message conversion.
For example, performing message conversion on a network message to be converted based on a target instance resource includes: calculating a target field value corresponding to the target field name based on the target instance resource; replacing the field name of the field to be converted based on the target field name, and replacing the field value corresponding to the field to be converted based on the target field value to obtain a replaced target field; and obtaining the converted network message based on the target field.
The target field value refers to the actual value of the field to be converted in the converted network message.
And calculating a field value of the field to be converted through a preset target instance resource, further obtaining a target field value of the field to be converted, replacing the field name of the field to be converted based on the target field name, and replacing the field value corresponding to the field to be converted based on the target field value, thereby obtaining a replaced target field. And carrying out the processing on each field to be converted to obtain the converted network message so as to realize the conversion process of the network message.
In some embodiments, after performing message conversion on the network message to be converted based on the target instance resource, the method further includes: acquiring a communication address corresponding to the second communication equipment; and transmitting the converted network message to the second communication device based on the communication address. For example, the gateway device queries a domain name server (Domain Name Server, DNS) for a communication address of the second communication device, and then sends the converted network message to the second communication device according to the queried communication address, so as to implement forwarding of the network message between different networks.
Referring to fig. 6, fig. 6 is a schematic diagram of message conversion in an exemplary embodiment of the present application, as shown in fig. 6, a first communication device terminal a in a first network system sends a request message to a second communication device terminal B in a second network system, a gateway device between the first network system and the second network system receives the request message, performs a message format conversion process and a field conversion process on the request message, where the field conversion process includes a field name lookup to obtain a target field name that can be identified by the terminal B, then obtains an instance resource according to the target field name, obtains a target instance resource, then executes the target instance resource to obtain a target field value, and performs a new value reinjection process on the target field value to replace an original field value corresponding to a field to be converted according to the target field value. After the message format conversion processing and the field conversion processing are carried out on the request message, a converted network message is obtained, and the gateway equipment forwards the converted network message to the terminal B.
According to the message conversion method, the type of the field to be configured and the field processing parameters corresponding to the field to be configured are obtained, the instantiation rule corresponding to the field to be configured is obtained based on the type of the field to be configured, then the instantiation processing is carried out on the field processing parameters corresponding to the field to be configured based on the instantiation rule, so that the instance resources corresponding to each field to be configured are obtained, and then the message conversion is carried out on the network message to be converted based on the instance resources corresponding to each field to be configured, so that the injection process of the field processing logic is unified, the standardization of the field processing logic injection is achieved, the processing logic between each system interface and the field is isolated, and different instantiation modes are adopted for the fields of different types, so that the code development efficiency is greatly improved, and the development operation cost is reduced.
Fig. 7 is a block diagram of a message conversion apparatus according to an exemplary embodiment of the present application. As shown in fig. 7, the exemplary message conversion apparatus 700 includes: an acquisition module 710, a rule determination module 720, an instantiation module 730, and a conversion module 740. Specifically:
an obtaining module 710, configured to obtain a type to which a field to be configured belongs and a field processing parameter corresponding to the field to be configured;
A rule determining module 720, configured to obtain an instantiation rule corresponding to the field to be configured based on a type to which the field to be configured belongs;
an instantiation module 730, configured to perform instantiation processing on the field processing parameters corresponding to the fields to be configured based on the instantiation rule, to obtain instance resources corresponding to each field to be configured;
and the conversion module 740 is configured to perform message conversion on the network message to be converted based on the instance resources corresponding to the fields to be configured.
In the exemplary message conversion device, the standardized injection of the field processing logic is achieved through the injection process of the unified field processing logic, so that the processing logic between each system interface and the field is isolated from each other, different instantiation modes are adopted for different types of fields, the code development efficiency is greatly improved, and the development operation and maintenance cost is reduced.
The functions of each module may be described in the embodiments of the message conversion method, which is not described herein.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an embodiment of an electronic device of the present application. The electronic device 800 comprises a memory 801 and a processor 802, the processor 802 being configured to execute program instructions stored in the memory 801 to implement the steps of any of the above-described message conversion method embodiments. In one particular implementation scenario, electronic device 800 may include, but is not limited to: the electronic device 800 may also include mobile devices such as a notebook computer and a tablet computer, and is not limited herein.
Specifically, the processor 802 is configured to control itself and the memory 801 to implement the steps of any of the above-described message conversion method embodiments. The processor 802 may also be referred to as a CPU (Central Processing Unit ). The processor 802 may be an integrated circuit chip with signal processing capabilities. The processor 802 may also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a Field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 802 may be commonly implemented by an integrated circuit chip.
According to the scheme, the standardized injection of the field processing logic is achieved through the injection process of the unified field processing logic, so that the processing logic between each system interface and the field is isolated from each other, different instantiation modes are adopted for different types of fields, the code development efficiency is greatly improved, and the development operation and maintenance cost is reduced.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an embodiment of a computer readable storage medium of the present application. The computer readable storage medium 900 stores program instructions 910 that can be executed by a processor, where the program instructions 910 are configured to implement the steps in any of the above-described message conversion method embodiments.
According to the scheme, the type of the field to be configured and the field processing parameters corresponding to the field to be configured are obtained; acquiring an instantiation rule corresponding to a field to be configured based on the type of the field to be configured; carrying out instantiation processing on field processing parameters corresponding to the fields to be configured based on the instantiation rule to obtain instance resources corresponding to each field to be configured; the method has the advantages that the message conversion is carried out on the network message to be converted based on the instance resources corresponding to each field to be configured, the injection process of the field processing logic can be unified, the standardization of the field processing logic injection is achieved, the code development efficiency is improved, and the development operation and maintenance cost is reduced.
In some embodiments, functions or modules included in an apparatus provided by the embodiments of the present disclosure may be used to perform a method described in the foregoing method embodiments, and specific implementations thereof may refer to descriptions of the foregoing method embodiments, which are not repeated herein for brevity.
The foregoing description of various embodiments is intended to highlight differences between the various embodiments, which may be the same or similar to each other by reference, and is not repeated herein for the sake of brevity.
In the several embodiments provided in the present application, it should be understood that the disclosed methods and apparatus may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical, or other forms.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units. The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all or part of the technical solution contributing to the prior art or in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.

Claims (10)

1. The message conversion method is characterized by comprising the following steps:
acquiring the type of a field to be configured and a field processing parameter corresponding to the field to be configured;
determining an instantiation rule corresponding to the field to be configured based on the type of the field to be configured;
carrying out instantiation processing on field processing parameters corresponding to the fields to be configured based on the instantiation rule to obtain instance resources corresponding to each field to be configured;
and carrying out message conversion on the network message to be converted based on the instance resources corresponding to the fields to be configured.
2. The method according to claim 1, wherein the obtaining the type of the field to be configured and the field processing parameter corresponding to the field to be configured includes:
responding to field processing parameter input operation in a configuration data input interface, and obtaining field processing parameters corresponding to the field to be configured;
calculating the complexity of the field processing parameters to obtain the processing complexity corresponding to the field to be configured;
and determining the type of the field to be configured based on the processing complexity.
3. The method of claim 2, wherein the field processing parameters consist of one or more processing steps; the calculating the complexity of the field processing parameters to obtain the processing complexity corresponding to the field to be configured includes:
Extracting the processing steps contained in the field processing parameters, and acquiring the type and the step content of each processing step;
respectively acquiring the complex weight corresponding to the type of each processing step, and acquiring the step complexity of each processing step based on the step content;
and weighting calculation is carried out on the step complexity of each processing step based on the complex weight corresponding to the type of each processing step, so as to obtain the processing complexity corresponding to the field to be configured.
4. The method of claim 1, wherein the field processing parameters consist of one or more processing steps; the determining, based on the type to which the field to be configured belongs, an instantiation rule corresponding to the field to be configured includes:
obtaining a code template matched with the type of the field to be configured from a preset code template set, obtaining a candidate code template corresponding to the field processing parameter, and extracting the step type of each processing step in the field processing parameter;
obtaining code templates matched with the step types of the processing steps from the candidate code templates to obtain target code templates corresponding to the processing steps;
And combining the target code templates corresponding to the processing steps to obtain the instantiation rule corresponding to the field to be configured.
5. The method of claim 1, wherein the instantiating the field processing parameters corresponding to the fields to be configured based on the instantiation rule to obtain the instance resources corresponding to each field to be configured, includes:
acquiring an instance code template based on the instantiation rule;
filling field processing parameters corresponding to the field to be configured into the instance code template to obtain an instance code;
and obtaining the instance resource corresponding to the field to be configured based on the instance code.
6. The method according to any one of claims 1 to 5, wherein the network message is sent by a first communication device to a second communication device; the message conversion of the network message to be converted based on the instance resource comprises the following steps:
extracting a field to be converted in the network message to be converted;
mapping the field name of the field to be converted based on a preset field mapping table to obtain a target field name; the field mapping table is used for storing a mapping relation between a field name corresponding to the first communication device and a field name corresponding to the second communication device;
Obtaining instance resources matched with the names of the target fields from the instance resources corresponding to the fields to be configured to obtain target instance resources;
and carrying out message conversion on the network message to be converted based on the target instance resource.
7. The method of claim 5, wherein the performing message conversion on the network message to be converted based on the target instance resource comprises:
calculating a target field value corresponding to the target field name based on the target instance resource;
replacing the field name of the field to be converted based on the target field name, and replacing the field value corresponding to the field to be converted based on the target field value to obtain a replaced target field;
and obtaining the converted network message based on the target field.
8. A message conversion device, comprising:
the acquisition module is used for acquiring the type of the field to be configured and the field processing parameters corresponding to the field to be configured;
the rule determining module is used for determining an instantiation rule corresponding to the field to be configured based on the type of the field to be configured;
the instantiation module is used for carrying out instantiation processing on the field processing parameters corresponding to the fields to be configured based on the instantiation rule to obtain instance resources corresponding to each field to be configured;
And the conversion module is used for carrying out message conversion on the network message to be converted based on the instance resources corresponding to the fields to be configured.
9. An electronic device comprising a memory and a processor for executing program instructions stored in the memory to implement the method of any one of claims 1 to 7.
10. A computer readable storage medium having stored thereon program instructions, which when executed by a processor, implement the method of any of claims 1 to 7.
CN202310427583.5A 2023-04-12 2023-04-12 Message conversion method, device, equipment and storage medium Pending CN116436989A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310427583.5A CN116436989A (en) 2023-04-12 2023-04-12 Message conversion method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310427583.5A CN116436989A (en) 2023-04-12 2023-04-12 Message conversion method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116436989A true CN116436989A (en) 2023-07-14

Family

ID=87087041

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310427583.5A Pending CN116436989A (en) 2023-04-12 2023-04-12 Message conversion method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116436989A (en)

Similar Documents

Publication Publication Date Title
US11150874B2 (en) API specification generation
CN107403173B (en) Face recognition system and method
CN110598280B (en) Equipment simulation system and method and computer readable storage medium
CN109635019B (en) Request processing method, device, equipment and storage medium
CN109213519B (en) Heterogeneous API adaptation processing method and system
WO2020042029A1 (en) Discovery method for invoked link, apparatus, device, and storage medium
WO2022257436A1 (en) Data warehouse construction method and system based on wireless communication network, and device and medium
US10382387B2 (en) OID configuration, resolution method, client, node, database and storage medium
CN111163072A (en) Method and device for determining characteristic value in machine learning model and electronic equipment
CN113360300B (en) Interface call link generation method, device, equipment and readable storage medium
RU2697648C2 (en) Traffic classification system
CN113626512A (en) Data processing method, device, equipment and readable storage medium
CN111949720B (en) Data analysis method based on big data and artificial intelligence and cloud data server
CN116776030A (en) Gray release method, device, computer equipment and storage medium
CN111917848A (en) Data processing method based on edge computing and cloud computing cooperation and cloud server
CN111209325A (en) Service system interface identification method, device and storage medium
WO2023077815A1 (en) Method and device for processing sensitive data
CN116436989A (en) Message conversion method, device, equipment and storage medium
CN112182413B (en) Intelligent recommendation method and server based on big teaching data
CN112417213B (en) VMware self-discovery monitoring and instance topology self-discovery method
CN108809900B (en) Framework and method for unified resource access
US10803115B2 (en) Image-based domain name system
CN107818122A (en) A kind of Agent components, search management method and search management system
CN112445811A (en) Data service method, device, storage medium and component based on SQL configuration
CN111695031A (en) Label-based searching method, device, server and storage medium

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