Distributed application method and device for encapsulating host services into microservices
By encapsulating the host service into microservices under the distributed platform and converting the message format, a unified external service of centralized and distributed architectures is realized, which solves the service uniformity problem caused by architecture differences and improves the system's call efficiency and collaboration capabilities.
Patent Information
- Application Number
- CN202210031727.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-12
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-01-12
AI Technical Summary
During the transformation of the platform architecture, due to the different communication protocols, message formats and encoding methods of centralized and distributed architectures, it is difficult to achieve unified external services for the two architectures.
By creating new microservices under a distributed platform, encapsulate host services into microservices, converting transaction packet formats, calling host services, and converting response packets into microservice packets, realizing unified external connections between centralized and distributed architectures Serve.
It realizes the unified external consistent services of centralized and distributed architectures, solves the problem of distributed system calling hosts, and improves efficient call and collaboration capabilities of host services.
Smart Images

Figure CN114371947B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer data processing, and in particular to a distributed application method and device for encapsulating a host service into a microservice. Background Art
[0002] This section is intended to provide a background or context to embodiments of the invention that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.
[0003] In the process of platform architecture transformation, due to the application of technology development or the transitional needs of the system switching, some functions of a system will be in the host and centralized architecture mode, while some functions will be in the x86 distributed architecture mode. Since the communication protocols, message formats, and encoding methods used by the two architecture systems are different, it is difficult to achieve unified external services for the two different architectures when providing external services.
[0004] Therefore, how to provide a new solution that can solve the above technical problems is a technical problem that needs to be solved urgently in this field. Summary of the invention
[0005] An embodiment of the present invention provides a distributed application method for encapsulating a host service into a microservice, so as to realize unified external consistent service provision of two different architectures, centralized and distributed. The method includes:
[0006] Create a new microservice on the distributed platform, encapsulate the host service into the microservice to generate a host packaging microservice;
[0007] When a transaction requiring host functionality is initiated in the distributed platform, the transaction microservice message is sent to the host packaging microservice;
[0008] Convert the transaction microservice message into a transaction fixed-length message, call the host service to execute the transaction, and determine the response fixed-length message; the transaction fixed-length message and the response fixed-length message match the host service;
[0009] The response fixed-length message is returned to the distributed platform and converted into a response microservice message; the transaction microservice message and the response microservice message match the microservice of the distributed platform.
[0010] An embodiment of the present invention further provides a distributed application device in which a host service is encapsulated as a microservice, comprising:
[0011] The host service encapsulation module is used to create a new microservice on the distributed platform and encapsulate the host service into the microservice to generate a host packaging microservice;
[0012] The host transaction initiation module is used to send the transaction microservice message to the host packaging microservice when a transaction requiring host functions is initiated in the distributed platform;
[0013] The host service calling module is used to convert the transaction microservice message into a transaction fixed-length message, call the host service to execute the transaction, and determine the response fixed-length message; the transaction fixed-length message and the response fixed-length message match the host service;
[0014] The response fixed-length message returning module is used to return the response fixed-length message to the distributed platform and convert it into a response microservice message; the transaction microservice message and the response microservice message match the microservice of the distributed platform.
[0015] An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the above-mentioned distributed application method of encapsulating a host service into a microservice is implemented.
[0016] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the distributed application method of encapsulating a host service into a microservice is implemented.
[0017] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the above-mentioned distributed application method of encapsulating a host service into a microservice.
[0018] The embodiment of the present invention provides a distributed application method and device for encapsulating a host service into a microservice, including: creating a new microservice under a distributed platform, encapsulating the host service into the microservice to generate a host packaging microservice; when a transaction requiring a host function is initiated in the distributed platform, sending the transaction microservice message to the host packaging microservice; converting the transaction microservice message into a transaction fixed-length message, calling the host service to execute the transaction, and determining the response fixed-length message; the transaction fixed-length message and the response fixed-length message match the host service; returning the response fixed-length message to the distributed platform and converting it into a response microservice message; the transaction microservice message and the response microservice message match the microservice of the distributed platform. The present invention can realize the unified provision of consistency services to the outside world by two different architectures, centralized and distributed, and package the host service into a microservice in a distributed application, so as to realize efficient calling and joint collaboration for other distributed microservices to complete the corresponding functions, and solve the problem of calling the host by the distributed system. From the perspective of the distributed system, whether it is the original distributed microservice or the host packaging microservice formed by the encapsulation of the host service, it looks the same, and the internal calling method of the distributed system is the same. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0020] Figure 1 A schematic diagram of a distributed application method for encapsulating a host service into a microservice according to an embodiment of the present invention.
[0021] Figure 2 This is an overall architecture diagram of a distributed application method for encapsulating a host service as a microservice according to an embodiment of the present invention.
[0022] Figure 3 A schematic diagram of a host service encapsulation process of a distributed application method for encapsulating a host service into a microservice according to an embodiment of the present invention.
[0023] Figure 4 This is a schematic diagram of a process of sending a transaction microservice message to a host packaging microservice in a distributed application method for encapsulating a host service into a microservice according to an embodiment of the present invention.
[0024] Figure 5 The present invention is a schematic diagram of a distributed application method for encapsulating a host service as a microservice and calling a host service to execute a transaction.
[0025] Figure 6 The present invention is a schematic diagram of a process of converting a transaction microservice message into a transaction fixed-length message in a distributed application method of encapsulating a host service as a microservice according to an embodiment of the present invention.
[0026] Figure 7 The present invention is a schematic diagram of a distributed application method for encapsulating a host service into a microservice through a Socket protocol receiving and converting program to call the host service process.
[0027] Figure 8 The present invention is a schematic diagram of a distributed platform conversion process in which a response fixed-length message is returned to a distributed application method for encapsulating a host service as a microservice according to an embodiment of the present invention.
[0028] Fig. 9 The present invention is a schematic diagram of a process of converting a response fixed-length message into a response microservice message in a distributed application method for encapsulating a host service as a microservice in an embodiment of the present invention.
[0029] Fig.10 A schematic diagram of a computer device for running a distributed application method for encapsulating a host service as a microservice implemented by the present invention.
[0030] Fig.11 A schematic diagram of a distributed application device in which a host service is encapsulated as a microservice according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] To make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0032] The present invention belongs to distributed technology. Figure 1 FIG. 1 is a schematic diagram of a distributed application method for encapsulating a host service into a microservice according to an embodiment of the present invention. Figure 1 As shown, an embodiment of the present invention provides a distributed application method for encapsulating a host service into a microservice, which realizes unified provision of consistent services to the outside by two different architectures, centralized and distributed. The method includes:
[0033] Step 101: Create a new microservice on the distributed platform, and encapsulate the host service into the microservice to generate a host packaging microservice;
[0034] Step 102: When a transaction requiring a host function is initiated in the distributed platform, the transaction microservice message is sent to the host packaging microservice;
[0035] Step 103: convert the transaction microservice message into a transaction fixed-length message, call the host service to execute the transaction, and determine the response fixed-length message; the transaction fixed-length message and the response fixed-length message match the host service;
[0036] Step 104: Return the fixed-length response message to the distributed platform and convert it into a response microservice message; the transaction microservice message and the response microservice message match the microservice of the distributed platform.
[0037] A distributed application method for encapsulating a host service as a microservice provided by an embodiment of the present invention includes: creating a new microservice under a distributed platform, encapsulating the host service into the microservice to generate a host packaging microservice; when a transaction requiring a host function is initiated in the distributed platform, sending a transaction microservice message to the host packaging microservice; converting the transaction microservice message into a transaction fixed-length message, calling the host service to execute the transaction, and determining the response fixed-length message; the transaction fixed-length message and the response fixed-length message match the host service; returning the response fixed-length message to the distributed platform and converting it into a response microservice message; the transaction microservice message and the response microservice message match the microservice of the distributed platform. The present invention can realize the unified provision of consistency services to the outside world by two different architectures, centralized and distributed, and package the host service into a microservice in a distributed application, so as to realize efficient calling and joint collaboration for other distributed microservices to complete the corresponding functions, and solve the problem of calling the host by the distributed system. From the perspective of the distributed system, whether it is the original distributed microservice or the host packaging microservice formed by the encapsulation of the host service, it looks the same, and the internal calling method of the distributed system is the same.
[0038] Figure 2 FIG. 1 is an overall architecture diagram of a distributed application method for encapsulating a host service into microservices according to an embodiment of the present invention. Figure 2 As shown, when a distributed application method for encapsulating a host service as a microservice provided by an embodiment of the present invention is specifically implemented, in one embodiment, it may include:
[0039] Create a new microservice on the distributed platform, encapsulate the host service into the microservice to generate a host packaging microservice;
[0040] When a transaction requiring host functionality is initiated in the distributed platform, the transaction microservice message is sent to the host packaging microservice;
[0041] Convert the transaction microservice message into a transaction fixed-length message, call the host service to execute the transaction, and determine the response fixed-length message; the transaction fixed-length message and the response fixed-length message match the host service; since the host service belongs to a centralized architecture, the message format supported by the host service and the host platform on which it is located is a fixed-length message, so when interacting with the host service, a fixed-length message needs to be used; both the transaction fixed-length message and the response fixed-length message belong to the fixed-length message format, so the transaction fixed-length message and the response fixed-length message can be matched with the host service to realize the interaction of the transaction fixed-length message and the response fixed-length message with the host service.
[0042] The response fixed-length message is returned to the distributed platform and converted into a response microservice message; the transaction microservice message and the response microservice message match the microservice of the distributed platform. Since the microservice is under the distributed architecture, the message format supported by the distributed platform and the microservice under the distributed architecture is the microservice message, such as the JSON message. Therefore, when interacting with the distributed platform and the microservice under the distributed architecture, it is necessary to use the microservice message. The transaction microservice message and the response microservice message both belong to the microservice message format. Therefore, the transaction microservice message and the response microservice message can be matched with the microservice of the distributed platform to realize the interaction between the transaction microservice message and the response microservice message and the microservice of the distributed platform.
[0043] Since the host centralized architecture and the distributed architecture use different communication protocols, message formats, and encoding methods, it is difficult to achieve consistency when providing external services. The present invention is implemented on the technical basis of being able to provide multiple microservices under a distributed architecture. The host service is encapsulated into a microservice to generate a host packaging microservice. The host service is encapsulated into the distributed architecture. The function of calling the host service conveniently and efficiently under the distributed architecture can be realized, and the corresponding functions can be completed in collaboration. Since the host service is encapsulated into the distributed architecture, the distributed architecture displays multiple microservices to the outside, thereby achieving consistency in external services.
[0044] Figure 3 FIG. 1 is a schematic diagram of a host service encapsulation process of a distributed application method for encapsulating a host service into a microservice according to an embodiment of the present invention. Figure 3 As shown, when a distributed application method for encapsulating a host service into a microservice provided by an embodiment of the present invention is specifically implemented, in one embodiment, a new microservice is created on a distributed platform, and the host service is encapsulated into the microservice to generate a host packaging microservice, including:
[0045] Step 301: Create a new microservice on a distributed platform; the distributed platform also includes multiple existing microservices;
[0046] Step 302: Encapsulate the host service into the newly created microservice, connect the newly created microservice with the host service to form a mapping relationship, generate a host packaging microservice, and register it to the registration center of the distributed platform.
[0047] In the embodiment, the distributed platform includes multiple existing microservices and a registration center, each microservice is registered with the registration center, and each microservice of the distributed platform can be connected from the registration center; therefore, in the process of encapsulating the host service into the microservice to generate the host packaging microservice, it mainly includes:
[0048] Create a new microservice on the distributed platform; encapsulate the host service into the newly created microservice, connect the newly created microservice with the host service to form a mapping relationship, generate a host-wrapped microservice, and register it with the registration center of the distributed platform. From the distributed system's registration center, whether it is the original distributed microservice or the host-wrapped microservice encapsulated by the host service, they look the same, and the calling method is also the same, which serves as the basis for calling the host service.
[0049] Figure 4 FIG. 1 is a schematic diagram of a process of sending a transaction microservice message to a host packaging microservice in a distributed application method for encapsulating a host service into a microservice according to an embodiment of the present invention, such as Figure 4 As shown, when a distributed application method for encapsulating a host service into a microservice provided by an embodiment of the present invention is specifically implemented, in one embodiment, when a transaction requiring a host function is initiated in a distributed platform, a transaction microservice message is sent to the host packaging microservice, including:
[0050] Step 401: When a transaction requiring a host function is initiated in the distributed platform, the corresponding host packaging microservice is found from the registration center;
[0051] Step 402: Packaging the microservice from the found host to generate a transaction microservice message;
[0052] Step 403: Send the transaction microservice message to the host packaging microservice.
[0053] In an embodiment, when a microservice in an external system or a distributed platform needs to call a host function, a transaction requiring the host function is initiated from the distributed platform, and the corresponding host packaging microservice is found from the registration center using the transaction requiring the host function. Then, a transaction microservice message is generated by the found host packaging microservice; finally, the transaction microservice message is sent to the host packaging microservice.
[0054] Figure 5 FIG. 1 is a schematic diagram of a process of calling a host service to execute a transaction in a distributed application method for encapsulating a host service as a microservice according to an embodiment of the present invention. Figure 5 As shown, when a distributed application method for encapsulating a host service as a microservice provided by an embodiment of the present invention is specifically implemented, in one embodiment, a transaction microservice message is converted into a transaction fixed-length message, a host service is called to execute a transaction, and a response fixed-length message is determined, including:
[0055] Step 501: Convert the transaction microservice message into a transaction fixed-length message according to the data conversion strategy;
[0056] Step 502: The host packaging microservice sends the transaction fixed-length message to the host platform, calls the host service in the host platform to execute the transaction, and determines the response fixed-length message; the host platform includes multiple host services.
[0057] In the embodiment, the process of converting the transaction microservice message into a transaction fixed-length message to call the host service to execute the transaction to determine the response fixed-length message mainly includes:
[0058] First, according to the data conversion strategy, the transaction microservice message is converted into a transaction fixed-length message; then, the host packaging microservice sends the transaction fixed-length message to the host platform, calls the host service in the host platform to execute the transaction, and determines the response fixed-length message; the host platform includes multiple host services.
[0059] Figure 6 FIG. 1 is a schematic diagram of a process of converting a transaction microservice message into a transaction fixed-length message in a distributed application method for encapsulating a host service as a microservice according to an embodiment of the present invention. Figure 6 As shown, when a distributed application method for encapsulating a host service as a microservice provided by an embodiment of the present invention is specifically implemented, in one embodiment, according to a data conversion strategy, a transaction microservice message is converted into a transaction fixed-length message, including:
[0060] Step 601: Analyze the transaction microservice message and determine the transaction microservice message field;
[0061] Step 602: Perform data dictionary management on the fields involved in the conversion, define data conversion strategies according to field types, and use corresponding data conversion strategies for each field;
[0062] Step 603: Convert the transaction microservice message field into a transaction fixed-length message according to the corresponding data conversion strategy.
[0063] In the embodiment, the transaction microservice message is converted into a transaction fixed-length message, and the main process includes:
[0064] First, analyze the transaction microservice message and determine the transaction microservice message fields. Then, perform data dictionary management on the fields involved in the conversion, define the data conversion strategy according to the field type, and use the corresponding data conversion strategy for each field. Finally, convert the transaction microservice message fields into transaction fixed-length messages according to the corresponding data conversion strategy.
[0065] The host supports the fixed-length packet message format, and the distributed microservice uses the JSON message format. The fields involved in the conversion are managed by the data dictionary, and the data conversion strategy is defined by the field type. Each field uses a corresponding data conversion strategy to complete the message format conversion. When the interface field changes, it is added and modified in the data dictionary, and the corresponding data conversion strategy is selected.
[0066] Figure 7 FIG. 1 is a schematic diagram of a distributed application method for encapsulating a host service as a microservice in an embodiment of the present invention, wherein a host service is received and converted through a Socket protocol and a process of calling a host service is described. Figure 7 As shown, when a distributed application method for encapsulating a host service as a microservice provided by an embodiment of the present invention is specifically implemented, in one embodiment, the host packaging microservice sends a transaction fixed-length message to the host platform, calls the host service in the host platform to execute the transaction, and determines a response fixed-length message, including:
[0067] Step 701: The host packaging microservice sends the transaction fixed-length message to the host platform;
[0068] Step 702: The host platform uses the Socket protocol receiving and conversion program and the TCP / IP-based gateway processing program to map the received fixed-length transaction message to the public basic copybook and obtain the transaction code field;
[0069] Step 703: Find the host transaction and mainline program of the corresponding host service according to the transaction code field, call up the mainline program to process the host transaction, and generate a response fixed-length message after the processing is completed.
[0070] In the embodiment, the transaction is executed by calling the host service through the Socket protocol receiving and conversion program, and the main process includes:
[0071] First, the host packaging microservice sends the fixed-length transaction message to the host platform; then, the host platform receives and converts the program through the Socket protocol, and the TCP / IP-based gateway handler maps the received fixed-length transaction message to the public basic copybook to obtain the transaction code field; finally, the host transaction and main line program of the corresponding host service are found according to the transaction code field, and the main line program is called up to process the host transaction. After the processing is completed, a response fixed-length message is generated.
[0072] The aforementioned Socket protocol receiving and conversion program is independently developed and manufactured by the embodiment of the present invention. Through the independently developed Socket protocol receiving and conversion program, a gateway processing program based on TCP / IP is used to map the received fixed-length message to a public basic copybook, obtain the transaction code field, and find the corresponding host transaction and main line program according to the transaction code, call up the main line program to perform transaction processing, and return the fixed-length message through the Socket protocol after the processing is completed.
[0073] Figure 8 FIG. 1 is a schematic diagram of a distributed platform conversion process of a distributed application method for encapsulating a host service as a microservice in an embodiment of the present invention, wherein a response fixed-length message is returned to the distributed platform. Figure 8As shown, when a distributed application method for encapsulating a host service as a microservice provided by an embodiment of the present invention is specifically implemented, in one embodiment, a response fixed-length message is returned to the distributed platform and converted into a response microservice message, including:
[0074] Step 801: using the Socket protocol receiving and conversion program, based on the TCP / IP gateway processing program, the response fixed-length message is returned to the host packaging microservice of the distributed platform;
[0075] Step 802: The host packages the microservice and converts the fixed-length response message into a microservice response message.
[0076] In the embodiment, after obtaining the response fixed-length message, the response fixed-length message needs to be returned to the distributed platform and converted into a response microservice message. The main process includes:
[0077] First, the Socket protocol receiving and conversion program is used to return the response fixed-length message to the host packaging microservice of the distributed platform based on the TCP / IP gateway processing program; then, the host packaging microservice converts the response fixed-length message into a response microservice message.
[0078] Write a corresponding microservice for each host transaction in the distributed framework. The internal processing logic of the microservice is to convert the received microservice message into a fixed-length message according to the data conversion strategy, call the host through the Socket protocol, and convert the returned fixed-length message into a microservice JSON message according to the data conversion strategy. Use the corresponding distributed microservice framework to register the packaged service to the registration center. In this way, from the perspective of the distributed system's registration center, whether it is the original distributed microservice or the microservice formed by the host service packaging, it looks the same, and the calling method is also the same.
[0079] Fig. 9 FIG. 1 is a schematic diagram of a process of converting a response fixed-length message into a response microservice message in a distributed application method for encapsulating a host service as a microservice according to an embodiment of the present invention. Fig. 9 As shown, when a distributed application method for encapsulating a host service as a microservice provided by an embodiment of the present invention is specifically implemented, in one embodiment, the response fixed-length message is converted into a response microservice message, including:
[0080] Step 901: Analyze the response fixed-length message and determine the response fixed-length message fields;
[0081] Step 902: The response fixed-length message is converted into a response microservice message using the data conversion strategy used when converting the transaction microservice message field into the transaction fixed-length message.
[0082] In the embodiment, the conversion of the response fixed-length message into the response microservice message also needs to follow the data conversion strategy, which may specifically include: first, analyzing the response fixed-length message to determine the response fixed-length message field; then, using the data conversion strategy adopted when converting the transaction microservice message field into the transaction fixed-length message, the response fixed-length message is converted into a response microservice message.
[0083] The host supports the fixed-length packet message format, and the distributed microservice uses the JSON message format. The fields involved in the conversion are managed by the data dictionary, and the data conversion strategy is defined by the field type. Each field uses a corresponding data conversion strategy to complete the message format conversion. When the interface field changes, it is added and modified in the data dictionary, and the corresponding data conversion strategy is selected.
[0084] When implementing a distributed application method for encapsulating a host service into a microservice provided by an embodiment of the present invention, in one embodiment, it also includes: performing flow control on the host-packaged microservice to control the concurrency of the host service encapsulated into the host-packaged microservice.
[0085] In the embodiment, since each host transaction is encapsulated into a corresponding distributed microservice, the concurrency of the host transaction can be controlled by controlling the flow of the corresponding microservice. By controlling the flow to the host, the host system can still maintain stable operation, avoiding the destructive impact of large flow of the distributed system on the host system, so that the host system can be packaged into a microservice more safely.
[0086] The embodiment of the present invention controls the flow to the host through concurrent management of transaction volume, so that the host system can still maintain stable operation, and avoids the destructive impact of large flow of distributed system on the host system.
[0087] The following is a brief description of a distributed application method for encapsulating a host service into a microservice provided by an embodiment of the present invention in conjunction with a specific scenario:
[0088] An embodiment of the present invention provides a distributed application method for encapsulating a host service into a microservice, and the main implementation process includes:
[0089] External systems or microservices in the internal distributed architecture initiate calls to host functions;
[0090] Through the registration center, find the microservice encapsulated by the host and call the encapsulated microservice;
[0091] The microservice encapsulated by the host converts the data into a fixed-length message according to the data conversion strategy, calls the host through the Socket protocol, and after receiving the returned fixed-length message, it converts it into a microservice JSON message according to the data conversion strategy and returns it;
[0092] By limiting the flow of encapsulated microservices, the purpose of limiting the host transaction flow can be achieved.
[0093] The embodiment of the present invention also provides a modular example of a distributed application method for encapsulating a host service into a microservice, which mainly includes:
[0094] Data dictionary management unit: define data conversion strategies;
[0095] The host supports the fixed-length packet message format, and the distributed microservice uses the JSON message format. The fields involved in the conversion are managed by the data dictionary, and the data conversion strategy is defined by the field type. Each field uses a corresponding data conversion strategy to complete the message format conversion. When the interface field changes, it is added and modified in the data dictionary, and the corresponding data conversion strategy is selected.
[0096] Independently develop Socket protocol receiving and conversion program on the host platform:
[0097] The host platform independently develops the Socket protocol receiving and conversion program, and the TCP / IP-based gateway processing program maps the received fixed-length message to the public basic copybook, obtains the transaction code field, and finds the corresponding host transaction and main line program according to the transaction code, calls up the main line program for transaction processing, and returns the fixed-length message through the Socket protocol after processing is completed.
[0098] The transaction conversion unit packages the host service into a distributed microservice unit:
[0099] For each host transaction, a corresponding microservice is newly written in the distributed framework. The internal processing logic of the microservice is to convert the received microservice message into a fixed-length message according to the data conversion strategy, call the host through the Socket protocol, and convert the returned fixed-length message into a microservice JSON message according to the data conversion strategy after receiving it. The corresponding distributed microservice framework is used to register the packaged service to the registration center. In this way, from the perspective of the registration center of the distributed system, whether it is the original distributed microservice or the microservice formed by the host service packaging, it looks the same and the calling method is the same.
[0100] Host transaction volume concurrent management unit:
[0101] Since each host transaction is encapsulated into a corresponding distributed microservice, the concurrency of host transactions can be controlled by controlling the traffic of the corresponding microservice. By controlling the traffic to the host, the host system can still maintain stable operation, avoiding the destructive impact of large traffic in the distributed system on the host system, so that the host system can be packaged into a microservice more safely.
[0102] The tasks that technicians need to perform include: implementing the data dictionary management module, the host platform Socket protocol receiving and conversion program, and the transaction conversion module. At the same time, the microservice distributed system needs to have a flow control function. The host platform Socket protocol receiving and conversion program is the most difficult to develop, and there are currently no large-scale production practice cases in the industry.
[0103] The embodiment of the present invention packages the host service into a distributed microservice for invocation within and outside the system, solving the problem of the distributed system calling the host. Through concurrent transaction volume management, the flow to the host is controlled, so that the host system can still maintain stable operation, avoiding the destructive impact of large flow of the distributed system on the host system.
[0104] Fig.10 A schematic diagram of a computer device for running a distributed application method for encapsulating a host service into a microservice implemented by the present invention, such as Fig.10 As shown, an embodiment of the present invention further provides a computer device 1000, including a memory 1010, a processor 1020, and a computer program 1030 stored in the memory and executable on the processor, wherein when the processor executes the computer program, the above-mentioned distributed application method of encapsulating a host service into a microservice is implemented.
[0105] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the distributed application method of encapsulating a host service into a microservice is implemented.
[0106] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the above-mentioned distributed application method of encapsulating a host service into a microservice.
[0107] The embodiment of the present invention also provides a distributed application device for encapsulating a host service as a microservice, as described in the following embodiment. Since the principle of solving the problem by the device is similar to that of a distributed application method for encapsulating a host service as a microservice, the implementation of the device can refer to the implementation of a distributed application method for encapsulating a host service as a microservice, and the repeated parts will not be repeated.
[0108] Fig.11 FIG. 1 is a schematic diagram of a distributed application device in which a host service is encapsulated as a microservice according to an embodiment of the present invention. Fig.11 As shown, the embodiment of the present invention also provides a distributed application device that encapsulates a host service into a microservice, which may include:
[0109] The host service encapsulation module 1101 is used to create a new microservice on the distributed platform and encapsulate the host service into the microservice to generate a host packaged microservice;
[0110] The host transaction initiation module 1102 is used to send the transaction microservice message to the host packaging microservice when a transaction requiring the host function is initiated in the distributed platform;
[0111] The host service calling module 1103 is used to convert the transaction microservice message into a transaction fixed-length message, call the host service to execute the transaction, and determine the response fixed-length message; the transaction fixed-length message and the response fixed-length message match the host service;
[0112] The response fixed-length message returning module 1104 is used to return the response fixed-length message to the distributed platform and convert it into a response microservice message; the transaction microservice message and the response microservice message match the microservice of the distributed platform.
[0113] When a distributed application device that encapsulates a host service as a microservice is specifically implemented in an embodiment of the present invention, in one embodiment, the host service encapsulation module is specifically used to:
[0114] Create a new microservice on a distributed platform; the distributed platform also includes multiple existing microservices;
[0115] Encapsulate the host service into the newly created microservice, connect the newly created microservice with the host service to form a mapping relationship, generate a host packaging microservice, and register it to the registration center of the distributed platform.
[0116] When a distributed application device that encapsulates a host service as a microservice is specifically implemented in an embodiment of the present invention, in one embodiment, the host transaction initiation module is specifically used to:
[0117] When a transaction requiring host functionality is initiated in the distributed platform, the corresponding host packaging microservice is found from the registration center;
[0118] The found host packages the microservice and generates a transaction microservice message;
[0119] Send the transaction microservice message to the host packaging microservice.
[0120] When a distributed application device that encapsulates a host service as a microservice is specifically implemented in an embodiment of the present invention, in one embodiment, the host service calling module is specifically used to:
[0121] According to the data conversion strategy, the transaction microservice message is converted into a transaction fixed-length message;
[0122] The host packaging microservice sends the transaction fixed-length message to the host platform, calls the host service in the host platform to execute the transaction, and determines the response fixed-length message; the host platform includes multiple host services.
[0123] When a distributed application device that encapsulates a host service as a microservice is specifically implemented in an embodiment of the present invention, in one embodiment, the host service calling module is further used to:
[0124] Analyze the transaction microservice message and determine the transaction microservice message fields;
[0125] Perform data dictionary management on the fields involved in conversion, define data conversion strategies by field type, and use corresponding data conversion strategies for each field;
[0126] Convert the transaction microservice message fields into transaction fixed-length messages according to the corresponding data conversion strategy.
[0127] When a distributed application device that encapsulates a host service as a microservice is specifically implemented in an embodiment of the present invention, in one embodiment, the host service calling module is further used to:
[0128] The host packaging microservice sends the fixed-length transaction message to the host platform;
[0129] The host platform receives and converts the program through the Socket protocol, and the gateway processing program based on TCP / IP maps the received fixed-length transaction message to the public basic copybook to obtain the transaction code field;
[0130] Find the host transaction and mainline program of the corresponding host service according to the transaction code field, call up the mainline program to process the host transaction, and generate a response fixed-length message after the processing is completed.
[0131] When a distributed application device that encapsulates a host service as a microservice provided by an embodiment of the present invention is specifically implemented, in one embodiment, the fixed-length message return module is specifically used to:
[0132] Using the Socket protocol receiving and conversion program, the TCP / IP-based gateway processing program returns the response fixed-length message to the host packaging microservice of the distributed platform;
[0133] The host wraps the microservice and converts the response fixed-length message into a response microservice message.
[0134] When a distributed application device that encapsulates a host service as a microservice is specifically implemented in an embodiment of the present invention, in one embodiment, the fixed-length message return module is further used to:
[0135] Analyze the response fixed-length message and determine the fields of the response fixed-length message;
[0136] The response fixed-length message is converted into a response microservice message by using the data conversion strategy adopted when converting the transaction microservice message field into the transaction fixed-length message.
[0137] When a distributed application device that encapsulates a host service as a microservice provided by an embodiment of the present invention is specifically implemented, in one embodiment, it also includes: a flow control module, which is used to control the flow of the host-packaged microservice to control the concurrency of the host service encapsulated into the host-packaged microservice.
[0138] In summary, the embodiment of the present invention provides a distributed application method and device for encapsulating a host service into a microservice, including: creating a new microservice under a distributed platform, encapsulating the host service into the microservice to generate a host packaging microservice; when a transaction requiring a host function is initiated in the distributed platform, sending the transaction microservice message to the host packaging microservice; converting the transaction microservice message into a transaction fixed-length message, calling the host service to execute the transaction, and determining the response fixed-length message; the transaction fixed-length message and the response fixed-length message match the host service; returning the response fixed-length message to the distributed platform and converting it into a response microservice message; the transaction microservice message and the response microservice message match the microservice of the distributed platform. The present invention can realize the unified provision of consistent services to the outside world by two different architectures, centralized and distributed, and package the host service into a microservice in a distributed application, so as to realize efficient calling and joint collaboration for other distributed microservices to complete the corresponding functions, and solve the problem of distributed system calling the host. From the perspective of the distributed system, whether it is the original distributed microservice or the host packaging microservice formed by the encapsulation of the host service, it looks the same, and the internal calling method of the distributed system is the same. Through concurrent transaction volume management, the traffic to the host is controlled so that the host system can continue to operate stably, avoiding the destructive impact of large traffic in the distributed system on the host system.
[0139] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0140] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0141] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0142] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0143] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A distributed application method for encapsulating a host service into a microservice, characterized in that: include: Create a new microservice on the distributed platform, encapsulate the host service into the microservice to generate a host packaging microservice; When a transaction requiring host functionality is initiated in the distributed platform, the transaction microservice message is sent to the host packaging microservice; Convert the transaction microservice message into a transaction fixed-length message, call the host service to execute the transaction, and determine the response fixed-length message; The transaction fixed-length message and the response fixed-length message match the host service; Return the fixed-length response message to the distributed platform and convert it into a response microservice message; The transaction microservice message and the response microservice message match the microservice of the distributed platform; Converting a transaction microservice message into a transaction fixed-length message, calling a host service to execute a transaction, and determining a response fixed-length message, including: the host packaging microservice converts the transaction microservice message into a transaction fixed-length message according to a data conversion strategy; the host packaging microservice sends the transaction fixed-length message to the host platform, calls a host service in the host platform to execute a transaction, and determines a response fixed-length message; the host platform includes a plurality of host services; calling a host service in the host platform to execute a transaction and determine a response fixed-length message, including: the host platform receives and converts a program through a Socket protocol, and a gateway processing program based on TCP / IP maps the received transaction fixed-length message to a public basic copybook, and obtains a transaction code field; finds the host transaction and main line program of the corresponding host service according to the transaction code field, calls up the main line program to process the host transaction, and generates a response fixed-length message after the processing is completed; The fixed-length response message is returned to the distributed platform and converted into a response microservice message, including: using the Socket protocol receiving and conversion program and the TCP / IP-based gateway processing program to return the fixed-length response message to the host packaging microservice of the distributed platform; and converting the fixed-length response message into a response microservice message through the host packaging microservice.
2. The method according to claim 1, characterized in that Create a new microservice on the distributed platform and encapsulate the host service into the microservice to generate a host packaging microservice, including: Create a new microservice on a distributed platform; the distributed platform also includes multiple existing microservices; Encapsulate the host service into the newly created microservice, connect the newly created microservice with the host service to form a mapping relationship, generate a host packaging microservice, and register it to the registration center of the distributed platform.
3. The method according to claim 2, characterized in that When a transaction requiring host functionality is initiated in the distributed platform, the transaction microservice message is sent to the host packaging microservice, including: When a transaction requiring host functionality is initiated in the distributed platform, the corresponding host packaging microservice is found from the registration center; Send the transaction microservice message to the host packaging microservice.
4. The method according to claim 1, characterized in that According to the data conversion strategy, the transaction microservice message is converted into a transaction fixed-length message, including: Analyze the transaction microservice message and determine the transaction microservice message fields; Perform data dictionary management on the fields involved in conversion, define data conversion strategies by field type, and use corresponding data conversion strategies for each field; Convert the transaction microservice message fields into transaction fixed-length messages according to the corresponding data conversion strategy.
5. The method according to claim 1, characterized in that The response fixed-length message is converted into a response microservice message, including: Analyze the response fixed-length message and determine the fields of the response fixed-length message; The response fixed-length message is converted into a response microservice message by using the data conversion strategy adopted when converting the transaction microservice message field into the transaction fixed-length message.
6. The method according to claim 1, characterized in that Also includes: The host packaging microservice is flow controlled to control the concurrency of the host service encapsulated into the host packaging microservice.
7. A distributed application device in which a host service is encapsulated as a microservice, characterized in that: include: The host service encapsulation module is used to create a new microservice on the distributed platform and encapsulate the host service into the microservice to generate a host packaging microservice; The host transaction initiation module is used to send the transaction microservice message to the host packaging microservice when a transaction requiring host functions is initiated in the distributed platform; The host service calling module is used to convert the transaction microservice message into a transaction fixed-length message, call the host service to execute the transaction, and determine the response fixed-length message; The transaction fixed-length message and the response fixed-length message match the host service; The fixed-length response message return module is used to return the fixed-length response message to the distributed platform and convert it into a response microservice message; The transaction microservice message and the response microservice message match the microservice of the distributed platform; The host service calling module is specifically used for: the host packaging microservice converts the transaction microservice message into a transaction fixed-length message according to the data conversion strategy; The host packaging microservice sends the transaction fixed-length message to the host platform, calls the host service in the host platform to execute the transaction, and determines the response fixed-length message; The host platform includes a plurality of host services; The calling of the host service in the host platform to execute the transaction and determine the response fixed-length message includes: the host platform receives and converts the program through the Socket protocol, and the gateway processing program based on TCP / IP maps the received transaction fixed-length message to the public basic copybook to obtain the transaction code field; finds the host transaction and main line program of the corresponding host service according to the transaction code field, calls up the main line program to process the host transaction, and generates the response fixed-length message after the processing is completed; The response fixed-length message return module is specifically used to use the Socket protocol receiving and conversion program, based on the TCP / IP gateway processing program, to return the response fixed-length message to the host packaging microservice of the distributed platform; convert it into a response microservice message through the host packaging microservice; the transaction microservice message and the response microservice message match the microservice of the distributed platform.
8. The device according to claim 7, characterized in that Host service encapsulation module, specifically used for: Create a new microservice on a distributed platform; the distributed platform also includes multiple existing microservices; Encapsulate the host service into the newly created microservice, connect the newly created microservice with the host service to form a mapping relationship, generate a host packaging microservice, and register it to the registration center of the distributed platform.
9. The device according to claim 8, characterized in that Host transaction initiation module, specifically used for: When a transaction requiring host functionality is initiated in the distributed platform, the corresponding host packaging microservice is found from the registration center; Send the transaction microservice message to the host packaging microservice.
10. The device according to claim 7, characterized in that The host service call module is also used to: Analyze the transaction microservice message and determine the transaction microservice message fields; Perform data dictionary management on the fields involved in conversion, define data conversion strategies by field type, and use corresponding data conversion strategies for each field; Convert the transaction microservice message fields into transaction fixed-length messages according to the corresponding data conversion strategy.
11. The device according to claim 7, characterized in that The fixed-length message return module is also used to: Analyze the response fixed-length message and determine the fields of the response fixed-length message; The response fixed-length message is converted into a response microservice message by using the data conversion strategy adopted when converting the transaction microservice message field into the transaction fixed-length message.
12. The device according to claim 7, characterized in that Also includes: The flow control module is used to perform flow control on the host packaging microservice, so as to control the concurrency of the host service encapsulated into the host packaging microservice.
13. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
15. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
