CN105677466B - The method and apparatus of the downgrade processing of third-party application interface - Google Patents

The method and apparatus of the downgrade processing of third-party application interface Download PDF

Info

Publication number
CN105677466B
CN105677466B CN201511031311.5A CN201511031311A CN105677466B CN 105677466 B CN105677466 B CN 105677466B CN 201511031311 A CN201511031311 A CN 201511031311A CN 105677466 B CN105677466 B CN 105677466B
Authority
CN
China
Prior art keywords
degradation
party application
application interface
configuration file
working condition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201511031311.5A
Other languages
Chinese (zh)
Other versions
CN105677466A (en
Inventor
罗磊
钟宇亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201511031311.5A priority Critical patent/CN105677466B/en
Publication of CN105677466A publication Critical patent/CN105677466A/en
Application granted granted Critical
Publication of CN105677466B publication Critical patent/CN105677466B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/552Detecting local intrusion or implementing counter-measures involving long-term monitoring or reporting

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The embodiment of the invention discloses the degradation processing methods and device of a kind of third-party application interface, this method comprises: query configuration file is according to the call request of the third-party application interface of generation with the working condition of the determination third-party application interface;If the working condition of the third-party application interface is degrading state, according to the downgrade processing rule in the configuration file, the strategy that degrades is determined;The degradation strategy is executed, the processing result of the call request is obtained.To solve in the prior art the problem that server is unstable to the calling of third-party application interface, causes the processing failure rate of business processing request high.

Description

The method and apparatus of the downgrade processing of third-party application interface
Technical field
The present embodiments relate at microcomputer data processing more particularly to a kind of degradation of third-party application interface The method and apparatus of reason.
Background technique
With becoming increasingly popular for network, the application of internet has been deep into every field, and is the daily life of user Living, working and learning provide convenient and fast service.Application program is a kind of software being mounted on intelligent terminal, usually as visitor Family end, with background server with being combined into the corresponding function services of user's offer.
With the development of the network integration, during background server provides function services for client, often will appear To the calling demand of other applications, that is, realize that the background server of the first function handles the business processing request of the first function When, the demand of the second function of processing can be generated, then needs to call and is able to achieve the third-party application interface of the second function to realize the Two functions.The processing result of second function is re-incorporated into the treatment process of the second function, and final result returns to client.
However since there are many type of third party application, interface stability is irregular, so that the third-party application The calling of interface cannot be completely trusted.
Therefore, the prior art is unstable to the calling of third-party application interface, failure rate is high, not can guarantee efficient for visitor Family end provides normal service processing function.
Summary of the invention
The embodiment of the invention provides a kind of method and apparatus of the downgrade processing of third-party application interface, efficiently to ensure The business function for being related to third-party application interface calling operates normally.
On the one hand, the embodiment of the invention provides a kind of degradation processing methods of third-party application interface, comprising:
According to the call request of the third-party application interface of generation, query configuration file is connect with the determination third-party application The working condition of mouth;
If the working condition of the third-party application interface is degrading state, according to the degradation in the configuration file Processing rule, determines the strategy that degrades;
The degradation strategy is executed, the processing result of the call request is obtained.
On the other hand, the embodiment of the invention also provides a kind of downgrade processing devices of third-party application interface, comprising:
Working condition determining module, for the call request according to the third-party application interface of generation, query configuration file With the working condition of the determination third-party application interface;
The tactful determining module that degrades is matched when the working condition for third-party application interface is degrading state according to described The downgrade processing rule in file is set, determines the strategy that degrades;
Processing result obtains module, for executing the degradation strategy, obtains the processing result of the call request.
Technical solution provided in an embodiment of the present invention, server according to the call request of the third-party application interface of generation, Query configuration file determines whether the third-party application interface is in degrading state, if it is, according to the drop in configuration file Grade processing rule determines the strategy that degrades, and executes the degradation strategy and requested with complete call, and obtain the processing knot of call request Fruit, the technical solution manage the working condition and downgrade processing rule of third-party application interface, Ke Yitong by configuration file It crosses change configuration file and adjusts degradation strategy in real time, without degradation strategy is built in background server to third in advance In the caller of square application interface, so more flexible degradation strategy can be used, to solve backstage in the prior art Server is unstable to the calling of third-party application interface, the problem for causing the processing failure rate requested business processing high.
Detailed description of the invention
Fig. 1 is a kind of flow chart of the degradation processing method for third-party application interface that the embodiment of the present invention one provides;
Fig. 2 is a kind of flow chart of the degradation processing method of third-party application interface provided by Embodiment 2 of the present invention;
Fig. 3 is a kind of process of the method for the degradation time started for record third party interface that the embodiment of the present invention three provides Figure;
Fig. 4 is a kind of structural representation of the downgrade processing device for third-party application interface that the embodiment of the present invention four provides Figure;
Fig. 5 is a kind of flow chart of the degradation processing method for third-party application interface that the embodiment of the present invention five provides.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to just Only the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Embodiment one
Fig. 1 is a kind of flow chart of the degradation processing method for third-party application interface that the embodiment of the present invention one provides.It should Method is applied in the background server of application program, is used cooperatively with the application client being installed in mobile terminal, Above-mentioned mobile terminal can be, but not limited to as any one in smart television, mobile phone, tablet computer or computer.
Referring to Fig.1, the degradation processing method of the third-party application interface includes following operation:
S110, the call request according to the third-party application interface of generation, query configuration file is with the determination third party The working condition of application interface.
In aforesaid operations, configuration file be can store in the background server of client, and can be deposited in configuration file Contain the working condition, downgrade processing rule and its interface identifier of one or more third-party application interfaces.Working condition packet Normal condition and degrading state are included, normal condition is that the third-party application interface does not occur exception, can be normal by background server It calls, degrading state is that the third-party application interface exception occurs, temporarily can not be by background server normal call.Working condition It can be by manually configuring, it can also be based on the default triggering rule that degrades from the dynamic work shape for updating third-party application interface State.
Usual background server can receive the business processing request of client transmission, based on various businesses processing request phase That answers produces the call request to third-party application interface.Third-party application interface herein can be any third party of realization The interface of function.It include the interface identifier of at least one third-party application interface in the call request of the third-party application interface. Background server is before calling corresponding third party's interface according to call request, query configuration file first, according to third party The interface identifier of application interface determines the working condition of different third-party application interfaces.
If the working condition of S120, the third-party application interface is degrading state, according in the configuration file Downgrade processing rule, determine degrade strategy.
If the third-party application interface is in normal condition, background server is normally adjusted according to its corresponding interface identifier With the third-party application interface, if the third-party application interface is in degrading state, background server is according in configuration file Downgrade processing rule determine the degradation strategy that need to currently execute.
Downgrade processing rule in configuration file can there are many forms, downgrade processing rule can refer to background server It can be in advance the degradation strategy of each third-party application interface setting default illustratively to the selection rule for the strategy that degrades, Degradation strategy can also be selected according to the priority of third-party application interface, or can also be connect according to third-party application The current processing status parameter of mouth selects degradation strategy.
In the present embodiment, at least two different degradation strategies are preferably configured with, degradation strategy may include: according to pre- If return value is degraded, is degraded using local cache data, utilizing random rejection service degradation and utilization message queue exceptionization Retry degradation etc..
The benefit of at least two degradation strategy of setting is in background server, when exception occurs in the first strategy that degrades When, background server, which can also continue to call second, degrades strategy to continue to request to carry out to the business processing that client is sent Processing, when third-party application interface being avoided only to be correspondingly arranged on a kind of degradation strategy of fixation, if the degradation strategy occur it is abnormal When, then background server will cannot complete the problem of business processing that client is sent is requested.
When background server query configuration file determines that the working condition of the third-party application interface is degrading state, then The strategy that degrades is determined according to downgrade processing rule.
In a specific embodiment of the embodiment of the present invention, downgrade processing rule refers to connecing according to third-party application The priority of mouth selects degradation strategy, and specific choice process includes following operation:
It operates one, according to the degradation policy priority grade being arranged in the configuration file, is selected according to priority orders current The degradation strategy of priority.
Degradation policy priority grade refers to the sequencing of the selection to different degradation strategies, the priority for the strategy that degrades Setting can be stability setting of the background server according to the strategy that degrades, or can also be operator according to reality What demand was manually set.
When third-party application interface is in degrading state, background server is called according to degradation policy priority grade, first choice The degradation strategy of highest priority.Illustratively, according to degradation policy priority grade, above-mentioned four kinds of degradation strategies can be according to as follows Sequence is ranked up:
Degrade according to default return value;
Degraded using local cache data;
Utilize random rejection service degradation;
Degradation is retried using message queue exceptionization.
I.e. when third-party application interface is in degrading state, background server calls first to degrade according to default return value The business processing request that continues to send client of degradation strategy handle, and obtain the place of the degradation strategy call request Manage result.
If the processing result of operation two, the call request got is processing failure, it is next excellent to return to selection The operation of the degradation strategy of first grade.
Background server analyzes the processing result got, when the processing result for determining the call request is processing When success, the business processing request for determining that client is sent has been completed, and business processing request can be sent to client and is completed Prompt information;When the processing result for determining the call request is processing failure, it is determined that the degradation strategy of current level goes out It is now abnormal, the customer service processing request of client transmission cannot be completed, then continues the degradation strategy for selecting next priority, still By operate one in give degradation strategy collating sequence for, then select using local cache data degrade degradation strategy after The continuous business processing request sent to client is handled, and obtains the processing result of this tactful call request that degrades.
Further, in the another embodiment of the embodiment of the present invention, downgrade processing rule refer to according to The current processing status parameter of third-party application interface selects degradation strategy, and specific choice process includes following behaviour Make:
It operates one, according to the downgrade processing rule being arranged in the configuration file, acquires the third-party application interface Current processing status parameter.
The current processing status parameter of third-party application interface can refer to the concurrent invocation quantity of third-party application interface, And calling response time of third-party application interface etc., it can also include the currently accumulative mistake time of third-party application interface Number.
Operate two, according to the corresponding degradation strategy of the current processing status parameter selection.
The concurrent invocation quantity of third-party application interface is more, then illustrates that the workload of third-party application interface is bigger;The The calling response time of tripartite's application interface is longer, then illustrates that the stability of third-party application interface is lower.For example, third at this time The concurrent invocation quantity of square application interface is mostly and the calling response time of third-party application interface is long, then the drop for selecting stability high Grade strategy.
S130, the degradation strategy is executed, obtains the processing result of the call request.
In aforesaid operations, background server determines the strategy that degrades according to the downgrade processing rule in configuration file, and executes The degradation strategy, and obtain the processing result of the degradation strategy call request.Obtaining the processing result is in order to the processing knot Fruit is analyzed, to determine whether the degradation strategy is handled successfully the business processing request that client is sent, if it is, after Platform server can send the prompt information that business processing request is completed to client;If it is not, then determining that the degradation strategy goes out Now abnormal, background server need to continue to call other strategies that optionally degrade, with the business processing that client is sent request after Continuous processing.
The technical solution of the embodiment of the present invention manages the working condition and drop of third-party application interface by configuration file Grade processing rule can adjust degradation strategy by change configuration file, without that will degrade built in strategy in advance in real time In caller of the background server to third-party application interface, so more flexible degradation schemes can be used, to solve Background server in the prior art of having determined is unstable to the calling of third-party application interface, leads to the processing requested business processing The high problem of failure rate.The technical solution of the present embodiment improves the success rate of the calling to third-party application interface, efficiently protects The normal operation of the business function of third-party application interface calling is hindered.
Embodiment two
Fig. 2 is a kind of flow chart of the degradation processing method of third-party application interface provided by Embodiment 2 of the present invention.This Embodiment on the basis of the above embodiment 1, increases the related content for realizing the triggering rule that degrades.The degradation processing method It can still be executed by background server.
In embodiments of the present invention, degradation triggering rule can also be stored in configuration file, according to the triggering rule that degrades The working condition for automatically to adjust third-party application interface realizes the triggering control of degradation strategy execution.
Referring to fig. 2, the degradation processing method of the third-party application interface includes following operation:
S210, the call request according to the third-party application interface of generation, query configuration file is with the determination third party The working condition of application interface.
If the working condition of S220, the third-party application interface is normal condition, according in the configuration file Degradation trigger rule, the calling situation of third-party application interface described in real-time monitoring, and matching described in situation change according to calling Set the working condition of third-party application interface in file.
In aforesaid operations, the degradation triggering rule in configuration file, which can be, refers to background server by third-party application interface Judgment rule of working condition when being changed to degrading state by normal condition.When the third-party application interface real-time monitored When situation being called to meet degradation triggering rule, the working condition of the third-party application interface is changed to degrade by normal condition State.
Illustratively, when background server determines that the working condition of third-party application interface is positive by query configuration file When normal state, on the one hand, background server calls directly the business processing that third-party application interface completion client is sent and asks It asks, on the other hand, rule, the calling situation of the real-time detection third-party application interface is triggered according to the degradation in configuration file. When abnormal situation, which occurs, in third-party server meets setting condition, then the work of third-party application interface in configuration file is changed Making state is degrading state, and in subsequent operation, background server is according to the downgrade processing rule being arranged in configuration file, selection Corresponding degradation strategy, and the degradation strategy is executed, complete the business processing request that client is sent.
Herein, it should be noted that abnormal can refer to when background server monitors the occurs in third-party application interface When tripartite's application interface is more than preset threshold to the response time of the call request of background server, it is determined that third-party application connects Mouth occurs abnormal.At this point, the working condition that background server needs to change third-party application interface is degrading state.
It should be appreciated by those skilled in the art that background server can detect that it is primary different that third-party application interface occurs Chang Shi, the working condition for changing the third-party application interface in configuration file at once is degrading state;Alternatively, background server is also It can recorde third-party application interface and abnormal errors number and wrong time of origin occur, and according to the errors number and mistake The working condition that time of origin determines the need for changing the third-party application interface is degrading state.
In a specific embodiment of the embodiment of the present invention, there is abnormal situation to third-party application interface and make It further limits, at this point, background server records the errors number and wrong time of origin every time of the third-party application interface, and Errors number and wrong time of origin are counted, when statistical result meets preset condition, change this in configuration file the The working condition of tripartite's application interface.Specifically, this method includes following operation:
Operation one triggers rule according to the degradation in the configuration file, in calling out for the third-party application interface When now abnormal, misregistration number and wrong time of origin.
When the calling of third-party application interface occurs abnormal, when background server misregistration number and mistake occur Between, to there are many recording modes of two data, for example, can be recorded in table form to two data. Mode one includes interface identifier, errors number and the wrong time of origin of the third-party application interface in table;Mode two, after Platform server adds up errors number, and records respectively to each wrong time of origin.In subsequent operation, backstage is taken Business device can count errors number and wrong time of origin at interval of the fixed cycle;Or background server can also be to mistake Accidentally number and wrong time of origin carry out real-time statistics, and the benefit being arranged in this way is needed more preferably more accurately to determine whether Change the working condition of the third-party application interface.
Operation two, errors number and wrong time of origin according to the triggering rule that degrades, to the third-party application interface Real-time statistics are carried out, if a situation arises meets preset condition for mistake, by third-party application interface in the configuration file Working condition is set as degrading state.
Wherein, background server in real time counts the errors number of record and wrong time of origin, wherein to mistake Accidentally number is counted to obtain summation errors number, and the mistake nearest to wrong time of origin for the first time and distance statistics moment is sent out The raw time asks poor, obtains mistake and total duration occurs.
Preset condition includes two parts, and first part is default errors number, and second part is preset duration, when mistake is sent out Raw total duration is less than or equal to preset duration, and when summation errors number is greater than default errors number, then background server determines A situation arises meets preset condition for mistake, and the working condition by the third-party application interface is needed to be changed to degrade by normal condition State, therefore degrading state is set by the working condition of the third-party application interface in configuration file.
The technical solution of the embodiment of the present invention, background server are adjusted in real time according to the degradation triggering rule in configuration file The working condition of whole third-party application interface, can real-time control whether execute degradation strategy.In the triggering rule that degrades, to calling feelings How condition monitors, and meet which kind of preset condition, can be updated by modification configuration file, or different the Tripartite's application interface flexibly configures different degradation triggering rules, so can be realized the real-time pipe to third-party application interface Reason also can further be improved using the degradation triggering rule being more suitable for the steady of third-party application interface calling It is qualitative, ensure the normal operation for the business function that third-party application interface calls.
Embodiment three
Fig. 3 is a kind of process of the method for the degradation time started for record third party interface that the embodiment of the present invention three provides Figure.The present embodiment on the basis of the above embodiments, increases the recovery control program to third-party application interface degrading state, I.e. when the working condition for determining third-party application interface is degrading state, record third-party application interface is further increased The operation of degradation time started, to the monitoring in subsequent operation according to background server to the degradation time started, to this The working condition of third-party application interface makes change.
In the present embodiment, the degradation time started and degradation that third-party application interface can also be stored in configuration file are held Continuous duration threshold value, to determine the degradation duration of third-party application interface according to the degradation time started, and by the degradation The degradation duration threshold value comparison of duration and corresponding third-party application interface, when degrading, the duration is met or exceeded When degradation duration threshold value, the working condition of the third-party application interface is changed to normal condition.
Referring to Fig. 3, the method for the degradation time started of record third-party application interface includes following operation:
S310, when setting degrading state for the working condition of third-party application interface in the configuration file, record drop The grade time started.
In aforesaid operations, the time started that degrades can refer to the working condition of the third-party application interface in configuration file It is set as the time of degrading state.Setting in this way is to determine third-party application by the time started that degrades in subsequent operation The degradation duration of interface.
It should be appreciated by those skilled in the art that background server is by the work shape of the third-party application interface in configuration file State be set as degrading state condition can there are many kinds of, for example, can according in configuration file degrade triggering rule, by work State is set as degrading state;Or can also be according to the demand of operator it is artificial set working condition to degradation shape State.
If S320, recognizing the current degradation duration according to the degradation time started and reaching the configuration file In degradation duration threshold value, then set normal condition for the working condition of the third-party application interface.
In aforesaid operations, the difference of present system time and the time started that degrades is determined as the duration that degrades.And it will The degradation duration is compared with degradation duration threshold value.Wherein, the manner of comparison of two time magnitudes can there are many Different modes.For example, the duration that degrades, and real-time monitoring is calculated according to the time started that degrades in real time in background server Whether the degradation duration meets or exceeds degradation duration threshold value, if so, by the work of the third-party application interface State is changed to normal condition by degrading state;
Alternatively, background server completes the first business processing of client transmission according to the degradation strategy in configuration file When requesting, and receiving the second business processing request of client transmission again, produced again according to second business processing request The call request of the raw third-party application interface, background server query configuration file determine the work shape of third-party application interface It while state is degrading state, inquires the degradation time started of third-party application interface, and is calculated according to the degradation time started The duration that degrades is obtained, judges whether the degradation duration meets or exceeds degradation duration threshold value, if so, should The working condition of third-party application interface is revised as normal condition by degrading state.At this point, background server determines the third party The working condition of application interface is normal condition, then calls directly the third-party application interface at the business that sends to client Reason request is handled,
It is also understood by those skilled in the art that degradation duration threshold value is the degradation to third-party application interface The restriction of duration, background server can be by the degradation duration threshold of all third-party application interfaces in embodiments of the present invention Value is set as same value, it is, of course, also possible to which the stability grade point according to third-party application interface connects each third-party application Mouth sets different degradation duration threshold values, or can also be according to the stability grade point of third-party application interface to difference Third-party application interface be grouped, and to every group of third-party application interface setting degradation duration threshold value.
In a preferred embodiment of the embodiment of the present invention, background server is according to the third-party application interface The degradation duration threshold value of third-party application interface described in the configuration file is arranged in stability grade point.
The technical solution of the embodiment of the present invention, when being started by recording the degradation of degrading state of third-party application interface Between, and according to the difference of the degradation time started and present system time determine degrade the duration, will degrade the duration with Degradation duration threshold value is compared, when the duration that degrades meeting or exceeding degradation duration threshold value, then by this The working condition of tripartite's application interface is revised as normal condition by degrading state.Third-party application is connect to be furthermore achieved The management of mouth, improves the success rate of the calling to third-party application interface, has efficiently ensured what third-party application interface called The normal operation of business function.
Example IV
Fig. 4 is a kind of structural representation of the downgrade processing device for third-party application interface that the embodiment of the present invention five provides Figure.The downgrade processing device can execute degradation processing method described in any embodiment of that present invention.
Referring to fig. 4, the specific structure of the downgrade processing device includes: working condition determining module 41, degrade tactful determine Module 42 and processing result obtain module 43, wherein
Working condition determining module 41, for the call request according to the third-party application interface of generation, query configuration text Part is with the working condition of the determination third-party application interface;
Degrade tactful determining module 42, when the working condition for third-party application interface is degrading state, according to described Downgrade processing rule in configuration file, determines the strategy that degrades;
Processing result obtains module 43, for executing the degradation strategy, obtains the processing result of the call request.
Further, the tactful determining module 42 of the degradation includes:
Current degradation policy selection unit 421, for pressing according to the degradation policy priority grade being arranged in the configuration file According to the degradation strategy of priority orders selection current priority;
Next degradation policy selection unit 422, if the processing result for the call request got is processing Failure then returns to the operation of the degradation strategy of the next priority of selection.
In above-mentioned technical proposal, the tactful determining module 42 that degrades is selected according to the degradation policy priority grade being arranged in configuration file Degradation strategy is selected, in addition, the tactful determining module 42 that degrades can also select to degrade according to the downgrade processing rule in configuration file Strategy, at this point, degradation strategy determining module 42 includes:
Parameter acquisition unit 423, for acquiring the third according to the downgrade processing rule being arranged in the configuration file The current processing status parameter of square application interface;
Degradation policy selection unit 424, for according to the corresponding degradation strategy of the current processing status parameter selection.
Preferably, the current processing status parameter includes at least one of following: the third-party application interface it is concurrent Call the calling response time of quantity and the third-party application interface.
Further, the degradation strategy includes at least one of following: degrading according to default return value, uses local cache Data degradation retries degradation using random rejection service degradation and using message queue exceptionization.
Further, on that basis of the above technical scheme, which can also include:
Working condition changes module 44, regular for being triggered according to the degradation in the configuration file, described in real-time monitoring The calling situation of third-party application interface, and according to the work for calling situation to change third-party application interface in the configuration file State.
Further, the working condition change module 44 includes:
Error logging unit 441, for triggering rule according to the degradation in the configuration file, in the third-party application When the calling of interface occurs abnormal, misregistration number and wrong time of origin;
Degrading state setting unit 442, for regular according to the triggering that degrades, to the mistake time of the third-party application interface Several and wrong time of origin carries out real-time statistics, will be in the configuration file if a situation arises meets preset condition for mistake The working condition of third-party application interface is set as degrading state.
In addition, based on the above technical solution, downgrade processing device can also include:
Degrade time started logging modle 45, for setting the working condition of third-party application interface in the configuration file When being set to degrading state, record degrades the time started;
Normal condition setup module 46, if continued for recognizing current degradation according to the degradation time started Between reach degradation duration threshold value in the configuration file, then set the working condition of the third-party application interface to Normal condition.
Further, which can also include:
The configuration is arranged for the stability grade point according to the third-party application interface in threshold setting module 47 The degradation duration threshold value of third-party application interface described in file.
Product described in the present embodiment can be performed the multi-screen executed by server that any embodiment of that present invention provides and switch Method has the corresponding functional module of execution method and beneficial effect.
Embodiment five
Fig. 5 is a kind of flow chart of the degradation processing method for third-party application interface that the embodiment of the present invention six provides.This Embodiment can be based on above-described embodiment, and it is Baidu's glutinous rice that the present embodiment, which is in client, which is mounted on mobile phone In under this concrete application scene, a kind of preferred embodiment for providing.
Referring to Fig. 5, which includes following operation:
S501, the call request according to the third-party application interface of generation, judge third-party application described in configuration file Whether the working condition of interface is normal condition.
If it is, operation S502 is executed, if it is not, then executing operation S507.
S502, third-party application interface is called, and rule is triggered according to the degradation in the configuration file, in the third When the calling of square application interface occurs abnormal, misregistration number and wrong time of origin.
Baidu's glutinous rice background server call directly the third-party application interface to the business processing of Baidu's glutinous rice request into Row processing.
S503, according to the triggering rule that degrades, to the errors number of the third-party application interface and wrong time of origin into Row real-time statistics, if a situation arises meets preset condition for mistake, by the work of third-party application interface in the configuration file Degrading state is set as state.
At this point, if when background server query configuration file confirm that the working condition of the third-party application interface is degradation shape State then executes operation S507.
S504, when setting degrading state for the working condition of third-party application interface in the configuration file, record drop The grade time started.
S505, the current degradation duration is recognized according to the degradation time started, and judges the duration that degrades Whether degradation duration threshold value in the configuration file is reached.
If it is, executing operation S506, operation S505 is otherwise continued to execute.
S506, normal condition is set by the working condition of the third-party application interface.
At this point, if when background server query configuration file confirm that the working condition of the third-party application interface is normal shape State then executes operation S502.
S507, according to the degradation policy priority grade being arranged in the configuration file, it is current excellent according to priority orders selection The degradation strategy of first grade.
S508, the degradation strategy is executed, obtains the processing result of the call request, and judge the place of the call request Whether reason result succeeds.
If it is, executing operation S509, operation S510 is otherwise executed.
Prompt information is completed in S509, the business processing request that background server is sent to client.
S510, the operation for selecting the degradation strategy of next priority is returned to, and executes operation S508.
In order to which the technical solution of the embodiment of the present invention is more clearly understood, now it is illustrated.
User purchases by group on Baidu's glutinous rice, and will purchase by group order and submit, time of delivery 15:07.Baidu glutinous rice visitor Family end receives user and purchases by group order business, and this is purchased by group order business is sent to background server and handle, and backstage takes Business device purchases by group the call request that order business generates third-party application interface according to this, for example, background server generates anti-cheating Third-party application interface call request generate preferential tactful third to check whether user has cheating when purchasing by group Square application interface call request, to check that shop quotient purchases by group whether order has preferential policy, and generation inventory third party to this Application interface call request, to check that this purchases by group whether product has remaining quantity in stock.
Interface identifier, the work shape of above-mentioned each third-party application interface are stored in the configuration file of background server State, default degrade, and strategy, optional degradation are tactful, the triggering rule that degrades, degrade time started and degradation duration threshold value.Table 1 is profile data table provided in an embodiment of the present invention.
The profile data table of 1 background server of table
According to table 1, the working condition of anti-third-party application interface of practising fraud is normal condition, and background server can be direct Call the anti-cheating third-party application interface;The working condition of preferential strategy third-party application interface is degrading state, and current Difference (the degradation duration is 7min) between system time (15:07) and degradation time started (15:00) not up to degrades Duration threshold value (10min), it is thus determined that the preferential policy third-party application interface is in degrading state;Similarly, preferential plan Slightly third-party application interface working condition be degrading state, and present system time (15:07) and degrade the time started (15: 03) difference (the degradation duration is 4min) between is not up to degradation duration threshold value (8min), it is thus determined that this is preferential Policy third-party application interface is in degrading state.
The background server of Baidu's glutinous rice client is adjusted according to the default degradation strategy of preferential tactful third-party application interface With the degradation strategy for using local cache data to degrade, is called and utilized according to the default of inventory's third-party application interface degradation strategy The degradation strategy of random rejection service degradation handles the order that purchases by group of Baidu's glutinous rice client.If above-mentioned third party connects The default of mouth degrades, and strategy appearance is abnormal, then background server can continue other the optional degradation plans being arranged in calling configuration file Slightly the business processing request that client is sent is continued with.
At the same time, when the errors number that background server records that anti-cheating third puts application interface in real time occurs with mistake Between, when its errors number and wrong duration are regular greater than the triggering that degrades, (mistake generation errors number is more than 10 in 1 minute It is secondary) when, then the working condition of anti-cheating third-party application interface is changed to degrading state.
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation, It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.

Claims (18)

1. a kind of degradation processing method of third-party application interface characterized by comprising
The interface identifier for third party's interface that call request according to the third-party application interface of generation includes, passes through query configuration File is with the working condition of the determination third-party application interface;
If the working condition of the third-party application interface is degrading state, according to the downgrade processing in the configuration file Rule determines the strategy that degrades;It is abnormal that the degrading state refers to that the third-party application interface occurs, and can not temporarily be taken from the background Business device normal call;The downgrade processing rule refers to priority or the current processing status ginseng according to third-party application interface The several pairs of strategies that degrade carry out the rule of selection;
The degradation strategy is executed, the processing result of the call request is obtained;The processing result of the call request is to true It is fixed that next degradation strategy whether is selected to handle the call request.
2. the method according to claim 1, wherein according to the downgrade processing rule in the configuration file, really Determining degradation strategy includes:
According to the degradation policy priority grade being arranged in the configuration file, according to the degradation of priority orders selection current priority Strategy;
If the processing result of the call request got is processing failure, the degradation plan for selecting next priority is returned Operation slightly.
3. the method according to claim 1, wherein according to the downgrade processing rule in the configuration file, really Determining degradation strategy includes:
According to the downgrade processing rule being arranged in the configuration file, the current processing status of the third-party application interface is acquired Parameter;
According to the corresponding degradation strategy of the current processing status parameter selection.
4. according to the method described in claim 3, it is characterized in that, the current processing status parameter includes following at least one :
The calling response time of the concurrent invocation quantity of the third-party application interface and the third-party application interface.
5. method according to claim 1 to 4, which is characterized in that the degradation strategy includes at least one of following: According to default return value degrade, using local cache data degrade, using random rejection service degradation and utilize message queue Exceptionization retries degradation.
6. the method according to claim 1, wherein further include:
Regular, the calling situation of third-party application interface described in real-time monitoring is triggered according to the degradation in the configuration file, and According to the working condition for calling situation to change third-party application interface in the configuration file.
7. according to the method described in claim 6, it is characterized in that, triggering rule according to the degradation in the configuration file, in fact When monitor the calling situation of the third-party application interface, and according to calling situation to change third-party application in the configuration file The working condition of interface includes:
Rule is triggered according to the degradation in the configuration file, when the calling of the third-party application interface occurs abnormal, note Record errors number and wrong time of origin;
According to the triggering rule that degrades, errors number and wrong time of origin to the third-party application interface are united in real time Meter sets the working condition of third-party application interface in the configuration file if a situation arises meets preset condition for mistake It is set to degrading state.
8. the method according to claim 1, wherein further include:
When setting degrading state for the working condition of third-party application interface in the configuration file, when record degradation starts Between;
If recognizing the current degradation duration according to the degradation time started reaches degradation in the configuration file Duration threshold value then sets normal condition for the working condition of the third-party application interface.
9. according to the method described in claim 8, it is characterized by further comprising:
According to the stability grade point of the third-party application interface, third-party application interface described in the configuration file is set Degradation duration threshold value.
10. a kind of downgrade processing device of third-party application interface characterized by comprising
Working condition determining module, the third party's interface for including for the call request according to the third-party application interface of generation Interface identifier, by query configuration file with the working condition of the determination third-party application interface;
Degrade tactful determining module, when the working condition for third-party application interface is degrading state, according to the configuration text Downgrade processing rule in part, determines the strategy that degrades;It is abnormal that the degrading state refers to that the third-party application interface occurs, temporarily Shi Buke is by background server normal call;The downgrade processing rule refer to according to third-party application interface priority or Current processing status parameter selects degradation strategy;
Processing result obtains module, for executing the degradation strategy, obtains the processing result of the call request;The calling The processing result of request selects next degradation strategy to handle the call request to determine whether.
11. device according to claim 10, which is characterized in that the tactful determining module of the degradation includes:
Current degradation policy selection unit, for according to the degradation policy priority grade being arranged in the configuration file, according to preferential The degradation strategy of grade sequential selection current priority;
Next degradation policy selection unit, if the processing result for the call request got is processing failure, Return to the operation for selecting the degradation strategy of next priority.
12. device according to claim 10, which is characterized in that the tactful determining module of the degradation includes:
Parameter acquisition unit, for acquiring the third-party application according to the downgrade processing rule being arranged in the configuration file The current processing status parameter of interface;
Degradation policy selection unit, for according to the corresponding degradation strategy of the current processing status parameter selection.
13. device according to claim 12, which is characterized in that the current processing status parameter includes following at least one :
The calling response time of the concurrent invocation quantity of the third-party application interface and the third-party application interface.
14. any device of 0-13 according to claim 1, which is characterized in that the degradation strategy includes following at least one : degrade according to default return value, degraded using local cache data, utilizing random rejection service degradation and utilization message team Column exceptionization retries degradation.
15. device according to claim 10, which is characterized in that further include:
Working condition changes module, for triggering rule, third party described in real-time monitoring according to the degradation in the configuration file The calling situation of application interface, and according to the working condition for calling situation to change third-party application interface in the configuration file.
16. device according to claim 15, which is characterized in that the working condition changes module and includes:
Error logging unit, for triggering rule according to the degradation in the configuration file, in the third-party application interface When calling appearance abnormal, misregistration number and wrong time of origin;
Degrading state setting unit, for regular according to the triggering that degrades, to the errors number and mistake of the third-party application interface Accidentally time of origin carries out real-time statistics, if a situation arises meets preset condition for mistake, by third party in the configuration file The working condition of application interface is set as degrading state.
17. device according to claim 10, which is characterized in that further include:
Degrade time started logging modle, for the working condition of third-party application interface in the configuration file to be set as dropping When grade state, record degrades the time started;
Normal condition setup module, if reached for recognizing the current degradation duration according to the degradation time started Degradation duration threshold value in the configuration file, then set normal shape for the working condition of the third-party application interface State.
18. device according to claim 17, which is characterized in that further include:
Threshold setting module is arranged in the configuration file for the stability grade point according to the third-party application interface The degradation duration threshold value of the third-party application interface.
CN201511031311.5A 2015-12-31 2015-12-31 The method and apparatus of the downgrade processing of third-party application interface Active CN105677466B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201511031311.5A CN105677466B (en) 2015-12-31 2015-12-31 The method and apparatus of the downgrade processing of third-party application interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201511031311.5A CN105677466B (en) 2015-12-31 2015-12-31 The method and apparatus of the downgrade processing of third-party application interface

Publications (2)

Publication Number Publication Date
CN105677466A CN105677466A (en) 2016-06-15
CN105677466B true CN105677466B (en) 2019-08-30

Family

ID=56298496

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201511031311.5A Active CN105677466B (en) 2015-12-31 2015-12-31 The method and apparatus of the downgrade processing of third-party application interface

Country Status (1)

Country Link
CN (1) CN105677466B (en)

Families Citing this family (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649045A (en) * 2016-12-30 2017-05-10 重庆腾帆科技有限公司 Third-party interface exception monitoring device
CN106844146A (en) * 2016-12-30 2017-06-13 重庆腾帆科技有限公司 A kind of tripartite's interface abnormality monitoring method
CN106533812B (en) * 2016-12-30 2020-01-14 重庆腾帆科技有限公司 Application server
CN107172122A (en) * 2017-03-31 2017-09-15 北京奇艺世纪科技有限公司 A kind of abnormality eliminating method and device
CN107689886A (en) * 2017-08-11 2018-02-13 北京小度信息科技有限公司 Data-interface fault handling method, device and electronic equipment
CN107659431A (en) * 2017-08-15 2018-02-02 北京趣拿软件科技有限公司 Interface processing method, apparatus, storage medium and processor
CN107707384B (en) * 2017-09-06 2021-02-02 北京五八到家信息技术有限公司 Service state monitoring method and monitoring system based on external service calling
CN107577629B (en) * 2017-09-25 2019-12-31 北京因特睿软件有限公司 Data interface processing method, device, server and medium
CN107908438A (en) * 2017-11-15 2018-04-13 山东浪潮通软信息科技有限公司 A kind of method and device for improving data interaction stability
CN110413486A (en) * 2018-04-28 2019-11-05 北京京东尚科信息技术有限公司 The method, apparatus and medium of monitoring system intrinsic call link
CN108717396A (en) * 2018-05-17 2018-10-30 中国平安人寿保险股份有限公司 A kind of degradation processing method, device, electronic equipment and its storage medium
CN110554895A (en) * 2018-05-31 2019-12-10 北京京东尚科信息技术有限公司 Data calling method and device
CN109120686A (en) * 2018-08-08 2019-01-01 联动优势电子商务有限公司 A kind of method and device servicing pre-authentication
CN109165127B (en) * 2018-08-29 2022-09-02 北京奇艺世纪科技有限公司 Problem interface positioning method and device and electronic equipment
CN110399178B (en) * 2019-06-14 2022-09-27 五八有限公司 Third-party service calling method and device, electronic equipment and storage medium
CN111988387B (en) * 2020-08-11 2023-05-30 北京达佳互联信息技术有限公司 Interface request processing method, device, equipment and storage medium
CN112187505B (en) * 2020-08-17 2023-04-18 杭州安恒信息技术股份有限公司 Adaptive service degradation method, electronic device and storage medium
CN112134721B (en) * 2020-08-17 2023-01-10 福建天泉教育科技有限公司 API gateway degradation method and terminal
CN112306659B (en) * 2020-11-02 2024-03-15 北京中电普华信息技术有限公司 Application degradation protection method and service processing system
CN113778980A (en) * 2021-02-02 2021-12-10 北京沃东天骏信息技术有限公司 DAO layer degradation method and device
CN113282392A (en) * 2021-05-24 2021-08-20 挂号网(杭州)科技有限公司 Interface service calling method and device, electronic equipment and storage medium
CN113179188B (en) * 2021-05-26 2022-09-13 深圳平安智汇企业信息管理有限公司 Service degradation dynamic realization method and device, computer equipment and storage medium
CN113791883A (en) * 2021-09-07 2021-12-14 百融至信(北京)征信有限公司 Third-party interface calling method and device
CN115766484A (en) * 2022-09-26 2023-03-07 京东科技信息技术有限公司 Service degradation method, device, equipment, computer readable medium and program product
CN115883358A (en) * 2022-11-23 2023-03-31 紫光云技术有限公司 Method and device for monitoring, early warning and degrading third-party application

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101272280A (en) * 2008-04-02 2008-09-24 北京邮电大学 Method and system for Web service management
CN104899106A (en) * 2014-03-07 2015-09-09 阿里巴巴集团控股有限公司 Processing method and processing device when interface service is abnormal
CN105159285A (en) * 2015-09-17 2015-12-16 北京汽车股份有限公司 CAN controller bus fault processing method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101272280A (en) * 2008-04-02 2008-09-24 北京邮电大学 Method and system for Web service management
CN104899106A (en) * 2014-03-07 2015-09-09 阿里巴巴集团控股有限公司 Processing method and processing device when interface service is abnormal
CN105159285A (en) * 2015-09-17 2015-12-16 北京汽车股份有限公司 CAN controller bus fault processing method and device

Also Published As

Publication number Publication date
CN105677466A (en) 2016-06-15

Similar Documents

Publication Publication Date Title
CN105677466B (en) The method and apparatus of the downgrade processing of third-party application interface
US8078483B1 (en) Systems and methods for queuing access to network resources
CN104038540B (en) Method and system for automatically selecting application proxy server
CN108376112A (en) Method for testing pressure, device and readable medium
CN107688496A (en) Task distribution formula processing method, device, storage medium and server
CN107943841A (en) Stream data processing method, system and computer-readable recording medium
CN107093038A (en) Means of distribution system of selection and device
CN113543178A (en) Service optimization method, device, equipment and storage medium based on user perception
CN108899082A (en) Maintenance service management method, system, terminal and computer readable storage medium
US10277529B2 (en) Visualization of computer resource quotas
US8959177B1 (en) Automated selection of a content provider
CN103679498B (en) A kind of information-pushing method and its system to the network terminal
US20140115486A1 (en) Manual clicker application
CN109784503A (en) Business O&M method, apparatus, equipment and readable storage medium storing program for executing
CN107018024B (en) Cloud service recommendation method and device
CN109918569A (en) Medicine information method for pushing, server and readable storage medium storing program for executing
CN111507674A (en) Task information processing method, device and system
CN108268357A (en) real-time data processing method and device
CN104239423B (en) A kind of relationship among persons are apart from acquisition methods and system
US10866959B2 (en) Debug tracing of next best action strategy engine
CN116431929B (en) Information recommendation method, device, equipment and medium based on privacy calculation
CN113010786B (en) Information pushing method, device, equipment and storage medium
CN105897443A (en) User grouping method and device
CN111159131A (en) Performance optimization method, device, equipment and computer readable storage medium
CN106161490A (en) A kind of user's online behavior state update method, Apparatus and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant