Configuration information pushing method and device
By receiving and storing the configuration information sent by the server in the resource routing, and conducting local queries when receiving the configuration acquisition request from the application side, the problem of long configuration information update time in the prior art is solved, and timely update and push configuration information is realized.
Patent Information
- Application Number
- CN202311260665.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2025-03-28
Smart Images

Figure CN119728762A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to a configuration information push method and device. Background Art
[0002] In the related field, it is necessary to maintain the configuration information of the application side. For example, the current configuration information of the application side is A, but due to changes in the environment, the current configuration information of the application side needs to be updated to B. However, in the related art, the update time of the configuration information of the application side is relatively long. Summary of the invention
[0003] In a first aspect, an embodiment of the present disclosure provides a configuration information push method, which is applied to resource routing, and the method includes: receiving configuration information sent by a server, and storing the configuration information sent by the server locally; receiving a configuration acquisition request sent by an application, suspending the configuration acquisition request, and querying the configuration information of the application locally; before the duration of suspension of the configuration acquisition request reaches a preset duration, if the configuration information of the application is queried locally, and the queried configuration information has changed relative to the current configuration information of the application, pushing the changed configuration information to the application in response to the configuration acquisition request.
[0004] In some embodiments, the method also includes: if the time duration for which the configuration acquisition request is suspended reaches a preset time duration, and the queried configuration information has not changed relative to the current configuration information of the application end, returning first indication information to the application end to indicate that the configuration information has not changed, so that the application end resends the configuration acquisition request in response to the first indication information.
[0005] In some embodiments, the configuration information sent by the server is associated with the version number of the configuration information and stored locally, and different configuration information corresponds to different version numbers; the method also includes: obtaining the version number included in the configuration acquisition request; the version number included in the configuration acquisition request corresponds to the current configuration information of the application; if the version number included in the configuration acquisition request is empty, or the version number included in the configuration acquisition request is inconsistent with the locally stored version number, it is determined that the locally stored configuration information has changed relative to the current configuration information of the application.
[0006] In some embodiments, the method further includes: comparing the configuration information sent by the server with the locally stored configuration information; if the configuration information sent by the server is inconsistent with the locally stored configuration information, updating the locally stored configuration information and the version number of the locally stored configuration information.
[0007] In some embodiments, the configuration information sent by the server is stored in a local cache and a local database respectively; the locally querying the configuration information of the application includes: querying the configuration information of the application in the local cache; if not found, querying the configuration information of the application in the local database.
[0008] In some embodiments, the method further includes: clearing configuration information in the local cache whose cache duration reaches a preset duration threshold from the local cache.
[0009] In some embodiments, the method also includes: if the local database cannot be accessed, requesting the configuration information of the application from the server; if the configuration information returned by the server is changed relative to the current configuration information of the application, pushing the configuration information returned by the server to the application.
[0010] In some embodiments, the configuration information stored locally is written into a local configuration file when preset conditions are met; after requesting the configuration information of the application end from the server end, the method further includes: if the configuration information sent by the server end is not received, querying the configuration information of the application end in the local configuration file; if the configuration information is found, and the configuration information queried from the local configuration file is changed relative to the current configuration information of the application end, pushing the configuration information queried from the local configuration file to the application end.
[0011] In some embodiments, the method further includes: if the configuration information of the application end is not found in the local configuration file, returning second indication information to the application end indicating that the configuration information of the application end is not found.
[0012] In some embodiments, the method further includes: requesting configuration information of a target application from the server at a preset time interval; the target application is an application that has sent a configuration acquisition request to a resource router.
[0013] In some embodiments, the configuration information of the application end stored locally is pre-encrypted based on the key of the application end; pushing the changed configuration information to the application end includes: decrypting the changed configuration information of the application end; and pushing the decrypted configuration information to the application end.
[0014] In some embodiments, after pushing the changed configuration information to the application end, the method further includes: monitoring the push result.
[0015] In a second aspect, an embodiment of the present disclosure provides a configuration information pushing device, which is applied to resource routing, and the device includes: a first receiving module, which is used to receive the configuration information sent by the server, and store the configuration information sent by the server locally; a second receiving module, which is used to receive a configuration acquisition request sent by an application, query the configuration information of the application locally, and suspend the configuration acquisition request; a pushing module, which is used to push the changed configuration information to the application in response to the configuration acquisition request before the configuration acquisition request is suspended for a preset period of time, if the configuration information of the application is queried locally, and the queried configuration information is changed relative to the current configuration information of the application.
[0016] In some embodiments, the device also includes: a sending module, which is used to return first indication information to the application end to indicate that the configuration information has not changed, if the time duration for which the configuration acquisition request is suspended reaches a preset time duration and the queried configuration information has not changed relative to the current configuration information of the application end, so that the application end resends the configuration acquisition request in response to the first indication information.
[0017] In some embodiments, the configuration information sent by the server is associated with the version number of the configuration information and stored locally, and different configuration information corresponds to different version numbers; the device also includes: an acquisition module, used to obtain the version number included in the configuration acquisition request; the version number included in the configuration acquisition request corresponds to the current configuration information of the application; a determination module, used to determine that the locally stored configuration information has changed relative to the current configuration information of the application if the version number included in the configuration acquisition request is empty, or the version number included in the configuration acquisition request is inconsistent with the locally stored version number.
[0018] In some embodiments, the device also includes: a comparison module for comparing the configuration information sent by the server with the locally stored configuration information; an update module for updating the locally stored configuration information and the version number of the locally stored configuration information if the configuration information sent by the server is inconsistent with the locally stored configuration information.
[0019] In some embodiments, the configuration information sent by the server is stored in a local cache and a local database respectively; the second receiving module is specifically used to: query the configuration information of the application in the local cache; if not found, query the configuration information of the application in the local database.
[0020] In some embodiments, the device further includes: a clearing module, configured to clear, from the local cache, configuration information whose cache duration in the local cache reaches a preset duration threshold.
[0021] In some embodiments, the device also includes: a first request module, used to request the configuration information of the application end from the server end if the local database cannot be accessed; a second push module, used to push the configuration information returned by the server end to the application end if the configuration information returned by the server end is changed relative to the current configuration information of the application end.
[0022] In some embodiments, the configuration information stored locally is written into a local configuration file if preset conditions are met; the device also includes: a query module, which is used to query the configuration information of the application end in the local configuration file if the configuration information sent by the server end is not received; a third push module, which is used to push the configuration information queried from the local configuration file to the application end if the configuration information queried from the local configuration file is changed relative to the current configuration information of the application end.
[0023] The query module further includes: a second sending module, which is used to return second indication information to the application end indicating that the configuration information of the application end has not been queried if the configuration information of the application end is not queried in the local configuration file.
[0024] In some embodiments, the device further includes: a second request module, configured to request configuration information of a target application from the server at a preset time interval; the target application is an application that has sent a configuration acquisition request to a resource router.
[0025] In some embodiments, the configuration information of the application end stored locally is pre-encrypted based on the key of the application end; the push module is specifically used to: decrypt the changed configuration information of the application end; and push the decrypted configuration information to the application end.
[0026] In some embodiments, the device further includes: a monitoring module, configured to monitor the push result after pushing the changed configuration information to the application end.
[0027] In a third aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any embodiment of the present disclosure.
[0028] In a fourth aspect, an embodiment of the present disclosure provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in any embodiment of the present disclosure when executing the program.
[0029] In the embodiment of the present disclosure, after receiving the configuration acquisition request, the resource routing will suspend the configuration acquisition request and query the configuration information of the application locally. During the period when the configuration acquisition request is suspended, as long as the resource routing monitors that the configuration information of the application has changed, the changed configuration information can be pushed to the application immediately without waiting for the application to send the configuration acquisition request next time. Therefore, the above method can effectively reduce the update time of the configuration information, so that the application can obtain the changed configuration information in time. The scheme of the embodiment of the present disclosure is illustrated below.
[0030] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The drawings herein are incorporated into the specification and constitute a part of the present disclosure. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.
[0032] Figure 1 It is a schematic diagram of an application scenario of an embodiment of the present disclosure.
[0033] Figure 2 It is a flowchart of the configuration information pushing method of the embodiment of the present disclosure.
[0034] Figure 3A and Figure 3B They are schematic diagrams of a method of pushing configuration information based on version numbers in an embodiment of the present disclosure.
[0035] Figure 4A , Figure 4B and Figure 4C These are schematic diagrams of different situations in which resource routing returns information to the application side.
[0036] Figure 5 It is a schematic diagram of the overall process of an embodiment of the present disclosure.
[0037] Figure 6 It is a block diagram of a configuration information pushing device according to an embodiment of the present disclosure.
[0038] Figure 7 is a schematic diagram of a computer device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0039] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0040] The terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items. In addition, the term "at least one" herein means any combination of at least two of any one or more of a plurality of.
[0041] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0042] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present disclosure and to make the above-mentioned purposes, features and advantages of the embodiments of the present disclosure more obvious and understandable, the technical solutions in the embodiments of the present disclosure are further described in detail below in conjunction with the accompanying drawings.
[0043] Due to environmental changes and other reasons, the configuration information of the application end 10 may change. In the related art, the application end 10 generally requests configuration information from the server end 30 at a certain time interval. After receiving the request sent by the application end 10, the server end 30 will query whether the configuration information of the application end 10 has changed. If so, the changed configuration information is pushed to the application end 10; if the configuration information of the application end 10 has not changed, the server end 30 will return to the application end 10 an indication that the configuration information has not changed. If the configuration information of the application end 10 changes during the time period from when the server end 30 returns the above indication information to the application end 10 to when the application end 10 next requests configuration information from the server end 30, it is necessary to wait for the application end 10 to request configuration information from the server end 30 next time, and then the server end 30 can return the changed configuration information to the application end 10. It can be seen that in the above method, the update time of the configuration information of the application end 10 is relatively long, and the update of the configuration information is not timely enough.
[0044] Based on this, the embodiment of the present disclosure provides a configuration information push method and device. The embodiment of the present disclosure adds a resource routing 20 between the application end 10 and the server end 30. The resource routing 20 can receive the configuration information sent by the server end 30 and store the configuration information locally. The resource routing 20 can also receive a configuration acquisition request sent by the application end 10. After receiving the configuration acquisition request, on the one hand, the resource routing 20 will suspend the configuration acquisition request; on the other hand, the resource routing 20 will query the configuration information of the application end 10 locally. If the resource routing 20 locally queries the configuration information of the application end 10 before the duration of the configuration acquisition request being suspended reaches a preset duration, and the queried configuration information is changed relative to the current configuration information of the application end 10, the changed configuration information can be pushed to the application end 10 in response to the configuration acquisition request. In the above scheme, during the period when the configuration acquisition request is suspended, as long as the resource routing 20 monitors that the configuration information of the application end 10 has changed, the changed configuration information can be pushed to the application end 10 immediately without waiting for the application end 10 to send the configuration acquisition request next time. Therefore, the above method can effectively reduce the update time of the configuration information, so that the application terminal 10 can obtain the changed configuration information in time. The following is an example of the solution of the embodiment of the present disclosure.
[0045] Figure 1 A schematic diagram of an application scenario of an embodiment of the present disclosure is shown. The application scenario includes an application end 10, a resource router 20, and a server end 30. The server end 30 is used to store configuration information of the application end 10 and push the configuration information to the resource router 20. The resource router 20 can store the configuration information pushed by the server end 30 locally. The resource router 20 can establish communication connections with one or more application ends 10 respectively, and push configuration information to each application end 10.
[0046] Figure 2 A flowchart of a configuration information push method according to an embodiment of the present disclosure is shown. The method can be applied to Figure 1 In the application scenario shown in FIG. 20 , the method includes:
[0047] Step S1: receiving the configuration information sent by the server 30, and storing the configuration information sent by the server 30 locally;
[0048] Step S2: receiving a configuration acquisition request sent by the application end 10, suspending the configuration acquisition request, and querying the configuration information of the application end 10 locally;
[0049] Step S3: Before the configuration acquisition request is suspended for a preset period of time, if the configuration information of the application end 10 is queried locally and the queried configuration information is changed relative to the current configuration information of the application end 10, the changed configuration information is pushed to the application end 10 in response to the configuration acquisition request.
[0050] In the above embodiment, step S1 and step S2 can be executed asynchronously. That is, the process of resource routing 20 receiving the configuration information sent by the server 30 and the process of receiving the configuration acquisition request sent by the application 10 can be performed relatively independently. Regardless of whether the resource routing 20 receives the configuration information sent by the server 30, the application 10 can send a configuration acquisition request to the resource routing 20, and the configuration acquisition request can be received by the resource routing 20. Similarly, regardless of whether the resource routing 20 receives the configuration acquisition request sent by the application 10, the server 30 can send configuration information to the resource routing 20, and the configuration information can be received and stored locally by the resource routing 20. By executing the above two steps asynchronously, the blocking of the configuration acquisition request can be reduced, and the change perception and query efficiency of the configuration information can be improved. The above steps S1 and S2 can be implemented based on the asynchronous servlet of servlet3.0.
[0051] In step S1, the developer can configure and save the configuration information of the application end 10 on the server end 30, wherein the saved configuration information can be the changed configuration information or the unchanged configuration information (i.e., the same as the configuration information before configuration). The server end 30 can send the currently saved configuration information to the resource routing 20 in response to the configuration information being saved. In this way, after the configuration information is configured, the server end 30 can automatically send the configured configuration information to the resource routing 20 without performing additional sending operations, thereby improving the efficiency of sending the configuration information. Further, when the number of application ends 10 is greater than 1, the server end 30 can bind the configuration information and the identification information of the application end 10 to which the configuration information belongs, and send the configuration information and the identification information bound to the configuration information to the resource routing 20. It can be understood that the above is only an exemplary description. In other examples, the server end 30 can also use other methods to send configuration information to the resource routing 20. The server 30 may also send identification information of the application 10 to which the configuration information belongs (eg, the ID of the application 10 ) to the resource router 20 , so that the resource router 20 can determine the application 10 to which the configuration information belongs.
[0052] The resource routing 20 can store the configuration information sent by the server 30 locally. Specifically, the resource routing 20 can include a database locally, and the resource routing 20 can store the configuration information sent by the server 30 in the local database (DataBase, DB). In order to improve the efficiency of obtaining configuration information, the resource routing 20 can also store the configuration information sent by the server 30 in a local cache (local cache). Furthermore, since the space of the local cache is limited, a validity period can also be set for the configuration information stored in the local cache. If the configuration information in the local cache exceeds the validity period, the configuration information can be cleared from the local cache. In an embodiment where the configuration information is bound to the identification information of the application end 10, the resource routing 20 can store the configuration information and the identification information bound to the configuration information in a local database or a local cache.
[0053] In step S2, the resource router 20 may receive a configuration acquisition request sent by any one or more application terminals 10 connected thereto. The configuration acquisition request sent by each application terminal 10 may carry the identification information of the application terminal 10, so that the resource router 20 can determine which application terminal 10 sent the configuration acquisition request.
[0054] After receiving the configuration acquisition request sent by the application end 10, the resource router 20 may suspend the configuration acquisition request. Suspension means that the configuration acquisition request is in the "in progress" state, but has not been responded to. The maximum suspension time of the configuration acquisition request can be preset. After suspending the configuration acquisition request, the resource router 20 can start timing until the timing reaches the maximum suspension time, or the configuration acquisition request is responded to. By suspending the configuration acquisition request, on the one hand, the configuration acquisition request is in an "in progress" state at the resource router 20 end. Therefore, during the period when the configuration acquisition request of the application end 10 is suspended, the application end 10 does not need to resend the configuration acquisition request to the resource router 20, thereby reducing the number of times the application end 10 sends the configuration acquisition request to the resource router 20, thereby reducing the occupation of network resources and reducing the probability of communication congestion; on the other hand, the suspended configuration acquisition request has not been responded to at the resource router 20 end. Therefore, at any time during the period when the configuration acquisition request of the application end 10 is suspended, as long as the resource router 20 queries that the configuration information of the application end 10 has changed, it can immediately respond to the configuration acquisition request without waiting for the application end 10 to respond after sending the configuration acquisition request next time, thereby improving the response efficiency of the configuration acquisition request, and then improving the efficiency of pushing the changed configuration information to the application end 10.
[0055] In addition to suspending the configuration acquisition request, the resource routing 20 can also query the configuration information of the application end 10 locally. As described above, the configuration information may be stored in the local cache and the local database at the same time. Therefore, the resource routing 20 can first query the configuration information of the application end 10 from the local cache. Since the local cache may be lost due to power failure or other reasons, or cleared when the cache is full, the configuration information of the application end 10 may not be queried in the local cache. If it is not found, the configuration information of the application end 10 is queried from the local database. Furthermore, due to reasons such as local database failure, it may not be accessible from the local database. At this time, the resource routing 20 can actively request the configuration information of the application end 10 from the server 30. If the configuration information returned by the server 30 is changed relative to the current configuration information of the application end 10, the configuration information returned by the server 30 is pushed to the application end 10.
[0056] In some embodiments, the resource routing 20 may write the configuration information stored locally into a local configuration file (local file) if the configuration information stored locally meets a preset condition. The preset condition may be reaching a preset time interval, or receiving a write instruction to the local configuration file, etc. The resource routing 20 may back up the configuration information stored locally through the local configuration file. After the resource routing 20 requests the configuration information of the application end 10 from the server end 30, if the configuration information sent by the server end 30 is not received, the resource routing 20 may query the configuration information of the application end 10 in the local configuration file. If the configuration information of the application end 10 queried from the local configuration file is changed relative to the current configuration information of the application end 10, the configuration information queried from the local configuration file is pushed to the application end 10.
[0057] If the configuration information of the application end 10 is not found in the local configuration file, the resource router 20 may return second indication information indicating that the configuration information of the application end 10 is not found to the application end 10. The application end 10 may display the second indication information to prompt the user. The application end 10 may also display a fault reporting portal, through which the user may report the fault so that the operation and maintenance personnel can handle the fault.
[0058] In some embodiments, the resource routing 20 may also request the configuration information of the target application 10 from the server 30 at a preset time interval. The target application 10 may include all application 10s that are in communication connection with the resource routing 20, that is, the resource routing 20 may request the full amount of configuration information from the server 30 at a preset time interval. Alternatively, the target application 10 may only include the application 10 that has sent a configuration acquisition request to the resource routing 20. That is, the resource routing 20 may request the configuration information of some application 10 from the server 30 at a preset time interval. Due to a failure in the network connection between the server 30 and the resource routing 20, or a failure in the local database of the resource routing 20, the process of the server 30 sending configuration information to the resource routing 20 may fail. Therefore, by actively pulling configuration information from the server 30 on a regular basis, the resource routing 20 can reduce the situation where the resource routing 20 fails to obtain the latest configuration information due to the above reasons.
[0059] In step S3, at any time before the configuration acquisition request is suspended for a preset time, the resource router 20 can determine whether the configuration information of the application end 10 is locally queried. If so, it is determined whether the queried configuration information has changed relative to the current configuration information of the application end 10. If so, the changed configuration information is pushed to the application end 10.
[0060] In some embodiments, after receiving the configuration information sent by the server 30, the resource routing 20 can generate a version number of the configuration information. Different configuration information corresponds to different version numbers. The resource routing 20 can store the configuration information of the application end 10 and the version number of the configuration information locally in association. Furthermore, since the number of application ends 10 connected to the resource routing 20 may be greater than 1, the resource routing 20 can also store the configuration information of the application end 10, the version number of the configuration information, and the identification information of the application end 10 locally in association. Similarly, the associated stored configuration information, the version number of the configuration information, and the identification information of the application end 10 can be stored in the local cache and the local database, respectively.
[0061] On this basis, when the application end 10 sends a configuration acquisition request to the resource router 20, the version number of the current configuration information of the application end 10 can be carried in the configuration acquisition request, and the version number corresponds to the current configuration information of the application end 10. The resource router 20 can determine whether the queried configuration information has changed relative to the current configuration information of the application end 10 based on the version number carried in the configuration acquisition request and the version number stored locally. Specifically, if the version number carried in the configuration acquisition request is the same as the version number stored locally, it is determined that the queried configuration information has not changed relative to the current configuration information of the application end 10. If the version number carried in the configuration acquisition request is different from the version number stored locally, it is determined that the queried configuration information has changed relative to the current configuration information of the application end 10.
[0062] See also Figure 3A, when the number of application terminals 10 is greater than 1, the server 30 can push the identification information of the application terminal 10 and the configuration information of the application terminal 10 to the resource routing 20. As shown in the figure, the configuration information pushed by the server 30 to the resource routing 20 includes the configuration information XX of the application terminal 10 (referred to as the application terminal 10A) with the identification information A and the configuration information YY of the application terminal 10 (referred to as the application terminal 10B) with the identification information B. The resource routing 20 can associate and store the identification information of the application terminal 10 with the configuration information of the corresponding application terminal 10, and generate a version number for each configuration information. Assume that the version number is a numeric type, and the initial value of the version number is "0". If the configuration information XX is the configuration information of the application terminal 10A that the resource routing 20 receives from the server 30 for the first time, the version number corresponding to the configuration information XX of the application terminal 10A is "0". If the configuration information YY is the configuration information of the application end 10B received by the resource routing 20 from the server end 30 for the second time, the version number corresponding to the configuration information YY of the application end 10B is "1" by adding 1 to the initial value of the version number. Assume that the application end 10A and the application end 10B send configuration acquisition requests to the resource routing 20 respectively, and the ID carried in the configuration acquisition request sent by the application end 10A is A and the version number is "0", and the ID carried in the configuration acquisition request sent by the application end 10B is B and the version number is "0", then the version number carried in the configuration acquisition request of the application end 10A is the same as the version number stored locally by the resource routing 20. If the resource routing 20 receives new configuration information of the application end 10A before the duration of suspending the configuration acquisition request of the application end 10A reaches the preset duration, the resource routing 20 can update the configuration information XX of the application end 10A stored locally to the new configuration information, and update the version number of the new configuration information to "1", and return the new configuration information and its corresponding version number "1" to the application end 10A. In addition, the version number carried in the configuration acquisition request of the application end 10B is different from the version number stored locally by the resource router 20. Therefore, the resource router 20 will directly push the configuration information YY and its corresponding version number "1" to the application end 10B.
[0063] In particular, when the application end 10 sends a configuration acquisition request to the resource router 20 for the first time, the application end 10 does not know the version number of the configuration information. Therefore, the configuration acquisition request sent by the application end 10 to the resource router 20 for the first time may not carry a version number (that is, the version number included in the configuration acquisition request is empty). When the resource router 20 parses and finds that the version number included in the configuration acquisition request is empty, it can also determine that the queried configuration information has changed relative to the current configuration information of the application end 10.
[0064] See also Figure 3B ,and Figure 3AThe difference between the embodiments shown is that the configuration acquisition request sent by the application end 10A to the resource router 20 does not carry a version number, but only carries the identification information of the application end 10A. Therefore, the resource router 20 can directly push the configuration information XX of the currently stored application end 10A and its corresponding version number "0" to the application end 10A. The processing process of the application end 10B can be seen in Figure 3A The embodiments shown will not be described in detail here.
[0065] When it is determined that the queried configuration information has changed relative to the current configuration information of the application end 10, the resource router 20 can push the queried configuration information and the version number of the configuration information to the application end 10. The application end 10 can store the version number of the configuration information and carry the stored version number in the configuration acquisition request when sending a configuration acquisition request next time.
[0066] Furthermore, the resource router 20 can compare the configuration information sent by the server 30 with the locally stored configuration information. If the configuration information sent by the server 30 is inconsistent with the locally stored configuration information, it means that the server 30 pushes new configuration information. Therefore, the resource router 20 can update the locally stored configuration information and the version number of the configuration information. Among them, the configuration information can be a string, and the comparison of two configuration information can be to compare the characters at corresponding positions in the strings corresponding to the two configuration information one by one. If the characters at any position in the two strings are different, it is determined that the two configuration information are inconsistent, and the version number of the configuration information is updated. If the characters at any position in the two strings are the same, it is determined that the two configuration information are consistent, and the version number of the configuration information remains unchanged.
[0067] For example, the locally stored configuration information is "abc", and the latest configuration information received by the resource router 20 from the server 30 is "abd", then the first character, the second character, and the third character of the two configuration information can be compared in sequence. Since the third characters of the two configuration information are different, it can be determined that the two configuration information are inconsistent.
[0068] In some embodiments, the version number of the configuration information is of a numerical type, for example, its initial value may be "0". After the resource router 20 receives the configuration information from the server 30, if it is determined that the received configuration information is inconsistent with the locally stored configuration information, the version number of the configuration information is increased by 1. Continuing with the previous example, assume that the configuration information stored locally by the resource router 20 is "abc" and its version number is 1. The latest configuration information received by the resource router 20 from the server 30 is "abd". Since it is inconsistent with the configuration information stored locally by the resource router 20, the configuration information stored locally by the resource router 20 can be updated to "abd", and at the same time, the version number of the configuration information "abd" can be set to 2.
[0069] It is to be understood that the above is only an exemplary description and is not intended to limit the present disclosure. In other embodiments, the version number may also be of other types (e.g., character type, or including both characters and numbers). In addition, the version number may also be updated in other ways, which are not listed here one by one.
[0070] In some embodiments, if the duration of the configuration acquisition request being suspended reaches a preset duration, and the queried configuration information has not changed relative to the current configuration information of the application end 10, the resource routing 20 can return to the application end 10 a first indication information indicating that the configuration information has not changed, so that the application end 10 resends the configuration acquisition request in response to the first indication information. In this embodiment, as long as the application end 10 receives the first indication information, it can immediately resend the configuration acquisition request to the resource routing 20. After receiving the resent configuration acquisition request, the resource routing 20 can re-execute the above steps S2 and S3. In this way, the resource routing 20 can continue to process the configuration acquisition request of the application end 10 almost uninterruptedly. After the server end 30 sends new configuration information, the resource routing 20 can quickly push the new configuration information to the application end 10.
[0071] Figure 4A , Figure 4B and Figure 4C Several possible situations of the configuration information push method of the embodiment of the present disclosure are compared. Figure 4A In the illustrated embodiment, after receiving the configuration acquisition request sent by the application terminal 10, the resource router 20 suspends the configuration acquisition request. Until the suspension duration reaches the preset duration T0, the resource router 20 clock does not query the current configuration information of the application terminal 10 for changes. Therefore, when the suspension duration reaches the preset duration T0, the resource router 20 returns the first indication information to the application terminal 10.
[0072] exist Figure 4BIn the illustrated embodiment, after receiving the configuration acquisition request sent by the application end 10, the resource router 20 suspends the configuration acquisition request. Before the suspension duration reaches the preset duration T0, the resource router 20 receives the changed configuration information sent by the server end 30, and pushes the changed configuration information to the application end 10. The duration from suspending the configuration acquisition request to the resource router 20 pushing the changed configuration information to the application end 10 is T1, and T1≤T0.
[0073] exist Figure 4C In the illustrated embodiment, after the resource routing 20 returns the first indication information to the application end 10 for the last time, the application end 10 sends a configuration acquisition request to the resource routing 20 again, and the resource routing 20 can receive the configuration acquisition request. Between the time when the resource routing 20 returns the first indication information to the application end 10 and the time when the application end 10 receives the configuration acquisition request again, the resource routing 20 may receive the changed configuration information sent by the service end 30. Therefore, after the resource routing 20 receives the configuration acquisition request, it can be determined that the local configuration information has changed relative to the current configuration information of the application end 10, so as to push the changed configuration information to the application end 10. The time from the resource routing 20 receiving the configuration acquisition request to the resource routing 20 pushing the changed configuration information to the application end 10 is T2, and T2 <T0。
[0074] In some embodiments, the configuration information of the application end 10 stored locally in the resource routing 20 is encrypted based on the key of the application end 10 in advance. The resource routing 20 can decrypt the changed configuration information of the application end 10 and push the decrypted configuration information to the application end 10. The server end 30 can identify the category of the configuration information. If the server end 30 identifies that the category of the configuration information is a sensitive category (for example, a password), the encryption interface opened in advance for the server end 30 by the resource routing 20 can be called. The server end 30 can send the configuration information to be encrypted and the identification information of the application end 10 to which the configuration information to be encrypted belongs to the resource routing 20 through the encryption interface. The resource routing 20 can encrypt the configuration information based on the identification information of the application end 10 sent by the server end 30, using the encryption key corresponding to the application end 10. Among them, the encryption keys corresponding to different application ends 10 can be the same or different. After receiving the configuration acquisition request sent by the application end 10, the resource routing 20 can also use the decryption key corresponding to the application end 10 to decrypt the encrypted configuration information, and push the decrypted configuration information to the application end 10.
[0075] The encryption key and the decryption key may be stored locally in advance by the resource router 20. In some embodiments, when receiving a call request for an encryption interface from the server 30, and the call request carries the identification information of a certain application 10 for the first time, the resource router 20 may generate and store the encryption key and the decryption key corresponding to the application 10 based on the identification information of the application 10 carried in the call request. Subsequently, the stored encryption key and the decryption key may be used to directly encrypt and decrypt the configuration information of the application 10.
[0076] In some embodiments, the resource router 20 may also monitor the push result. The monitoring information includes at least the following: the change time of the configuration information, the configuration information before the change, the configuration information after the change, the application end 10 to which the configuration information belongs, and whether the configuration information push is successful. The resource router 20 may store the above monitoring information in a local database, and in response to the user's monitoring information query request, display the monitoring information in the local database to the user.
[0077] Figure 5 The overall flow chart of the embodiment of the present disclosure is shown. After the resource routing 20 receives the configuration acquisition request sent by the application end 10, the resource routing 20 can first query the configuration information of the application end 10 from the local cache. If the query is found, and the configuration information queried from the local cache is changed relative to the current configuration information of the application end 10, the configuration information is returned to the application end 10. If not found, the resource routing 20 queries the configuration information from the local database (DB). If the query is found, and the configuration information queried from the local database is changed relative to the current configuration information of the application end 10, the configuration information is returned to the application end 10. If the local database cannot be accessed, the resource routing 20 requests the configuration information of the application end 10 from the server end 30. If the configuration information returned by the server end 30 is received, and the configuration information received from the server end 30 is changed relative to the current configuration information of the application end 10, the resource routing 20 returns the configuration information returned by the server end 30 to the application end 10. If the configuration information returned by the server 30 is not received, the resource router 20 queries the backup configuration information from the local configuration file. If the configuration information is found, and the configuration information found from the local configuration file is changed relative to the current configuration information of the application 10, the configuration information is returned to the application 10. If the configuration information is not found, the resource router 20 notifies the application 10 that the configuration information does not exist.
[0078] See also Figure 6 The embodiment of the present disclosure also provides a configuration information push device, which is applied to resource routing 20, and the device includes:
[0079] The first receiving module 11 is used to receive the configuration information sent by the server 30 and store the configuration information sent by the server 30 locally;
[0080] The second receiving module 12 is used to receive a configuration acquisition request sent by the application terminal 10, query the configuration information of the application terminal 10 locally, and suspend the configuration acquisition request;
[0081] The push module 13 is used to push the changed configuration information to the application terminal 10 in response to the configuration acquisition request before the configuration acquisition request is suspended for a preset period of time, if the configuration information of the application terminal 10 is queried locally and the queried configuration information is changed relative to the current configuration information of the application terminal 10.
[0082] An embodiment of the present disclosure further provides a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any of the above embodiments is implemented.
[0083] Figure 7 A more specific hardware structure diagram of a computing device provided by an embodiment of the present disclosure is shown, and the device may include: a processor 21, a memory 22, an input / output interface 23, a communication interface 24, and a bus 25. The processor 21, the memory 22, the input / output interface 23, and the communication interface 24 are connected to each other in communication within the device through the bus 25.
[0084] The processor 21 can be implemented by a general central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits, etc., for executing relevant programs to implement the technical solutions provided by the embodiments of the present disclosure. The processor 21 can also include a graphics card, which can be a Nvidia titan X graphics card or a 10120Ti graphics card, etc.
[0085] The memory 22 can be implemented in the form of a read-only memory (ROM), a random access memory (RAM), a static storage device, a dynamic storage device, etc. The memory 22 can store an operating system and other application programs. When the technical solution provided by the embodiment of the present disclosure is implemented by software or firmware, the relevant program code is stored in the memory 22 and called and executed by the processor 21.
[0086] The input / output interface 23 is used to connect the input / output module to realize information input and output. The input / output module can be configured as a component in the device (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0087] The communication interface 24 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0088] The bus 25 includes a path that transmits information between the various components of the device (eg, the processor 21, the memory 22, the input / output interface 23, and the communication interface 24).
[0089] It should be noted that, although the above device only shows the processor 21, the memory 22, the input / output interface 23, the communication interface 24 and the bus 25, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present disclosure, and does not necessarily include all the components shown in the figure.
[0090] The present disclosure also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described in any of the above embodiments is implemented.
[0091] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0092] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the embodiments of the present disclosure can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the embodiments of the present disclosure is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present disclosure or some parts of the embodiments.
[0093] The systems, devices, modules or units described in the above embodiments may be implemented by computer devices or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0094] Each embodiment in the present disclosure is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, wherein the modules described as separate components may or may not be physically separated, and the functions of each module can be implemented in the same one or more software and / or hardware when implementing the embodiment of the present disclosure. It is also possible to select some or all of the modules according to actual needs to achieve the purpose of the embodiment. A person of ordinary skill in the art can understand and implement it without paying creative labor.
[0095] The above is only a specific implementation of the embodiment of the present disclosure. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the embodiment of the present disclosure. These improvements and modifications should also be regarded as the protection scope of the embodiment of the present disclosure.
Claims
1. A configuration information push method, applied to resource routing, the method comprising: Receive the configuration information sent by the server, and store the configuration information sent by the server locally; Receive a configuration acquisition request sent by an application, suspend the configuration acquisition request, and query the configuration information of the application locally; Before the configuration acquisition request is suspended for a preset period of time, if the configuration information of the application end is queried locally and the queried configuration information is changed relative to the current configuration information of the application end, the changed configuration information is pushed to the application end in response to the configuration acquisition request.
2. The method according to claim 1, further comprising: If the configuration acquisition request is suspended for a preset period of time, and the queried configuration information has not changed relative to the current configuration information of the application end, first indication information indicating that the configuration information has not changed is returned to the application end, so that the application end resends the configuration acquisition request in response to the first indication information.
3. According to the method of claim 1, the configuration information sent by the server is associated with the version number of the configuration information and stored locally, and different configuration information corresponds to different version numbers; the method further comprises: Obtaining a version number included in the configuration acquisition request; the version number included in the configuration acquisition request corresponds to the current configuration information of the application end; If the version number included in the configuration acquisition request is empty, or the version number included in the configuration acquisition request is inconsistent with the locally stored version number, it is determined that the locally stored configuration information has changed relative to the current configuration information of the application end.
4. The method according to claim 3, further comprising: Compare the configuration information sent by the server with the locally stored configuration information; If the configuration information sent by the server is inconsistent with the locally stored configuration information, the locally stored configuration information and the version number of the locally stored configuration information are updated.
5. According to the method of claim 1, the configuration information sent by the server is stored in a local cache and a local database respectively; The locally querying the configuration information of the application terminal includes: Querying the local cache for configuration information of the application end; If not found, query the local database for the configuration information of the application end.
6. The method according to claim 5, further comprising: The configuration information whose cache duration in the local cache reaches a preset duration threshold is cleared from the local cache.
7. The method according to claim 5, further comprising: If the local database cannot be accessed, request the configuration information of the application end from the server end; If the configuration information returned by the server is changed relative to the current configuration information of the application, the configuration information returned by the server is pushed to the application.
8. According to the method of claim 7, the configuration information stored locally is written into the local configuration file when the preset conditions are met; After requesting the configuration information of the application end from the server end, the method further includes: If the configuration information sent by the server is not received, query the configuration information of the application in the local configuration file; If found, and the configuration information found from the local configuration file is changed relative to the current configuration information of the application end, the configuration information found from the local configuration file is pushed to the application end.
9. The method according to claim 8, further comprising: If the configuration information of the application end is not found in the local configuration file, second indication information indicating that the configuration information of the application end is not found is returned to the application end.
10. The method according to claim 1, further comprising: Requesting the configuration information of the target application from the server at a preset time interval; The target application end is the application end that has sent a configuration acquisition request to the resource router.
11. The method according to claim 1, wherein the configuration information of the application end stored locally is encrypted in advance based on the key of the application end; The pushing of the changed configuration information to the application terminal includes: Decrypting the changed configuration information of the application end; Push the decrypted configuration information to the application end.
12. The method according to claim 1, after pushing the changed configuration information to the application end, the method further comprises: Monitor the push results.
13. A configuration information push device, applied to resource routing, the device comprising: A first receiving module, used to receive the configuration information sent by the server, and store the configuration information sent by the server locally; A second receiving module is used to receive a configuration acquisition request sent by an application end, query the configuration information of the application end locally, and suspend the configuration acquisition request; A push module is used to push the changed configuration information to the application end in response to the configuration acquisition request before the configuration acquisition request is suspended for a preset period of time, if the configuration information of the application end is queried locally and the queried configuration information is changed relative to the current configuration information of the application end.
14. A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
15. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 12 when executing the program.