Method and device for pushing service processing result
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for pushing a service processing result.
Background
With the development of the internet and computers (or called terminals, including mobile computers, also called mobile terminals), various internet services (simply referred to as services) have appeared, and users can request and complete services in the internet through the computers. The method comprises the following steps from the beginning to the completion of a service: the service processing usually takes most time, and due to the large number and complex types of services, there are many situations that the service processing is overtime, for example, query service, and due to many query requests, processing is overtime is likely to occur when the query request is processed.
In the prior art, as shown in fig. 1, a service requester (a request terminal for short) and a service processor (a processing terminal for short) interact with each other in a short connection manner, where a short connection (short connection) means that a connection is established only when data needs to be sent in a data transmission process, and the connection is disconnected after the data is sent, that is, only one service is sent in each connection. When the request terminal and the processing terminal establish short connection and then send a service request, if the processing terminal overtime, the processing terminal returns the processing result to the request terminal or directly disconnects the short connection. After that, the service terminal needs to query the processing result in a polling manner, that is, after the processing terminal completes the service processing, the request terminal needs to establish a connection with the processing terminal in a short connection manner again, so as to obtain the processing result, so as to complete the service. However, it is obvious that the time for establishing the short connection is not related to the time for processing the service, but is generated additionally, which increases the time consumption of the whole service completion process, thereby reducing the efficiency of completing the service.
Disclosure of Invention
The embodiment of the application provides a method for pushing a service processing result, which is used for improving the completion efficiency of an internet service.
The embodiment of the application provides a device for pushing a service processing result, which is used for improving the completion efficiency of an internet service.
The embodiment of the application adopts the following technical scheme:
a method for pushing a service processing result comprises the following steps:
the processing terminal processes the service request sent by the request terminal through the short connection;
when the service processing is overtime, the short connection is disconnected;
the processing terminal determines an available long connection with the request terminal;
and when the processing terminal completes the service processing, pushing the processing result to the request terminal through the available long connection.
Preferably, the determining, by the processing terminal, an available long connection with the requesting terminal includes:
when the processing terminal and the request terminal have long connection;
determining the long connection as an available long connection.
Preferably, the processing terminal and the request terminal have a long connection, and the method includes:
the first long connection module contained in the processing terminal and the second long connection module contained in the request terminal are already connected;
pushing the processing result to the requesting terminal through the available long connection, including:
and pushing the processing result to the request terminal through the established long connection between the first long connection module and the second long connection module.
Preferably, the method further comprises:
when the processing terminal does not have long connection with the request terminal;
and establishing the long connection between the processing terminal and the request terminal, and determining the long connection as the available long connection.
Preferably, the processing terminal is a server, and the request terminal is a client.
A device for pushing service processing results is applied to a processing terminal and comprises: a processing unit, a judging unit, a determining unit and a pushing unit, wherein,
the processing unit is used for processing a service request sent by a receiving request terminal through short connection, and when the service processing is overtime, the processing terminal returns a waiting instruction to the request terminal;
the judging unit is used for disconnecting the short connection when judging that the service processing is overtime;
the determining unit is used for determining the available long connection existing between the requesting terminal and the terminal;
and the pushing unit is used for pushing the processing result to the request terminal through the available long connection when the service processing is finished.
Preferably, the determination unit is adapted to determine,
when there is a long connection with the requesting terminal;
determining the long connection as an available long connection.
Preferably, the determination unit is adapted to determine,
when a first long connection unit contained in the processing terminal and a second long connection unit contained in the request terminal exist the established long connection; determining the long connection as an available long connection;
the push-in unit is then able to,
and pushing the processing result to the request terminal through the established long connection between the first long connection module and the second long connection module.
Preferably, the determination unit is adapted to determine,
when the processing terminal does not have long connection with the request terminal;
and establishing the long connection between the processing terminal and the request terminal, and determining the long connection as the available long connection.
A device for pushing service processing results is applied to a request terminal and comprises: a receiving unit for receiving the received data,
and receiving the processing result pushed by the processing terminal through the established long connection between the first long connection module and the second long connection module.
The embodiment of the application adopts at least one technical scheme which can achieve the following beneficial effects: when the processing terminal overtimes the service processing in the process of processing the service request sent by the request terminal through the short connection, the processing terminal disconnects the short connection to determine an available long connection with the request terminal, and after the service processing is completed and a processing result is obtained, the processing result is pushed to the request terminal through the long connection.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a diagram illustrating the results of a prior art acquisition process;
FIG. 2 is a diagram of the results of a prior art acquisition process based on a time axis;
FIG. 3 is a diagram of the results of a prior art acquisition process based on a time axis;
fig. 4 is a schematic flowchart of a method for pushing a service processing result according to embodiment 1 of the present application;
fig. 5 is a schematic diagram of a service processing result pushed through a long connection according to embodiment 1 of the present application;
fig. 6 is a schematic diagram of a service processing result pushed through a long connection module according to embodiment 1 of the present application;
fig. 7 is a schematic diagram of a processing result of a push service based on a time axis according to embodiment 1 of the present application;
fig. 8 is a structural diagram of an apparatus for pushing a service processing result according to embodiment 2 of the present application;
fig. 9 is a structural diagram of a device for processing a push service according to embodiment 2 of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Example 1
As described above, in the prior art, when a processing timeout occurs in a processing terminal, a result of processing (waiting) is returned to a requesting terminal or a connection is directly disconnected, and then the processing terminal processes a service until the processing is completed, and acquires a processing result, while the service terminal needs to query the processing result in a polling manner. As shown in FIG. 2, t0The time is the time when the processing terminal receives the service request after the short connection is established between the request terminal and the processing terminal, the service processing is started from the time, the processing terminal returns the processing (waiting) result to the request terminal due to the overtime processing, and the processing terminal returns the processing (waiting) result to the request terminal at t1The processing is completed at the moment, and a processing result is obtained, at the moment, the request terminal can immediately establish the short connection with the processing terminal, but the short connection is required to be eliminated when one-time short connection is establishedTime-consuming, i.e. consuming t1-t2At time t, finally2And acquiring a processing result at any time. t is t1-t2This time is not time-consuming in the service processing process, but increases the time-consuming in the whole service completion process, thereby reducing the efficiency of service completion. In addition, the above case is t1The short connection is established immediately after the time processing is finished, but in practical application, the short connection can not be established at t exactly every time1The connection is established at a time ("pacing" is consistent), and since it is polling, it is likely that a "pacing" condition will occur, i.e., the requesting terminal is not at t as shown in fig. 31The connection is established at a moment but t passes1-t2This idle time, at t2The connection is established at a time and at t3The processing result is obtained at any time, so that the time consumption of the whole service completion process is further increased, and the service completion efficiency is further reduced. Therefore, based on the defect, the application provides a method for pushing the service processing result, which is used for improving the completion efficiency of the internet service. The flow diagram of the method is shown in fig. 4, and comprises the following steps:
step 11: and processing the service request sent by the terminal to the request terminal through the short connection.
When a user needs to request an internet service, a service request, such as an inquiry service, a login service, a payment service, etc., may be sent through a terminal, where the terminal may be a PC (personal computer), a portable computer, a mobile phone, etc., and is herein referred to as a request terminal, i.e., a terminal for sending a service request. And after receiving the service request, the service processing terminal starts to process the service. In practical applications, there may be many services in (an application program of) a service terminal, and the service terminal may also correspond to many functional modules, for example, one application program may include a login service, an inquiry service, a payment service, an instant messaging service, and the like, but since a long connection needs to be maintained all the time, most of the services (the inquiry service, the payment service, and the like) do not always keep a long connection with a processing terminal, but need to establish a short connection with the processing terminal when a service is requested, and then disconnect the service after the processing is completed. The service referred to in this step of the embodiment may be a service that does not establish a long connection with the processing terminal for a long time, but is connected with the processing terminal through a short connection only when needed, that is, the requesting terminal may send a service request through the short connection.
It should be noted that, the processing terminal and the requesting terminal mentioned herein imply that the application program in the processing terminal and the application program in the requesting terminal, for example, the client application program in the mobile terminal) send the query request to the server application program in the server, and the server application program processes the query request after receiving the query request.
Step 12: when the business processing time-out occurs, the short connection is disconnected.
A timeout threshold may be preset, for example, 1 second, when the time of the service processing exceeds 1 second, it is determined that the service processing is timeout, at this time, the short connection may be disconnected, and the result of processing (waiting) may also be sent to the requesting terminal through the short connection, so that the requesting terminal can know the processing condition. And in the case that the processing terminal determines that the processing is overtime, the short connection is disconnected, or a waiting instruction is returned to disconnect the short connection.
Step 13: the processing terminal determines an available long connection with the requesting terminal.
As described in the previous step, there are many services in the application program, and the service referred to in this embodiment does not keep long connection with the processing terminal, but there may be services that keep long connection with the processing terminal in the application program, such as an instant messaging service, an information push service, and the like. Therefore, the step can comprise: when the processing terminal and the request terminal have long connection; the long connection is determined to be an available long connection. In particular, the processing terminal may determine at least one available long connection with the requesting terminal, e.g. if a long connection between the instant messaging service and the processing terminal is found, this long connection may be determined as an available long connection. The long connection available here means a long connection that can be used for data transmission. In practical applications, the long connection may be implemented by a dedicated connection module, specifically, a first long connection module may exist in the processing terminal, and a second long connection module may exist in the requesting terminal, so this step may include: the first long connection module included in the processing terminal and the second long connection module included in the requesting terminal have established a long connection therebetween. For example, the first long connection module and the second long connection module maintain a long connection for the instant messaging service to ensure the operation of the instant messaging service, and then the long connection can be determined as the existing long connection.
In practical applications, there may be no long connection, so this step may further include: when the processing terminal does not have a long connection with the requesting terminal; a long connection is established between the processing terminal and the requesting terminal and determined as an available long connection. Specifically, the long connection may be established through TCP (Transmission Control Protocol), or may be established through HTTP (HyperText Transfer Protocol), for example, persistent connection may be performed through HTTP 1.1.
In summary, the present step provides a policy for determining a long connection, that is, when a service processing is overtime, it may be first found whether a long connection established for another service exists, if so, the long connection is used by the service after the service processing is completed, and if not, a long connection is established, so as to push a processing result after the service processing is completed. For example, in an application program, after a short connection is established between an inquiry service and an inquiry system in a processing terminal, a service request is sent, if the service is overtime, the short connection is disconnected, and the inquiry system inquires that the instant communication system and the instant communication service in the application program in the request terminal keep a long connection, the long connection is used as an available long connection; for another example, if the query system queries that the instant messaging system maintains a long connection with the instant messaging service in another application in the requesting terminal, the long connection in the another application may also be determined as an available long connection if the two applications can implement data inter-transmission.
Step 14: and after the processing terminal completes the service processing, pushing the processing result to the request terminal through the available long connection.
If an available long connection is determined in step 13, for example, a long connection between the instant messaging service and the processing terminal, then this step may be as shown in fig. 5, and the processing result is pushed to the requesting terminal through the long connection, which refers to a technology for transmitting messages based on the internet, as opposed to actively acquiring, in which case the request is actively initiated by the user or the terminal. That is, the processing result is monitored and, once determined, is immediately triggered to be sent to the specified location. In this step, when t is1After the moment determination processing is recorded, the processing result can be immediately sent to the request terminal, and the step of establishing the short connection again is omitted.
The above step introduces that the processing terminal and the requesting terminal may respectively include a first long connection module and a second long connection module to maintain long connection, and then this step may include: and pushing the processing result to the request terminal through the established long connection between the first long connection module and the second long connection module. Specifically, as shown in fig. 6, after the processing terminal determines the processing result, the processing result is pushed to a first long connection module included in the processing terminal, and since long connection is maintained with a second long connection module inside the request terminal, the first long connection module can directly push the processing result to the second long connection module, and finally the second long connection module gives the processing result to the request terminal, so that the request terminal obtains the processing result of the service.
In practical application, the request terminal and the service terminal are two separate terminals, and may exist in the form of a client terminal as the request terminal and a server as the service terminal.
It should be noted that in the embodiment of the present application, unexpected time consumption such as time duration of pushing to the request terminal being affected by the lack of smoothness of the long connection due to network delay, time delay due to poor processing capability, and the like is ignored, that is, the default long connection is in a smooth state, and the processing result is obtained and then the processing result can be immediately transmitted to the request terminal through the long connection.
By adopting the method provided by the embodiment 1, when the processing terminal overtimes the service processing in the process of processing the service request sent by the request terminal through the short connection, the processing terminal disconnects the short connection and determines an available long connection with the requesting terminal, and after the service processing is completed and a processing result is obtained, the processing result is pushed to the requesting terminal through the long connection, which avoids the time-consuming situation of establishing the short connection when the requesting terminal needs to actively establish the short connection with the processing terminal to obtain the processing result, as shown in fig. 7, through long connection, the purpose that the request terminal can be directly informed as long as the service result is determined is achieved, extra time consumption caused by waiting for the request terminal to establish a short link and then acquiring the processing result is not needed, and the service completion efficiency is improved by shortening the time consumption of the whole service.
Example 2
Based on the same inventive concept, embodiment 2 provides a device for pushing a service processing result, which can be applied to a processing terminal. Fig. 8 is a structural view of the apparatus, which includes: a processing unit 21, a judging unit 22, a determining unit 23, and a pushing unit 24, wherein,
a processing unit 21, configured to process a service request sent by a request terminal through a short connection;
the judging unit 22 may disconnect the short connection when it is judged that the service processing is overtime;
a determination unit 23 that can determine an available long connection with the requesting terminal;
the pushing unit 24 may push the processing result to the requesting terminal through the available long connection when the service processing is completed.
In one embodiment, the determining unit 23 may determine that the connection is a long connection with the requesting terminal; a long connection is determined as an available long connection.
In one embodiment, the determining unit 23 may determine that there is an established long connection between a first long connection unit included in the processing terminal and a second long connection unit included in the requesting terminal; determining a long connection as an available long connection;
the pushing unit 24 may push the processing result to the requesting terminal through the long connection already established between the first long connection module and the second long connection module.
In one embodiment, the determining unit 23 may determine that the processing terminal is not connected to the requesting terminal; a long connection is established between the processing terminal and the requesting terminal and determined as an available long connection.
In addition, the embodiment also provides a device for pushing the service processing result, which can be applied to the request terminal. Fig. 9 is a structural view of the apparatus, which includes:
the receiving unit 31 may receive a processing result pushed by the processing terminal through the long connection established between the first long connection module and the second long connection module.
By adopting the apparatus provided in embodiment 2, when the processing terminal overtimes the service processing in the process of processing the service request sent by the request terminal through the short connection, the processing terminal disconnects the short connection to determine an available long connection with the request terminal, and after the service processing is completed and a processing result is obtained, the processing result is pushed to the request terminal through the long connection.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.