Disclosure of Invention
The application provides a data processing method and device based on a service configuration template, which can improve the operation efficiency of an enterprise transaction bus, save the occupation of system resources and reduce the system consumption.
The application provides the following scheme:
a data processing method based on a service configuration template comprises the following steps:
acquiring and analyzing a service configuration template, wherein the service configuration template is a configuration template corresponding to a second type of service generated by assembling a first type of service through a preset graphical operation interface;
creating a corresponding data structure for each service configuration template in a system memory, wherein each data structure comprises a plurality of data nodes;
correspondingly storing fields contained in each analyzed service configuration template into data nodes of the data structure;
and creating a data object corresponding to each service configuration template in a system memory according to the content in the data node contained in each data structure, so that when any service configuration template is called, data is directly obtained from the corresponding data object, and after business operation is performed, services are provided for the outside.
Optionally, a corresponding data structure is created in the system memory for each service configuration template, where each data structure includes a plurality of data nodes, and the method includes:
and creating a corresponding DOM tree structure for each service configuration template in the system memory, wherein each DOM tree structure comprises a plurality of NODE objects serving as data NODEs.
Optionally, after creating the data object corresponding to each service configuration template in the system memory according to the content in the data node included in each data structure, the method further includes:
allocating a service identifier for each service configuration template;
encrypting each service identifier to generate a corresponding query identifier;
and storing the service configuration template and the corresponding query identifier in a system memory.
Optionally, the allocating a service identifier for each service configuration template includes:
distinguishing the obtained service configuration templates according to service contents;
and allocating a service identifier for each distinguished service configuration template.
Optionally, the method further includes:
when a request for calling any service configuration template is received, generating a check value according to the service identifier of the service configuration template;
comparing the check value with a query identifier in a system memory;
and when the check value is matched with any query identifier, directly reading data from the data object of the service configuration template corresponding to the query identifier, and performing service operation to provide service for the outside.
A data processing apparatus based on a service configuration template, comprising:
the service configuration template is a configuration template corresponding to a second type of service generated by assembling a first type of service through a preset graphical operation interface;
the data structure creating unit is used for creating a corresponding data structure for each service configuration template in a system memory, and each data structure comprises a plurality of data nodes;
the first storage unit is used for correspondingly storing the fields contained in each analyzed service configuration template into the data nodes of the data structure to which the fields belong;
and the data object creating unit is used for creating a data object corresponding to each service configuration template in the system memory according to the content in the data node contained in each data structure, so that when any service configuration template is called, data is directly obtained from the corresponding data object, and after business operation is performed, services are provided for the outside.
Optionally, the data structure creating unit is specifically configured to:
and creating a corresponding DOM tree structure for each service configuration template in the system memory, wherein each DOM tree structure comprises a plurality of NODE objects serving as data NODEs.
Optionally, the apparatus further includes:
the service identifier distribution unit is used for distributing a service identifier for each service configuration template;
the query identifier generating unit is used for encrypting each service identifier to generate a corresponding query identifier;
and the second storage unit is used for storing the service configuration template and the corresponding query identifier in a system memory.
Optionally, the service identifier allocating unit is specifically configured to:
distinguishing the obtained service configuration templates according to service contents;
and allocating a service identifier for each distinguished service configuration template.
Optionally, the apparatus further includes:
the verification value generating unit is used for generating a verification value according to the service identifier of any service configuration template when a request for calling the service configuration template is received;
the comparison unit is used for comparing the check value with the query identifier in the system memory;
and the data acquisition unit is used for directly acquiring data from the data object of the service configuration template corresponding to the query identifier and performing service operation to provide service to the outside when the check value is matched with any query identifier.
According to the specific embodiments provided herein, the present application discloses the following technical effects:
according to the embodiment of the application, after the pushed service configuration template is obtained and analyzed (the first type of service is assembled through the preset graphical operation interface to generate the configuration template corresponding to the second type of service), a corresponding data structure with a plurality of data nodes is created for each service configuration template in the system memory, then fields contained in each analyzed service configuration template can be correspondingly stored in the data nodes of the data structure, and the data object corresponding to each service configuration template is created in the system memory according to the content in the data nodes contained in each data structure, so that when any service configuration template is called, data can be directly obtained from the corresponding data object, and the service is provided to the outside after the service operation is performed. Therefore, the service configuration template only needs to be analyzed once and the analyzed data is stored in the form of the data object, so that when the service is provided to the outside each time, the analyzed data is directly obtained from the data object corresponding to the relevant service configuration template to perform business operation and then provide the service to the outside, and the analysis operation on the relevant service configuration template is not needed when the service is provided to the outside each time, so that the speed of providing the service to the outside can be improved, and the operation efficiency of an enterprise transaction bus is further improved; on the other hand, from the system perspective, the occupation of system resources can be saved, and the system consumption can be reduced.
Of course, it is not necessary for any product to achieve all of the above-described advantages at the same time for the practice of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments that can be derived from the embodiments given herein by a person of ordinary skill in the art are intended to be within the scope of the present disclosure.
Referring to fig. 1, an embodiment of the present application first provides a data processing method based on a service configuration template, which may include the following steps:
s101, acquiring and analyzing a service configuration template.
The service configuration template is a configuration template corresponding to a second type of service generated by assembling a first type of service through a preset graphical operation interface.
In this embodiment, a graphical operation interface for assembling a first type of service (e.g., an atomic service) in a "data processing method and apparatus based on graphics" proposed by the applicant may add a first type of service node in the operation interface in a dragging manner, add a connecting line between two related nodes, edit identity information of the first type of service node, and the like, and then generate a service configuration template corresponding to a second type of service (e.g., a business service) assembled by the first type of service according to the identity information of the first type of service node in the operation interface and sequence information between the nodes.
The generated service configuration template (i.e., all data included in the service configuration template) may then be pushed (e.g., may be pushed one by one or pushed in batches, etc.) to the preset cache, that is, the preset cache may obtain the pushed service configuration template.
The obtained service configuration template may then be parsed. In a specific implementation, each service configuration template needs to be parsed, and each parsed service configuration template may include a plurality of fields (for example, a service address field of the service configuration template, an accessed time field of the service configuration template, a check field of the service configuration template, and the like may be included).
S102, a corresponding data structure is created for each service configuration template in a system memory, and each data structure can comprise a plurality of data nodes.
In a specific implementation, for example, a corresponding DOM (Document Object Model) tree structure may be created in the system memory for each service configuration template, where each DOM tree structure includes a plurality of NODE objects as data NODEs, and of course, the data structure applicable thereto may be selected according to actual requirements, which is not limited in this embodiment.
S103, correspondingly storing the fields contained in each analyzed service configuration template into the data nodes of the data structure to which the fields belong.
In practical applications, fields included in each service configuration template may be correspondingly stored in data NODEs (e.g., NODE objects of the DOM tree) of a data structure to which the service template belongs, that is, each data NODE (e.g., NODE object) may store the field contents of the service configuration template.
And S104, creating a data object corresponding to each service configuration template in a system memory according to the content in the data node contained in each data structure, so that when any service configuration template is called, data is directly obtained from the corresponding data object, service operation is performed, and then service is provided for the outside.
In specific implementation, a data object corresponding to each service configuration template may be created in a system memory according to contents in data NODEs (e.g., NODE objects) included in a data structure (e.g., DOM tree) corresponding to each service configuration template, that is, each data object completely includes all data in one service configuration template, and when any service configuration template needs to be called for providing a service to the outside, parsed data may be directly acquired from the data object corresponding to the service configuration template, and related service operations may be performed to obtain an operation result of a service related to the service configuration template, so as to implement providing the service to the outside.
Therefore, the service configuration template only needs to be analyzed once and the analyzed data is stored in the form of the data object, so that when the service is provided to the outside each time, the analyzed data is directly obtained from the data object corresponding to the relevant service configuration template to perform business operation and then provide the service to the outside, the analysis operation on the relevant service configuration template is not needed when the service is provided to the outside each time, the speed of providing the service to the outside can be improved, the operation efficiency of an enterprise transaction bus is further improved, the speed of calling the service configuration template each time on average can be saved by 15ms (millisecond) compared with the existing scheme, and by taking 40 ten thousand times of calling the service configuration template each day as an example, 1 hour and 40 minutes can be saved each day; on the other hand, from the system perspective, the occupation of system resources can be saved, and the system consumption can be reduced.
In this embodiment, after the data object corresponding to each service configuration template is established, a service identifier may be further allocated to each service configuration template, each service identifier is encrypted to generate a corresponding query identifier, and then the service configuration template and the corresponding query identifier are stored in the system memory.
In a specific implementation, the service configuration templates may be pushed one by one or pushed in batches, after the preset cache receives the pushed service configuration templates, the obtained service configuration templates may be distinguished according to service contents (for example, service contents corresponding to the service configuration templates), and then a corresponding service ID (for example, the service ID may be a combination of a number and a letter) is assigned to each distinguished service configuration template to serve as a service identifier.
In this embodiment, the encryption may be performed by a hash algorithm, that is, a hash value of each service identifier (each service ID) is calculated to serve as a query identifier corresponding to each service identifier.
Since the hash value is a data-unique and extremely compact numerical representation form, the computed hash value can be used as a unique query ID for each service configuration template, so as to be conveniently used when querying the service configuration template in the following process.
And storing the service configuration template and the corresponding query identifier in a preset position in a system memory, wherein the preset position of the system memory can be used for storing the data of all pushed service configuration templates and the corresponding query identifiers.
In this embodiment, the storage form of the service configuration template and the query identifier may be as shown in table 1:
| form panel | Query identification |
| 001 | X1X1X |
| 002 | A1B1C |
| …… | …… |
TABLE 1
Therefore, the service configuration template can be inquired through the inquiry identification, and due to the data uniqueness and compactness of the hash value, the inquiry speed of the service configuration template can be greatly increased under the condition that the service configuration template needs to be inquired, called and the like, so that the operation speed of an enterprise transaction bus is increased, through performance test, each inquiry only needs 2ms, and the inquiry efficiency completely meets the development requirements of the current and the future.
In practical application, when any business service is requested through the enterprise transaction bus platform, a check value can be generated according to a service identifier (service ID) of a service configuration template in order to receive a request for calling the service configuration template corresponding to the business service.
In this embodiment, the hash value of the service ID may be calculated to serve as a check value, the check value is compared with the query identifier in the system memory, when the check value matches any query identifier, a service configuration template corresponding to the query identifier is called from the system memory, so as to perform operations such as parsing on the service configuration template to obtain corresponding operation parameters, and then preset business operations (e.g., addition operation, surplus budget fetching, and the like) are performed on the operation parameters to obtain operation results related to the service corresponding to the service configuration template, for example, if the service corresponding to the service configuration template is the number of participation and the total amount of participation of a certain person, the operation results may correspond to the total number of participation and the total amount of participation of the person, and the like.
Therefore, even under the condition that a large number of service configuration templates are required to be called to provide related services in practical application of the enterprise transaction bus, the service configuration templates are inquired and called through the service ID and the inquiry identification, the inquiry and calling speed can be greatly improved, and the overall operation speed of the enterprise transaction bus is further improved.
According to the embodiment of the application, after the pushed service configuration template is obtained and analyzed (the first type of service is assembled through the preset graphical operation interface to generate the configuration template corresponding to the second type of service), a corresponding data structure with a plurality of data nodes is created for each service configuration template in the system memory, then fields contained in each analyzed service configuration template are correspondingly stored in the data nodes of the data structure, and the data object corresponding to each service configuration template is created in the system memory according to the content in the data nodes contained in each data structure, so that when any service configuration template is called, data are directly obtained from the corresponding data objects, and service operation is performed to provide services to the outside. Therefore, the service configuration template only needs to be analyzed once and the analyzed data is stored in the form of the data object, so that when the service is provided to the outside each time, the analyzed data is directly obtained from the data object corresponding to the relevant service configuration template to perform business operation and then provide the service to the outside, and the analysis operation on the relevant service configuration template is not needed when the service is provided to the outside each time, so that the speed of providing the service to the outside can be improved, and the operation efficiency of an enterprise transaction bus is further improved; on the other hand, from the system perspective, the occupation of system resources can be saved, and the system consumption can be reduced.
Corresponding to the data processing method based on the service configuration template provided in the foregoing embodiment, an embodiment of the present application further provides a data processing apparatus based on the service configuration template, and referring to fig. 2, the apparatus may include:
the obtaining and analyzingunit 21 is configured to obtain and analyze a service configuration template, where the service configuration template is a configuration template corresponding to a second type of service, and the configuration template is formed by assembling a first type of service through a preset graphical operation interface.
The datastructure creating unit 22 is configured to create a corresponding data structure for each service configuration template in the system memory, where each data structure includes a plurality of data nodes.
In a specific implementation, the datastructure creating unit 22 may specifically be configured to: and creating a corresponding DOM tree structure for each service configuration template in the system memory, wherein each DOM tree structure comprises a plurality of NODE objects serving as data NODEs.
Thefirst storage unit 23 is configured to correspondingly store the fields included in each parsed service configuration template in the data nodes of the data structure to which the fields belong.
And the data object creatingunit 24 is configured to create a data object corresponding to each service configuration template in the system memory according to the content in the data node included in each data structure, so that when any service configuration template is called, data is directly obtained from the corresponding data object, service operation is performed on the data, and then a service is provided to the outside.
In addition, the device may further include:
the service identifier distribution unit is used for distributing a service identifier for each service configuration template;
the query identifier generating unit is used for encrypting each service identifier to generate a corresponding query identifier;
and the second storage unit is used for storing the service configuration template and the corresponding query identifier in a system memory.
In this embodiment, the service identifier allocating unit may be specifically configured to:
distinguishing the obtained service configuration templates according to service contents;
and allocating a service identifier for each distinguished service configuration template.
In practical applications, the apparatus may further include:
the verification value generating unit is used for generating a verification value according to the service identifier of any service configuration template when a request for calling the service configuration template is received;
the comparison unit is used for comparing the check value with the query identifier in the system memory;
and the data acquisition unit is used for directly acquiring data from the data object of the service configuration template corresponding to the query identifier when the check value is matched with any query identifier, performing service operation and then providing services to the outside.
According to the embodiment of the application, after the pushed service configuration template is obtained and analyzed (the first type of service is assembled through the preset graphical operation interface to generate the configuration template corresponding to the second type of service), a corresponding data structure with a plurality of data nodes is created for each service configuration template in the system memory, then fields contained in each analyzed service configuration template can be correspondingly stored in the data nodes of the data structure, and the data object corresponding to each service configuration template is created in the system memory according to the content in the data nodes contained in each data structure, so that when any service configuration template is called, data can be directly obtained from the corresponding data object, service operation is performed, and then the service is provided for the outside. Therefore, the service configuration template only needs to be analyzed once and the analyzed data is stored in the form of the data object, so that when the service is provided to the outside each time, the analyzed data is directly obtained from the data object corresponding to the relevant service configuration template to perform business operation and then provide the service to the outside, and the analysis operation on the relevant service configuration template is not needed when the service is provided to the outside each time, so that the speed of providing the service to the outside can be improved, and the operation efficiency of an enterprise transaction bus is further improved; on the other hand, from the system perspective, the occupation of system resources can be saved, and the system consumption can be reduced.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present application.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The data processing method and apparatus based on the service configuration template provided by the present application are introduced in detail, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the above embodiment is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, the specific embodiments and the application range may be changed. In view of the above, the description should not be taken as limiting the application.