Summary of the invention
The application is to provide a kind of processing method and processing device of business, and with effective solution, above-mentioned there are technical problems.
To achieve the goals above, embodiments herein is accomplished in that
In a first aspect, the embodiment of the present application provides a kind of processing method of business, which comprises
Obtain the relevant parameter of service request;
The relevant parameter is stored, and the service request is associated with business and is executed in queue;
When the business executes queue and goes to the service request, the industry is executed according to the relevant parameter is stored
Business request, and obtain the implementing result of the service request;
When determining that the service request executes failure according to the implementing result, record according to the relevant parameter and institute
State the business diary of implementing result generation.
In some implementations optionally of first aspect, the relevant parameter is stored, and by the business
Request is associated with business and executes in queue, comprising:
The storage of relevant parameter described in the first temporary variable will be stored in the corresponding storage of service request described in Redis
Region, and executed in the business and establish the Redis business key name for being associated with the service request in queue.
In some implementations optionally of first aspect, asked according to the relevant parameter execution business is stored
It asks, and obtains the implementing result of the service request, comprising:
The Redis business key name in queue is executed according to the business, acquisition is stored in the storage region
With the associated relevant parameter of the Redis business key name, and establishes the second temporary variable and store the relevant parameter;
The service request is executed according to the relevant parameter in second temporary variable, and obtains the business and asks
The implementing result asked.
In some implementations optionally of first aspect, the relevant parameter includes that required parameter and port are called
As a result;
The relevant parameter for obtaining service request, comprising:
The first temporary variable is established to store the required parameter for obtaining service request;
Related port needed for executing the service request is called according to the required parameter, and is obtained port and called knot
Fruit, and the port call result stored in first temporary variable.
In some implementations optionally of first aspect, the business is gone in business execution queue and is asked
When asking, the service request is executed according to the relevant parameter is stored, and after obtaining the implementing result of the service request, institute
State method further include:
When determining that the service request runs succeeded according to the implementing result, by the relevant parameter and the execution
As a result it deletes.
Second aspect, the embodiment of the present application provide a kind of processing unit of business, and described device includes:
Module is obtained, for obtaining the relevant parameter of service request;
Processing module is associated with business execution queue for storing the relevant parameter, and by the service request
In;
Execution module, for when the business executes queue and goes to the service request, according to storing the correlation
Parameter executes the service request, and obtains the implementing result of the service request;
Logging modle, for recording according to institute when determining that the service request executes failure according to the implementing result
State the business diary of relevant parameter and implementing result generation.
In some implementations optionally of second aspect, the processing module is also used to be stored in first and faces
The storage of relevant parameter described in variations per hour is held to the corresponding storage region of service request described in Redis, and in the business
The Redis business key name for being associated with the service request is established in row queue.
In some implementations optionally of second aspect, the execution module is also used to be held according to the business
The Redis business key name in row queue, acquisition are stored in being associated in the storage region with the Redis business key name
The relevant parameter, and establish the second temporary variable and store the relevant parameter;According to the institute in second temporary variable
It states relevant parameter and executes the service request, and obtain the implementing result of the service request.
In some implementations optionally of second aspect, the relevant parameter includes that required parameter and port are called
As a result;
The acquisition module is also used to establish the first temporary variable to store the required parameter for obtaining service request;According to
The required parameter calls execute the service request needed for related port, and obtain port call result, and described the
The port call result stored in one temporary variable.
In some implementations optionally of second aspect, described device further include:
Removing module, for when determining that the service request runs succeeded according to the implementing result, by the correlation
Parameter and the implementing result are deleted.
The third aspect, the embodiment of the present application provide a kind of electronic equipment, and the electronic equipment includes: processor, storage
Device, bus and communication interface;The processor, the communication interface and memory are connected by the bus.
The memory, for storing program.
The processor, for the program by calling storage in the memory, to execute first aspect and first
The processing method of business described in any embodiment of aspect.
Fourth aspect, the embodiment of the present application provide a kind of calculating of non-volatile program code that can be performed with computer
The readable storage medium of machine, said program code execute the computer in a first aspect, and first aspect any embodiment
The processing method of the business.
The beneficial effect of the embodiment of the present application is:
By storing the relevant parameter of the service request, then executing queue asynchronous execution to the service request in business
When, not only service request can be executed according to the relevant parameter is stored, and determining that service request executes mistake according to implementing result
When losing, even if business executes queue asynchronous execution and isolates out the execution of the service request, it is also possible to the correlation according to storage
The business diary that can express the complete implementation procedure of the service request that parameter and implementing result generate.So that operation maintenance personnel according to
Business diary can know that kind of the entire implementation procedure of service request is, so that operation maintenance personnel can be easily to business
The problem that mistake occurs for the execution of request is searched and is positioned.
To enable the above objects, features, and advantages of the application to be clearer and more comprehensible, preferred embodiment is cited below particularly, and cooperate
Appended attached drawing, is described in detail below.
Specific embodiment
Below in conjunction with attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Ground description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.Usually exist
The component of the embodiment of the present application described and illustrated in attached drawing can be arranged and be designed with a variety of different configurations herein.Cause
This, is not intended to limit claimed the application's to the detailed description of the embodiments herein provided in the accompanying drawings below
Range, but it is merely representative of the selected embodiment of the application.Based on embodiments herein, those skilled in the art not into
Row goes out every other embodiment obtained under the premise of creative work, shall fall in the protection scope of this application.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang Yi
It is defined in a attached drawing, does not then need that it is further defined and explained in subsequent attached drawing.Term " first ", " the
Two " etc. are only used for distinguishing description, are not understood to indicate or imply relative importance.
First embodiment
Referring to Fig. 1, the embodiment of the present application provides electronic equipment 10, electronic equipment 10 can be terminal device or be
Server.Wherein, terminal device can be PC (personal computer, PC), tablet computer, smart phone, a
Personal digital assistant (personal digital assistant, PDA) etc.;Server can take for network server, database
Business device, Cloud Server or the server set that is made of multiple child servers at etc..
In the present embodiment, which may include: memory 11, communication module 12, bus 13 and processor 14.
Wherein, processor 14, communication module 12 and memory 11 are connected by bus 13.Processor 14 is deposited in memory 11 for executing
The executable module of storage, such as computer program.The component and structure of electronic equipment 10 shown in FIG. 1 are only exemplary, and
Unrestricted, as needed, electronic equipment 10 also can have other assemblies and structure.
Wherein, memory 11 may include high-speed random access memory (Random Access Memory RAM),
It may further include non-labile memory (non-volatile memory), for example, at least a magnetic disk storage.This implementation
In example, memory 11 stores program required for the processing method of execution business.
Bus 13 can be isa bus, pci bus or eisa bus etc..It is total that bus can be divided into address bus, data
Line, control bus etc..Only to be indicated with a four-headed arrow in Fig. 1, it is not intended that an only bus or one convenient for indicating
The bus of seed type.
Processor 14 may be a kind of IC chip, the processing capacity with signal.During realization, above-mentioned side
Each step of method can be completed by the integrated logic circuit of the hardware in processor 14 or the instruction of software form.Above-mentioned
Processor 14 can be general processor, including central processing unit (Central Processing Unit, abbreviation CPU), network
Processor (Network Processor, abbreviation NP) etc.;It can also be digital signal processor (DSP), specific integrated circuit
(ASIC), ready-made programmable gate array (FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components.It may be implemented or execute disclosed each method, step and the logic diagram in the embodiment of the present invention.It is general
Processor can be microprocessor or the processor is also possible to any conventional processor etc..In conjunction with institute of the embodiment of the present invention
The step of disclosed method, can be embodied directly in hardware decoding processor and execute completion, or with the hardware in decoding processor
And software module combination executes completion.Software module can be located at random access memory, and flash memory, read-only memory may be programmed read-only
In the storage medium of this fields such as memory or electrically erasable programmable memory, register maturation.
Method performed by the device of stream process or definition that any embodiment of the embodiment of the present invention discloses can be applied to
In processor 14, or realized by processor 14.Processor 14 is stored in after receiving and executing instruction by the calling of bus 13
After program in memory 11, processor 14, which controls communication module 12 by bus 13, can then execute the processing method of business
Process.
Second embodiment
Referring to Fig. 2, present embodiments providing a kind of processing method of business, the processing method of the business is applied to electronics
Equipment, the processing method of the business include: step S100, step S200, step S300 and step S400.
Step S100: the relevant parameter of service request is obtained.
Step S200: the relevant parameter is stored, and the service request is associated with business and is executed in queue.
Step S300: when the business executes queue and goes to the service request, according to the storage relevant parameter
The service request is executed, and obtains the implementing result of the service request.
Step S400: it when determining that the service request executes failure according to the implementing result, records according to the phase
Close the business diary that parameter and the implementing result generate.
The present processes process will be described in detail below.
Step S100: the relevant parameter of service request is obtained.
Service request can may be on electronic equipment or electronic equipment for Client-initiated request or service request
The application program request that needs to generate in the process of running according to pre-set programs.For example, service request is Client-initiated
When request, service request can be for such as requesting payment request, video;In another example service request is according to default journey
Sort run and when the request generated, service request such as data can update request, compression of images request for.
Certainly, whether according further to the request for running and generating according to pre-set programs, electronics is set for Client-initiated request
Standby be all based on generates the service request and obtains the required parameter in the service request.
Optionally, electronic equipment obtain required parameter may include: the path of service request, service request type,
Request body, the head of service request and the source of service request of the parameter of service request, service request.
It is to execute in the memory of electronic equipment since electronic equipment executes the service request, then electronic equipment can be
First temporary variable is established in memory, so that the required parameter of acquisition is arrived the temporary variable with the formation storage of array
In.In this way, electronic equipment can call phase needed for executing the service request according to the required parameter in the first temporary variable
Port is closed, and obtains port call result.Wherein, the related port called can be the third party port on electronic equipment,
For example, the video APP on electronic equipment initiates payment request, just need to call then the electronic equipment executes the payment request
The related port of payment APP on electronic equipment, to realize final payment function.
It certainly, is the integrality for guaranteeing data, electronic equipment is also deposited the port call result of acquisition in the form of array
It stores up in first temporary variable.In this way, required parameter and port call result are just saved in the first temporary variable, the request
Parameter and port call result are it may be considered that be the relevant parameter of the service request, i.e. electronic equipment just obtains the business and asks
Seek the relevant parameter comprising required parameter and port call result.
For electronic equipment after obtaining relevant parameter, electronic equipment can continue to execute step S200.
Step S200: the relevant parameter is stored, and the service request is associated with business and is executed in queue.
First temporary variable is located in the memory of electronic equipment, then the first temporary variable would take up the resource of memory.
For the resource utilization of memory optimization, after electronic equipment stores the port call result of acquisition into the first temporary variable, electricity
Relevant parameter in first temporary variable can be stored into the Redis of electronic equipment that service request is corresponding deposits by sub- equipment
Storage area domain, and first temporary variable in memory is deleted.So i.e. ensure that the relevant parameter of the service request pass through by
Storage region is stored without losing, and deletes the resource utilization of the first temporary variable in memory and memory optimization.,
In the present embodiment, also due to the service request is asynchronous execution, therefore the service request is subsequent also needs to hold in business
It is executed in row queue.So, while the storage region in Redis stores the relevant parameter of the service request,
The service request can also be associated with to business to execute in queue, this can be continued to execute by business execution queue so as to subsequent
Service request.
A kind of mode that queue is associated is executed as by service request and business, can execute in queue and build in business
The Redis business key name of vertical associated services request, the Redis business key name allow for electronic equipment and execute the business in queue
Business when going at the Redis business key name, electronic equipment can go depositing for Redis according to the Redis business key name
The relevant parameter of the service request is searched in storage area domain.
It is understood that electronic equipment can continue to execute after the service request is associated in business execution queue
Step S300.
Step S300: when the business executes queue and goes to the service request, according to the storage relevant parameter
The service request is executed, and obtains the implementing result of the service request.
It is successively executed as electronic equipment executes each business successively to sort in queue to business, then electronic equipment
Can go to the business execute queue in the service request business execute queue in Redis business key name at.In this way, electric
Sub- equipment is obtained with the Redis business key name.
For electronic equipment by parsing to the Redis business key name, electronic equipment can know the Redis business key name
Indicate that electronic equipment needs to go to obtain the relevant parameter of the service request.So, electronic equipment can according to the Redis business key name
With found from Redis with the associated storage region of Redis business key name, thus obtained from the storage region storage should
The relevant parameter of service request.
Also due to it is to execute in the memory of electronic equipment that electronic equipment, which executes the service request, then electronic equipment may be used also
To re-establish second temporary variable in memory, so that the relevant parameter of acquisition be reverted in the second temporary variable.
In this way, electronic equipment can according to the execution to the relevant parameter in the second temporary variable, and realize to the service request into
Row execute, and then electronic equipment be obtained with indicate the service request execution be successfully or unsuccessfully implementing result.Example
Such as, the video APP on electronic equipment initiates payment request, then the electronic equipment passes through the relevant parameter to the payment request
It executes, so that it may payment be initiated by the payment APP on electronic equipment, and obtain expression and pay the payment knot successfully or to fail
Fruit.
In the present embodiment, after electronic equipment obtains implementing result, electronic equipment can continue to execute step S400.
Step S400: it when determining that the service request executes failure according to the implementing result, records according to the phase
Close the business diary that parameter and the implementing result generate.
Electronic equipment can be judged according to the return value in implementing result be to the execution of the service request successfully or
Failure.
If the return value obtained in implementing result is the first preset value, then electronic equipment can be according to first preset value
The execution to service request is judged to run succeeded.Based on this as a result, being the performance for guaranteeing electronic equipment, electronic equipment can be incited somebody to action
Second temporary variable is deleted, and is optimized with internally depositing.At the same time, electronic equipment can also be by the implementing result of acquisition and general
The relevant parameter of the service request stored in Redis is deleted, to avoid the performance of the data influence equipment of these redundancies.
If the return value obtained in implementing result is the second preset value, then electronic equipment can be according to second preset value
The execution to service request is judged to execute failure.Based on this as a result, to guarantee that operation maintenance personnel can accurately orient execution
The reason of failure, the relevant parameter for the service request that electronic equipment can store in implementing result based on acquisition and Redis,
Generate the business diary of the service request.Since can completely to represent the service request complete for implementing result and relevant parameter
Implementation procedure just can be from completely holding then operation maintenance personnel is based on the business diary comprising implementing result and relevant parameter
Row positions quickly and accurately the reason of service request executes failure in the process.
It is understood that being also the performance for guaranteeing electronic equipment, after generating business diary, electronic equipment can also be by the
Two temporary variables are deleted, and are optimized with internally depositing.At the same time, electronic equipment can also be by the implementing result of acquisition and general
The relevant parameter of the service request stored in Redis is deleted, and the performance of the data influence equipment of these redundancies is also avoided.
3rd embodiment
Referring to Fig. 3, the embodiment of the present application provides a kind of processing unit 100 of business, it is applied to electronic equipment, business
Processing unit 100 include:
Module 110 is obtained, for obtaining the relevant parameter of service request.
Processing module 120 is associated with business execution team for storing the relevant parameter, and by the service request
In column.
Execution module 130, for when the business executes queue and goes to the service request, according to storing the phase
It closes parameter and executes the service request, and obtain the implementing result of the service request.
Logging modle 140, for recording basis when determining that the service request executes failure according to the implementing result
The business diary that the relevant parameter and the implementing result generate.
Removing module 150, for being asked by described in when determining that the service request runs succeeded according to the implementing result
Parameter and the implementing result is asked to delete.
Optionally, the acquisition module 110 is also used to establish the request ginseng that the storage of the first temporary variable obtains service request
Number;Related port needed for executing the service request is called according to the required parameter, and obtains port call result, and
The port call result stored in first temporary variable.
In detail, service request can may be electronic equipment or electricity for Client-initiated request or service request
The request that application program in sub- equipment needs to generate in the process of running according to pre-set programs.For example, service request is to use
When the request that family is initiated, service request can be for such as requesting payment request, video;In another example service request be by
When the request generated according to pre-set programs operation, service request such as data can update request, compression of images request for.
Certainly, whether Client-initiated request obtains mould according further to the request for running and generating according to pre-set programs
Block 110, which is all based on, to be generated the service request and obtains the required parameter in the service request.
Optionally, the class that the required parameter that module 110 obtains may include: the path of service request, service request is obtained
Request body, the head of service request and the source of service request of type, the parameter of service request, service request.
It is to be executed in the memory of electronic equipment due to obtaining module 110 to execute the service request, then obtaining module 110
First temporary variable can be established in memory, so that the required parameter of acquisition be faced with the formation storage of array to this
In variations per hour.The service request is executed in this way, obtaining module 110 and can call according to the required parameter in the first temporary variable
Required related port, and obtain port call result.Wherein, the related port called can be the third on electronic equipment
Square end mouth, for example, the video APP on electronic equipment initiates payment request, then the acquisition module 110 executes the payment request just
Need to call the related port of the payment APP on electronic equipment, to realize final payment function.
Certainly, it is the integrality for guaranteeing data, obtains module 110 also by the port call result of acquisition in the form of array
It stores in first temporary variable.In this way, just saving required parameter and port call result in the first temporary variable, this is asked
Parameter and port call result are asked it may be considered that being the relevant parameter of the service request, i.e. acquisition module 110 is just somebody's turn to do
Service request includes the relevant parameter of required parameter and port call result.
Optionally, the processing module 120 is also used to be stored in required parameter storage described in the first temporary variable and arrives
The corresponding storage region of service request described in Redis, and execute the foundation association business in queue in the business and ask
The Redis business key name asked.
In detail, the first temporary variable is located in the memory of electronic equipment, then the first temporary variable would take up memory
Resource.For the resource utilization of memory optimization, module 110 is obtained by the port call result storage of acquisition to the first interim change
After in amount, the relevant parameter in first temporary variable can be stored the business into the Redis of electronic equipment by processing module 120
Corresponding storage region is requested, and first temporary variable in memory is deleted.It ensure that the phase of the service request in this way
Parameter is closed by being stored in storage region without losing, and deletes the money of the first temporary variable in memory and memory optimization
Source utilization rate.,
In the present embodiment, also due to the service request is asynchronous execution, therefore the service request is subsequent also needs to hold in business
It is executed in row queue.So, storage region of the processing module 120 in Redis stores the correlation of the service request
While parameter, which can also be associated with business and executed in queue by processing module 120, can be passed through so as to subsequent
Business executes queue and continues to execute the service request.
A kind of mode that queue is associated is executed as by service request and business, processing module 120 can be in business
The Redis business key name that associated services request is established in queue is executed, which allows for processing module 120 will
When the business that the business executes in queue is gone at the Redis business key name, processing module 120 can be according to the Redis industry
Business key name and go in the storage region of Redis to search the relevant parameter of the service request.Optionally, the execution module 130, also
For according to the business execute queue in the Redis business key name, obtain be stored in the storage region with institute
The associated relevant parameter of Redis business key name is stated, and establishes the second temporary variable and stores the relevant parameter;According to described
The relevant parameter in second temporary variable executes the service request, and obtains the implementing result of the service request.
It is successively executed as execution module 130 executes each business successively to sort in queue to business, then executing
Module 130 can go to the business execute queue in the service request business execute queue in Redis business key name at.
In this way, execution module 130 is obtained with the Redis business key name.
For execution module 130 by parsing to the Redis business key name, execution module 130 can know the Redis industry
Business key name indicates that execution module 130 needs to go to obtain the relevant parameter of the service request.So, execution module 130 is according to this
Redis business key name can be found from Redis with the associated storage region of Redis business key name, thus from the memory block
The relevant parameter of the service request of storage is obtained in domain.
Also due to it is to execute in the memory of electronic equipment that execution module 130, which executes the service request, then execution module
130 can also re-establish second temporary variable in memory, so that it is interim that the relevant parameter of acquisition is reverted to second
In variable.In this way, execution module 130 can be realized according to the execution to the relevant parameter in the second temporary variable to this
Service request is executed, so execution module 130 be obtained with indicate the service request execution be successfully or unsuccessfully
Implementing result.For example, the video APP on electronic equipment initiates payment request, then the electronic equipment is by asking the payment
The execution for the relevant parameter asked, so that it may payment is initiated by payment APP on electronic equipment, and obtain expression pay successfully or
The payment result of person's failure.
In detail, logging modle 140 and removing module 150 can be judged according to the return value in implementing result to the industry
The execution of business request is success or failure.
If obtaining the return value in implementing result is the first preset value, then logging modle 140 can be first pre- according to this
If value judges the execution to service request to run succeeded.Based on this as a result, being the performance for guaranteeing electronic equipment, logging modle
140 can delete the second temporary variable, be optimized with internally depositing.At the same time, logging modle 140 can also be by acquisition
Implementing result and the relevant parameter of the service request stored in Redis is deleted, to avoid the data influence of these redundancies
The performance of equipment.
If obtaining the return value in implementing result is the second preset value, then removing module 150 can be second pre- according to this
If value judges the execution to service request to execute failure.Based on this as a result, to guarantee that operation maintenance personnel can be oriented accurately
The reason of executing failure, the phase for the service request that removing module 150 can store in implementing result based on acquisition and Redis
Parameter is closed, the business diary of the service request is generated.Since implementing result and relevant parameter can completely represent the business
Complete implementation procedure is requested, it, just can be from then operation maintenance personnel is based on the business diary comprising implementing result and relevant parameter
The reason of service request executes failure is positioned quickly and accurately in complete implementation procedure.
It is understood that being also the performance for guaranteeing electronic equipment, after generating business diary, removing module 150 can also be with
Second temporary variable is deleted, is optimized with internally depositing.At the same time, removing module 150 can also be by the execution knot of acquisition
Fruit and the relevant parameter of the service request stored in Redis is deleted, also avoids the data influence equipment of these redundancies
Performance.It should be understood by those skilled in the art that, the embodiment of the present application can provide as method, system or computer program product.
Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the embodiment of the present application
Apply the form of example.Moreover, it wherein includes computer usable program code that the embodiment of the present application, which can be used in one or more,
The computer implemented in computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
The form of program product.
In conclusion the embodiment of the present application provides a kind of processing method and processing device of business.Method includes: acquisition business
The relevant parameter of request;Relevant parameter is stored, and service request is associated with business and is executed in queue;Team is executed in business
When column go to service request, service request is executed according to storage relevant parameter, and obtain the implementing result of service request;In root
When determining that service request executes failure according to implementing result, the business diary generated according to relevant parameter and implementing result is recorded.
By storing the relevant parameter of the service request, then executing queue asynchronous execution to the service request in business
When, not only service request can be executed according to the relevant parameter is stored, and determining that service request executes mistake according to implementing result
When losing, even if business executes queue asynchronous execution and isolates out the execution of the service request, it is also possible to the correlation according to storage
The business diary that can express the complete implementation procedure of the service request that parameter and implementing result generate.So that operation maintenance personnel according to
Business diary can know that kind of the entire implementation procedure of service request is, so that operation maintenance personnel can be easily to business
The problem that mistake occurs for the execution of request is searched and is positioned.
The above is only preferred embodiment of the present application, are not intended to limit this application, for those skilled in the art
For member, various changes and changes are possible in this application.Within the spirit and principles of this application, it is made it is any modification,
Equivalent replacement, improvement etc., should be included within the scope of protection of this application.It should also be noted that similar label and letter are under
Similar terms are indicated in the attached drawing in face, therefore, once being defined in a certain Xiang Yi attached drawing, are not then needed in subsequent attached drawing
It is further defined and explained.
More than, the only specific embodiment of the application, but the protection scope of the application is not limited thereto, and it is any to be familiar with
Those skilled in the art within the technical scope of the present application, can easily think of the change or the replacement, and should all cover
Within the protection scope of the application.Therefore, the protection scope of the application should be subject to the protection scope in claims.