Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer and more complete, the technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention, and based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without creative efforts belong to the scope of the present invention.
As shown in fig. 1, an embodiment of the present invention provides a method for processing a service request, where the method may include the following steps:
step 101: receiving a service request, wherein the service request comprises: type identification, current external single number.
The type identifier, the current external single number and the service information can be included in the created service request. For example, the user orders and purchases the commodity B in the service system a, and the order number provided by the service system a to the user is the current external order number. The create-type service request may be a payment request, a registration request, etc.
Any one or more of type identification, current external single number, current internal single number and service information can be included in the dependent service request. The current internal single number corresponds to the current external single number. The dependent service request may be a refund request.
For example, the user purchases a product B at a business system a (e-commerce platform), and the business system a generates an order number 001. The method receives a creating type service request which is sent by a service system A and comprises an order number 001, and determines that a payment order number is 002.
At this time, the order number 001 is the above-mentioned current external order number.
When the user returns the commodity B, the method receives a dependent service request which is sent by the service system A and comprises an order number 001 and a payment order number 002.
In this case, the order number 001 is the current external ticket number, and the payment ticket number 002 is the current internal ticket number.
It should be noted that the create-type service request refers to a service request generated without depending on a previous service, and the dependent-type service request is generated based on a previous service.
Step 102: and determining the type of the service request according to the type identifier.
The types of service requests include: a create service request, and/or a dependent service request.
Step 103: when the service request is a creating type service request, and the stored corresponding relation between the external single number and the internal single number does not have the current external single number, the service request is routed to a new service system, the current internal single number is generated, and the corresponding relation between the current external single number and the current internal single number is stored.
The phrase "no current external single number exists in the corresponding relationship between the external single number and the internal single number" means that no corresponding relationship including the current external single number exists in the corresponding relationship between the external single number and the internal single number.
When the type of the service request is a creation type, it is indicated that the service corresponding to the service request is new, and the service can be switched to a new service system without depending on other services. In the embodiment of the invention, the current internal single number corresponds to the new service system. For a create-type service request, the payment order number 002 is the current internal order number.
The current internal account can identify a service system for processing a service request corresponding to the current external account.
The method stores the corresponding relation between the external single number and the internal single number, and switches the created service request to a new service system under the condition of not stopping the work of the service system, thereby ensuring the availability of the service and improving the experience of users. Meanwhile, the method can ensure that the repeatedly sent establishment type service requests are processed consistently, and the quality of service is ensured.
In one embodiment of the present invention, in order to ensure consistent processing of repeatedly transmitted create-type service requests, the method further comprises:
a1: and when the service request is a created service request and the current external single number exists in the corresponding relation between the external single number and the internal single number, determining a first service system corresponding to the service request according to the internal single number corresponding to the current external single number.
For the creating type service request, when the current external single number exists in the corresponding relation between the external single number and the internal single number, it indicates that the creating type service request has been processed once, the creating type service request is repeatedly sent, and the service system executing the request should be consistent with the previously determined service system. Of course, for the repeatedly transmitted create-type service request or the repeatedly transmitted dependent-type service request, the execution may also be rejected, and the create-type service request or the repeatedly transmitted dependent-type service request is prompted.
A2: routing the service request to a first service system; the first service system is a new service system or an old service system.
In one embodiment of the invention, the method further comprises: and when the service request is a dependent service request, determining whether the current external single number exists in the corresponding relation between the external single number and the internal single number, and if not, routing the service request to the old service system.
For a dependent service request, when there is no current external account in the corresponding relationship between the external single number and the internal single number, it is indicated that the internal service that the dependent service request depends on should be processed earlier, that is, the current internal account is generated earlier, and it can be considered that there is no new service system at that time.
In one embodiment of the present invention, in order to ensure consistent processing of the repeatedly transmitted dependent service requests, the method further includes:
b1: and when the service request is a dependent service request, determining whether the current external single number exists in the corresponding relation between the external single number and the internal single number, and if so, determining a second service system corresponding to the service request according to the internal single number corresponding to the current external single number.
For the dependent service request, when the current external single number exists in the corresponding relationship between the external single number and the internal single number, it indicates that the dependent service request has been processed, the dependent service request is repeatedly sent, and the service system executing the request should be consistent with the previously determined service system.
B2: routing the service request to a second service system; wherein, the second service system is a new service system or an old service system.
It should be noted that, for the dependent service request, the second service system may also be directly determined according to the current internal single number carried by the dependent service request, without the need of the corresponding relationship between the stored external single number and the stored internal single number.
In an embodiment of the present invention, in order to ensure that a new service system and an old service system realize smooth flow switching and prevent unstable new service system caused by excessive switched flow, routing a service request to the new service system includes:
routing a first number of service requests of the service requests to a new service system, and routing a second number of service requests of the service requests to an old service system; wherein the first number and the second number meet a preset tangential flow proportion.
In an actual application scenario, the traffic proportion can be dynamically adjusted according to the operating conditions of the new service system and the old service system. And determining whether to route the service request to a new service system according to the flow cutting proportion.
In one embodiment of the present invention, in order to realize smooth interfacing with a new service system and an old service system, routing a service request to the new service system includes:
routing the service request to a new service system according to a preset access mode; wherein, the access mode includes: any one or more of RPC (Remote Procedure Call), HTTP (Hypertext Transfer Protocol), and HTTPs (Hypertext Transfer Protocol Secure).
Preferably, the service request is routed to the new service system using RPC. The service request is routed into the old service system using HTTP or HTTPs.
As shown in fig. 2, an embodiment of the present invention will describe in detail a method for processing a service request, where the method includes:
step 201: receiving a service request, wherein the service request comprises: type identification, current external single number.
Step 202: and determining the type of the service request according to the type identifier, executing step 203 when the service request is a creation type service request, and executing step 206 when the service request is a dependent type service request.
In an actual application scenario, different types of service requests correspond to different processing logics, and therefore, the service requests are processed separately. Namely, the creating service request enters the creating service entrance, and the dependent service request enters the dependent service entrance.
Step 203: and determining whether the stored corresponding relation between the external single number and the internal single number has the current external single number, if so, executing the step 204, otherwise, executing the step 205.
Step 204: determining a first service system corresponding to the service request according to the internal single number corresponding to the current external single number, and routing the service request to the first service system; the first service system is a new service system or an old service system.
Step 205: and routing the service request to a new service system, generating a current internal single number, and storing the corresponding relation between the current external single number and the current internal single number.
Step 206: and (4) determining whether the corresponding relation between the external single number and the internal single number has the current external single number, if so, executing the step 207, otherwise, executing the step 208.
Step 207: determining a second service system corresponding to the service request according to the internal single number corresponding to the current external single number; routing the service request to a second service system; wherein, the second service system is a new service system or an old service system.
Step 208: the service request is routed to the old service system.
In an actual application scenario, as the flow switching process proceeds, the created service request realizes 100% flow switching, that is, all the received created service requests are routed to the new service system. At this time, because the dependent service is generally an asynchronous service, a short pause processing can be performed on the dependent service request. When the processing of the dependent service request is suspended, all data in the old service system can be converted into the data format of the new service system according to the mapping rule, and the data is imported into the database of the new service system.
When the order creation class service switching reaches 100%, all requests are requested to the new system, and the dependent class service needs to be stopped. Typically, the dependency service is an asynchronous service, such as a refund. Since the service result is not immediately available, a short stop can be made. At this time, the dependent service is stopped, all data of the old system are converted into the data format of the new system according to a certain mapping rule, and the data format is imported into the database of the new system. Thereafter, processing of dependent service requests can resume, and all service requests will be routed to the new service system.
As shown in fig. 3, the present invention provides a service request processing apparatus, including:
a traffic ingress unit 301, configured to receive a service request, where the service request includes: type identification, current external single number;
a service splitting unit 302, configured to determine the type of the service request according to the type identifier;
and a flow switching unit 303, configured to determine whether a current external single number exists in a corresponding relationship between the stored external single number and the stored internal single number when the service request is a create-type service request, route the service request to a new service system if the current external single number does not exist in the corresponding relationship between the stored external single number and the stored internal single number, generate a current internal single number, and store a corresponding relationship between the current external single number and the current internal single number.
In an embodiment of the present invention, the flow switching unit 303 is further configured to determine, when the service request is a create-type service request, and a current external single number exists in a corresponding relationship between the external single number and the internal single number, a first service system corresponding to the service request according to the internal single number corresponding to the current external single number; routing the service request to a first service system; the first service system is a new service system or an old service system.
In an embodiment of the present invention, the flow switching unit 303 is further configured to determine whether a current external single number exists in a corresponding relationship between the external single number and the internal single number when the service request is a dependent service request, and if not, route the service request to the old service system.
In an embodiment of the present invention, the flow switching unit 303 is further configured to determine, when the service request is a dependent service request and a current external single number exists in a corresponding relationship between the external single number and the internal single number, a second service system corresponding to the service request according to the internal single number corresponding to the current external single number; routing the service request to a second service system; wherein, the second service system is a new service system or an old service system.
In an embodiment of the present invention, the flow switching unit 303 is configured to route a first number of service requests of the service requests to a new service system, and route a second number of service requests of the service requests to an old service system; wherein the first number and the second number meet a preset tangential flow proportion.
In an embodiment of the present invention, the flow switching unit 303 is configured to route the service request to a new service system according to a preset access manner; wherein, the access mode includes: any one or more of RPC, HTTP and HTTPs.
An embodiment of the present invention provides a device for processing a service request, including: a processor and a memory;
the memory is used for storing execution instructions, and the processor is used for executing the execution instructions stored by the memory to realize the method of any one of the above embodiments.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention 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 invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. 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. The use of the phrase "including a" does not exclude the presence of other, identical elements in the process, method, article, or apparatus that comprises the same element, whether or not the same element is present in all of the same element.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is 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.