Data processing method, device, electronic device and storage medium
By determining the target request identification and interface parameters when the server is abnormal, and using the data reading interface in the underlying operation library to read and feedback response data from the distributed database, the problem that local databases and non-Redux logic cannot be shared data is solved, improving the user experience.
Patent Information
- Application Number
- CN202110327295.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-26
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-03-26
AI Technical Summary
The local database stored data cannot be shared with non-Redux logic, resulting in the inability to feedback the corresponding response data to the client when the server is abnormal.
When detecting the abnormal status of the server, determine the target request identification of the target data acquisition request, determine the corresponding interface parameters, and find the corresponding data reading interface in the pre-encapsulated underlying operation library, read the target response data from the distributed database and feed it back to the client.
It realizes that the corresponding response data can be feedback when the server is abnormal, thereby improving the user experience.
Smart Images

Figure CN113760842B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to a data processing method, device, electronic device, and storage medium. Background Art
[0002] PouchDB is a cross-platform javascript database. Redux-Offline is a middleware based on Redux. Users can configure the interface to be cached to the middleware to serialize offline data into the local PouchDB database.
[0003] When implementing the technical solution based on the above method, the inventor found the following problems:
[0004] The data stored in the local database cannot be shared with other non-Redux logic. When a data acquisition request is received, the corresponding response data cannot be retrieved from the local database and fed back to the client, and thus the technical problem of not being able to feed back the response data corresponding to the data acquisition request. Summary of the invention
[0005] The present invention provides a data processing method, device, electronic device and storage medium, so as to achieve the technical effect that when a server abnormally receives a data acquisition request, corresponding response data can be fed back, thereby improving the user experience.
[0006] In a first aspect, an embodiment of the present invention provides a data processing method, the method comprising:
[0007] When detecting that the server is in an abnormal state and receiving a target data acquisition request initiated by a client, determining a target request identifier of the target data acquisition request;
[0008] Determine an interface parameter corresponding to the target request identifier, and determine at least one data reading interface corresponding to the interface parameter in a pre-packaged underlying operation library;
[0009] Based on the data processing component and the at least one data reading interface, read the target response data matching the target data acquisition request from the underlying operation library, and feed back the target response data to the client;
[0010] The underlying operation library includes a distributed database, and the data stored in the distributed database is the response data responded to when the server works normally and receives a data acquisition request.
[0011] In a second aspect, an embodiment of the present invention further provides a data processing device, the device comprising:
[0012] A target request identifier determination module, configured to determine a target request identifier of the target data acquisition request when detecting that the server is in an abnormal state and receiving a target data acquisition request initiated by a client;
[0013] A data reading interface determination module, used to determine an interface parameter corresponding to the target request identifier, and determine at least one data reading interface corresponding to the interface parameter in a pre-packaged underlying operation library;
[0014] A response data feedback module, configured to read target response data matching the target data acquisition request from the underlying operation library based on the data processing component and the at least one data reading interface, and feed back the target response data to the client;
[0015] The underlying operation library includes a distributed database, and the data stored in the distributed database is the response data responded to when the server works normally and receives a data acquisition request.
[0016] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0017] one or more processors;
[0018] a storage device for storing one or more programs,
[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method as described in any one of the embodiments of the present invention.
[0020] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute a data processing method as described in any one of the embodiments of the present invention.
[0021] The technical solution of the embodiment of the present invention can determine the target request identifier in the target data acquisition request when it is detected that the server is in an abnormal state and receives a target data acquisition request. Further, it can determine the interface parameters corresponding to the target request identifier, and determine the data reading interface corresponding to the interface parameters in the pre-packaged underlying operation library. After determining the data reading interface, the target response data matching the target data acquisition request can be read from the underlying database based on the data processing middleware, and the target data can be fed back to the client, so that the middleware can obtain data matching the data acquisition request from the database, feed back the response data to the client and draw a response page, thereby improving the technical effect of user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required to describe the embodiments. Obviously, the drawings introduced are only drawings of a part of the embodiments to be described in the present invention, rather than all the drawings. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 A schematic diagram of a data processing method provided in Embodiment 1 of the present invention;
[0024] Figure 2 A schematic diagram of a server anomaly detection process provided by Embodiment 1 of the present invention;
[0025] Figure 3 A schematic diagram of a data processing method provided in Embodiment 2 of the present invention;
[0026] Figure 4 A schematic diagram of a data processing method provided in Embodiment 3 of the present invention;
[0027] Figure 5 A schematic diagram of the structure of a data processing device provided in Embodiment 4 of the present invention;
[0028] Figure 6 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION
[0029] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0030] Embodiment 1
[0031] Figure 1 This is a flow chart of a data processing method provided in Embodiment 1 of the present invention. This embodiment is applicable to the situation where, when a server is abnormal and receives a data acquisition request sent by a client, response data corresponding to the data acquisition request can be retrieved from the encapsulated underlying database based on a pre-set middleware. The method can be executed by a data processing device, which can be implemented in the form of software and / or hardware. The hardware can be an electronic device, such as a mobile terminal, a PC or a server.
[0032] Before introducing the technical solution of this embodiment, an exemplary description of the application scenario can be given. Redux middleware is provided in the Web front-end page, and the redux middleware is used to receive the data acquisition request sent by the client and send the data acquisition request to the server. Accordingly, when the server feeds back feedback data corresponding to the data acquisition request, the redux middleware can receive the feedback data and send the feedback data to the client. At the same time, the feedback data can be refined and written into the encapsulated underlying operation library, which includes a local database (IndexDB), and the response data fed back by the server is mainly stored in the local database.
[0033] like Figure 1 The method of this embodiment includes:
[0034] S110. When it is detected that the server is in an abnormal state and a target data acquisition request initiated by a client is received, a target request identifier of the target data acquisition request is determined.
[0035] Among them, the state of server downtime or server non-working can be regarded as the abnormal state of the server. The user can trigger any control on the client display interface. When the triggered control needs to feedback corresponding data, the request generated by the triggered control at this time can be used as the target data acquisition request. Each target data acquisition request can include a corresponding target request identifier. When receiving a data acquisition request, the request identifier in the data acquisition request can be extracted and used as the target request identifier.
[0036] Specifically, when it is detected that the server is in an abnormal state and a target data acquisition request sent by a client is received, the target request identifier in the target data acquisition request can be determined.
[0037] In this embodiment, the detecting that the server is in an abnormal state includes: regularly sending a heartbeat packet to the server; if response data corresponding to the heartbeat packet is not received within a preset time period, determining that the server is in an abnormal state.
[0038] Among them, the heartbeat detection service can be built based on service worker or Node.js. Its main purpose is to detect whether the request interface is working properly. Heartbeat packets can be sent to the server regularly or in real time to determine whether the server is in normal working condition. Of course, in order to save resources, heartbeat packets can be sent to the server regularly. The timing can be periodic, optional, with every ten seconds as a cycle, and a heartbeat packet can be sent to the server every ten seconds. The feedback data corresponding to the sent heartbeat packet is used as the response data. The preset duration can be five seconds, ten seconds, twenty seconds, etc., and the user can set the preset duration according to actual needs.
[0039] Specifically, Node.js may send a heartbeat packet to the server every ten seconds. When no response data corresponding to the heartbeat packet is received within a certain period of time, optionally within twenty seconds, it is determined that the server is in an abnormal state.
[0040] S120: Determine an interface parameter corresponding to the target request identifier, and determine at least one data reading interface corresponding to the interface parameter in a pre-packaged underlying operation library.
[0041] Generally, when a data acquisition request is initiated, a data processing interface corresponding to the data acquisition request may be determined.
[0042] Among them, when redux receives a data acquisition request, it can strip the target request identifier based on the API middleware in redux, that is, the interface stripping middleware, and determine the interface method and interface type corresponding to the target request identifier. That is to say, the target request identifier is stripped based on the pre-set interface stripping middleware to determine the interface parameters corresponding to the target request identifier. The encapsulated underlying operation library includes a distributed database, and the distributed database stores the response data responded to when the server receives a data acquisition request when it works normally. In order to realize the data interaction between redux and the distributed database, the distributed database can be encapsulated to obtain a set of general underlying operation libraries. At the same time, according to the pre-set configuration items, multiple data acquisition interfaces can be abstracted and separated, and the corresponding data can be obtained from the distributed database based on the independent data acquisition interface. At this time, the interaction between the redux middleware and the database is realized, solving the problem that the database and the redux middleware cannot interact with each other at present.
[0043] In this embodiment, the benefit of encapsulating the underlying operation library is that data interaction between the database and redux can be achieved.
[0044] In this embodiment, determining at least one data reading interface corresponding to the interface parameters in a pre-packaged underlying operation library includes: generating a target configuration file based on the interface parameters; using the target configuration file as an input to the interface stripping middleware, and based on the corresponding relationship, determining at least one data reading interface corresponding to the interface parameters in the pre-packaged underlying operation library.
[0045] It should be noted that you can first separate a layer of redux, which includes API middleware (interface stripping middleware) and offline middleware (data processing middleware). API middleware (interface stripping middleware) is used to strip the interface parameters corresponding to the request identifier; offline middleware (data processing middleware) is used to obtain the corresponding response data from the underlying operation library.
[0046] Specifically, after the API middleware strips the interface parameters in the target data identifier, the target configuration file can be generated based on the interface parameters. The target configuration file can be input into the interface stripping middleware to determine the data reading interface corresponding to the data acquisition request that can be fed back. In other words, after obtaining the interface parameters, the interface stripping middleware can generate a configuration file based on the interface parameters, and the interface stripping middleware can process the configuration file to determine which one or more abstracted data reading interfaces of the pre-packaged underlying operation library the interface parameters correspond to.
[0047] On the basis of the above technical solution, before determining at least one data reading interface corresponding to the interface parameters in the pre-packaged underlying operation library, it also includes: generating a configuration file to be processed according to the interface abstracted from the pre-packaged underlying operation library and the interface parameters to be processed corresponding to each interface; processing the configuration file based on the interface stripping middleware to obtain the correspondence between each data acquisition request and the interface, so as to determine the corresponding data acquisition interface based on the correspondence when receiving the data acquisition request.
[0048] It should be noted that this can be the configuration stage, that is, to establish a relationship between the pre-encapsulated underlying operation library and the redux middleware.
[0049] Among them, multiple data reading interfaces are abstracted in the pre-packaged underlying operation library. The interface parameters such as the method and implementation method encapsulated in each data acquisition interface can still be determined based on the interface stripping middleware. After obtaining the interface parameters of each data reading interface, a configuration file corresponding to all data acquisition interfaces can be generated. Correspondingly, the to-be-processed file is a configuration file generated based on the interface parameters of all data acquisition interfaces. The data acquisition interface abstracted in the underlying operation library is determined based on the configuration items of the pre-selected configuration or based on the pre-set business processing rules. The data acquisition interface corresponding to the data acquisition request can be one or more, and the data acquisition interface adapted to the data acquisition request can be determined based on the interface stripping middleware. The corresponding relationship can be understood as the corresponding relationship between the interface parameters determined after stripping the request identifier of the data acquisition request and the data reading interface (data acquisition interface), so that when receiving the data acquisition request, the redux middleware can determine the data reading interface adapted to the data acquisition request.
[0050] It should be noted that when the client initiates a data acquisition request, the redux middleware can first receive the data acquisition request and forward the data acquisition request to the server. When the server feeds back response data that matches the data acquisition request, the redux middleware can obtain the response data and store the data in a distributed database, and feed back the response data to the client. Correspondingly, when the server is abnormal and the client initiates a data acquisition request, the interface stripping middleware and data processing middleware in the redux middleware can process the data acquisition request to retrieve the response data that matches the data acquisition request from the encapsulated underlying operation library.
[0051] S130, based on the data processing middleware and at least one data reading interface, read the target response data matching the target data acquisition request from the underlying operation library, and feed back the target response data to the client.
[0052] Among them, the underlying operation library includes a distributed database, and the data stored in the distributed database is the response data responded to when the server works normally and receives a data acquisition request. That is, the data stored in the distributed database is the data corresponding to the data acquisition request fed back by the server when the client initiates a data acquisition request, and the data can be fed back to the client and stored in the distributed database at the same time. The data processing component can be offlinemiddleware in redux. Based on offline middleware, the response data corresponding to the data acquisition request in the underlying database can be read. The data corresponding to the target data acquisition request obtained from the underlying operation library can be used as the target response data.
[0053] Specifically, based on the offline middleware and the data reading interface determined by the determined API middleware, the target response data matching the target data acquisition request can be obtained from the underlying operation library, and the target response data can be fed back to the client.
[0054] The technical solution of the embodiment of the present invention can determine the target request identifier in the target data acquisition request when it is detected that the server is in an abnormal state and receives a target data acquisition request. Further, it can determine the interface parameters corresponding to the target request identifier, and determine the data reading interface corresponding to the interface parameters in the pre-packaged underlying operation library. After determining the data reading interface, the target response data matching the target data acquisition request can be read from the underlying database based on the data processing middleware, and the target data can be fed back to the client, so that the middleware can obtain data matching the data acquisition request from the database, feed back the response data to the client and draw a response page, thereby improving the technical effect of user experience.
[0055] Based on the above technical solution, the method also includes: monitoring the current state of the server based on a scheduled task, and if the current state is restored from the abnormal state to the normal state, then when a data acquisition request is received, the data acquisition request is sent to the server so that the server can feedback target response data corresponding to the data acquisition request.
[0056] It should be noted that when it is detected that the server is in an abnormal state, the heartbeat packet may continue to be sent to determine whether the server has recovered from the abnormal state to a normal state.
[0057] Among them, the scheduled task can be a task set when the server is in an abnormal state. A heartbeat packet can be sent to the server based on the scheduled task. The time in the scheduled task can be set to send a heartbeat packet to the server every sixty seconds. The current state can be that the server is in an abnormal state or has returned to a normal state. The current state can be determined based on whether the server feeds back response data corresponding to the heartbeat packet.
[0058] Specifically, the heartbeat detection service can be continued, and optionally, the interface detection service timing task can be triggered to detect the server every 60 seconds to determine whether the server has restored the normal service in the current time interval. If the normal service is not restored, the method provided in the first embodiment can still be used to determine the feedback data corresponding to the data acquisition request.
[0059] As an optional embodiment of the above embodiment, the heartbeat detection service is built through Node.js, the main purpose of which is to detect whether the request interface is working properly and provide a reliable request solution. The specific process can be: Figure 2 If the front end initiates a service request, the heartbeat detection service automatically starts to detect the service cluster currently providing the service. If the heartbeat detection service determines that the server is in an abnormal working state, it can be transferred to the backup service, that is, the solution provided by this embodiment is executed. At the same time, the heartbeat detection service can be continued to trigger the interface detection service timing task, and the server is detected every 60S to determine whether there is a server that has resumed normal service in the current time interval. If not, the corresponding feedback data will continue to be obtained from the distributed database.
[0060] In this embodiment, the advantage of determining whether the server has recovered to normal based on heartbeat detection is that the data acquisition request can be forwarded to the server in a timely manner, so that the server feeds back response data matching the data acquisition request.
[0061] Embodiment 2
[0062] Figure 3 A flow chart of a data processing method provided in the second embodiment of the present invention. Based on the above embodiment, when the server is working normally, the server can receive a data acquisition request and feedback response data matching the data acquisition request. At the same time, the data can be stored in a pre-packaged underlying operation library, so that when the server abnormally receives a data acquisition request, the middleware can retrieve the response data corresponding to the data acquisition request from the underlying operation library and feedback it to the client, so as to draw the corresponding page on the client. Among them, the technical terms that are the same as or corresponding to the above embodiment are not repeated here.
[0063] like Figure 3 As shown, the method includes:
[0064] S310: Receive response data corresponding to the data acquisition request fed back by the server.
[0065] It should be noted that this embodiment is mainly applicable to the server being in a normal working state.
[0066] After the middleware receives the data acquisition request and sends the data acquisition request to the server, the server can determine the feedback data corresponding to the data acquisition request and feed the feedback data back to the middleware. The target feedback data is the data matched with the data acquisition request fed back by the server.
[0067] Specifically, when the server feeds back feedback data corresponding to the data acquisition request, the middleware may receive the feedback data and use the feedback data as target feedback data.
[0068] S320, feeding back the response data to the client, and storing the response data in a pre-packaged underlying operation library, so that when the server is detected to be in an abnormal state and receives a data acquisition request initiated by the client, data matching the acquisition request is retrieved from the packaged underlying database.
[0069] It should be noted that after receiving the target feedback data, the middleware can feed back the target data to the client, so that the client can rebuild the page or image according to the received feedback data. At the same time, the target feedback data can also be stored in the underlying operation library, so that when a server abnormality is detected and a data acquisition request initiated by the client is received, the response data matching the data acquisition request can be retrieved from the underlying operation library.
[0070] Based on the above technical solutions, the method also includes: when it is detected that the target response data obtained by the target data processing component is changed, the target response data is added to the asynchronous message queue, so that when it is detected that the server is working normally, the target response data is updated to the background database.
[0071] In this embodiment, the effect of data synchronization update can also be achieved. Synchronous update mainly updates the data of the encapsulated bottom operation library to the background database.
[0072] Among them, the target response data change mainly refers to the backend personnel changing the target corresponding data due to other reasons, for example, the backend personnel deleted part of the target response data. In order to ensure that the data in the encapsulated underlying operation library is consistent with the backend data, the changed data can be added to the asynchronous message queue first. In order to synchronize the changed data to the backend database, the data arriving at the offlinemiddleware middleware can be registered based on the pre-set data synchronization manager and added to the asynchronous message queue. When it is detected that the server has recovered from an abnormal state to a normal state, the changed data is synchronized to the backend database.
[0073] The technical solution of this embodiment realizes that when the server crashes or is offline for a long time, the received data acquisition request can be processed based on the provided backup service and the corresponding response data can be fed back, thereby improving the working progress of the web application. At the same time, the synchronous update method provided not only gets rid of the problem that the web application cannot work in a weak network environment or an environment without a network, but also can record the data changed by the back-end personnel during the offline period and synchronize the changed data to the back-end database, thereby improving the convenience and effectiveness of data use.
[0074] In order to achieve refined control over offline data without intruding too much on the original online logic, the local database IndexDB can be used on the data storage to replace the background return data. The response data fed back by the server can be processed, and the local table can be built according to the database design principles. The specific table building method is not described here. Based on the data stored in the local database and the configuration items in the local table, multiple data reading interfaces are abstracted, and offline data backup services are provided in the form of git sub-repositories to obtain the encapsulated underlying operation library. The advantage of encapsulating the underlying operation library is that data interaction between the database and the middleware can be realized.
[0075] That is to say, it is also necessary to determine the encapsulated underlying operation library; wherein the underlying operation library includes at least one distributed database; the determination of the encapsulated underlying operation library includes: when the server is working normally, obtaining the response data fed back by the server, and storing the response data in the distributed database; encapsulating the distributed database, and abstracting at least one data acquisition interface according to pre-set configuration items, so that when the server abnormally receives a data acquisition request, the corresponding data can be obtained based on the data acquisition interface.
[0076] Embodiment 3
[0077] As an alternative embodiment of the above embodiment, Figure 4 The following is a flow chart of a data processing method provided by Embodiment 3 of the present invention. Technical terms that are the same as or corresponding to those in the above embodiments are not described in detail here.
[0078] like Figure 4 As shown, the method includes:
[0079] S410: The front end initiates a data acquisition request.
[0080] The front end can be understood as a web front end or a created page. A user can trigger any control on the page, and the data acquisition request generated based on the triggered control can be used as a data acquisition request initiated by the front end.
[0081] S420, determine whether the server is abnormal, if so, execute S430; if not, execute S440.
[0082] Specifically, based on the heartbeat detection service, it is determined whether the server is in an abnormal state. Optionally, a heartbeat packet is sent to the server every ten seconds. When response data corresponding to the heartbeat packet is received, it is determined that the server is in a normal state. Otherwise, it is determined that the server is in an abnormal state.
[0083] S430: Determine an interface parameter corresponding to the target request identifier, and determine at least one data reading interface corresponding to the interface parameter in a pre-packaged underlying operation library.
[0084] At this time, the encapsulated underlying operation library may include a distributed database, optionally an IndexDB database. The stored data can provide a backup service, record each data acquisition request, and read the refined offline data in the IndexDB backup service.
[0085] It should be noted that in order to synchronize local data to the background, a new data change manager can be created, such as a data synchronization manager. The main function of the synchronization manager can be to define change types, fields, etc. After the server abnormally reads data from the underlying operation library, if the background staff changes the data, the response data arriving at the offlinemiddleware registers the data change through the synchronization manager, and at the same time adds the changed data to the asynchronous message queue, so that when the server returns to normal, the updated data can be synchronized to the background database.
[0086] S440, redux receives the target feedback data corresponding to the data acquisition request fed back by the server, and stores the target feedback data in the encapsulated underlying operation library.
[0087] Specifically, redux can receive the target feedback data corresponding to the data acquisition request fed back by the server. If redux middleware detects that the distributed database does not include the target feedback data, the target feedback data can be finely processed and written into the distributed database to provide corresponding feedback data when the next request is abnormal. If reduxmiddleware detects that the distributed database includes the target feedback data, a data synchronization manager can be generated through the redux middleware to register the changes, and then perform diff (data processing) management. Optionally, compare the target feedback data fed back by the current data acquisition request with the data returned by the previous request to see if they are consistent. If they are consistent, no update is required; if they are inconsistent, the feedback data that meets the requirements needs to be cached according to the update logic set by the diff management, such as the amount of data fed back by the same data acquisition request, or the timestamp of the feedback data of the same data acquisition request.
[0088] S450: Based on the data processing middleware and the at least one data reading interface, read the target response data matching the target data acquisition request from the underlying operation library, and feed back the target response data to the client.
[0089] The technical solution of the embodiment of the present invention can provide a responsive fallback service when the server crashes or the response time is long, thereby reducing the coupling between the front-end and the back-end. Furthermore, an update process is set in the fallback service, which eliminates the problem that the web application cannot work in an environment or without an environment, thereby improving the technical effect of user experience.
[0090] Embodiment 4
[0091] Figure 5 This is a schematic diagram of the structure of a data processing device provided by Embodiment 4 of the present invention. Figure 5 As shown, the device includes: a target request identifier determination module 510, a data reading interface determination module 520 and a response data feedback module 530.
[0092] Among them, the target request identifier determination module 510 is used to determine the target request identifier of the target data acquisition request when it is detected that the server is in an abnormal state and receives a target data acquisition request initiated by the client; the data reading interface determination module 520 is used to determine the interface parameters corresponding to the target request identifier, and determine at least one data reading interface corresponding to the interface parameters in the pre-packaged underlying operation library; the response data feedback module 530 is used to read the target response data matching the target data acquisition request from the underlying operation library based on the data processing middleware and the at least one data reading interface, and feed back the target response data to the client; wherein the underlying operation library includes a distributed database, and the data stored in the distributed database is the response data responded to when the server works normally and receives a data acquisition request.
[0093] On the basis of the above technical solution, the data identification determination module further includes:
[0094] The heartbeat packet sending unit is used to send heartbeat packets to the server set at a regular interval; the abnormal state determining unit is used to determine that the server is in an abnormal state if no response data corresponding to the heartbeat packet is received within a preset time period.
[0095] On the basis of the above technical solutions, the data reading interface determination module includes: an interface parameter determination unit, which is used to strip the target request identifier based on a preset interface stripping middleware and determine the interface parameters corresponding to the target request identifier.
[0096] On the basis of the above-mentioned technical solutions, the data reading interface determination module, before being used to determine at least one data reading interface corresponding to the interface parameters in the pre-packaged underlying operation library, is also used to: generate a configuration file to be processed according to the interface abstracted from the pre-packaged underlying operation library and the interface parameters to be processed corresponding to each interface; process the configuration file based on the interface stripping middleware to obtain the correspondence between each data acquisition request and the interface, so as to determine the corresponding data acquisition interface based on the correspondence when receiving the data acquisition request.
[0097] On the basis of the above technical solutions, the data reading interface determination module includes:
[0098] A configuration file generating unit, used to generate a target configuration file based on the interface parameters;
[0099] The data reading interface determination unit is used to use the target configuration file as the input of the interface stripping middleware, and based on the corresponding relationship, determine at least one data reading interface corresponding to the interface parameter in the pre-packaged underlying operation library.
[0100] On the basis of the above technical solutions, the device further comprises: a bottom layer operation library encapsulation module, used to determine the encapsulated bottom layer operation library; wherein the bottom layer operation library comprises at least one distributed database;
[0101] The bottom layer operation library encapsulation module includes:
[0102] A data storage unit is used to obtain response data fed back by the server when the server is operating normally, and store the response data in the distributed database; an interface abstraction unit is used to encapsulate the distributed database and abstract at least one data acquisition interface according to pre-set configuration items, so that when the server abnormally receives a data acquisition request, the corresponding data can be obtained based on the data acquisition interface.
[0103] Based on the above technical solutions, the device also includes: a data synchronization module, which is used to add the target response data to the asynchronous message queue when it is detected that the target response data obtained by the target data processing component is changed, so as to update the target response data to the background database when it is detected that the server is working normally.
[0104] On the basis of the above-mentioned technical solutions, the device also includes: a timing monitoring module, which is used to monitor the current state of the server based on a timing task. If the current state is restored from the abnormal state to the normal state, then when a data acquisition request is received, the data acquisition request is sent to the server so that the server can feedback the target response data corresponding to the data acquisition request.
[0105] On the basis of the above technical solutions, the timing monitoring module, after being used to detect that the server is in a normal state, is further used to:
[0106] Receive response data corresponding to the data acquisition request fed back by the server; feed back the response data to the client, and store the response data in a pre-packaged underlying operation library, so that when the server is detected to be in an abnormal state and receives a data acquisition request initiated by the client, the response data matching the acquisition request can be retrieved from the packaged underlying database.
[0107] The technical solution of the embodiment of the present invention can determine the target request identifier in the target data acquisition request when it is detected that the server is in an abnormal state and receives a target data acquisition request. Further, it can determine the interface parameters corresponding to the target request identifier, and determine the data reading interface corresponding to the interface parameters in the pre-packaged underlying operation library. After determining the data reading interface, the target response data matching the target data acquisition request can be read from the underlying database based on the data processing middleware, and the target data can be fed back to the client, so that the middleware can obtain data matching the data acquisition request from the database, feed back the response data to the client and draw a response page, thereby improving the technical effect of user experience.
[0108] The data processing device provided in the embodiment of the present invention can execute the data processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0109] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present invention.
[0110] Embodiment 5
[0111] Figure 6 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. Figure 6 A block diagram of an exemplary electronic device 60 suitable for use in implementing exemplary embodiments of the present invention is shown. Figure 6The electronic device 60 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0112] like Figure 6 As shown, the electronic device 60 is in the form of a general computing device. The components of the electronic device 60 may include but are not limited to: one or more processors or processing units 601, a system memory 602, and a bus 603 connecting different system components (including the system memory 602 and the processing unit 601).
[0113] Bus 603 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0114] The electronic device 60 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 60, including volatile and non-volatile media, removable and non-removable media.
[0115] The system memory 602 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 604 and / or cache memory 605. The electronic device 60 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 606 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, usually called a "hard drive"). Although Figure 6 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 603 via one or more data medium interfaces. Memory 602 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of various embodiments of the present invention.
[0116] A program / utility 608 having a set (at least one) of program modules 607 may be stored, for example, in the memory 602, such program modules 607 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 607 generally perform the functions and / or methods of the embodiments described herein.
[0117] The electronic device 60 may also communicate with one or more external devices 609 (e.g., keyboards, pointing devices, displays 610, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 60, and / or may communicate with any device that enables the electronic device 60 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface 611. Furthermore, the electronic device 60 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 612. As shown, the network adapter 612 communicates with other modules of the electronic device 60 via a bus 603. It should be understood that although Figure 6 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 60, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0118] The processing unit 601 executes various functional applications and data processing by running the programs stored in the system memory 602, such as implementing the data processing method provided in the embodiment of the present invention.
[0119] Embodiment 6
[0120] Embodiment 6 of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute a data processing method when executed by a computer processor.
[0121] The method includes:
[0122] When detecting that the server is in an abnormal state and receiving a target data acquisition request initiated by a client, determining a target request identifier of the target data acquisition request;
[0123] Determine an interface parameter corresponding to the target request identifier, and determine at least one data reading interface corresponding to the interface parameter in a pre-packaged underlying operation library;
[0124] Based on the data processing middleware and the at least one data reading interface, read the target response data matching the target data acquisition request from the underlying operation library, and feed back the target response data to the client;
[0125] The underlying operation library includes a distributed database, and the data stored in the distributed database is the response data responded to when the server works normally and receives a data acquisition request.
[0126] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0127] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0128] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0129] Computer program code for performing the operation of embodiments of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0130] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A data processing method, characterized in that: include: When detecting that the server is in an abnormal state and receiving a target data acquisition request initiated by a client, determining a target request identifier of the target data acquisition request; Determine an interface parameter corresponding to the target request identifier, and determine at least one data reading interface corresponding to the interface parameter in a pre-packaged underlying operation library; Based on the data processing middleware and the at least one data reading interface, read the target response data matching the target data acquisition request from the underlying operation library, and feed back the target response data to the client; The underlying operation library includes a distributed database, and the data stored in the distributed database is the response data responded to when the server works normally and receives a data acquisition request.
2. The method according to claim 1, characterized in that The detecting that the server is in an abnormal state includes: Send heartbeat packets to the server set periodically; If the response data corresponding to the heartbeat packet is not received within a preset time period, it is determined that the server is in an abnormal state.
3. The method according to claim 1, characterized in that The determining of the interface parameters corresponding to the target request identifier includes: The target request identifier is stripped based on a preset interface stripping middleware to determine an interface parameter corresponding to the target request identifier.
4. The method according to claim 3, characterized in that Before determining at least one data reading interface corresponding to the interface parameter in the pre-packaged underlying operation library, the method further includes: Generate a configuration file to be processed according to the interfaces abstracted by the pre-packaged underlying operation library and the interface parameters to be processed corresponding to each interface; The configuration file is processed based on the interface stripping middleware to obtain the corresponding relationship between each data acquisition request and the interface, so as to determine the corresponding data acquisition interface based on the corresponding relationship when receiving the data acquisition request.
5. The method according to claim 4, characterized in that The step of determining at least one data reading interface corresponding to the interface parameter in a pre-packaged underlying operation library comprises: generating a target configuration file based on the interface parameters; The target configuration file is used as the input of the interface stripping middleware, and based on the corresponding relationship, at least one data reading interface corresponding to the interface parameter in the pre-packaged underlying operation library is determined.
6. The method according to claim 1, characterized in that Also includes: Determine a packaged underlying operation library; wherein the underlying operation library includes at least one distributed database; The determining and encapsulating the underlying operation library includes: When the server operates normally, obtaining response data fed back by the server, and storing the response data in the distributed database; The distributed database is encapsulated, and at least one data acquisition interface is abstracted according to the preset configuration items, so that when the server abnormally receives a data acquisition request, the corresponding data can be acquired based on the data acquisition interface.
7. The method according to claim 1, characterized in that Also includes: When it is detected that the response data acquired by the data processing middleware is changed, the response data is added to the asynchronous message queue, so that when it is detected that the server is operating normally, the response data is updated to the background database.
8. The method according to claim 1, characterized in that include: The current state of the server is monitored based on a scheduled task. If the current state is restored from the abnormal state to the normal state, when a data acquisition request is received, the data acquisition request is sent to the server so that the server can feedback target response data corresponding to the data acquisition request.
9. The method according to claim 8, characterized in that When it is detected that the server is in a normal state, the method further includes: Receive response data corresponding to the data acquisition request fed back by the server; The response data is fed back to the client, and the response data is stored in a pre-packaged underlying operation library, so that when the server is detected to be in an abnormal state and a data acquisition request initiated by the client is received, the response data matching the acquisition request is retrieved from the packaged underlying database.
10. A data processing device, characterized in that: include: A target request identifier determination module, configured to determine a target request identifier of the target data acquisition request when detecting that the server is in an abnormal state and receiving a target data acquisition request initiated by a client; A data reading interface determination module, used to determine an interface parameter corresponding to the target request identifier, and determine at least one data reading interface corresponding to the interface parameter in a pre-packaged underlying operation library; A response data feedback module, configured to read target response data matching the target data acquisition request from the underlying operation library based on the data processing middleware and the at least one data reading interface, and feed back the target response data to the client; The underlying operation library includes a distributed database, and the data stored in the distributed database is the response data responded to when the server works normally and receives a data acquisition request.
11. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method according to any one of claims 1 to 9.
12. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to perform the data processing method according to any one of claims 1 to 9 when executed by a computer processor.
Citation Information
Patent Citations
Communication switching method and device, coordinating server and readable storage medium
CN108040108A