CN110336865A - Service calling method, device, storage medium and electronic equipment - Google Patents
Service calling method, device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN110336865A CN110336865A CN201910540641.9A CN201910540641A CN110336865A CN 110336865 A CN110336865 A CN 110336865A CN 201910540641 A CN201910540641 A CN 201910540641A CN 110336865 A CN110336865 A CN 110336865A
- Authority
- CN
- China
- Prior art keywords
- service
- hop
- instance
- invocation request
- routing iinformation
- 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.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/74—Address processing for routing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
- H04L67/63—Routing a service request depending on the request content or context
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
This application discloses a kind of service calling method, device, electronic equipment and storage medium, route field is carried out transparent transmission by the application in call chain;Each service in call chain in the corresponding service of invocation target service identifiers, according to target ip address in the associated multiple Service Instances of the service selection target Service Instance.The process for the service called in this way can flexibly select Service Instance according to the routing iinformation in request header, do not need to configure the routing iinformation on the node of each deployment services, avoid cumbersome configuration process.
Description
Technical field
This application involves computer field more particularly to a kind of service calling method, system, device, storage medium and electricity
Sub- equipment.
Background technique
In order to execute business function, it usually needs call a series of services to realize, service call would generally be according to certain
Sequence realize the calling of multiple services, when calling, can indicate to call which or those services according to service identifiers.?
In service arrangement, a service would generally dispose multiple Service Instances, can call under the same service according to different needs
Different Service Instances.For the calling of multiple services, only can just be determined according to the routing iinformation being locally configured when calling
The specific service example being sent under service actually.And in order to realize this service call, it needs to match on the node of deployment services
Routing iinformation is set, however the number of nodes of deployment services may much and routing iinformation may be changed frequently, then matching
The mode of setting can be troublesome.
Summary of the invention
In order to solve the above technical problems, the application provides a kind of service calling method, relevant apparatus and storage medium, leads to
It crosses the carrying routing iinformation realization in request header and selects specified Service Instance in multiple service instances, avoid the numerous of configuration process
It is trivial.
In a first aspect, this application provides a kind of service calling methods, comprising:
Obtain service invocation request;If the service invocation request carries route field, wrapped according in the route field
The routing iinformation included determines next-hop Service Instance;Wherein, the routing iinformation include destination service mark and target ip address,
The route field is passed through into the next-hop Service Instance.
It is described to determine that next-hop service is real according to the routing iinformation carried in route field in a kind of possible design
Example, comprising:
Determine the service identifiers of next-hop service;
If the service identifiers of next-hop service are destination service mark;
It is being serviced under the Service Instance conduct that selection target IP address indicates in associated multiple Service Instances with next-hop
One jumps Service Instance.
In a kind of possible design, the service identifiers of the determining next-hop service include:
Determine the call chain for responding the service invocation request;
The service identifiers of next service are inquired in the call chain according to the service identifiers of current service.
It is described that next-hop Service Instance is determined according to routing iinformation in a kind of possible design, further includes:
If the service identifiers of the next-hop service are not the destination service mark;
It is serviced in associated multiple Service Instances according to preconfigured routing iinformation in the next-hop and selects next-hop
Service Instance.
In a kind of possible design, further includes:
If the route field is not carried in the service invocation request;
Preconfigured routing iinformation is obtained, it is associated more in next-hop service according to the preconfigured routing iinformation
Next-hop Service Instance is selected in a Service Instance;
The service invocation request is sent to the next-hop Service Instance.
Second aspect, this application provides a kind of service calling methods, comprising:
Acquiring unit, for obtaining service invocation request;
Determination unit, if being carried for carrying route field in the service invocation request according in the route field
Routing iinformation determine next-hop Service Instance;Wherein, the routing iinformation includes destination service mark and target ip address;
Transmission unit, for the route field to be passed through the next-hop Service Instance.
The another aspect of the application provides a kind of device, and the service scheduling method of above-mentioned first aspect may be implemented.Such as
Described device can be chip (such as baseband chip or communication chip etc.) or server.Can by software, hardware or
The corresponding software realization above method is executed by hardware.
It in one possible implementation, include processor, memory in the structure of described device;The processor quilt
It is configured to that described device is supported to execute corresponding function in above-mentioned service calling method.Memory is used to couple with processor,
Save the necessary program of described device (instruction) and/or data.Optionally, described device can also include communication interface for branch
Hold the communication between described device and other network elements.
In alternatively possible implementation, described device may include the list for executing corresponding actions in the above method
Element module.
In another possible implementation, including processor and R-T unit, the processor and the transmitting-receiving fill
Set coupling, the processor for executing computer program or instruction, with control the R-T unit carry out information reception and
It sends;When the processor executes the computer program or instruction, the processor is also used to realize the above method.Its
In, the R-T unit can be transceiver, transmission circuit or input/output interface.When described device is chip, the receipts
Transmitting apparatus is transmission circuit or input/output interface.
When described device is chip, transmission unit can be output unit, such as output circuit or communication interface;It connects
Receiving unit can be input unit, such as input circuit or communication interface.When described device is the network equipment, transmission unit
It can be transmitter or transmitter;Receiving unit can be receiver or receiver.
The another aspect of the application provides a kind of device, which includes: memory and processor;Wherein, the storage
Batch processing code is stored in device, and the processor executes each side for calling the program code stored in the memory
Method described in face.
The another aspect of the application has been mentioned for a kind of computer readable storage medium, in the computer readable storage medium
It is stored with instruction, when run on a computer, so that computer executes method described in above-mentioned various aspects.
The another aspect of the application provides a kind of computer program product comprising instruction, when it runs on computers
When, so that computer executes method described in above-mentioned various aspects.
According to the above embodiments, service invocation request is obtained, carries route field, route field in service invocation request
Including destination service mark and target ip address;According to service invocation request, the call chain for responding the service invocation request is determined;
Route field is subjected to transparent transmission in call chain;Each service in call chain is in the corresponding service of invocation target service identifiers
When, according to target ip address in the associated multiple Service Instances of the service selection target Service Instance.The service called in this way
Process Service Instance can flexibly be selected according to the routing iinformation in request header, do not need the node in each deployment services
Upper configuration routing iinformation, avoids cumbersome configuration process.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of application for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Figure 1A is a kind of network architecture diagram provided by the embodiments of the present application;
Figure 1B is the deployment schematic diagram of Service Instance provided by the embodiments of the present application;
Fig. 2 is a kind of flow diagram of service calling method provided by the embodiments of the present application;
Fig. 3 is another flow diagram of service calling method provided by the embodiments of the present application;
Fig. 4 is the schematic illustration of service invocation procedure provided by the embodiments of the present application;
Fig. 5 is another schematic illustration of service invocation procedure provided by the embodiments of the present application;
Fig. 6 is the interaction schematic diagram of service calling method provided by the embodiments of the present application;
Fig. 7 is a kind of structural schematic diagram of device provided by the embodiments of the present application.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood
The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, and
It is not used in restriction the application.Meanwhile in the description of the present application, term " first ", " second " etc. are only used for distinguishing description, without
It can be interpreted as indication or suggestion relative importance.It will be clear to one skilled in the art that these details its
The application also may be implemented in its embodiment.In other situations, it omits to well-known system, device, circuit and side
The detailed description of method, so as not to obscure the description of the present application with unnecessary details.
Figure 1A shows the exemplary system frame of the service calling method that can be applied to the application or service call device
Structure 100.
As shown in Figure 1, system architecture 100 may include terminal device 101, terminal device 102, terminal device 103, network
104 and server 105.Network 104 between terminal device 101~103 for providing the medium of communication link.Network 104 can
To include various types of wired communications links or wireless communication link, such as: wired communications links include optical fiber, twisted pair or
Coaxial cable, wireless communication link includes bluetooth communications link, Wireless Fidelity (WIreless-FIdelity, Wi-Fi) communication
Link or microwave communications link etc..
User can be used terminal 101~103 and be interacted by network 104 with server 105, come from server to receive
105 message sends message to server 105.Various communication customer ends can be installed to answer on terminal device 101~103
With, such as: video record application, video playing application, interactive voice application, searching class application, timely means of communication, mailbox visitor
Family end, social platform software etc..
Terminal device 101~103 can be hardware, be also possible to software.It, can when terminal device 101~103 is hardware
To be the various electronic equipments with display screen, including but not limited to smart phone, tablet computer, laptop portable computer
With desktop computer etc..When terminal device 101~103 is software, it can be and install above-mentioned cited electronic equipment
In.It may be implemented also to may be implemented into single soft in multiple softwares or software module (such as: for providing Distributed Services)
Part or software module, are not specifically limited herein.
When terminal device 101~103 is hardware, it is also equipped with display equipment thereon, display can be various energy
The equipment for realizing display function, such as: cathode-ray tube display (Cathode raytubedisplay, abbreviation CR) shines
Diode display (Light-emitting diode display, abbreviation LED), electronic ink screen, liquid crystal display
(Liquid crystal display, abbreviation LCD), Plasmia indicating panel (Plasma displaypanel, abbreviation PDP)
Deng.User can use the display equipment on terminal device 101~103, come information such as the texts, picture, video of checking display.
It should be noted that service calling method provided by the embodiments of the present application is generally executed by server, correspondingly, clothes
Business calling device is generally positioned in server.
It should be noted that server 105 can be hardware, it is also possible to software.It, can when server 105 is hardware
To be implemented as the distributed server cluster that multiple servers form, individual server also may be implemented into.When server 105 is
When software, multiple softwares or software module (such as providing Distributed Services) may be implemented into, also may be implemented into single
Software or software module, are not specifically limited herein.
It should be understood that the number of terminal device, network and server in Fig. 1 is only illustrative.It, can according to needs are realized
To be any number of terminal device, network and server.
Wherein, the service there are many type is disposed in server 105, each type of service is associated with one or more versions
This Service Instance, a plurality of types of services may be disposed on the same server, it is also possible to be deployed in different servers
On;Associated multiple Service Instances may be deployed on the same Service Instance under the same service, it is also possible to be deployed in difference
Service Instance on, the application is with no restriction.Service Instance indicates to execute the software environment and hardware environment of the function of the service.
Terminal device can send service invocation request to server 105, and one or more services in request call server have come
At specified function, server is responded after executing the service invocation request to terminal device transmission service call.
Such as: referring to service A, service B and service C shown in Figure 1B, is deployed in server 105, service A is associated with service
Example A1 and Service Instance A2;Service B is associated with Service Instance B1, Service Instance B2 and Service Instance B3, and service C is associated with clothes
Pragmatic example C1, Service Instance C2 and Service Instance C3.Terminal device, which calls, successively calls service A, service B and service C completion to refer to
When fixed function, due to being deployed with the Service Instance of multiple and different versions under different services.To realize specific function, need
Specified Service Instance is selected in servicing corresponding multiple Service Instances.Such as: for identical service call chain: service A
→ service B → service C, terminal device need successively to call Service Instance A1, Service Instance B1 kimonos in a service call
Pragmatic example C1 is completed;Terminal device in another secondary service call, need successively to call Service Instance A2, Service Instance B3 and
Service Instance C2 is completed, and in order to realize the service call for not having to demand, the scheme of current realization is the section in deployment services
Routing iinformation is configured on point, each node carries out the forwarding of service invocation request according to the routing iinformation of configuration, however disposes clothes
The number of nodes of business can very pair and the demand that frequently changes will lead to frequent configuration and reconfigure routing letter on each node
Breath, this configuration process undoubtedly can be troublesome.
In order to illustrate technical solution described herein, the following is a description of specific embodiments.
Referring to fig. 2, Fig. 2 is the flow diagram of service calling method provided by the embodiments of the present application, is implemented in the application
In example, which comprises
S201, service invocation request is obtained.
Wherein, service invocation request may be service caller, and service caller can be hardware and be also possible to software, example
If service caller is terminal device or application program.Service invocation request is also likely to be the clothes in call chain where some service
It is engaged in what device was sent, service call device intercepts the service invocation request of server transmission.This can be carried in service invocation request
Call chain, call chain indicate to execute the calling sequence between multiple services of specific function, and call chain may include multiple services
Calling sequencing between the service of mark and the instruction of multiple service identifiers.Such as: call chain can indicate A.com →
B.com → C.com, A.com are the domain name for servicing A, and B.com is the domain name for servicing B, and C.com is the domain name for servicing C, server
Specified function is completed after successively calling service A, service B and service C.
It wherein, include request header and message body in service invocation request, the quantity of request header can be multiple, and different asks
It asks head that there is different identity, can according to need and configure customized request header in service invocation request, this is made by oneself
Request header, that is, route field of justice.Such as: the type of message of service invocation request is HTTP (HyperText Transfer
Protocol, hypertext transfer protocol) it requests, multiple header are carried in HTTP request, each header has an identity
Marker, the identity position of route field are " 00 ", and service call device is by the identity position in identification header
No is " 00 " to determine whether there is route field.
If carrying route field in S202, service invocation request, under being determined according to the routing iinformation carried in route field
One jumps Service Instance.
Wherein, routing iinformation indicates forwarding service invocation request to the rule of next-hop Service Instance.Service call device
Next-hop service is determined according to service invocation request, and determines the associated one or more Service Instances of next-hop service;If
Next-hop service is associated with multiple Service Instances, selected in multiple Service Instances according to routing iinformation a Service Instance as
Next-hop Service Instance.
Such as: routing iinformation A.com=10.0.0.1, when which indicates the service for calling domain name to be A.com,
Selecting IP address is the Service Instance of 10.0.0.1 as next-hop Service Instance.
S203, route field is passed through to next-hop Service Instance.
It wherein, will include the call result of current service example in service invocation request, service call device adjusts service
Next-hop Service Instance is issued with request, after next-hop Service Instance receives service invocation request, analysis service call request
In whether there is route field, route field if it exists obtains the current service example in the message body in service invocation request
Call result, handled to obtain the call result of next-hop Service Instance according to the call result of current service example, will
The call result of next-hop Service Instance is encapsulated in the message body of service invocation request.Transparent transmission herein refers to not to routing word
The content of section carries out any processing, is transferred directly to next-hop Service Instance.It should be understood that while transmission route field, clothes
Message body in business call request can also be sent to next-hop Service Instance with route field.
Wherein, when next-hop Service Instance is if it is final jump Service Instance, by the calling knot of next-hop Service Instance
Fruit is encapsulated in service call response, carries call result in service call response, and service call response is sent to service and is adjusted
User.
Implement the embodiment of the present application, obtains service invocation request, carry route field, route field in service invocation request
Including destination service mark and target ip address;According to service invocation request, the call chain for responding the service invocation request is determined;
Route field is subjected to transparent transmission in call chain;Each service in call chain is in the corresponding service of invocation target service identifiers
When, according to target ip address in the associated multiple Service Instances of the service selection target Service Instance.The service called in this way
Process Service Instance can flexibly be selected according to the routing iinformation in request header, do not need the node in each deployment services
Upper configuration routing iinformation, avoids cumbersome configuration process.
It is a kind of another flow diagram of service calling method provided by the embodiments of the present application, in the application referring to Fig. 3
In embodiment, which comprises
S301, service invocation request is obtained.
Wherein, service invocation request may be from the server where current service example, be also possible to adjust from service
User (such as: terminal device).When for service invocation request from server where current service example, service call
Device can intercept the service invocation request from the server, and service invocation request can also carry call chain, call chained list
Show the calling sequence between multiple services that service caller is called, the calling that service caller is indicated according to call chain is sequentially
It can complete specific function.Call chain may include between the service of multiple service identifiers and the instruction of multiple service identifiers
Call sequencing.After service call device gets service invocation request, call chain can be determined according to service invocation request.
Such as: call chain can be expressed as A.com → B.com → C.com, and A.com is the domain name for servicing A, and B.com is clothes
The domain name of business B, C.com are the domain name for servicing C, and service is successively called service A, service B according to the call chain and completed after servicing C
Specified function.
It wherein, include request header and request body in service invocation request, the quantity of request header can be multiple, service call
The maximum quantity of request header in request be it is fixed, the maximum quantity can according to actual needs depending on.Different request headers
There is different positions in service invocation request, route field can be pre-configured in the designated position in service invocation request
Or be provided with specified identity in advance.Route field is the customized request header of user, includes routing letter in route field
Breath, the corresponding all services of call chain all can carry out routing forwarding according to the routing iinformation.
S302, analysis service call request request header.
Specifically, carrying request header and message body, service call device analysis service call request in service invocation request
The request header of middle carrying judges whether the request header is route field.
Whether S303, service invocation request carry route field.
In one or more embodiments, service call device can recognize the identity of each request header in service invocation request
Mark determines in the case where the identity of some request header is default identity and carries routing in service invocation request
Field.
Such as: can preset can at most carry 8 request headers in service invocation request, the identity mark of 8 request headers
Know the mark of 3 bits, different bits corresponds to different identity, and the identity of route field is " 000 ", clothes
When business calling device identifies that the identity of the request header carried in service invocation request is " 000 ", determine in service invocation request
Carry route field.
In one or more embodiments, route field is pre-configured in the designated position of service invocation request, and service is adjusted
It can recognize on the designated position with device with the presence or absence of request header, and if it exists, determine and carry route field in service invocation request.
Such as: 8 request headers of carrying in service invocation request, the memory space of 8 bytes of each request header occupancy, 8
Request header is respectively a corresponding relative address space in service invocation request, it is assumed that the relative address space of route field is
0X00~0XFF;It detects whether in service call device relative address space 0X00~0XFF there are request header, if service call
Device detects request header in the relative address space, determines and carries route field in service invocation request.If service call
Request header is not detected in the relative address space in device, determines and does not carry route field in service invocation request.
Wherein, the routing iinformation in route field includes destination service mark and target ip address, the road in route field
The invocation target in the associated multiple Service Instances of the service in the service that invocation target service identifiers indicate is indicated by information
The Service Instance of IP address instruction.
In one embodiment, in route field routing iinformation may include multiple groups destination service mark and target ip address,
When any one service call destination service in call chain identifies corresponding service, determined according to corresponding target ip address
Service Instance.
S304, next-hop Service Instance is determined according to preconfigured routing iinformation.
Wherein, in the case where not carrying route field in service invocation request, the acquisition of service call device is pre-configured with
Routing iinformation, routing iinformation indicate services selection next-hop Service Instance rule, this routing iinformation can be according to reality
Depending on the demand of border, the application is with no restriction.
In one embodiment, preconfigured routing iinformation includes: to obtain the associated multiple services of service to be called
The version number of example, according to newest Service Instance in the multiple Service Instances of version number's calling as destination service example.
In one embodiment, preconfigured routing iinformation includes: to obtain the associated multiple services of service to be called
The load status information of example, under calling the Service Instance that load is most light in multiple Service Instances to be used as according to load status information
One jumps Service Instance.
In one embodiment, preconfigured routing iinformation includes: to obtain the associated multiple services of service to be called
The link-state information of example calls the Service Instance that link-quality is best in multiple Service Instances to make according to link-state information
For next-hop Service Instance.
S305, route field is passed through to next-hop Service Instance.
Wherein, the call result of current Service Instance is encapsulated in the message body of service invocation request by service call device
In, service invocation request is then sent to next-hop Service Instance, still can carry route field, road in service invocation request
Next-hop Service Instance is sent to by the mode that field will use transparent transmission.Transparent transmission indicate service call device not to route field into
Row processing, is sent to next-hop Service Instance, the routing word that so all Service Instances of call chain are got in a transparent manner
Section be all it is identical, will not change.
S306, the service identifiers that next-hop service is determined according to service invocation request.
Wherein, service call device determines the service of next-hop service according to the service identifiers and call chain of current service
Mark, service identifiers may include domain name and service name, and different services has different service identifiers.
Such as: according to the example of S301, service call device determines that calling is suitable according to the call chain in service invocation request
Sequence are as follows: the domain name of A.com → B.com → C.com, current service are A.com, then determining next-hop service according to call chain
Domain name is B.com.
S307, next-hop service service identifiers whether be destination service mark.
Wherein, in the case where the service identifiers of next-hop service are that destination service identifies, S310 is executed;It is taken in next-hop
In the case that the service identifiers of business are not destination service mark, S308 is executed.
Such as: service identifiers indicate that the domain name of next-hop service is B.com, the road carried in route field with domain name
Being identified as by the destination service for including in information indicates with target ip address are as follows: B.com=10.0.0.1, B.com are target clothes
Business mark, 10.0.0.1 is target ip address, then can determine the service identifiers of next-hop service and destination service mark is phase
With.
Another example is: the domain name of next-hop service is A.com, the destination service that the routing iinformation carried in route field includes
Mark and target ip address indicate are as follows: B.com=10.0.01 can then determine the service identifiers and target clothes of next-hop service
Business mark is not identical.
S308, next-hop Service Instance is determined according to preconfigured routing iinformation.
Wherein, in the case where the service identifiers and destination service of the service that next-hop is called identify different situation, service is adjusted
Preconfigured routing iinformation is obtained with device, determines that the method for next-hop Service Instance can according to preconfigured routing iinformation
Referring to the description of S304, details are not described herein again.
S309, route field is sent to next-hop Service Instance.
Wherein, the detailed process of S309 can refer to the description of S305, and details are not described herein again.
S310, determination and destination service identify associated multiple Service Instances.
Specifically, service call device is pre-stored or is pre-configured with the IP address of destination service mark and multiple Service Instances
Between mapping relations, such as: mapping relations can indicate are as follows: A.com=(10.0.0.1,10.0.0.2,10.0.0.3).
S311, the Service Instance for indicating target ip address in multiple Service Instances are as next-hop Service Instance.
Such as: the destination service mark and target ip address carried in route field indicates are as follows: A.com=10.0.0.1,
So service call device calls the service that domain name is A.com and IP address is 10.0.01 real according to the mapping relations of S310
Example, using the Service Instance as next-hop Service Instance.
S312, route field is passed through to next-hop Service Instance.
Wherein, the call result of current service example is encapsulated in the message body of service invocation request by service call device
In, service invocation request is then sent to next-hop Service Instance, still can carry route field, road in service invocation request
Next-hop Service Instance is sent to by the mode that field will use transparent transmission.Transparent transmission indicate service call device not to route field into
Row processing, is sent to next-hop Service Instance, the routing word that so all Service Instances of call chain are got in a transparent manner
Section is all identical.
The process of the service calling method of the application is described in detail in two specific embodiments below.
Shown in Figure 4, service caller issues service invocation request, determines call chain according to service invocation request are as follows:
A → service B → service A → C is serviced, there are route field in service invocation request, the routing iinformation of route field is expressed as:
A.com=10.0.0.1.Service calling system is deployed with service A, service B and service C.The domain name for servicing A is A.com, services A
Associated 3 Service Instances, the IP address of Service Instance A1 are 10.0.0.1, and the IP address of Service Instance A2 is 10.0.0.2,
The IP address of Service Instance A3 is 10.0.0.3.The domain name for servicing B is B.com, services 3 Service Instances that are associated with of B, and is serviced
The IP address of example B1 is 20.0.0.1, and the IP address for servicing B2 is 20.0.0.2, and the IP address for servicing B3 is 20.0.0.3;Clothes
The domain name of business C is C.com, and service C is associated with 3 Service Instances, and the IP address of Service Instance C1 is 30.0.0.1, Service Instance
The IP address of C2 is 30.0.0.2.
Service caller determines that next-hop service, will according to the routing iinformation in route field for service A according to call chain
Service invocation request is sent to Service Instance A1, obtains calling knot after being handled after Service Instance A1 reception service invocation request
Call result is encapsulated in service invocation request by fruit, and Service Instance A1 determines that next-hop service is service B according to call chain,
It services B and service A is not identical, Service Instance A1 determines that next-hop calls Service Instance for clothes according to preconfigured routing iinformation
Service invocation request is sent to Service Instance B2 by pragmatic example B2, and Service Instance B2, which is received, comes from service invocation request, and service is real
Example B2 is handled to obtain call result, call result is encapsulated in service invocation request, Service Instance B2 is according to call chain
Determine that service invocation request for service A, is sent to Service Instance A1 according to the routing iinformation in route field by next-hop service,
Service Instance A1 receives service invocation request, and Service Instance A1 obtains call result after being handled, call result is encapsulated in
In service invocation request.Service Instance A1 determines that next-hop service for service C, is believed according to preconfigured routing according to call chain
Service invocation request is sent to Service Instance C1 by breath, and Service Instance C1 receives the service invocation request from Service Instance A1,
Service Instance C1 obtains call result after being handled, Service Instance C1 is that call chain is determined as final jump, Service Instance C1
Call result is encapsulated in service call response, sends service call response to service caller.
Another example is: shown in Figure 5, service caller issues service invocation request, is determined and is adjusted according to service invocation request
With chain are as follows: service A → service B → service A → C, there are route field, the route information tables of route field in service invocation request
It is shown as: A.com=10.0.0.3;B.com=20.0.0.2;C.com=30.0.0.1.Service calling system be deployed with service A,
Service B and service C.The domain name for servicing A is A.com, services associated 3 Service Instances of A, the IP address of Service Instance A1 is
10.0.0.1, the IP address of Service Instance A2 is 10.0.0.2, and the IP address of Service Instance A3 is 10.0.0.3.Service the domain of B
Entitled B.com services 3 Service Instances that are associated with of B, and the IP address of Service Instance B1 is 20.0.0.1, with servicing the IP of B2
Location is 20.0.0.2, and the IP address for servicing B3 is 20.0.0.3;The domain name for servicing C is C.com, and it is real that service C is associated with 3 services
Example, the IP address of Service Instance C1 are 30.0.0.1, and the IP address of Service Instance C2 is 30.0.0.2.
Service caller determines that next-hop service, will according to the routing iinformation in route field for service A according to call chain
Service invocation request is sent to Service Instance A3, obtains calling knot after being handled after Service Instance A3 reception service invocation request
Call result is encapsulated in service invocation request by fruit, and Service Instance A1 determines that next-hop service is service B according to call chain,
Determine that next-hop Service Instance is Service Instance B2 according to the routing iinformation carried in route field, Service Instance A3 adjusts service
It is sent to Service Instance B2 with request, Service Instance B2, which is received, comes from service invocation request, and Service Instance B2 is handled to obtain
Call result is encapsulated in service invocation request by call result, and Service Instance B2 determines that next-hop service is according to call chain
A is serviced, service invocation request is sent to by Service Instance A3 according to the routing iinformation in route field, Service Instance A3 receives clothes
Business call request, Service Instance A3 obtain call result after being handled, call result are encapsulated in service invocation request.Clothes
Pragmatic example A3 determines next-hop service for service C, according to carrying routing iinformation in route field for service call according to call chain
Request is sent to Service Instance C1, and Service Instance C1 receives the service invocation request from Service Instance A3, Service Instance C1 into
Call result is obtained after row processing, Service Instance C1 is that call chain is determined as final jump, and Service Instance C1 seals call result
In service call response, service call response is sent to service caller.
Implement the embodiment of the present application, obtains service invocation request, carry route field, route field in service invocation request
Including destination service mark and target ip address;According to service invocation request, the call chain for responding the service invocation request is determined;
Route field is subjected to transparent transmission in call chain;Each service in call chain is in the corresponding service of invocation target service identifiers
When, according to target ip address in the associated multiple Service Instances of the service selection target Service Instance.The service called in this way
Process Service Instance can flexibly be selected according to the routing iinformation in request header, do not need the node in each deployment services
Upper configuration routing iinformation, avoids cumbersome configuration process.
Above-mentioned Fig. 2 to Fig. 5 illustrates service calling method.A kind of structure of the device of corresponding the embodiment of the present application
Schematic diagram.
Fig. 6 is referred to, Fig. 6 is a kind of structural schematic diagram of device 6 provided by the embodiments of the present application, which can wrap
Include acquiring unit 601, determination unit 602 and transmission unit 603.
Acquiring unit 601, for obtaining service invocation request.
Determination unit 602, if being taken for carrying route field in the service invocation request according in the route field
The routing iinformation of band determines next-hop Service Instance;Wherein, the routing iinformation includes destination service mark and target ip address.
Transmission unit 603, for the route field to be passed through the next-hop Service Instance.
In one or more embodiments, determination unit 602 is used for:
Determine the service identifiers of next-hop service;
If the service identifiers of the next-hop service are destination service mark;
The clothes that the target ip address instruction is selected in associated the multiple Service Instance are being serviced with the next-hop
Pragmatic example is as the next-hop Service Instance.
In one or more embodiments, determination unit 602 is used to determine the service identifiers of next-hop service, comprising:
Determine the call chain for responding the service invocation request;
The service identifiers of next service are inquired in the call chain according to the service identifiers of current service.
In one or more embodiments, determination unit 602 is also used to:
If the service identifiers of the next-hop service are not the destination service mark;
It is serviced in associated multiple Service Instances according to preconfigured routing iinformation in the next-hop and selects next-hop
Service Instance.
In one or more embodiments, device 6 further include:
Processing unit, if for not carrying the route field in the service invocation request;
Preconfigured routing iinformation is obtained, it is associated more in next-hop service according to the preconfigured routing iinformation
Next-hop Service Instance is selected in a Service Instance;
The service invocation request is sent to the next-hop Service Instance.
It in one or more embodiments, include multiple groups destination service mark and target ip address in the route field.
In one or more embodiments, the destination service is identified as domain name or service name.
The embodiment of the present application and the embodiment of the method for Fig. 2 and Fig. 3 are based on same design, bring technical effect also phase
Together, detailed process can refer to the description of the embodiment of the method for Fig. 2 and Fig. 3, and details are not described herein again.
Device 6 can be server or terminal device, described device 6 or the field-programmable for realizing correlation function
Gate array (field-programmable gate array, FPGA), special integrated chip, System on Chip/SoC (system on
Chip, SoC), central processing unit (central processorunit, CPU), network processing unit (networkprocessor,
NP), digital signal processing circuit, microcontroller (micro controller unit, MCU), can also use PLC technology
Device (programmable logic device, PLD) or other integrated chips.
Fig. 7 is a kind of apparatus structure schematic diagram provided by the embodiments of the present application, and hereinafter referred to as device 7, device 7 can integrate
In terminal device or server, as shown in fig. 7, the device 7 includes: memory 702, processor 701, input unit 703, output
Device 704 and communication interface.
Memory 702 can be independent physical unit, can with processor 701, input unit 703 and output device 704
To be connected by bus.Memory 702, processor 701, transceiver 703 also can integrate together, pass through hardware realization etc..
Memory 702 is used to store the program for realizing above method embodiment or Installation practice modules, processing
Device 701 calls the program, executes the operation of above method embodiment.
Input unit 702 includes but is not limited to keyboard, mouse, touch panel, camera and microphone;Output device includes
But it is limited to display screen.
For receiving and dispatching various types of message, communication interface includes but is not limited to wireless interface or wired connects communication interface
Mouthful.
Optionally, when passing through software realization some or all of in the service calling method of above-described embodiment, device
Processor can be only included.Memory for storing program is located at except device, and processor passes through circuit/electric wire and memory
Connection, for reading and executing the program stored in memory.
Processor can be central processing unit (central processing unit, CPU), network processing unit
The combination of (networkprocessor, NP) or CPU and NP.
Processor can further include hardware chip.Above-mentioned hardware chip can be specific integrated circuit
(application-specific integrated circuit, ASIC), programmable logic device (programmable
Logic device, PLD) or combinations thereof.Above-mentioned PLD can be Complex Programmable Logic Devices (complex
Programmable logic device, CPLD), field programmable gate array (field-programmable gate
Array, FPGA), Universal Array Logic (generic array logic, GAL) or any combination thereof.
Memory may include volatile memory (volatile memory), such as access memory (random-
Access memory, RAM);Memory also may include nonvolatile memory (non-volatile memory), such as fastly
Flash memory (flashmemory), hard disk (hard disk drive, HDD) or solid state hard disk (solid-state drive,
SSD);Memory can also include the combination of the memory of mentioned kind.
The embodiment of the present application also provides a kind of computer storage mediums, are stored with computer program, the computer program
For executing service calling method provided by the above embodiment.
The embodiment of the present application also provides a kind of computer program products comprising instruction, when it runs on computers
When, so that computer executes service calling method provided by the above embodiment.
It should be understood by those skilled in the art that, embodiments herein 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 application
Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more,
The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces
The form of product.
The application is referring to method, the process of equipment (system) and computer program product according to the embodiment of the present application
Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions
The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs
Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce
A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real
The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
Claims (10)
1. a kind of service calling method characterized by comprising
Obtain service invocation request;
If carrying route field in the service invocation request, determined according to the routing iinformation carried in the route field next
Jump Service Instance;Wherein, the routing iinformation includes destination service mark and target ip address;
The route field is passed through into the next-hop Service Instance.
2. the method according to claim 1, wherein described according to the routing iinformation carried in the route field
Determine next-hop Service Instance, comprising:
Determine the service identifiers of next-hop service;
If the service identifiers of the next-hop service are destination service mark;
Select the service of the target ip address instruction real in associated the multiple Service Instance servicing with the next-hop
Example is used as the next-hop Service Instance.
3. according to the method described in claim 2, it is characterized in that, the service identifiers of the determining next-hop service, comprising:
Determine the call chain for responding the service invocation request;
The service identifiers of next service are inquired in the call chain according to the service identifiers of current service.
4. according to the method in claim 2 or 3, which is characterized in that described to determine that next-hop service is real according to routing iinformation
Example, further includes:
If the service identifiers of the next-hop service are not the destination service mark;
It is serviced according to preconfigured routing iinformation in the next-hop and selects next-hop service in associated multiple Service Instances
Example.
5. method according to claim 1 or 2, which is characterized in that further include:
If the route field is not carried in the service invocation request;
Preconfigured routing iinformation is obtained, associated multiple clothes are serviced in next-hop according to the preconfigured routing iinformation
Next-hop Service Instance is selected in pragmatic example;
The service invocation request is sent to the next-hop Service Instance.
6. according to the method described in claim 5, it is characterized in that, in the route field include multiple groups destination service mark and
Target ip address.
7. according to the method described in claim 6, it is characterized in that, the destination service is identified as domain name or service name.
8. a kind of service dispatch device, comprising:
Acquiring unit, for obtaining service invocation request;
Determination unit, if for carrying route field in the service invocation request, according to the road carried in the route field
Next-hop Service Instance is determined by information;Wherein, the routing iinformation includes destination service mark and target ip address;
Transmission unit, for the route field to be passed through the next-hop Service Instance.
9. a kind of electronic equipment, which is characterized in that including processor and memory, wherein the memory is calculated for storing
Machine program, the computer program include program instruction, and the processor is executed for calling described program to instruct as right is wanted
Seek the described in any item methods of 1-7.
10. a kind of computer readable storage medium, which is characterized in that the computer storage medium is stored with computer program,
The computer program includes program instruction, and described program instruction makes the processor execute such as right when being executed by a processor
It is required that 1-7 is described in any item.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910540641.9A CN110336865A (en) | 2019-06-21 | 2019-06-21 | Service calling method, device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910540641.9A CN110336865A (en) | 2019-06-21 | 2019-06-21 | Service calling method, device, storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110336865A true CN110336865A (en) | 2019-10-15 |
Family
ID=68142548
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910540641.9A Pending CN110336865A (en) | 2019-06-21 | 2019-06-21 | Service calling method, device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110336865A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110913025A (en) * | 2019-12-31 | 2020-03-24 | 中国银联股份有限公司 | Service calling method, device, equipment and medium |
CN110995780A (en) * | 2019-10-30 | 2020-04-10 | 北京文渊佳科技有限公司 | API calling method and device, storage medium and electronic equipment |
CN111786825A (en) * | 2020-06-23 | 2020-10-16 | 京东数字科技控股有限公司 | Method, device, system and storage medium for dynamically configuring interface service |
CN112532523A (en) * | 2020-11-23 | 2021-03-19 | 福建顶点软件股份有限公司 | In-process scheduling method based on sub-service routing and storage device |
CN112953982A (en) * | 2019-11-26 | 2021-06-11 | 腾讯科技(深圳)有限公司 | Service processing method, service configuration method and related device |
CN112968954A (en) * | 2021-02-10 | 2021-06-15 | 中国工商银行股份有限公司 | Flow control method, server and system for service migration |
CN112995269A (en) * | 2020-12-10 | 2021-06-18 | 腾讯科技(深圳)有限公司 | Data processing method, computer device and readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150319089A1 (en) * | 2014-04-30 | 2015-11-05 | International Business Machines Corporation | Techniques for realizing service chaining |
CN105229968A (en) * | 2013-05-29 | 2016-01-06 | 瑞典爱立信有限公司 | For the method and system that the bandwidth aware service of service chaining is arranged |
CN107231412A (en) * | 2017-05-22 | 2017-10-03 | 浙江工商大学 | A kind of service path building method mapped based on virtual net |
CN108377262A (en) * | 2017-01-30 | 2018-08-07 | 汤姆逊许可公司 | Manage the method for the service chaining at the network equipment, the corresponding network equipment |
-
2019
- 2019-06-21 CN CN201910540641.9A patent/CN110336865A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105229968A (en) * | 2013-05-29 | 2016-01-06 | 瑞典爱立信有限公司 | For the method and system that the bandwidth aware service of service chaining is arranged |
US20150319089A1 (en) * | 2014-04-30 | 2015-11-05 | International Business Machines Corporation | Techniques for realizing service chaining |
CN105099960A (en) * | 2014-04-30 | 2015-11-25 | 国际商业机器公司 | Service chain realization method and device |
CN108377262A (en) * | 2017-01-30 | 2018-08-07 | 汤姆逊许可公司 | Manage the method for the service chaining at the network equipment, the corresponding network equipment |
CN107231412A (en) * | 2017-05-22 | 2017-10-03 | 浙江工商大学 | A kind of service path building method mapped based on virtual net |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110995780A (en) * | 2019-10-30 | 2020-04-10 | 北京文渊佳科技有限公司 | API calling method and device, storage medium and electronic equipment |
CN112953982A (en) * | 2019-11-26 | 2021-06-11 | 腾讯科技(深圳)有限公司 | Service processing method, service configuration method and related device |
CN110913025B (en) * | 2019-12-31 | 2022-06-24 | 中国银联股份有限公司 | Service calling method, device, equipment and medium |
CN110913025A (en) * | 2019-12-31 | 2020-03-24 | 中国银联股份有限公司 | Service calling method, device, equipment and medium |
US11677815B2 (en) | 2019-12-31 | 2023-06-13 | China Unionpay Co., Ltd. | Service invoking method, device, apparatus and medium |
CN111786825A (en) * | 2020-06-23 | 2020-10-16 | 京东数字科技控股有限公司 | Method, device, system and storage medium for dynamically configuring interface service |
CN111786825B (en) * | 2020-06-23 | 2023-06-27 | 京东科技控股股份有限公司 | Method, device, system and storage medium for dynamically configuring interface service |
CN112532523A (en) * | 2020-11-23 | 2021-03-19 | 福建顶点软件股份有限公司 | In-process scheduling method based on sub-service routing and storage device |
CN112532523B (en) * | 2020-11-23 | 2021-11-12 | 福建顶点软件股份有限公司 | In-process scheduling method based on sub-service routing and storage device |
CN112995269B (en) * | 2020-12-10 | 2022-01-11 | 腾讯科技(深圳)有限公司 | Data processing method, computer device and readable storage medium |
CN112995269A (en) * | 2020-12-10 | 2021-06-18 | 腾讯科技(深圳)有限公司 | Data processing method, computer device and readable storage medium |
CN112968954B (en) * | 2021-02-10 | 2023-04-07 | 中国工商银行股份有限公司 | Flow control method, server and system for service migration |
CN112968954A (en) * | 2021-02-10 | 2021-06-15 | 中国工商银行股份有限公司 | Flow control method, server and system for service migration |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110336865A (en) | Service calling method, device, storage medium and electronic equipment | |
CN104471957B (en) | Utilize the sensor of data stream while using various parameters | |
CN109995877A (en) | Information-pushing method and device | |
CN109154890A (en) | Software renewing apparatus and software update system | |
CN108920376A (en) | Test method, device and the medium of application program | |
CN112039796B (en) | Data packet transmission method and device, storage medium and electronic equipment | |
CN110311983A (en) | Processing method, device, system, electronic equipment and the storage medium of service request | |
CN110321738A (en) | Information processing method and device | |
CN110263565A (en) | Method and apparatus for calling service | |
CN110209315A (en) | The display methods of character, device, electronic equipment and storage medium in user interface | |
CN110377440A (en) | Information processing method and device | |
WO2014112727A1 (en) | Shortened url management method and management device, and storage medium storing computer program for management thereof | |
CN110471848A (en) | A kind of method and apparatus of dynamic returned packet | |
CN108805379A (en) | Support that multi-mode is honoured an agreement the system and method for flow | |
CN104348583A (en) | Information processing method and electronic equipment | |
CN110505074A (en) | A kind of application module integrated approach and device | |
CN113254235A (en) | Message transmission method and device under multi-test environment | |
CN110879729B (en) | Channel configuration method and device for live broadcast room, readable medium and electronic equipment | |
CN108733614A (en) | Data transmission system, method and apparatus | |
CN110768903A (en) | Method, device, terminal and storage medium for optimizing network connection | |
CN108959636A (en) | Data processing method, device, system, computer-readable medium | |
CN112152879A (en) | Network quality determination method and device, electronic equipment and readable storage medium | |
CN109698774A (en) | Method and device for monitoring device working condition | |
CN107222365A (en) | Data processing method, device and server | |
CN108989157A (en) | Method, apparatus for smart machine control |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20191015 |