CN110290135B - Method for unified and standardized processing of complex messages and requested data stream - Google Patents
Method for unified and standardized processing of complex messages and requested data stream Download PDFInfo
- Publication number
- CN110290135B CN110290135B CN201910557722.XA CN201910557722A CN110290135B CN 110290135 B CN110290135 B CN 110290135B CN 201910557722 A CN201910557722 A CN 201910557722A CN 110290135 B CN110290135 B CN 110290135B
- Authority
- CN
- China
- Prior art keywords
- information
- chain
- data
- checker
- complex
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/565—Conversion or adaptation of application format or content
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a method for uniformly and standardly processing complex messages and a requested data stream, belongs to the technical field of message processing, and solves the problems of IO query resource consumption and the like in the prior art. According to the method, each chain node in a processor chain is initialized aiming at different types of request messages according to configured record information, and each chain node comprises a JSON field acquirer, a compliance checker and a type converter; acquiring data information from the request message according to a JSON field acquirer of the current link node, carrying out validity check on input data according to a compliance checker, creating a corresponding conversion expression object for data caching after the check is passed, and sequentially executing subsequent nodes after the current link node logic is executed until all link logics are checked; and obtaining a type converter list according to the information of the data cache, and sequentially adopting type converters in corresponding link nodes to perform data conversion according to the type converter list. The invention is used for unified and standardized processing of complex messages.
Description
Technical Field
A method for unified and standardized processing of complex messages and a requested data stream are used for unified and standardized processing of complex messages and belong to the technical field of message processing.
Background
Type converter: for adjusting different types of data to a compliant data type by a rule.
A compliance checker: the method is used for data compliance verification, namely when the JSON field acquirer acquires data information, the data information is judged to be of a simple type or a complex type for verification, the simple type refers to that a single compliance verifier is adopted for verification of each field, and the method comprises the following steps: only checking whether the data is empty, the length of the character string or whether the data is a plurality of appointed values, wherein the complex type has a plurality of checking requirements, and the checking rule is carried out in a responsibility chain mode.
JSON field obtainer, attribute obtainer: and acquiring information of different levels of json message information of unknown formats of upstream systems by using corresponding attribute acquirers.
In the prior art, verification, conversion and completion are performed on structured non-fixed message attributes, different field descriptions are configured corresponding to different systems, corresponding configuration information is acquired according to different application items, the information is analyzed, information judgment is performed in a hard code mode, and thus different logic codes are executed. That is, as shown in fig. 1, the project packet enters the execution logic, performs public information check, and determines the application type of the project packet. And according to the judged type, searching all fields in the database/cache and traversing all the fields. And according to the traversed description information, performing structured object attribute acquisition and checking operation.
Aiming at the prior art, the following defects exist:
firstly, the adjustment of the configuration information is often accompanied with the adjustment of the code logic, the code logic amount is very large, the maintenance is not easy, and the determination of the configuration information in the project logic also causes the execution efficiency to be low.
Secondly, in the prior art, for the configuration of the interface field, the structure nesting information (i.e. the complex type messages) is not friendly, the structure information needs to be judged and obtained in a hard code mode, the nesting level needs to be specified in advance, and if the nesting level is exceeded, code adjustment needs to be performed.
And thirdly, for part of logic fields needing code table mapping, before other fields are basically detected, finally, the illegal fields are checked/checked, and IO query resources are consumed.
Disclosure of Invention
In view of the above-mentioned research problems, an object of the present invention is to provide a method for unified and normalized processing of complex packets and a requested data stream, which solve the problems in the prior art that the adjustment of configuration information is accompanied with the adjustment of code logic, the code logic amount is very large, the maintenance is not easy, and the determination of configuration information in project logic also causes low execution efficiency; for part of logical fields needing code table mapping, before other fields are basically detected, the fields are finally checked/checked to be illegal, and IO query resources are consumed.
In order to achieve the purpose, the invention adopts the following technical scheme:
a unified and standardized processing method for complex messages comprises the following steps:
s1, initializing each chain node in the processor chain according to the configured record information and aiming at different types of request messages, wherein the chain node comprises a JSON field acquirer, a compliance checker and a type converter;
s2, acquiring data information from the request message according to the JSON field acquirer of the current link node, carrying out validity check on input data according to the compliance checker, creating a corresponding conversion expression object for data caching after the check is passed, and sequentially executing subsequent nodes after the current link node logic is executed until all link logics are checked;
and S3, obtaining a type converter list according to the information of the data cache, and sequentially adopting the type converters in the corresponding link nodes to perform data conversion according to the type converter list.
Further, the compliance checker in step S1 includes a simple type information processor and a complex type information processor chain, where the information processor chain includes a null checker and a JSON object checker, the JSON object checker is a complex processor chain including multi-chain nodes, the simple type means that each field is expressed by simple information, and the complex type means that each field is expressed by nested information, that is, expressed by multiple simple information.
Further, the configuration and development of the conversion expression in step S2 are performed according to actual needs, including:
normal: the data passing the verification is not converted;
sting-location: converting the code value passing the check into an actual address;
string-yuan2 fen: converting the element passing the verification into a score;
string-substitution: and converting the ethnic information after passing the verification into a standard code value.
A processor in a server receives a request message sent by a third party, calls a method for uniformly and normally processing the complex message loaded in a memory, checks and converts the request message, and uses the check and conversion for subsequent processing.
Compared with the prior art, the invention has the beneficial effects that:
firstly, all fields are extracted, the check logic is abstracted, and the description information of all configuration fields is analyzed and judged to carry out initialization preprocessing. The corresponding message of one type only needs to be initialized once, so that the situation that each project message needs to judge and execute the field information description is avoided, and the execution efficiency is improved; and the message with different contents can be fully covered, and only the corresponding check information needs to be adjusted.
And secondly, the invention only needs to carry out interface extension on JSON/XML with different standards, only needs to develop aiming at types, does not need to develop aiming at contents, and reduces development and test cost.
The invention abstracts the information acquisition and conversion, has clear code hierarchy and definite code function, and has small code change amount and clear test range for expanding scene development.
Drawings
FIG. 1 is a schematic diagram of prior art execution logic;
FIG. 2 is a schematic diagram of the execution logic of the present invention;
FIG. 3 is a schematic diagram of an initialization chain node of the present invention, wherein solid arrows represent inheritance and dashed arrows represent dependency;
FIG. 4 is a schematic view of an embodiment of the present invention;
Detailed Description
The invention will now be further described by way of examples. The attached drawings are practical application configurations.
A unified and standardized processing method for complex messages comprises the following steps:
s1, initializing each chain node in the processor chain according to the configured record information and aiming at different types of request messages, wherein the chain node comprises a JSON field acquirer, a compliance checker and a type converter;
s2, acquiring data information from the request message according to the JSON field acquirer of the current link node, carrying out validity check on input data according to the compliance checker, creating a corresponding conversion expression object for data caching after the check is passed, and sequentially executing subsequent nodes after the current link node logic is executed until all link logics are checked;
and S3, obtaining a type converter list according to the information of the data cache, and sequentially adopting the type converters in the corresponding link nodes to perform data conversion according to the type converter list.
Further, the compliance checker in step S1 includes a simple type information processor and a complex type information processor chain, where the information processor chain includes a null checker and a JSON object checker, the JSON object checker is a complex processor chain including multi-chain nodes, the simple type means that each field is expressed by simple information, and the complex type means that each field is expressed by nested information, that is, expressed by multiple simple information.
Further, the conversion expression in step S2 is configured and developed according to actual needs, including normal, training-location, string-yuan2fen, string-location, and the like:
normal: the data passing the verification is not converted;
sting-location: converting the code value passing the check into an actual address;
string-yuan2 fen: converting the element passing the verification into a score;
string-substitution: and converting the ethnic information after passing the verification into a standard code value.
A processor in a server receives a request message sent by a third party, calls a method for uniformly and normally processing the complex message loaded in a memory, checks and converts the request message, and uses the check and conversion for subsequent processing.
Example (b):
the input object information is described as a user JSON object message, and the configured record information comprises information such as name, school, age, native place, object and the like. Wherein, the name, the age and the native place are simple objects (namely, simple types) and are represented by characters or numbers; the schools and the objects are structural body information, namely complex objects (namely complex types), and the complex objects have simple information such as names, positions and native places for nested expression.
When a third party applies for such a message for the first time, the server needs to initialize each link node to form a processor chain, and the processor chain comprises:
the link point comprises a name information JSON field acquirer, a name information verification mode and a school information conversion mode;
a 'school information JSON field acquirer + school information verification' chain node;
the 'object information JSON field acquirer + object information check' chain node;
the link points of the 'age information JSON field acquirer + age information verification + school information conversion mode';
link points of 'native information JSON field acquirer + native information verification + school information conversion mode';
in which complex object (object/school) information checks recursively initialize their own information processor chains. Its own chain of information processors is executed in the check processing logic. The method comprises the following specific steps:
the information processor chain aiming at school information is a school information checker chain, and comprises two checkers, wherein one checker is an empty checker (type conversion is carried out because no information conversion is carried out in the check), and the other checker is a JSON object checker (conversion is carried out according to the requirement of conversion whether the check is needed), namely, the check is firstly carried out to determine whether the check is empty, and then the JSON object check is carried out.
As shown in the JSON object check description in fig. 4, a school object processor chain (i.e., a complex processor chain) is formed by initialized link points inside the JSON object checker, which is specifically as follows:
a link point of 'a name correction information JSON field acquirer + a name correction information verification + a name correction information conversion mode';
link points of 'checking address information JSON field acquirer + checking address information verification + checking address information conversion mode';
……
and repeating the steps in sequence to obtain all the information in a recursion mode to form a school object processor chain required by the request message format.
After obtaining the processor chain:
executing a first chain node in the processor chain: and acquiring name character string information by using a name information processor, submitting the name character string information to a name information verification processor, judging the length of the name character string information, checking the blank correlation and the blank correlation, putting a result expression into an information expression list under the condition that the field conforms to a standard, otherwise, applying for the non-important real name information, throwing an exception to perform quick failure response, and returning the request message without the exception.
When the execution of the first link node is finished, the second school information check is started, namely, when the school node processing is executed, the school structure complex object is obtained according to the school information processor, after the corresponding school check processor performs simple empty check on the school information, the information content contained in the school information is processed by the complex processor chain of the school information (the complex processor chain initialization is recursive call, and the complex processor chain logic is executed).
Such as: and acquiring a name checking information character string by using a first chain link point of a complex processor chain of the name checking information, submitting the name checking information character string to a name checking information checker, judging whether one or more of a name checking space, a length, illegal characters and the like exist, putting a result expression into an information expression list under the condition that a field accords with a standard, otherwise, applying for the information without important real names, throwing an exception, carrying out quick failure response, and returning the exception of the message which is not in accordance with the standard.
Completing the execution of the first link node under the complex processor chain of the school information, starting to execute the second link node, and checking the address information;
……
and analogizing in turn, executing all subsequent checks, placing the compliance information in a cache type converter list, traversing the list, calculating the expression (the format of some compliance information meets the requirement, conversion is not needed, and the compliance information does not need to be stored in the cache type converter list), acquiring the converted uniform legal information, and performing subsequent transaction processing.
After the processor chain is executed, a type converter list of the data cache information is obtained (some compliance information formats meet requirements, conversion is not needed, and storage in the cache type converter list is not needed), the list is traversed, the expression is calculated, the converted uniform legal information is obtained, and subsequent transaction processing is carried out.
The above are merely representative examples of the many specific applications of the present invention, and do not limit the scope of the invention in any way. All the technical solutions formed by the transformation or the equivalent substitution fall within the protection scope of the present invention.
Claims (1)
1. A unified standardized processing method for complex messages is characterized by comprising the following steps:
s1, initializing each chain node in the processor chain according to the configured record information and aiming at different types of request messages, wherein the chain node comprises a JSON field acquirer, a compliance checker and a type converter;
s2, acquiring data information from the request message according to the JSON field acquirer of the current link node, carrying out validity check on input data according to the compliance checker, creating a corresponding conversion expression object for data caching after the check is passed, and sequentially executing subsequent nodes after the current link node logic is executed until all link logics are checked;
the compliance checker comprises a simple type information processor and a complex type information processor chain, wherein the information processor chain comprises a null checker and a JSON object checker, the JSON object checker is a complex processor chain comprising multi-chain nodes, the simple type means that each field is expressed by simple information, the complex type means that each field is expressed by nested information and is expressed by a plurality of simple information;
the conversion expression is configured and developed according to actual needs, and comprises the following steps:
normal: the data passing the verification is not converted;
sting-location: converting the code value passing the check into an actual address;
string-yuan2 fen: converting the element passing the verification into a score;
string-substitution: converting the ethnic information passing the verification into a standard code value;
and S3, obtaining a type converter list according to the information of the data cache, and sequentially adopting the type converters in the corresponding link nodes to perform data conversion according to the type converter list.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910557722.XA CN110290135B (en) | 2019-06-24 | 2019-06-24 | Method for unified and standardized processing of complex messages and requested data stream |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910557722.XA CN110290135B (en) | 2019-06-24 | 2019-06-24 | Method for unified and standardized processing of complex messages and requested data stream |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110290135A CN110290135A (en) | 2019-09-27 |
CN110290135B true CN110290135B (en) | 2021-12-07 |
Family
ID=68005950
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910557722.XA Active CN110290135B (en) | 2019-06-24 | 2019-06-24 | Method for unified and standardized processing of complex messages and requested data stream |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110290135B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110727475B (en) * | 2019-10-12 | 2023-07-21 | 四川新网银行股份有限公司 | Intelligent service calling method based on configuration |
CN112165465B (en) * | 2020-09-16 | 2023-04-07 | 杭州安恒信息技术股份有限公司 | Data processing method and device for outgoing third-party platform and electronic device |
CN112733199A (en) * | 2020-12-28 | 2021-04-30 | 北京极豪科技有限公司 | Data processing method and device, electronic equipment and readable storage medium |
CN113706125B (en) * | 2021-09-08 | 2023-08-22 | 北京鲸鹳科技有限公司 | Group insurance service processing method and system based on data conversion verification |
CN114500666A (en) * | 2021-12-29 | 2022-05-13 | 海南同享数字科技有限公司 | XML-based custom message general method and device and electronic equipment |
CN115866087B (en) * | 2022-11-29 | 2023-11-17 | 广发银行股份有限公司 | Message mapping and message conversion method, device and transmission system |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101022431A (en) * | 2007-03-09 | 2007-08-22 | 中国移动通信集团福建有限公司 | Interface gateway and interface gateway data processing method |
CN101706716A (en) * | 2009-09-08 | 2010-05-12 | 南京师范大学 | VO-based form customization, configuration and parsing operation method |
CN103414252A (en) * | 2013-08-30 | 2013-11-27 | 湘潭大学 | Transformer substation communication service configuration information real-time synchronization system and method thereof |
CN103870274A (en) * | 2014-03-14 | 2014-06-18 | 浪潮集团山东通用软件有限公司 | Visual development assembly for realizing data interaction between heterogeneous systems based on web service technology |
CN105138613A (en) * | 2015-08-07 | 2015-12-09 | 北京思特奇信息技术股份有限公司 | Business object and xml message mutual conversion method and system |
US9298371B1 (en) * | 2014-12-22 | 2016-03-29 | American Megatrends, Inc. | System and method of reducing write cycles and increasing longevity of non-volatile memory in baseboard management controller (BMC) |
CN106506347A (en) * | 2016-11-10 | 2017-03-15 | 成都中嵌自动化工程有限公司 | A kind of multi-protocol data communication gate equipment for air traffic control system |
CN108306767A (en) * | 2018-01-25 | 2018-07-20 | 烽火通信科技股份有限公司 | The configuration method and system of the abstraction function user interface of compatible multiple designated equipments |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104079624A (en) * | 2014-05-09 | 2014-10-01 | 国云科技股份有限公司 | Message access layer framework based on service and implementing method thereof |
-
2019
- 2019-06-24 CN CN201910557722.XA patent/CN110290135B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101022431A (en) * | 2007-03-09 | 2007-08-22 | 中国移动通信集团福建有限公司 | Interface gateway and interface gateway data processing method |
CN101706716A (en) * | 2009-09-08 | 2010-05-12 | 南京师范大学 | VO-based form customization, configuration and parsing operation method |
CN103414252A (en) * | 2013-08-30 | 2013-11-27 | 湘潭大学 | Transformer substation communication service configuration information real-time synchronization system and method thereof |
CN103870274A (en) * | 2014-03-14 | 2014-06-18 | 浪潮集团山东通用软件有限公司 | Visual development assembly for realizing data interaction between heterogeneous systems based on web service technology |
US9298371B1 (en) * | 2014-12-22 | 2016-03-29 | American Megatrends, Inc. | System and method of reducing write cycles and increasing longevity of non-volatile memory in baseboard management controller (BMC) |
CN105138613A (en) * | 2015-08-07 | 2015-12-09 | 北京思特奇信息技术股份有限公司 | Business object and xml message mutual conversion method and system |
CN106506347A (en) * | 2016-11-10 | 2017-03-15 | 成都中嵌自动化工程有限公司 | A kind of multi-protocol data communication gate equipment for air traffic control system |
CN108306767A (en) * | 2018-01-25 | 2018-07-20 | 烽火通信科技股份有限公司 | The configuration method and system of the abstraction function user interface of compatible multiple designated equipments |
Non-Patent Citations (2)
Title |
---|
Xiaoqi Lu 等."Research and implementation of medical information format conversion based on HL7 Version 2.x".《 2011 International Conference on Computer Science and Service System (CSSS)》.2011,第2440-2443页. * |
可变报文格式测试工具设计方法";王璇 等;《测试技术学报》;20150213;第29卷(第1期);第41-47页 * |
Also Published As
Publication number | Publication date |
---|---|
CN110290135A (en) | 2019-09-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110290135B (en) | Method for unified and standardized processing of complex messages and requested data stream | |
CN106919509B (en) | Client generation method and device and electronic equipment | |
CN110287109B (en) | Protocol interface testing method and device, computer equipment and storage medium thereof | |
CN109684607B (en) | JSON data analysis method and device, computer equipment and storage medium | |
CN110554958B (en) | Graph database testing method, system, device and storage medium | |
US11561997B2 (en) | Methods, systems, and computer readable media for data translation using a representational state transfer (REST) application programming interface (API) | |
CN110058864B (en) | Micro-service deployment method and device | |
CN113079198B (en) | Method and device for converting cloud platform interface protocol | |
CN104320312B (en) | Network application safe test tool and fuzz testing case generation method and system | |
CN109460220A (en) | The predefined code generating method of message, device, electronic equipment and storage medium | |
CN113238740B (en) | Code generation method, code generation device, storage medium and electronic device | |
CN114238381A (en) | Data quality checking method, device and computer readable storage medium | |
CN104408073A (en) | Data operation method and device | |
CN112181924A (en) | File conversion method, device, equipment and medium | |
CN115599359A (en) | Code generation method, device, equipment and medium | |
CN114691105A (en) | Data processing method and device based on SOMEIP protocol under SOA architecture of whole vehicle | |
CN113742231A (en) | Protobuf protocol dynamic analysis-based number making method and device | |
CN112883088B (en) | Data processing method, device, equipment and storage medium | |
CN116483888A (en) | Program evaluation method and device, electronic equipment and computer readable storage medium | |
CN116755684B (en) | OAS Schema generation method, device, equipment and medium | |
CN115543485B (en) | Data conversion configuration generation method, device, computer equipment and medium | |
CN117609084A (en) | Class conflict detection method, device and equipment for application program and storage medium | |
CN116382640A (en) | Method, device, equipment and storage medium for managing micro-service | |
CN117688907A (en) | XML logic processing method and device, electronic equipment and medium | |
CN116893819A (en) | Program compiling method, device, chip, electronic device 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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |