[go: up one dir, main page]

CN112099973B - Service calling method and device - Google Patents

Service calling method and device Download PDF

Info

Publication number
CN112099973B
CN112099973B CN202010974484.5A CN202010974484A CN112099973B CN 112099973 B CN112099973 B CN 112099973B CN 202010974484 A CN202010974484 A CN 202010974484A CN 112099973 B CN112099973 B CN 112099973B
Authority
CN
China
Prior art keywords
service
calling
target
current service
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010974484.5A
Other languages
Chinese (zh)
Other versions
CN112099973A (en
Inventor
黄廷科
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202010974484.5A priority Critical patent/CN112099973B/en
Publication of CN112099973A publication Critical patent/CN112099973A/en
Application granted granted Critical
Publication of CN112099973B publication Critical patent/CN112099973B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4812Task transfer initiation or dispatching by interrupt, e.g. masked

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Exchange Systems With Centralized Control (AREA)

Abstract

本说明书实施例提供了一种服务调用方法和装置,其中,该方法包括:响应于用户发起的目标业务请求,获取所述目标业务的服务调用关系信息集;其中,所述目标业务的服务调用关系信息集中包含所述目标业务涉及的多个服务的调用关系;根据所述目标业务涉及的多个服务的调用关系,利用多个线程依次调用所述目标业务涉及的多个服务。在本说明书实施例中,无需依赖于任何流程平台进行组合服务的封装,可以高效地对用户请求的目标业务所涉及的多个服务进行的灵活调用。

The embodiments of this specification provide a service calling method and device, wherein the method includes: in response to a target service request initiated by a user, obtaining a service calling relationship information set of the target service; wherein the service calling relationship information set of the target service includes calling relationships of multiple services involved in the target service; and according to the calling relationships of multiple services involved in the target service, using multiple threads to sequentially call multiple services involved in the target service. In the embodiments of this specification, there is no need to rely on any process platform to encapsulate the combined service, and multiple services involved in the target service requested by the user can be efficiently and flexibly called.

Description

Service calling method and device
Technical Field
The embodiment of the specification relates to the technical field of data processing, in particular to a service calling method and device.
Background
Because the system scale of large commercial bank enterprises is often very large, the transaction business number of all product systems can be tens of thousands sometimes, so in order to adapt to the rapid growth of business and the iterative update of the system, the system gradually changes from a centralized architecture to a distributed service architecture, all transaction interfaces are fully serviced, the distributed service architecture effectively solves the problems of performance expansion, agile iterative upgrade and the like in the centralized architecture, but users need to call a plurality of services to finish when requesting some business, namely, a plurality of services related to the business need to be combined to realize one business flow.
In the prior art, the combined service method generally realizes the combined management of the services through a flow platform, and the basic principle of the realization is that a plurality of services related to the service are packaged into one service to be called by the service through the function of the flow platform, so that the integrated call of the service is realized. The existing combined service method mainly depends on a flow platform, and if the flow platform is replaced, the combined service codes are required to be rewritten for each service, so that the flexibility is not provided. And when the combination service corresponding to the existing service is changed or a new service appears, the combination service codes of the service need to be rewritten, so that a plurality of services related to the service cannot be conveniently called by adopting the existing combination service method.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the specification provides a service calling method and device, which are used for solving the problem that a plurality of services related to a service are conveniently called in the prior art.
The embodiment of the specification provides a service calling method, which comprises the steps of responding to a target service request initiated by a user, obtaining a service calling relation information set of the target service, wherein the service calling relation information set of the target service comprises calling relations of a plurality of services related to the target service, and calling the plurality of services related to the target service in sequence by utilizing a plurality of threads according to the calling relations of the plurality of services related to the target service.
The embodiment of the specification also provides a service calling device which comprises a processing module and a calling module, wherein the processing module is used for responding to a target service request initiated by a user and obtaining a service calling relation information set of the target service, the service calling relation information set of the target service comprises calling relations of a plurality of services related to the target service, and the calling module is used for calling the plurality of services related to the target service in sequence by using a plurality of threads according to the calling relations of the plurality of services related to the target service.
The present description also provides a computer-readable storage medium having stored thereon computer instructions that when executed implement the steps of the service invocation method.
The embodiment of the specification provides a service calling method, which can respond to a target service request initiated by a user to acquire a service calling relation information set of the target service. Because the service calling relation information of the target service contains the calling relation of a plurality of services related to the target service in a centralized manner, the plurality of services related to the target service can be sequentially called by utilizing a plurality of threads according to the calling relation of the plurality of services related to the target service, the package of the combined service is not needed to be dependent on any flow platform, and the flexible calling of the plurality of services related to the target service requested by a user can be efficiently performed.
Drawings
The accompanying drawings, which are included to provide a further understanding of embodiments of the present specification, are incorporated in and constitute a part of this specification and do not limit the embodiments of the present specification. In the drawings:
fig. 1 is a schematic diagram of a service invocation system provided according to an embodiment of the present specification;
FIG. 2 is a schematic diagram of steps of a service invocation method provided according to an embodiment of the present disclosure;
fig. 3 is a schematic structural view of a service invocation apparatus provided according to an embodiment of the present specification;
Fig. 4 is a schematic structural diagram of a service invocation apparatus provided according to an embodiment of the present specification.
Detailed Description
The principles and spirit of the embodiments of the present specification will be described below with reference to several exemplary implementations. It should be understood that these embodiments are presented merely to enable one skilled in the art to better understand and implement the present description embodiments and are not intended to limit the scope of the present description embodiments in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Those skilled in the art will appreciate that the implementations of the embodiments of the present description may be implemented as a system, apparatus, method, or computer program product. Accordingly, the present specification embodiment disclosure may be embodied in the form of entirely hardware, entirely software (including firmware, resident software, micro-code, etc.) or in a combination of hardware and software.
While the flow described below includes a number of operations occurring in a particular order, it should be apparent that these processes may include more or fewer operations, which may be performed sequentially or in parallel (e.g., using a parallel processor or a multi-threaded environment).
In one scenario example of the present application, a service invocation system is provided, as shown in fig. 1, and may include a terminal device 101 and a server 102, where a user may initiate a target service request through the terminal device 101. The server 102 may respond to the user submitting the target service request, obtain the service call relationship information set of the target service, and call the multiple services related to the target service in turn by using multiple threads according to the call relationship of the multiple services related to the target service, so that the flexible call of the multiple services related to the target service may be implemented efficiently without depending on any flow platform. In some scenario examples, the server 102 may also feed back the execution results of the plurality of services related to the invoked target service to the terminal device 101.
The terminal device 101 may be a terminal device or software used by a user operation. Specifically, the terminal device may be a terminal device such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart watch or other wearable devices, or may be a robot device or the like. Of course, the terminal device 101 may be software that can be executed in the terminal device. Such as application software for system applications, payment applications, browsers, weChat applets, etc.
The server 102 may be a single server or a server cluster, and of course, the functions of the server may be implemented by using a cloud computing technology. The server 102 may be connected to a plurality of terminal devices or may be a server having a strong information set library, and may obtain a service call relationship information set of a target service based on a target service request initiated by a user, and call a plurality of services related to the target service in turn by using a plurality of threads according to a call relationship of a plurality of services related to the target service, so that efficient flexible call of a plurality of services related to the target service may be implemented independently of any flow platform.
Referring to fig. 2, the present embodiment may provide a service calling method. The service calling method can be used for calling a plurality of services related to the target service in sequence by utilizing a plurality of threads according to the calling relation of the plurality of services related to the target service based on the target service request initiated by the user, so that the flexible calling of the plurality of services related to the target service can be realized efficiently. The service invocation method may include the following steps.
S201, a service calling relation information set of a target service is obtained in response to a target service request initiated by a user, wherein the service calling relation information set of the target service contains calling relations of a plurality of services related to the target service.
In this embodiment, a service call relationship information set of a target service is acquired in response to a target service request issued by a user. In some embodiments, the server used for processing the service request and scheduling the resources in the institutions such as banks responds to the target service request sent by the user, or the process responds to the target service request sent by the user, and the method and the system can be specifically determined according to actual conditions, and are not limited in this aspect.
In this embodiment, the target service request may be a request sent by a user for a target service, and the target service request may be transmitted in a message form. The target service may be a service that the user desires to realize, and in one scenario example, the target service may include transferring money, depositing money, withdrawing money, inquiring balance, handling credit card, applying for loan, etc., and of course, the target service is not limited to the above example, and other modifications may be made by those skilled in the art in light of the technical spirit of the embodiments of the present specification, but it is intended to cover the protection scope of the embodiments of the present specification as long as the functions and effects implemented by the target service are the same as or similar to those of the embodiments of the present specification.
In this embodiment, since a plurality of services may need to be invoked in a certain order after completing one service, a service invocation relationship information set of a target service may be obtained after receiving a target service request initiated by a user, where the service invocation relationship information set of the target service includes invocation relationships of a plurality of services related to the target service. In the case that the target service is a transfer service, the plurality of services related to the transfer service may include, but are not limited to, a transfer function, registration information, an accumulated amount, and the like.
In this embodiment, a plurality of services related to the target service and call relations of the plurality of services related to the target service may be determined according to a service call relation information set of the target service, where the call relations of the plurality of services may be a manner, a sequence, and the like of calling each service, and the manner of calling the services may include at least one of serial and parallel. And when the service calling mode is serial, the service is characterized as synchronous calling, and when the service calling mode is parallel, the service is characterized as asynchronous calling. Synchronous call is a blocking type call mode, namely, a main calling party code is always blocked and waits until a called party returns, and if a page needs to be made in three things, A, B, C, the synchronous call mode is generally that B is made after A is made and C is made after B is made, while asynchronous call is that when A is started, B can be started after A is not made, and C can be started after B is not made. If all three things take 5s, the synchronous call mode needs to be completed for 15s at least, and if asynchronous, the asynchronous call is completed for 5s at least, so that the efficiency of the asynchronous call is higher compared with that of the synchronous call. Asynchronous calls are only applicable where there is no correlation between the various services that need to be called. If there are interrelated, interdependent situations, e.g., B must make a call after execution of A is complete, C must make a call after execution of B is complete, then a synchronous call is needed.
In this embodiment, the service call relation information set of the target service may further include feature information related to each service, for example, a service ID (identity), a waiting synchronization flag, and the like. The service ID can be a character string, one service can be uniquely identified through the service ID, and the synchronous waiting identification can be used for identifying whether the calling of a plurality of services related to the target service synchronously waits for a processing result.
In one embodiment, service call relation information sets of each service available in the system may be stored in a preset database in advance, and when an initiated target service request is received, the service call relation information set of the target service may be obtained from the preset database according to the target service request. The preset database may be a database storing business data in a bank or other institutions. It will be understood that, of course, other possible ways may be used to obtain the service call relationship information set of the target service, for example, the service call relationship information set of the target service is searched in the web page according to a certain search condition, which may be specifically determined according to the actual situation, and the embodiment of the present disclosure is not limited to this.
In some embodiments, the target service request may include identification information of the target service, so that the service to be processed may be uniquely determined according to the identification information of the target service.
S202, according to the calling relation of a plurality of services related to the target business, a plurality of threads are utilized to call the plurality of services related to the target business in sequence.
In the present embodiment, since the service call relationship information of the target service includes the call relationships of the plurality of services related to the target service in a concentrated manner, the plurality of services related to the target service can be sequentially called by a plurality of threads according to the call relationships of the plurality of services related to the target service.
In this embodiment, the plurality of threads and the plurality of services may be in one-to-one correspondence, that is, one thread may be used to call and process one service. Of course, in the case of executing the synchronous call, a thread may be used to call and process a service, which may be specifically determined according to practical situations, and the present application is not limited thereto.
In this embodiment, the multiple threads may be created simultaneously or sequentially, for example, a thread of a next service of the current service may be created when successful call or successful execution of the current service is confirmed, and the steps are repeated in a loop until all the multiple services related to the target service are called. Of course, the manner of sequentially calling the plurality of services related to the target service by the plurality of threads is not limited to the above example, and other modifications may be made by those skilled in the art in light of the technical spirit of the embodiments of the present specification, but all the functions and effects implemented by the method are the same as or similar to those of the embodiments of the present specification, and are included in the protection scope of the embodiments of the present specification.
In this embodiment, the thread (thread) is a term in operating system technology, is the smallest unit that an operating system can perform operation scheduling, is included in a process, and is the actual unit of operation in the process. A process is a memory area containing some resources, and an operating system divides its work into functional units by using a process, where one or more execution units contained in the process are called threads (threads), a thread refers to a single sequential control flow in the process, multiple threads can be parallel in a process, and each thread can execute different tasks in parallel.
From the above description, it can be seen that the embodiment of the present specification achieves the technical effect that a service call relationship information set of a target service can be obtained in response to a target service request initiated by a user. Because the service call relationship information of the target service contains the call relationship of a plurality of services related to the target service in a centralized manner, the plurality of services related to the target service can be sequentially called by utilizing a plurality of threads according to the call relationship of the plurality of services related to the target service, and the package of the combined service is not needed to be dependent on any flow platform, so that the flexible call of the plurality of services related to the target service requested by the user can be efficiently performed.
In one embodiment, the method for sequentially calling the plurality of services related to the target service by using the plurality of threads according to the calling relation of the plurality of services related to the target service may include creating a thread of a current service according to the calling relation of the plurality of services related to the target service, wherein the current service is a service to be called currently. Further, the thread of the current service can be called based on the reflection mechanism, and when the current service is determined to be synchronously called according to the service calling relation information set of the target service, the thread of the next service of the current service can be created according to the calling relation of a plurality of services related to the target service when the current service is determined to be successfully executed. The thread of the next service of the current service can be used as the thread of the current service until the plurality of service calls related to the target service are completed.
In this embodiment, the multiple services and the multiple threads are in one-to-one correspondence, each created thread is only used for processing the corresponding service, and after the corresponding service is successfully executed, the resources of the thread can be released.
In this embodiment, since the synchronous call needs to wait for the current service to be executed before the next service is called, when it is determined that the current service is the synchronous call, a thread of the next service of the current service may be created according to the call relationships of the plurality of services related to the target service when it is determined that the current service has been successfully executed, so that the thread of the next service of the current service may be used to call and execute the next service of the current service, and the above steps may be looped until the plurality of services related to the target service are all called.
In this embodiment, reflection refers to a class of applications where the reflection mechanism is self-describing and self-controlling. That is, such applications implement self-presenting and monitoring (appearance) of their own behavior by employing some mechanism, and can adjust or modify the state and related semantics of the behavior described by the application according to the state and result of their own behavior. In one embodiment, the current service may be invoked with its threads based on a reflection mechanism.
In one embodiment, in a process of sequentially calling a plurality of services related to a target service by using a plurality of threads, if it is determined that one service has not been successfully called or has not been successfully executed, the processing of the threads may be ended, and the compensation service of the plurality of services related to the target service may be sequentially called by using the plurality of threads in the reverse order of the order of calling the plurality of services related to the target service.
In the present embodiment, the compensation service of the plurality of services related to the target service is called in the reverse order of the calling order of the plurality of services related to the target service, and the continuity and consistency of the data can be ensured. The compensation service may be a direction service of one service, and may also be called a flushing service (a remedy method adopted when the system considers that the system may fail), wherein the compensation service needs to be invoked in a serial manner.
In one embodiment, after the current service is called by the thread of the current service based on the reflection mechanism, the method can further comprise creating the thread of the next service of the current service according to the calling relation of a plurality of services related to the target service under the condition that the current service is determined to be asynchronously called according to the service calling relation information set of the target service. Further, the thread of the next service of the current service may be used as the thread of the current service until the multiple service calls related to the target service are completed.
In this embodiment, since the asynchronous call can call the next service of the current service without waiting until the current service is successfully executed, after it is determined that the current service is successfully called, a thread of the next service of the current service can be created according to the calling relationships of the plurality of services related to the target service, and the next service of the current service can be called by using the thread of the next service of the current service, so that the above steps can be circularly executed until the plurality of services related to the target service are all called.
In one embodiment, the message may be used to transmit information, so before the service is invoked by the thread of the current service based on the reflection mechanism, the method may further include reading a message configuration information set of the current service, where the message configuration information set includes configuration information configured by metadata of an input message and an output message of the current service. Further, a request message and a target response message of the current service can be constructed according to the message configuration information set of the current service, wherein the request message and the target response message are transmitted in a MAP mode.
In this embodiment, the MAP is a container for storing several elements, and the elements are composed of key value and mapping value pairs, so that the MAP can be used for flexibly storing and retrieving data. MAPs may provide one-to-one (where the first may be referred to as a key, each key may occur only once in the MAP, and the second as a value for the key).
In this embodiment, a message configuration information set of a service may be preconfigured for each service and stored in a preset database, where a message is a data unit exchanged and transmitted in a network, that is, a data block to be sent by a station at one time, and the message includes complete data information to be sent, where the length is inconsistent, and the length is unlimited and variable. The message configuration information set can be displayed and stored in the form of a table, an image or a text, and can be stored in a preset database so as to be convenient to read and modify. The preset database may be a database storing business data in a bank or other institutions.
In this embodiment, since the standard format of the message is required before the message is transmitted, the message configuration information set may include configuration information of an input message and an output message of the current service, where the configuration information of the input message and the output message of the current service may be used to characterize the standard format of the request message required to be sent by invoking the current service and the standard format of the corresponding message generated when the current service is successfully executed. It will be understood, of course, that the message configuration information set may also include other information, for example, a service ID (identity), which may be a character string, and a service may be uniquely identified by the service ID.
In this embodiment, a request message and a target response message of a current service may be constructed according to configuration information of an input message and an output message of the current service. The target response message may be a message that needs to be generated when the current service is executed successfully, so that whether the current service is executed successfully or not may be determined according to the target response message.
In this embodiment, the input message and the output message may be configured by using metadata, where metadata and types thereof use unified naming and definition specifications, each metadata has a unique naming, and a definition type thereof uses unified data standards. Metadata is mainly information describing data attributes and is used for supporting functions such as indicating storage locations, historical data, resource searching, file recording and the like. The most intrinsic and abstract definition is data about data, which is a widely-existing phenomenon, and the concrete definition and application of the data are in many fields. It will be understood, of course, that in some embodiments, the input message and the output message may be configured in other manners, and specifically may be determined according to practical situations, which is not limited by the present application.
In the embodiment, the corresponding method for calling the current service by using the thread of the current service based on the reflection mechanism can comprise the steps of calling the current service by using the request message of the current service and the thread based on the reflection mechanism.
In one embodiment, since resources for processing the target service request need to be allocated before the target service request is processed, before the service calling relation information set of the target service is acquired in response to the target service request initiated by the user, the method can further comprise the step of calling a service calling process according to the target service request, wherein the service calling process is used for executing calling processing of a plurality of services related to the target service. Further, in the case that the target service request involves an asynchronous call, an asynchronous service receiving process may be called, where the asynchronous service receiving process is configured to receive a result returned by the service of the asynchronous call, and information is exchanged between the service calling process and the asynchronous service receiving process through a message mechanism.
In this embodiment, the plurality of services related to realizing the target service may be invoked by the service invocation process according to the service invocation relation information set of the target service. Since an asynchronous call can call a next service immediately without waiting for the call result of the current service, it is necessary to receive the result returned by the asynchronously called service through the asynchronous service receiving process, thereby determining whether the asynchronously called service is successfully executed.
In this embodiment, in order for the asynchronous service receiving process to send the received result returned by the asynchronously invoked service to the service invoking process, the service invoking process and the asynchronous service receiving process exchange information through a message mechanism.
Wherein, since all time of occurrence can be represented by a message, the message is used for telling the operating system what happens, and the parameters of the message contain important information. A message queue may be maintained for the asynchronous service receiving process using a message mechanism, and after the asynchronous service receiving process receives the results returned by the asynchronously invoked service, the asynchronous service receiving process may convert the event into a message and place the message into the message queue. Further, messages may be fetched from the message queue through a message loop, which is the task of retrieving a message from the message queue and then passing the message to the appropriate process.
In one embodiment, the method for sequentially calling the plurality of services related to the target service by using the plurality of threads according to the calling relation of the plurality of services related to the target service can comprise the step that a service calling process creates a thread of a current service according to the calling relation of the plurality of services related to the target service, wherein the current service is the service needing to be called currently. Further, the thread of the current service calls the current service based on the reflection mechanism, and when the thread of the current service receives the call result of the current service under the condition that the current service is determined to be synchronously called according to the service call relation information set of the target service, the call result of the current service is sent to the service call process. And under the condition that the current service is successfully executed according to the calling result of the current service, the service calling process creates a thread of the next service of the current service according to the calling relation of a plurality of services related to the target service, and takes the thread of the next service of the current service as the thread of the current service until the calling of the plurality of services related to the target service is completed.
In this embodiment, the multiple services and the multiple threads are in one-to-one correspondence, each created thread is only used for processing the corresponding service, and after the corresponding service is successfully executed, the resources of the thread can be released.
In this embodiment, since the synchronous call needs to wait for the current service to be executed before the next service is called, when it is determined that the current service is the synchronous call, a thread of the next service of the current service may be created according to the call relationships of the plurality of services related to the target service when it is determined that the current service has been successfully executed, so that the thread of the next service of the current service may be used to call and execute the next service of the current service, and the above steps may be looped until the plurality of services related to the target service are all called.
In one embodiment, after the thread of the current service invokes the current service based on the reflection mechanism, the service invocation process may determine an invocation order of the plurality of services related to the target service according to the service invocation relationship information set of the target service, if it is determined that the current service is not successfully executed. Further, the service calling process sequentially calls the compensation service of each service related to the target service by using a plurality of threads according to the reverse order of the calling order of the plurality of services related to the target service.
In the present embodiment, the compensation service of the plurality of services related to the target service is called in the reverse order of the calling order of the plurality of services related to the target service, and the continuity and consistency of the data can be ensured. The compensation service may be a direction service of one service, and may also be called a flushing service (a remedy method adopted when the system considers that the system may fail), wherein the compensation service needs to be invoked in a serial manner.
In one embodiment, in order to enable each called service related information to be queried, after the current service thread calls the current service based on the reflection mechanism, the method further comprises the steps that when the current service is determined to be synchronously called according to the service call relation information set of the target service, the current service thread generates service flowing water of the current service according to the call result of the current service when receiving the call result of the current service, and the service flowing water of the current service is stored in a preset database.
In this embodiment, the service flow may be used to characterize the call and execution of the service, and in some embodiments, the service flow may include, but is not limited to, a service ID, an input message, an output message, a service execution result, and an ID of a last call service of a current service.
In this embodiment, the preset database may be a database storing business data in a bank or other institutions.
In one embodiment, after the current service thread calls the current service based on the reflection mechanism, the method can further comprise that in the case that the current service is determined to be asynchronously called according to the service call relation information set of the target service, the current service thread sends a call result of the current process to the service call process, and in the case that the current process is determined to have been successfully called according to the call result of the current process, the service call process can create a next service thread of the current service according to call relations of a plurality of services related to the target service. Further, the thread of the next service of the current service may be used as the thread of the current service until the multiple service calls related to the target service are completed.
In this embodiment, the call result may be used to indicate whether the service is successfully invoked, and the call result may be used to indicate whether the service is successfully executed. In the asynchronous call scenario, after confirming that the current service has been successfully invoked, a thread of a next service of the current service may be created by the service invocation process according to the invocation relationship of the plurality of services involved in the target service.
In this embodiment, since the asynchronous call can call the next service of the current service without waiting until the current service is successfully executed, after it is determined that the current service is successfully called, a thread of the next service of the current service can be created according to the calling relationships of the plurality of services related to the target service, and the next service of the current service can be called by using the thread of the next service of the current service, so that the above steps can be circularly executed until the plurality of services related to the target service are all called.
In one embodiment, after the thread of the current service sends the call result of the current process to the service call process, the method further comprises the step that when the asynchronous service receiving process determines that the call result returned by the thread of the current service is successfully received, the asynchronous service receiving process generates a response message of the current service according to the service call relation information set of the target service and the call result of the current service. Further, the asynchronous service receiving process puts the response message of the current service into the target message queue, and the service calling process determines whether the current service is successfully executed or not according to the response message of the current service in the target message queue. And ending the call flow of the current service under the condition that the current service is successfully executed.
In this embodiment, since the service call relationship information set of the target service includes the output message configured in advance, the response message of the current service may be generated according to the service call relationship information set of the target service and the call result of the current service.
In this embodiment, when the asynchronous service receiving process successfully receives the call result returned by the current service thread, the asynchronous service receiving process may preliminarily determine the call result returned by the current service thread. The output message configured in the service calling relation information set of the target service is a message which is normally responded under the condition that the current service is successfully executed, so that the response message of the current service can be directly generated according to the service calling relation information set of the target service and the calling result of the current service under the condition that the current service is successfully executed, and the output message configured in the service calling relation information set of the target service can be adjusted according to the calling result of the current service under the condition that the current service is not successfully executed, thereby generating the response message of the current service.
In this embodiment, when it is determined that the current service is successfully executed, the thread resource of the current service may be released, so as to end the call flow of the current service.
In one embodiment, after the service calling process determines whether the current service is successfully executed according to the response message of the current service in the target message mechanism, the method can further comprise determining calling sequences of a plurality of services related to the target service according to the service calling relation information set of the target service under the condition that the current service is not successfully executed, and calling the compensation service of the feature service related to the target service by using a plurality of threads in turn according to the reverse sequence of the calling sequences of the plurality of services related to the target service by the service calling process. The feature service is a service related to the target service and needing to call the compensation service.
In this embodiment, the service calling process sequentially calls the compensation service of at least one feature service related to the target service by using a plurality of threads according to the reverse order of the calling order of the plurality of services related to the target service, and may further include the service calling process reading a plurality of service flows related to the target service from a preset database, sequentially re-creating the plurality of threads according to the reverse order of the calling order of the plurality of services related to the target service according to the service flows of the respective feature services, and sequentially calling the compensation service of the feature service related to the target service by using the re-created plurality of threads.
In the embodiment, the method for sequentially calling the compensation service of the feature service related to the target business by using the recreated multiple threads can comprise the steps that the thread of the target feature service determines the compensation service ID of the target feature service according to the target feature service ID in the service flow of the target feature service. Further, the compensation service of the target feature service may be invoked according to the compensation service ID of the target feature service based on the reflection mechanism until the compensation service invocation of the at least one feature service related to the target service is completed.
In this embodiment, when the thread of the current service receives the call result of the current service, the service flow of the current service may be generated according to the call result of the current service, and the service flow of the current service may be stored in the preset database. Therefore, before the compensation service is invoked, a plurality of service flows of the target service history record can be acquired from the preset database.
In this embodiment, the service flow may be used to characterize the call and execution of the service, and in some embodiments, the service flow may include, but is not limited to, a service ID, an input message, an output message, a service execution result, and an ID of a last call service of a current service.
In this embodiment, since the plurality of threads are newly created according to the service flow of each feature service, there is no record of the service flow in the non-invoked service among the plurality of services related to the target service, it is only necessary to execute the compensation service in reverse order from the service whose execution failed, and it is not necessary to execute the corresponding compensation service from the last service among the plurality of services related to the target service.
In this embodiment, a compensation service information set may be preset and stored in a preset database, so as to configure a correspondence between each service and its compensation service. The set of compensation service information may include a service ID, a service name, whether a compensation service is required (identifying whether the service requires a compensation service), a compensation service ID (if not configured, i.e., the ID of the compensation service may be directly the ID of the service).
In this embodiment, the compensation service ID of the target feature service may be determined according to the compensation service information set and the target feature service ID, so that the compensation service of the target feature service may be called according to the compensation service ID of the target feature service.
In this embodiment, since the service flow of the feature service includes the input message and the output message of the service, before the compensation service of the target feature service is invoked, the request message and the response message of the compensation service of the target feature service may also be constructed according to the service flow of the feature service. Correspondingly, the compensation service of the target feature service can be called according to the constructed request message.
In this embodiment, after the compensation service of the target feature service is invoked, the invocation result of the compensation service may be waited, and in the case that it is determined that the compensation service of the target feature service is successfully executed, the compensation service of the next feature service may be continuously invoked in reverse order until the compensation services of all feature services related to the target service have been successfully executed.
In one embodiment, if the execution of the compensation service fails, the call may be continued, or a prompt of the abnormal execution of the target service may be directly returned to the user side, or the relevant information of the failure execution of the target service may be fed back to the corresponding processor, and the cause of the failure execution may be confirmed manually, which may be specifically determined according to the actual situation, which is not limited in the present application.
Based on the same inventive concept, a service calling device is also provided in the embodiments of the present specification, as follows. Because the principle of the service calling device for solving the problem is similar to that of the service calling method, the implementation of the service calling device can refer to the implementation of the service calling method, and the repetition is not repeated. As used below, the term "unit" or "module" may be a combination of software and/or hardware that implements the intended function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated. Fig. 3 is a block diagram of a service invocation apparatus according to an embodiment of the present disclosure, and as shown in fig. 3, may include a processing module 301 and an invocation module 302, and this structure will be described below.
The processing module 301 may be configured to obtain a service call relationship information set of a target service in response to a target service request initiated by a user, where the service call relationship information set of the target service includes call relationships of a plurality of services related to the target service;
the calling module 302 may be configured to call, in sequence, the plurality of services related to the target service by using the plurality of threads according to a calling relationship of the plurality of services related to the target service.
The embodiment of the present disclosure further provides an electronic device, which may specifically refer to a schematic diagram of an electronic device composition based on the service invocation method provided in the embodiment of the present disclosure shown in fig. 4, where the electronic device may specifically include an input device 41, a processor 42, and a memory 43. Wherein the input device 41 may be specifically used for entering a target service request. The processor 42 may be specifically configured to obtain a service call relationship information set of a target service in response to a target service request initiated by a user, where the service call relationship information set of the target service includes call relationships of a plurality of services related to the target service, and sequentially call the plurality of services related to the target service by using a plurality of threads according to the call relationships of the plurality of services related to the target service. The memory 43 may be used for storing parameters such as a service invocation relation information set.
In this embodiment, the input device may specifically be one of the main means for exchanging information between the user and the computer system. Input devices may include a keyboard, mouse, camera, scanner, light pen, handwriting input pad, voice input device, etc., for inputting raw data and programs for processing these numbers into a computer. The input device may also obtain data transmitted from other modules, units, and devices. The processor may be implemented in any suitable manner. For example, a processor 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, application SPECIFIC INTEGRATED Circuits (ASICs), programmable logic controllers, and embedded microcontrollers, among others. The memory may in particular be a memory device for storing information in modern information technology. The memory may comprise multiple levels, in a digital system, the memory may be any memory as long as it can hold binary data, in an integrated circuit, a circuit with a memory function without a physical form, such as RAM, FIFO, etc., and in a system, a memory device with a physical form, such as a memory bank, TF card, etc.
In this embodiment, the specific functions and effects of the electronic device may be explained in comparison with other embodiments, which are not described herein.
The embodiment of the specification also provides a computer storage medium based on the service calling method, wherein the computer storage medium stores computer program instructions, and the computer program instructions can be implemented when executed, the computer program instructions can be used for responding to a target service request initiated by a user to obtain a service calling relation information set of the target service, wherein the service calling relation information set of the target service comprises calling relations of a plurality of services related to the target service, and the plurality of services related to the target service are sequentially called by a plurality of threads according to the calling relations of the plurality of services related to the target service.
In the present embodiment, the storage medium includes, but is not limited to, a random access Memory (Random Access Memory, RAM), a Read-Only Memory (ROM), a Cache (Cache), a hard disk (HARD DISK DRIVE, HDD), or a Memory Card (Memory Card). The memory may be used to store computer program instructions. The network communication unit may be an interface for performing network connection communication, which is set in accordance with a standard prescribed by a communication protocol.
In this embodiment, the functions and effects of the program instructions stored in the computer storage medium may be explained in comparison with other embodiments, and are not described herein.
It will be apparent to those skilled in the art that the modules or steps of the embodiments described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may alternatively be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps within them may be fabricated into a single integrated circuit module. Thus, embodiments of the present specification are not limited to any specific combination of hardware and software.
Although the present description provides the method operational steps as described in the above embodiments or flowcharts, more or fewer operational steps may be included in the method, either on a routine or non-inventive basis. In steps where there is logically no necessary causal relationship, the execution order of the steps is not limited to the execution order provided in the embodiments of the present specification. The described methods, when performed in an actual apparatus or an end product, may be performed sequentially or in parallel (e.g., in a parallel processor or multithreaded environment) as shown in the embodiments or figures.
It is to be understood that the above description is intended to be illustrative, and not restrictive. Many embodiments and many applications other than the examples provided will be apparent to those of skill in the art upon reading the above description. The scope of the embodiments of the specification should, therefore, be determined not with reference to the above description, but instead should be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled.
The above description is only of the preferred embodiments of the present embodiments and is not intended to limit the present embodiments, and various modifications and variations can be made to the present embodiments by those skilled in the art. Any modification, equivalent replacement, improvement, or the like made within the spirit and principles of the embodiments of the present specification should be included in the protection scope of the embodiments of the present specification.

Claims (12)

1.一种服务调用方法,其特征在于,包括:1. A service calling method, characterized by comprising: 响应于用户发起的目标业务请求,获取所述目标业务的服务调用关系信息集;其中,所述目标业务的服务调用关系信息集中包含所述目标业务涉及的多个服务的调用关系;In response to a target service request initiated by a user, a service call relationship information set of the target service is obtained; wherein the service call relationship information set of the target service includes call relationships of multiple services involved in the target service; 根据所述目标业务涉及的多个服务的调用关系,利用多个线程依次调用所述目标业务涉及的多个服务;According to the calling relationship of the multiple services involved in the target business, the multiple services involved in the target business are called in sequence by using multiple threads; 根据所述目标业务涉及的多个服务的调用关系,利用多个线程依次调用所述目标业务涉及的多个服务,包括:According to the calling relationship of multiple services involved in the target business, multiple services involved in the target business are called in sequence using multiple threads, including: 服务调用进程根据所述目标业务涉及的多个服务的调用关系创建当前服务的线程;其中,所述当前服务为当前需要调用的服务;The service calling process creates a thread of the current service according to the calling relationship of multiple services involved in the target business; wherein the current service is the service that needs to be called currently; 当前服务的线程读取所述当前服务的报文配置信息集;其中,所述报文配置信息集中包含所述当前服务的输入报文和输出报文采用元数据的方式进行配置的配置信息;元数据及对应的类型采用统一的命名及定义规范;The thread of the current service reads the message configuration information set of the current service; wherein the message configuration information set includes configuration information of the input message and the output message of the current service configured in the form of metadata; the metadata and the corresponding types adopt a unified naming and definition specification; 当前服务的线程根据所述当前服务的报文配置信息集,构建所述当前服务的请求报文和目标响应报文;其中,所述请求报文和目标响应报文通过MAP的方式传递;The thread of the current service constructs a request message and a target response message of the current service according to the message configuration information set of the current service; wherein the request message and the target response message are transmitted in a MAP manner; 当前服务的线程基于反射机制,利用所述当前服务的请求报文和线程调用所述当前服务;The thread of the current service calls the current service based on a reflection mechanism by using the request message and thread of the current service; 服务调用进程在根据所述目标业务的服务调用关系信息集确定出所述当前服务为同步调用的情况下,在确定所述当前服务已被成功执行时释放当前服务的线程的资源,并根据所述目标业务涉及的多个服务的调用关系创建所述当前服务的下一服务的线程;The service calling process, when determining that the current service is a synchronous call according to the service calling relationship information set of the target business, releases the resources of the thread of the current service when determining that the current service has been successfully executed, and creates a thread of the next service of the current service according to the calling relationship of multiple services involved in the target business; 将所述当前服务的下一服务的线程作为当前服务的线程,直至所述目标业务涉及的多个服务调用完成;Using the thread of the next service of the current service as the thread of the current service until multiple service calls involved in the target business are completed; 在响应于用户发起的目标业务请求,获取所述目标业务的服务调用关系信息集之前,还包括:Before the method responds to a target service request initiated by a user and obtains a service call relationship information set of the target service, the method further includes: 根据所述目标业务请求调用服务调用进程;其中,所述服务调用进程用于执行所述目标业务涉及的多个服务的调用处理;Calling a service calling process according to the target business request; wherein the service calling process is used to execute calling processing of multiple services involved in the target business; 在所述目标业务请求涉及异步调用的情况下,调用异步服务接收进程;其中,所述异步服务接收进程用于接收异步调用的服务返回的结果,所述服务调用进程和所述异步服务接收进程之间通过消息机制进行信息的交换。In the case where the target business request involves an asynchronous call, an asynchronous service receiving process is called; wherein the asynchronous service receiving process is used to receive the result returned by the asynchronously called service, and the service calling process and the asynchronous service receiving process exchange information through a message mechanism. 2.根据权利要求1所述的方法,其特征在于,在基于反射机制,利用所述当前服务的线程调用所述当前服务之后,还包括:2. The method according to claim 1, characterized in that after calling the current service by using the thread of the current service based on the reflection mechanism, it also includes: 在根据所述目标业务的服务调用关系信息集确定出所述当前服务为异步调用的情况下,根据所述目标业务涉及的多个服务的调用关系创建当前服务的下一服务的线程;When it is determined according to the service call relationship information set of the target business that the current service is an asynchronous call, creating a thread of the next service of the current service according to the call relationship of multiple services involved in the target business; 将所述当前服务的下一服务的线程作为当前服务的线程,直至所述目标业务涉及的多个服务调用完成。The thread of the next service of the current service is used as the thread of the current service until the multiple service calls involved in the target business are completed. 3.根据权利要求1所述的方法,其特征在于,根据所述目标业务涉及的多个服务的调用关系,利用多个线程依次调用所述目标业务涉及的多个服务,包括:3. The method according to claim 1 is characterized in that, according to the calling relationship of the multiple services involved in the target business, the multiple services involved in the target business are called in sequence by using multiple threads, comprising: 所述服务调用进程根据所述目标业务涉及的多个服务的调用关系创建当前服务的线程;其中,所述当前服务为当前需要调用的服务;The service calling process creates a thread of the current service according to the calling relationship of multiple services involved in the target business; wherein the current service is the service that needs to be called currently; 所述当前服务的线程基于反射机制调用所述当前服务;The thread of the current service calls the current service based on the reflection mechanism; 在根据所述目标业务的服务调用关系信息集确定出所述当前服务为同步调用的情况下,所述当前服务的线程在接收到所述当前服务的调用结果时,将所述当前服务的调用结果发送给所述服务调用进程;When it is determined that the current service is a synchronous call according to the service call relationship information set of the target business, the thread of the current service sends the call result of the current service to the service call process upon receiving the call result of the current service; 所述服务调用进程在根据所述当前服务的调用结果确定所述当前服务已被成功执行的情况下,根据所述目标业务涉及的多个服务的调用关系创建所述当前服务的下一服务的线程;The service calling process, when determining that the current service has been successfully executed according to the calling result of the current service, creates a thread of the next service of the current service according to the calling relationship of multiple services involved in the target business; 将所述当前服务的下一服务的线程作为当前服务的线程,直至所述目标业务涉及的多个服务调用完成。The thread of the next service of the current service is used as the thread of the current service until the multiple service calls involved in the target business are completed. 4.根据权利要求3所述的方法,其特征在于,在所述当前服务的线程基于反射机制调用所述当前服务之后,还包括:4. The method according to claim 3, characterized in that after the thread of the current service calls the current service based on the reflection mechanism, it also includes: 在确定所述当前服务未被成功执行的情况下,根据所述目标业务的服务调用关系信息集确定所述目标业务涉及的多个服务的调用顺序;In the case where it is determined that the current service is not successfully executed, determining a calling sequence of multiple services involved in the target business according to the service calling relationship information set of the target business; 所述服务调用进程按照所述目标业务涉及的多个服务的调用顺序的倒序,利用多个线程依次调用所述目标业务涉及的各个服务的补偿服务。The service calling process sequentially calls the compensation services of the services involved in the target business using multiple threads in the reverse order of the calling sequence of the multiple services involved in the target business. 5.根据权利要求3所述的方法,其特征在于,在所述当前服务的线程基于反射机制调用所述当前服务之后,还包括:5. The method according to claim 3, characterized in that after the thread of the current service calls the current service based on the reflection mechanism, it also includes: 服务调用进程在根据所述目标业务的服务调用关系信息集确定出所述当前服务为同步调用的情况下,所述当前服务的线程在接收到所述当前服务的调用结果时,根据所述当前服务的调用结果生成所述当前服务的服务流水;When the service calling process determines that the current service is a synchronous call according to the service calling relationship information set of the target business, the thread of the current service generates a service flow of the current service according to the calling result of the current service when receiving the calling result of the current service; 将所述当前服务的服务流水存储至预设数据库中。The service flow of the current service is stored in a preset database. 6.根据权利要求5所述的方法,其特征在于,所述服务流水包括:服务ID、输入报文、输出报文、服务执行结果、当前服务的上一调用服务的ID。6. The method according to claim 5 is characterized in that the service flow includes: service ID, input message, output message, service execution result, and ID of the last called service of the current service. 7.根据权利要求3所述的方法,其特征在于,在所述当前服务的线程基于反射机制调用所述当前服务之后,还包括:7. The method according to claim 3, characterized in that after the thread of the current service calls the current service based on the reflection mechanism, it also includes: 在根据所述目标业务的服务调用关系信息集确定出所述当前服务为异步调用的情况下,所述当前服务的线程向所述服务调用进程发送所述当前服务的线程的调起结果;When it is determined that the current service is an asynchronous call according to the service call relationship information set of the target business, the thread of the current service sends a call result of the thread of the current service to the service call process; 所述服务调用进程在根据所述当前服务的线程的调起结果确定出所述当前服务的线程已被成功调用的情况下,根据所述目标业务涉及的多个服务的调用关系创建当前服务的下一服务的线程;The service calling process, when determining according to the calling result of the thread of the current service that the thread of the current service has been successfully called, creates a thread of the next service of the current service according to the calling relationship of multiple services involved in the target business; 将所述当前服务的下一服务的线程作为当前服务的线程,直至所述目标业务涉及的多个服务调用完成。The thread of the next service of the current service is used as the thread of the current service until the multiple service calls involved in the target business are completed. 8.根据权利要求6所述的方法,其特征在于,在所述当前服务的线程向所述服务调用进程发送所述当前服务的线程的调起结果之后,还包括:8. The method according to claim 6, characterized in that after the thread of the current service sends the calling result of the thread of the current service to the service calling process, it also includes: 所述异步服务接收进程在确定成功接收到所述当前服务的线程返回的调用结果时,根据所述目标业务的服务调用关系信息集和所述当前服务的调用结果生成所述当前服务的响应报文;When the asynchronous service receiving process determines that the calling result returned by the thread of the current service is successfully received, the asynchronous service receiving process generates a response message of the current service according to the service calling relationship information set of the target business and the calling result of the current service; 所述异步服务接收进程将所述当前服务的响应报文放入目标消息队列中;The asynchronous service receiving process puts the response message of the current service into the target message queue; 所述服务调用进程根据所述目标消息队列中的所述当前服务的响应报文确定所述当前服务是否被成功执行;The service calling process determines whether the current service is successfully executed according to the response message of the current service in the target message queue; 在确定所述当前服务被成功执行的情况下,结束所述当前服务的调用流程。When it is determined that the current service is successfully executed, the calling process of the current service is terminated. 9.根据权利要求8所述的方法,其特征在于,在所述服务调用进程根据所述目标消息队列中的所述当前服务的响应报文确定所述当前服务是否被成功执行之后,还包括:9. The method according to claim 8, characterized in that after the service calling process determines whether the current service is successfully executed according to the response message of the current service in the target message queue, it also includes: 在确定所述当前服务未被成功执行的情况下,根据所述目标业务的服务调用关系信息集确定所述目标业务涉及的多个服务的调用顺序;In the case where it is determined that the current service is not successfully executed, determining a calling sequence of multiple services involved in the target business according to the service calling relationship information set of the target business; 所述服务调用进程按照所述目标业务涉及的多个服务的调用顺序的倒序,利用多个线程依次调用所述目标业务涉及的至少一个特征服务的补偿服务;其中,所述特征服务为所述目标业务涉及的需要调用补偿服务的服务。The service calling process uses multiple threads to sequentially call the compensation service of at least one feature service involved in the target business in reverse order of the calling order of multiple services involved in the target business; wherein the feature service is a service involved in the target business that needs to call the compensation service. 10.根据权利要求9所述的方法,其特征在于,所述服务调用进程按照所述目标业务涉及的多个服务的调用顺序的倒序,利用多个线程依次调用所述目标业务涉及的至少一个特征服务的补偿服务,包括:10. The method according to claim 9, characterized in that the service calling process sequentially calls the compensation service of at least one characteristic service involved in the target business using multiple threads in the reverse order of the calling sequence of multiple services involved in the target business, comprising: 所述服务调用进程从预设数据库读取所述目标业务涉及的多条服务流水;The service calling process reads multiple service flows involved in the target business from a preset database; 按照所述目标业务涉及的多个服务的调用顺序的倒序,依次根据各个特征服务的服务流水重新创建多个线程,并依次利用重新创建的多个线程依次调用所述目标业务涉及的特征服务的补偿服务;Re-create multiple threads according to the service flow of each characteristic service in reverse order of the calling sequence of multiple services involved in the target business, and call the compensation services of the characteristic services involved in the target business in sequence by using the re-created multiple threads; 其中,利用重新创建的多个线程依次调用所述目标业务涉及的特征服务的补偿服务,包括:目标特征服务的线程根据所述目标特征服务的服务流水中的目标特征服务ID确定所述目标特征服务的补偿服务ID;基于反射机制,根据所述目标特征服务的补偿服务ID调用所述目标特征服务的补偿服务,直至所述目标业务涉及的至少一个特征服务的补偿服务调用完成。Among them, the compensation service of the feature service involved in the target business is called in sequence by using multiple recreated threads, including: the thread of the target feature service determines the compensation service ID of the target feature service according to the target feature service ID in the service flow of the target feature service; based on the reflection mechanism, the compensation service of the target feature service is called according to the compensation service ID of the target feature service until the compensation service call of at least one feature service involved in the target business is completed. 11.一种服务调用装置,其特征在于,包括:11. A service calling device, comprising: 处理模块,用于响应于用户发起的目标业务请求,获取所述目标业务的服务调用关系信息集;其中,所述目标业务的服务调用关系信息集中包含所述目标业务涉及的多个服务的调用关系;A processing module, configured to obtain a service call relationship information set of the target service in response to a target service request initiated by a user; wherein the service call relationship information set of the target service includes call relationships of multiple services involved in the target service; 调用模块,用于根据所述目标业务涉及的多个服务的调用关系,利用多个线程依次调用所述目标业务涉及的多个服务;A calling module, used to call the multiple services involved in the target business in sequence using multiple threads according to the calling relationship of the multiple services involved in the target business; 所述调用模块具体用于:The calling module is specifically used for: 利用服务调用进程根据所述目标业务涉及的多个服务的调用关系创建当前服务的线程;其中,所述当前服务为当前需要调用的服务;Using the service calling process to create a thread of the current service according to the calling relationship of multiple services involved in the target business; wherein the current service is the service that needs to be called currently; 利用当前服务的线程读取所述当前服务的报文配置信息集;其中,所述报文配置信息集中包含所述当前服务的输入报文和输出报文采用元数据的方式进行配置的配置信息;元数据及对应的类型采用统一的命名及定义规范;Using the thread of the current service to read the message configuration information set of the current service; wherein the message configuration information set includes configuration information of the input message and the output message of the current service configured in the form of metadata; the metadata and the corresponding types adopt a unified naming and definition specification; 利用当前服务的线程根据所述当前服务的报文配置信息集,构建所述当前服务的请求报文和目标响应报文;其中,所述请求报文和目标响应报文通过MAP的方式传递;Using the thread of the current service according to the message configuration information set of the current service, constructing the request message and the target response message of the current service; wherein the request message and the target response message are transmitted in a MAP manner; 利用当前服务的线程基于反射机制,利用所述当前服务的请求报文和线程调用所述当前服务;Using the thread of the current service based on the reflection mechanism, using the request message and thread of the current service to call the current service; 利用服务调用进程在根据所述目标业务的服务调用关系信息集确定出所述当前服务为同步调用的情况下,在确定所述当前服务已被成功执行时根据所述目标业务涉及的多个服务的调用关系创建所述当前服务的下一服务的线程;When the service calling process determines that the current service is a synchronous call according to the service calling relationship information set of the target business, and when it is determined that the current service has been successfully executed, a thread of the next service of the current service is created according to the calling relationship of multiple services involved in the target business; 将所述当前服务的下一服务的线程作为当前服务的线程,直至所述目标业务涉及的多个服务调用完成;Using the thread of the next service of the current service as the thread of the current service until multiple service calls involved in the target business are completed; 所述装置还用于:根据所述目标业务请求调用服务调用进程;其中,所述服务调用进程用于执行所述目标业务涉及的多个服务的调用处理;在所述目标业务请求涉及异步调用的情况下,调用异步服务接收进程;其中,所述异步服务接收进程用于接收异步调用的服务返回的结果,所述服务调用进程和所述异步服务接收进程之间通过消息机制进行信息的交换。The device is also used to: call a service calling process according to the target business request; wherein the service calling process is used to execute the calling processing of multiple services involved in the target business; and when the target business request involves an asynchronous call, call an asynchronous service receiving process; wherein the asynchronous service receiving process is used to receive the result returned by the asynchronously called service, and the service calling process and the asynchronous service receiving process exchange information through a message mechanism. 12.一种计算机可读存储介质,其特征在于,其上存储有计算机指令,所述指令被执行时实现权利要求1至10中任一项所述方法的步骤。12. A computer-readable storage medium, characterized in that computer instructions are stored thereon, and when the instructions are executed, the steps of the method according to any one of claims 1 to 10 are implemented.
CN202010974484.5A 2020-09-16 2020-09-16 Service calling method and device Active CN112099973B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010974484.5A CN112099973B (en) 2020-09-16 2020-09-16 Service calling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010974484.5A CN112099973B (en) 2020-09-16 2020-09-16 Service calling method and device

Publications (2)

Publication Number Publication Date
CN112099973A CN112099973A (en) 2020-12-18
CN112099973B true CN112099973B (en) 2025-01-10

Family

ID=73759329

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010974484.5A Active CN112099973B (en) 2020-09-16 2020-09-16 Service calling method and device

Country Status (1)

Country Link
CN (1) CN112099973B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113989046A (en) * 2021-11-05 2022-01-28 中国工商银行股份有限公司 Transaction processing method, apparatus, electronic device, storage medium and program product
CN114490690A (en) * 2022-02-07 2022-05-13 北京电解智科技有限公司 Transaction management method and device, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111277639A (en) * 2020-01-16 2020-06-12 中国建设银行股份有限公司 Method and device for maintaining data consistency
CN111580793A (en) * 2020-04-30 2020-08-25 微民保险代理有限公司 Method, apparatus, computer device and storage medium for executing service

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10104187B2 (en) * 2016-06-15 2018-10-16 Futurewei Technologies, Inc. System, computer program, and method for dividing services into subsets based on interdependencies
CN109040152B (en) * 2017-06-08 2022-05-31 创新先进技术有限公司 Service request and providing method and device based on service arrangement and electronic equipment
CN110321119A (en) * 2018-03-30 2019-10-11 优酷网络技术(北京)有限公司 The generation method of data processing module, server and client side
CN111553652B (en) * 2020-04-23 2023-10-27 中国银行股份有限公司 Service processing method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111277639A (en) * 2020-01-16 2020-06-12 中国建设银行股份有限公司 Method and device for maintaining data consistency
CN111580793A (en) * 2020-04-30 2020-08-25 微民保险代理有限公司 Method, apparatus, computer device and storage medium for executing service

Also Published As

Publication number Publication date
CN112099973A (en) 2020-12-18

Similar Documents

Publication Publication Date Title
Varia Cloud architectures
US7349970B2 (en) Workload management of stateful program entities
CN101097527B (en) Flowpath scheduling method and system of application progress
US7609703B2 (en) Group communication system and method
CN110377410A (en) Method for scheduling task, system, electronic equipment and computer readable storage medium
US10970141B2 (en) Integrating transaction processing system interfaces with event-driven polyglot runtime modules
AU2020399282B2 (en) Controlling transaction requests between applications and servers
CN111277639A (en) Method and device for maintaining data consistency
CN107113341A (en) The system of the high-throughput processing of affairs in the Distributed Relation Database Management System divided for data
CN112099973B (en) Service calling method and device
CN109614271A (en) Control method, device, device and storage medium for data consistency of multiple clusters
CN114691309A (en) Batch business processing system, method and device
CN107025257A (en) A kind of transaction methods and device
CN113347238A (en) Message partitioning method, system, device and storage medium based on block chain
US11803789B2 (en) Provision of remote application action feed cards
CN112948430B (en) Date data query method and device
CN115545639A (en) Financial business processing method and device, electronic equipment and storage medium
CN115617768A (en) Log management method, system, electronic device and storage medium
CN101295269B (en) A Method of Component Interaction Synchronization Based on Transaction
CN112162988A (en) Distributed transaction processing method and device and electronic equipment
CN119759372B (en) Low-code development platform, method, and equipment based on independent deployment architecture
CN113934761B (en) A method and device for data processing
CN115033214B (en) Data importing method, device, computer equipment and storage medium
CN114327800A (en) Method and device for writing in topic, processor and stream processing platform
WO2025074399A1 (en) Method and system for handling of event(s) concerning policies related to one or more operations

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
GR01 Patent grant
GR01 Patent grant