CN109298928B - Service processing method and device - Google Patents

Service processing method and device Download PDF

Info

Publication number
CN109298928B
CN109298928B CN201811177448.5A CN201811177448A CN109298928B CN 109298928 B CN109298928 B CN 109298928B CN 201811177448 A CN201811177448 A CN 201811177448A CN 109298928 B CN109298928 B CN 109298928B
Authority
CN
China
Prior art keywords
service
service request
execution
request
obtaining
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
CN201811177448.5A
Other languages
Chinese (zh)
Other versions
CN109298928A (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.)
Anhui Yilu Weixing Technology Co.,Ltd.
Original Assignee
Shenzhen Gaodeng Computer 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 Shenzhen Gaodeng Computer Technology Co Ltd filed Critical Shenzhen Gaodeng Computer Technology Co Ltd
Priority to CN201811177448.5A priority Critical patent/CN109298928B/en
Publication of CN109298928A publication Critical patent/CN109298928A/en
Application granted granted Critical
Publication of CN109298928B publication Critical patent/CN109298928B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • 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
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The embodiment of the application provides a service processing method and device, and relates to the technical field of data processing. The method comprises the following steps: obtaining relevant parameters of a service request; storing the relevant parameters and associating the service request into a service execution queue; when the service execution queue executes the service request, executing the service request according to the storage related parameters and obtaining an execution result of the service request; and when the execution failure of the service request is determined according to the execution result, recording a service log generated according to the relevant parameters and the execution result. Even if the service execution queue asynchronously executes the execution of the service request to be split, a service log capable of expressing the complete execution process of the service request can be generated according to the stored related parameters and the execution result. The operation and maintenance personnel can know what the whole execution process of the service request is according to the service log, so that the operation and maintenance personnel can conveniently search and locate the problem that the execution of the service request is wrong.

Description

Service processing method and device
Technical Field
The present application relates to the technical field of data processing, and in particular, to a method and an apparatus for processing a service.
Background
In the execution process of the service request, most of the service requests are asynchronously executed in the queue, so that the performance of the equipment is ensured. But also because the service request is asynchronously executed in the queue, the complete execution flow of the service request is split. Therefore, once an error occurs in the execution of the service request, the operation and maintenance personnel have difficulty in knowing what the calling process of the service request is in the whole execution process due to the fact that the complete execution flow is split, and thus the operation and maintenance personnel have difficulty in finding and locating the problem that the execution of the service request has an error.
Disclosure of Invention
The present application provides a method and an apparatus for processing a service, so as to effectively solve the above existing technical problems.
In order to achieve the above object, embodiments of the present application are implemented as follows:
in a first aspect, an embodiment of the present application provides a method for processing a service, where the method includes:
obtaining relevant parameters of a service request;
storing the relevant parameters and associating the service request into a service execution queue;
when the service execution queue executes the service request, executing the service request according to the stored related parameters, and obtaining an execution result of the service request;
and when the execution failure of the service request is determined according to the execution result, recording a service log generated according to the relevant parameters and the execution result.
In some optional implementations of the first aspect, storing the relevant parameters and associating the service request into a service execution queue includes:
and storing the relevant parameters stored in the first temporary variable into a storage area corresponding to the service request in Redis, and establishing a Redis service key name associated with the service request in the service execution queue.
In some optional implementation manners of the first aspect, executing the service request according to storing the relevant parameter, and obtaining an execution result of the service request includes:
according to the Redis service key name in the service execution queue, obtaining the related parameters which are stored in the storage area and are related to the Redis service key name, and establishing a second temporary variable to store the related parameters;
and executing the service request according to the related parameters in the second temporary variable, and obtaining the execution result of the service request.
In some optional implementations of the first aspect, the relevant parameters include a request parameter and a port call result;
the obtaining of the relevant parameters of the service request includes:
establishing a first temporary variable to store a request parameter for obtaining a service request;
and calling a relevant port required for executing the service request according to the request parameter, obtaining a port calling result, and storing the port calling result in the first temporary variable.
In some optional implementation manners of the first aspect, when the service execution queue executes the service request, after the service request is executed according to the stored relevant parameters and an execution result of the service request is obtained, the method further includes:
and deleting the relevant parameters and the execution result when the execution success of the service request is determined according to the execution result.
In a second aspect, an embodiment of the present application provides an apparatus for processing a service, where the apparatus includes:
the obtaining module is used for obtaining relevant parameters of the service request;
the processing module is used for storing the related parameters and associating the service request into a service execution queue;
the execution module is used for executing the service request according to the stored related parameters and obtaining the execution result of the service request when the service execution queue executes the service request;
and the recording module is used for recording a service log generated according to the relevant parameters and the execution result when the execution failure of the service request is determined according to the execution result.
In some optional implementations of the second aspect, the processing module is further configured to store the relevant parameter stored in the first temporary variable to a storage area corresponding to the service request in Redis, and establish a Redis service key name associated with the service request in the service execution queue.
In some optional implementations of the second aspect, the execution module is further configured to obtain, according to the Redis service key name in the service execution queue, the relevant parameter stored in the storage area and associated with the Redis service key name, and establish a second temporary variable to store the relevant parameter; and executing the service request according to the related parameters in the second temporary variable, and obtaining the execution result of the service request.
In some optional implementations of the second aspect, the relevant parameters include a request parameter and a port call result;
the obtaining module is further configured to establish a first temporary variable to store a request parameter of a service obtaining request; and calling a relevant port required for executing the service request according to the request parameter, obtaining a port calling result, and storing the port calling result in the first temporary variable.
In some optional implementations of the second aspect, the apparatus further comprises:
and the deleting module is used for deleting the relevant parameters and the execution result when the execution success of the service request is determined according to the execution result.
In a third aspect, an embodiment of the present application provides an electronic device, where the electronic device includes: a processor, a memory, a bus and a communication interface; the processor, the communication interface and the memory are connected by the bus.
The memory is used for storing programs.
The processor is configured to execute the first aspect and the method for processing the service according to any one of the embodiments of the first aspect by calling a program stored in the memory.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a non-volatile program code executable by a computer, where the program code causes the computer to execute the first aspect and the method for processing a service according to any embodiment of the first aspect.
The beneficial effects of the embodiment of the application are that:
by storing the relevant parameters of the service request, when the service execution queue asynchronously executes to the service request, the service request can be executed according to the stored relevant parameters, and when the execution of the service request is determined to fail according to the execution result, even if the execution of the service request is asynchronously executed to split the execution of the service request, a service log capable of expressing the complete execution process of the service request can be generated according to the stored relevant parameters and the execution result. The operation and maintenance personnel can know what the whole execution process of the service request is according to the service log, so that the operation and maintenance personnel can conveniently search and locate the problem that the execution of the service request is wrong.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 shows a block diagram of an electronic device according to a first embodiment of the present application;
fig. 2 is a flowchart illustrating a method for processing a service according to a second embodiment of the present application;
fig. 3 shows a block diagram of a service processing apparatus according to a third embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without inventive step, are within the scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. The terms "first," "second," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
First embodiment
Referring to fig. 1, an electronic device 10 is provided in the embodiment of the present application, and the electronic device 10 may be a terminal device or a server. The terminal device may be a Personal Computer (PC), a tablet PC, a smart phone, a Personal Digital Assistant (PDA), or the like; the server may be a web server, a database server, a cloud server, or a server assembly composed of a plurality of sub servers, etc.
In this embodiment, the electronic device 10 may include: memory 11, communication module 12, bus 13, and processor 14. Wherein the processor 14, the communication module 12 and the memory 11 are connected by a bus 13. The processor 14 is arranged to execute executable modules, such as computer programs, stored in the memory 11. The components and configurations of electronic device 10 shown in FIG. 1 are for example, and not for limitation, and electronic device 10 may have other components and configurations as desired.
The Memory 11 may include a high-speed Random Access Memory (Random Access Memory RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. In the present embodiment, the memory 11 stores a program required to execute a processing method of a service.
The bus 13 may be an ISA bus, a PCI bus, an EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 1, but this does not indicate only one bus or one type of bus.
The processor 14 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by instructions in the form of hardware, integrated logic circuits, or software in the processor 14. The Processor 14 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art.
The method performed by the flow process or the defined device disclosed in any of the embodiments of the present invention may be applied to the processor 14, or may be implemented by the processor 14. After the processor 14 receives the execution instruction and calls the program stored in the memory 11 through the bus 13, the processor 14 controls the communication module 12 through the bus 13 so as to execute the flow of the processing method of the service.
Second embodiment
Referring to fig. 2, the present embodiment provides a service processing method, where the service processing method is applied to an electronic device, and the service processing method includes: step S100, step S200, step S300, and step S400.
Step S100: and obtaining relevant parameters of the service request.
Step S200: storing the relevant parameters, and associating the service request into a service execution queue.
Step S300: and when the service execution queue executes the service request, executing the service request according to the stored related parameters, and obtaining an execution result of the service request.
Step S400: and when the execution failure of the service request is determined according to the execution result, recording a service log generated according to the relevant parameters and the execution result.
The process flow of the present application will be described in detail below.
Step S100: and obtaining relevant parameters of the service request.
The service request may be a request initiated by a user, or the service request may also be a request that needs to be generated by the electronic device or an application program on the electronic device in the running process according to a preset program. For example, when the service request is a request initiated by a user, the service request may be, for example, a payment request, a video acquisition request, or the like; for another example, when the service request is a request generated according to a preset program, the service request may be, for example, a data update request, an image compression request, or the like.
Of course, the electronic device obtains the request parameter in the service request based on generating the service request, whether the request is initiated by the user or generated according to the operation of the preset program.
Optionally, the request parameters obtained by the electronic device may include: a path of the service request, a type of the service request, parameters of the service request, a request body of the service request, a header of the service request, and a source of the service request.
Since the electronic device executes the service request as being executed in the memory of the electronic device, the electronic device may establish a first temporary variable in the memory, so as to store the obtained request parameter in the temporary variable in the form of an array. Thus, the electronic device can call the relevant port required for executing the service request according to the request parameter in the first temporary variable, and obtain the port calling result. The called relevant port may be a third-party port on the electronic device, for example, a video APP on the electronic device initiates a payment request, and then the electronic device needs to call the relevant port of the payment APP on the electronic device to implement a final payment function when executing the payment request.
Of course, to ensure the integrity of the data, the electronic device also stores the obtained port call result in the form of an array into the first temporary variable. Thus, the first temporary variable stores the request parameter and the port call result, which can be regarded as the relevant parameters of the service request, i.e. the electronic device obtains the relevant parameters of the service request including the request parameter and the port call result.
After the electronic device obtains the relevant parameters, the electronic device may continue to perform step S200.
Step S200: storing the relevant parameters, and associating the service request into a service execution queue.
The first temporary variable is located in a memory of the electronic device, and the first temporary variable occupies resources of the memory. In order to optimize the resource utilization rate of the memory, after the electronic device stores the obtained port call result in the first temporary variable, the electronic device may store the relevant parameter in the first temporary variable in a storage area corresponding to the service request in the Redis of the electronic device, and delete the first temporary variable in the memory. Therefore, the relevant parameters of the service request are guaranteed not to be lost by being stored in the storage area, the first temporary variable in the memory is deleted, and the resource utilization rate of the memory is optimized. A
In this embodiment, since the service request is executed asynchronously, the service request needs to be executed in the service execution queue subsequently. Then, while the storage area in the Redis stores the relevant parameters of the service request, the service request may also be associated into the service execution queue, so that the service request can be continuously executed through the service execution queue in the following.
As a way of associating the service request with the service execution queue, a Redis service key name for associating the service request may be established in the service execution queue, and when the Redis service key name enables the electronic device to execute the service in the service execution queue to the Redis service key name, the electronic device may search a storage area of the Redis for a relevant parameter of the service request according to the Redis service key name.
It is understood that after associating the service request in the service execution queue, the electronic device may continue to perform step S300.
Step S300: and when the service execution queue executes the service request, executing the service request according to the stored related parameters, and obtaining an execution result of the service request.
As the electronic device sequentially executes the services sequentially ordered in the service execution queue, the electronic device may execute the service request in the service execution queue at the Redis service key name in the service execution queue. Thus, the electronic device can obtain the Redis service key name.
By analyzing the Redis service key name, the electronic device can know that the Redis service key name indicates that the electronic device needs to obtain the relevant parameters of the service request. Then, the electronic device can find the storage area associated with the Redis service key name from the Redis according to the Redis service key name, so as to obtain the stored relevant parameters of the service request from the storage area.
Also, since the electronic device executes the service request as being executed in the memory of the electronic device, the electronic device may also re-establish a second temporary variable in the memory, so as to restore the obtained relevant parameter to the second temporary variable. In this way, the electronic device can execute the service request according to the execution of the relevant parameter in the second temporary variable, and then the electronic device can obtain an execution result indicating that the execution of the service request is successful or failed. For example, a video APP on the electronic device initiates a payment request, and the electronic device, through execution of relevant parameters of the payment request, may initiate payment through the payment APP on the electronic device and obtain a payment result indicating success or failure of payment.
In this embodiment, after the electronic device obtains the execution result, the electronic device may continue to execute step S400.
Step S400: and when the execution failure of the service request is determined according to the execution result, recording a service log generated according to the relevant parameters and the execution result.
The electronic device may determine whether execution of the service request succeeded or failed based on a return value in the execution result.
If the return value in the obtained execution result is the first preset value, the electronic device may determine, according to the first preset value, that the execution of the service request is successful. Based on the result, the electronic device may delete the second temporary variable to optimize the memory in order to guarantee the performance of the electronic device. Meanwhile, the electronic device can delete both the obtained execution result and the relevant parameters of the service request stored in the Redis, so as to prevent the redundant data from affecting the performance of the device.
If the return value in the obtained execution result is the second preset value, the electronic device may determine that the execution of the service request is an execution failure according to the second preset value. Based on the result, in order to ensure that the operation and maintenance personnel can accurately locate the reason of the execution failure, the electronic device may generate a service log of the service request based on the obtained execution result and the relevant parameters of the service request stored in the Redis. Because the execution result and the related parameters can completely show the complete execution process of the service request, the operation and maintenance personnel can quickly and accurately locate the reason of the execution failure of the service request from the complete execution process based on the service log containing the execution result and the related parameters.
It is to be understood that, in order to ensure the performance of the electronic device, after the service log is generated, the electronic device may also delete the second temporary variable to optimize the memory. Meanwhile, the electronic device can delete both the obtained execution result and the relevant parameters of the service request stored in the Redis, and the influence of the redundant data on the performance of the device is avoided.
Third embodiment
Referring to fig. 3, an embodiment of the present application provides a service processing apparatus 100, which is applied to an electronic device, and the service processing apparatus 100 includes:
an obtaining module 110, configured to obtain a parameter related to the service request.
The processing module 120 is configured to store the relevant parameters and associate the service request into a service execution queue.
The execution module 130 is configured to execute the service request according to the stored relevant parameters when the service execution queue executes the service request, and obtain an execution result of the service request.
A recording module 140, configured to record a service log generated according to the relevant parameter and the execution result when it is determined that the service request is failed to be executed according to the execution result.
A deleting module 150, configured to delete the request parameter and the execution result when it is determined that the service request is successfully executed according to the execution result.
Optionally, the obtaining module 110 is further configured to establish a first temporary variable to store a request parameter of the obtain service request; and calling a relevant port required for executing the service request according to the request parameter, obtaining a port calling result, and storing the port calling result in the first temporary variable.
In detail, the service request may be a request initiated by a user, or the service request may also be a request that needs to be generated by the electronic device or an application program on the electronic device in the running process according to a preset program. For example, when the service request is a request initiated by a user, the service request may be, for example, a payment request, a video acquisition request, or the like; for another example, when the service request is a request generated according to a preset program, the service request may be, for example, a data update request, an image compression request, or the like.
Of course, the obtaining module 110 obtains the request parameter in the service request based on generating the service request, whether the request is initiated by the user or generated according to the operation of the preset program.
Optionally, the request parameters obtained by the obtaining module 110 may include: a path of the service request, a type of the service request, parameters of the service request, a request body of the service request, a header of the service request, and a source of the service request.
Since the obtaining module 110 executes the service request as being executed in the memory of the electronic device, the obtaining module 110 may establish a first temporary variable in the memory, so as to store the obtained request parameter in the temporary variable in the form of an array. The obtaining module 110 may then call the relevant port required for executing the service request according to the request parameter in the first temporary variable, and obtain the port call result. The called relevant port may be a third-party port on the electronic device, for example, a video APP on the electronic device initiates a payment request, and the obtaining module 110 needs to call the relevant port of the payment APP on the electronic device to implement a final payment function when executing the payment request.
Of course, to ensure data integrity, the obtaining module 110 also stores the obtained port call results in an array to the first temporary variable. Thus, the first temporary variable stores the request parameter and the port call result, which can be regarded as the relevant parameters of the service request, i.e. the obtaining module 110 obtains the relevant parameters of the service request including the request parameter and the port call result.
Optionally, the processing module 120 is further configured to store the request parameter stored in the first temporary variable into a storage area corresponding to the service request in the Redis, and establish a Redis service key name associated with the service request in the service execution queue.
In detail, the first temporary variable is located in a memory of the electronic device, and the first temporary variable occupies resources of the memory. In order to optimize the resource utilization rate of the memory, after the obtaining module 110 stores the obtained port call result in the first temporary variable, the processing module 120 may store the relevant parameter in the first temporary variable in a storage area corresponding to a service request in the Redis of the electronic device, and delete the first temporary variable in the memory. Therefore, the relevant parameters of the service request are guaranteed not to be lost by being stored in the storage area, the first temporary variable in the memory is deleted, and the resource utilization rate of the memory is optimized. A
In this embodiment, since the service request is executed asynchronously, the service request needs to be executed in the service execution queue subsequently. Then, while the processing module 120 stores the relevant parameters of the service request in the storage area in the Redis, the processing module 120 may also associate the service request into the service execution queue, so that the service request can be continuously executed through the service execution queue in the following.
As a way of associating the service request with the service execution queue, the processing module 120 may establish a Redis service key name associated with the service request in the service execution queue, where the Redis service key name enables the processing module 120 to execute the service in the service execution queue to the Redis service key name, and the processing module 120 may search a storage area of the Redis for a relevant parameter of the service request according to the Redis service key name. Optionally, the execution module 130 is further configured to obtain the relevant parameter stored in the storage area and associated with the Redis service key name according to the Redis service key name in the service execution queue, and establish a second temporary variable to store the relevant parameter; and executing the service request according to the related parameters in the second temporary variable, and obtaining the execution result of the service request.
As the execution module 130 sequentially executes the services sequentially ordered in the service execution queue, the execution module 130 may execute the service request in the service execution queue at the Redis service key name in the service execution queue. Thus, the execution module 130 can obtain the Redis service key name.
By parsing the key name of the Redis service, the execution module 130 may learn that the key name of the Redis service indicates that the execution module 130 needs to obtain the relevant parameter of the service request. Then, the execution module 130 may find a storage area associated with the Redis service key name from the Redis according to the Redis service key name, so as to obtain the stored relevant parameters of the service request from the storage area.
Also, since execution module 130 executes the service request as being executed in the memory of the electronic device, execution module 130 may also re-establish a second temporary variable in the memory, so as to restore the obtained relevant parameter to the second temporary variable. In this way, the execution module 130 can execute the service request according to the execution of the relevant parameter in the second temporary variable, and the execution module 130 can obtain an execution result indicating that the execution of the service request is successful or failed. For example, a video APP on the electronic device initiates a payment request, and the electronic device, through execution of relevant parameters of the payment request, may initiate payment through the payment APP on the electronic device and obtain a payment result indicating success or failure of payment.
In detail, the recording module 140 and the deleting module 150 may determine whether the execution of the service request is successful or failed according to a return value in the execution result.
If the return value in the execution result is the first preset value, the recording module 140 may determine that the execution of the service request is successful according to the first preset value. Based on the result, the recording module 140 may delete the second temporary variable to optimize the memory in order to guarantee the performance of the electronic device. Meanwhile, the recording module 140 may also delete both the obtained execution result and the relevant parameters of the service request stored in the Redis, so as to prevent the redundant data from affecting the performance of the device.
If the return value in the execution result is the second preset value, the deleting module 150 may determine that the execution of the service request is an execution failure according to the second preset value. Based on the result, in order to ensure that the operation and maintenance staff can accurately locate the reason for the execution failure, the deleting module 150 may generate a service log of the service request based on the obtained execution result and the relevant parameters of the service request stored in the Redis. Because the execution result and the related parameters can completely show the complete execution process of the service request, the operation and maintenance personnel can quickly and accurately locate the reason of the execution failure of the service request from the complete execution process based on the service log containing the execution result and the related parameters.
It is to be understood that, also to ensure the performance of the electronic device, the deletion module 150 may delete the second temporary variable after generating the service log to optimize the memory. Meanwhile, the deleting module 150 may also delete both the obtained execution result and the parameter related to the service request stored in the Redis, and also avoid that these redundant data affect the performance of the device. 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, embodiments of 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, embodiments of 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.
To sum up, the embodiment of the present application provides a method and an apparatus for processing a service. The method comprises the following steps: obtaining relevant parameters of a service request; storing the relevant parameters and associating the service request into a service execution queue; when the service execution queue executes the service request, executing the service request according to the storage related parameters and obtaining an execution result of the service request; and when the execution failure of the service request is determined according to the execution result, recording a service log generated according to the relevant parameters and the execution result.
By storing the relevant parameters of the service request, when the service execution queue asynchronously executes to the service request, the service request can be executed according to the stored relevant parameters, and when the execution of the service request is determined to fail according to the execution result, even if the execution of the service request is asynchronously executed to split the execution of the service request, a service log capable of expressing the complete execution process of the service request can be generated according to the stored relevant parameters and the execution result. The operation and maintenance personnel can know what the whole execution process of the service request is according to the service log, so that the operation and maintenance personnel can conveniently search and locate the problem that the execution of the service request is wrong.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (4)

1. A method for processing a service, the method comprising:
obtaining relevant parameters of a service request, wherein the relevant parameters comprise request parameters and a port calling result, and the request parameters comprise a path of the service request, the type of the service request, parameters of the service request, a request body of the service request, a head of the service request and a source of the service request; the obtaining of the relevant parameters of the service request includes: establishing a first temporary variable to store a request parameter for obtaining a service request; calling a relevant port required for executing the service request according to the request parameter, obtaining a port calling result, and storing the port calling result in the first temporary variable;
storing the relevant parameters and associating the service request into a service execution queue, including: storing the relevant parameters stored in a first temporary variable into a storage area corresponding to the service request in Redis, establishing a Redis service key name associated with the service request in the service execution queue, and deleting the first temporary variable;
when the service execution queue executes the service request, executing the service request according to the stored relevant parameters, and obtaining an execution result of the service request, including: according to the Redis service key name in the service execution queue, obtaining the related parameters which are stored in the storage area and are related to the Redis service key name, and establishing a second temporary variable to store the related parameters; executing the service request according to the related parameters in the second temporary variable, and obtaining the execution result of the service request;
and when the execution failure of the service request is determined according to the execution result, recording a service log generated according to the relevant parameters and the execution result.
2. The method for processing the service according to claim 1, wherein when the service execution queue executes the service request, after the service request is executed according to the stored relevant parameters and the execution result of the service request is obtained, the method further comprises:
and deleting the relevant parameters and the execution result when the execution success of the service request is determined according to the execution result.
3. An apparatus for processing traffic, the apparatus comprising:
the system comprises an obtaining module, a processing module and a processing module, wherein the obtaining module is used for obtaining relevant parameters of a service request, and the relevant parameters comprise request parameters and a port calling result, wherein the request parameters comprise a path of the service request, a type of the service request, parameters of the service request, a request body of the service request, a head of the service request and a source of the service request; the obtaining module is also used for establishing a first temporary variable to store the request parameter of the service obtaining request; calling a relevant port required for executing the service request according to the request parameter, obtaining a port calling result, and storing the port calling result in the first temporary variable;
the processing module is used for storing the related parameters and associating the service request into a service execution queue; the system is further used for storing the relevant parameters stored in a first temporary variable into a storage area corresponding to the service request in Redis, establishing a Redis service key name associated with the service request in the service execution queue, and deleting the first temporary variable;
the execution module is used for executing the service request according to the stored related parameters and obtaining the execution result of the service request when the service execution queue executes the service request; the system is further used for obtaining the relevant parameters stored in the storage area and associated with the Redis service key name according to the Redis service key name in the service execution queue, and establishing a second temporary variable to store the relevant parameters; executing the service request according to the related parameters in the second temporary variable, and obtaining the execution result of the service request;
and the recording module is used for recording a service log generated according to the relevant parameters and the execution result when the execution failure of the service request is determined according to the execution result.
4. The apparatus for processing service of claim 3, wherein the apparatus further comprises:
and the deleting module is used for deleting the relevant parameters and the execution result when the execution success of the service request is determined according to the execution result.
CN201811177448.5A 2018-10-10 2018-10-10 Service processing method and device Active CN109298928B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811177448.5A CN109298928B (en) 2018-10-10 2018-10-10 Service processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811177448.5A CN109298928B (en) 2018-10-10 2018-10-10 Service processing method and device

Publications (2)

Publication Number Publication Date
CN109298928A CN109298928A (en) 2019-02-01
CN109298928B true CN109298928B (en) 2021-05-25

Family

ID=65162138

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811177448.5A Active CN109298928B (en) 2018-10-10 2018-10-10 Service processing method and device

Country Status (1)

Country Link
CN (1) CN109298928B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113449023A (en) * 2020-09-01 2021-09-28 北京新氧科技有限公司 Service processing method and device and electronic equipment
CN113296996B (en) * 2021-05-31 2024-03-29 中国民航信息网络股份有限公司 Service request processing method, related device and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101753344A (en) * 2008-12-12 2010-06-23 华为技术有限公司 Method, device and system for logging
CN107995169A (en) * 2017-11-21 2018-05-04 厦门点触科技股份有限公司 A kind of mobile phone games skeleton system based on micro services framework

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101710411A (en) * 2009-12-01 2010-05-19 中国建设银行股份有限公司 Method and equipment for processing real-time task
CN106250178B (en) * 2016-07-26 2019-10-25 北京北森云计算股份有限公司 The method that realization system dynamic function intercepts extension online is compiled by multilingual cloud
CN107659555B (en) * 2016-08-30 2020-08-11 北京长亭未来科技有限公司 Network attack detection method and device, terminal equipment and computer storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101753344A (en) * 2008-12-12 2010-06-23 华为技术有限公司 Method, device and system for logging
CN107995169A (en) * 2017-11-21 2018-05-04 厦门点触科技股份有限公司 A kind of mobile phone games skeleton system based on micro services framework

Also Published As

Publication number Publication date
CN109298928A (en) 2019-02-01

Similar Documents

Publication Publication Date Title
CN109951547B (en) Transaction request parallel processing method, device, equipment and medium
US9009539B1 (en) Identifying and grouping program run time errors
CN110851159B (en) Business rule updating method and device, computer equipment and storage medium
US11567756B2 (en) Causality determination of upgrade regressions via comparisons of telemetry data
US20210042150A1 (en) Method-call-chain tracking method, electronic device, and computer readable storage medium
CN112154420A (en) Automatic intelligent cloud service testing tool
US10642585B1 (en) Enhancing API service schemes
CN107644075B (en) Method and device for collecting page information
US20160196188A1 (en) Failure recovery of a task state in batch-based stream processing
CN109298928B (en) Service processing method and device
CN108509322B (en) Method for avoiding excessive return visit, electronic device and computer readable storage medium
CN111698281B (en) Resource downloading method and device, electronic equipment and storage medium
CN110750443A (en) Webpage testing method and device, computer equipment and storage medium
CN110647463B (en) Method and device for restoring test breakpoint and electronic equipment
CN110069217B (en) Data storage method and device
CN114090113B (en) Method, device, equipment and storage medium for dynamically loading data source processing plug-in
CN111694639A (en) Method and device for updating address of process container and electronic equipment
CN114817340A (en) Data tracing method and device, computer equipment and storage medium
CN106210159B (en) Domain name resolution method and device
CN111611058A (en) Task execution method and device and electronic equipment
CN108390770B (en) Information generation method and device and server
US10474443B2 (en) Code lineage tool
CN115328734A (en) Cross-service log processing method and device and server
CN112818204B (en) Service processing method, device, equipment and storage medium
CN115220714A (en) Development method and device of application programming interface

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 27D, building 2, building 1, Dachong Business Center (phase II), 9678 Shennan Avenue, Dachong community, Yuehai street, Nanshan District, Shenzhen City, Guangdong Province

Applicant after: Shenzhen Gaodeng Computer Technology Co.,Ltd.

Address before: 570100 Hainan Ecological Software Park

Applicant before: HAINAN GAODENG TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20221223

Address after: Room 812, Kechuang Building, No. 860, West Wangjiang Road, High tech Zone, Hefei City, Anhui Province, 230000

Patentee after: Anhui Gaodeng Weixing Technology Co.,Ltd.

Address before: 27D, building 2, building 1, Dachong Business Center (phase II), 9678 Shennan Avenue, Dachong community, Yuehai street, Nanshan District, Shenzhen City, Guangdong Province

Patentee before: Shenzhen Gaodeng Computer Technology Co.,Ltd.

TR01 Transfer of patent right
CP03 Change of name, title or address

Address after: Building A1, 37th Floor, Zhong'an Chuanggu Science and Technology Park, No. 900 Wangjiang West Road, Shushan District, Hefei City, Anhui Province, China 230031

Patentee after: Anhui Yilu Weixing Technology Co.,Ltd.

Country or region after: China

Address before: Room 812, Kechuang Building, No. 860, West Wangjiang Road, High tech Zone, Hefei City, Anhui Province, 230000

Patentee before: Anhui Gaodeng Weixing Technology Co.,Ltd.

Country or region before: China

CP03 Change of name, title or address