A high-speed remote calling method and system between microservices

By deploying remote call components and service middleware in the government network environment and creating message queues and transmission channels, the problem of the technical architecture of remote procedure call protocol in the government network environment cannot be adapted, and high-speed remote call from the client call server is realized, which improves network security and data transmission efficiency.

CN118509468BActive Publication Date: 2025-04-29HENAN INFORMATIZATION GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410720064.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2025-04-29
Estimated Expiration
2044-06-05

AI Technical Summary

Technical Problem

The existing technology cannot adapt to the Internet area client to call the network request of the intranet area server in the government network environment, resulting in the intranet government data being unable to display the Internet.

Method used

Based on the original remote procedure call protocol technical structure, remote call components, configuration files, interface identifiers and service middleware are deployed, and message queues and transmission channels are created to realize high-speed remote call between the client and the server.

Benefits of technology

It breaks the policy restrictions of the government-side network to directly call the Internet area in the intranet area, solves the problem that the technical architecture of the remote process call protocol cannot be adapted in the government-side network environment, thereby improving network security and data transmission efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118509468B_ABST
    Figure CN118509468B_ABST
Patent Text Reader

Abstract

The present invention discloses a high-speed remote calling method and system between microservices, which relates to the field of network security transmission technology, and solves the problem that an Internet regional client under a government network environment cannot call and display government data of an intranet regional server; the remote calling method comprises initializing M servers and N clients under a distributed network environment; the M servers send requests to a service middleware to create or inspect a message queue and a transmission channel; the M servers automatically monitor the M transmission channels in the message queue, and at the same time, the upper layer interfaces corresponding to the N clients are connected to the message queue; the N clients create and monitor a message return queue and a transmission return channel; the N clients send a message to the message return queue, and select a unique channel to send the message body; the M servers pull and process the message body of the transmission return channel, and send a return message; the N clients listen to, pull and process the return message in the target return queue.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network security transmission technology, and in particular to a high-speed remote calling method and system between microservices. Background Art

[0002] Network security is an eternal topic, especially for government agencies. In the important field of government affairs, network security is undoubtedly regarded as a top priority. The distributed architecture system of microservices often requires remote calls for data transmission. The government network environment basically adopts a distributed network environment, dividing the internal LAN into the Internet area and the intranet area. In order to ensure the security of network data transmission, some specific government departments will restrict the data transmission strategy between the Internet area and the intranet area, and only allow the intranet area to access the Internet area network, and even prohibit the Internet area from directly calling the intranet area. A more secure way is adopted to relax the policy restrictions on the intranet area directly calling the Internet area.

[0003] Patent No. CN2023108684484 discloses a remote call management method, device, equipment and medium for microservices. By obtaining the configuration information of the configuration center, receiving the identity information reported by each microservice, generating a first list and a second list according to the identity information and the configuration information, the first list is used to record the version number of the RPC interface module of the first microservice, and the second list is used to record the dependency relationship between each microservice and the version number of the RPC interface module of the second microservice as the caller; the version of the RPC interface module of the second microservice is updated according to the first list and the second list, so that the version number of the RPC interface module of the updated second microservice is consistent with the version number of the RPC interface module of the first microservice on which it depends. The above invention maintains the dependency relationship between the RPC interface modules of each microservice, updates the dependent version of the caller, and ensures the normal use of remote calls between microservices without restarting the microservice.

[0004] Patent No. CN2024100498909 discloses a remote scheduling method and system between microservices, including: configuring a first microservice and a second microservice, configuring a remote call component for the first microservice, and configuring a first specified annotation for the method that needs to be called by the first microservice according to the remote call component; the first specified annotation includes the first method name and path in the second microservice, and when the second microservice method is called according to the first specified annotation, the first method name and path are obtained to configure the second specified annotation; the first method in the second microservice is obtained according to the second specified annotation, and the call result is returned to the first microservice according to the first method; the called method class and method of the first microservice are encapsulated to obtain a first encapsulation object, and at the same time, all methods and classes in the first microservice that use the first encapsulation object are obtained and encapsulated to obtain a second encapsulation object, and a dimension call relationship maintenance table is constructed according to the first encapsulation object and the second encapsulation object.

[0005] However, the above patents cannot adapt the network requests of the Internet area client to call the intranet area server in the government network environment, making it impossible to display the intranet government data on the Internet. Summary of the invention

[0006] The purpose of the present invention is to provide a high-speed remote calling method and system between microservices, which can deploy remote calling components, configuration files, interface identifiers and service middleware on the basis of the original remote procedure call protocol technical structure, so as to break the policy restrictions of the government side network that open the intranet area to directly call the Internet area, and solve the problem that the remote procedure call protocol technical architecture cannot be adapted in the government network environment, thereby further improving network security.

[0007] The present invention utilizes the following technical solutions:

[0008] A high-speed remote calling method between microservices includes the following steps:

[0009] S1: In a distributed network environment, initialize M servers and N clients respectively;

[0010] S2: M servers send requests to the service middleware to create or inspect message queues and transmission channels between N clients and M servers;

[0011] S3: The target services corresponding to the M servers are connected and automatically monitor the M transmission channels in the message queue. At the same time, the upper layer interfaces corresponding to the N clients are connected to the message queue.

[0012] S4: N clients create message return queues according to the interface identifier of the message queue, and create and monitor N transmission return channels;

[0013] S5: N clients send messages to the message return queue through the upper layer interface, and use the load balancing device to select a unique channel from the M stable transmission return channels in the message return queue to send the message body;

[0014] S6: M servers stably and uninterruptedly pull corresponding message bodies from M transmission return channels for processing, and send return messages to the target return queue;

[0015] S7: N client listeners automatically pull and process the return messages in N channels in the target return queue, and delete the temporary return queue according to the unique identifier of the return message.

[0016] Preferably, the distributed network environment is divided into an Internet area and an intranet area; the initialization of the server is a process of starting and loading memory on the server in the intranet area, and the initialization of the client is a process of starting and loading memory on the client in the Internet area; the initialization order of the server and the client is:

[0017] A: If the server is initialized first, it will create a message queue based on a unique identifier and send a request to the service middleware to create the message queue. It will also create M transmission channels under the message queue according to the number of servers M identified by the corresponding interface.

[0018] B: If the client is initialized first, it will create a message queue based on the unique identifier and send a request to the service middleware to create the message queue. When the server is initialized and creates a message queue with a unique identifier, it will first check the message queue. If a message queue with the same identifier already exists, it will not be created repeatedly. Instead, it will directly create M transmission channels under the identifier list according to the number of servers M with the corresponding interface identifier.

[0019] Preferably, the service end identifies the upper layer interface to be processed to form an interface identifier Name=A, and transmits the interface identifier Name=A when sending a request to the service middleware, and creates a message queue and a transmission channel according to the interface identifier.

[0020] Preferably, the service middleware creates a message queue based on the interface identifier passed in, and creates a transmission channel under the message queue. At the same time, it periodically inspects the survival status of the target service in the transmission channel according to preset parameters to dynamically control the creation and destruction of the transmission channel; the message queue is a storage mechanism channel collection with a set of first-in-first-out specific parameter capacities; the number of transmission channels contained in the message queue is equal to the number of service terminals corresponding to the interface identifier, and the number of transmission channels is M.

[0021] Preferably, the scheduled inspection of the service middleware is to monitor the client and the server every X seconds on the service middleware according to preset parameters, and send a health check request to the service in the transmission channel; if a target service has no health response for more than C seconds, the transmission channel in the message queue of the interface identifier where the service is located is destroyed; the process of the server monitoring the transmission channel is: the servers of X interface identifiers respectively start the scheduled tasks, pull the message body of the corresponding transmission channel every 1ms, and create a corresponding number of thread pools to process the message body according to the configuration number M of each upper-layer interface on the server.

[0022] Preferably, the client checks or creates a message queue corresponding to the interface identifier, and the client does not monitor and pull the sent message body, nor monitor the message queue; the interface identifier Name=A of the client is the same as the interface identifier of the corresponding server.

[0023] Preferably, the client sends the message body to the service middleware according to the interface identifier of the message queue, and the upper-level interface where the client is located sends the interface identifier Name=A and the message to be sent to the service middleware, and then selects the corresponding message queue according to the interface identifier, and obtains the message bodies of all transmission channels under the message queue to send the message body; if the transmission channel is channel, and the number of message bodies in the transmission channel is Y, then the channel selection algorithm is: channel=channel(min(Y)), so as to select the transmission channel with the least number of message bodies to send the message body.

[0024] Preferably, a unique message identification ID is assigned to the message body when it is encapsulated; after the client sends the message body to the service middleware, it starts the message return queue timer monitoring task created for the message identification ID according to the message identification ID, and calculates the return message reception timeout D seconds for the message identification ID; after the server obtains and processes the message body from the service middleware, it creates a one-way temporary transmission return channel and a message return queue according to the message identification ID.

[0025] Preferably, the client calculates the timeout based on the message identifier ID. The client configures the timeout parameter D seconds in the configuration file of the interface identifier. After sending the message body, if the client listener does not obtain a return message after D seconds, the client sends a request to the service middleware, and the service middleware deletes the temporary message return queue and transmission return channel of the message body, and the client listener is closed.

[0026] Also included is a high-speed remote calling system between microservices, including a client, a server, and an upper-layer interface;

[0027] The client is used to accept user requests in the Internet area of ​​the government network and provide data responses;

[0028] The server is used to interact with the intranet database in the intranet area of ​​the government network to provide data support to the client;

[0029] The upper layer interface is used to provide upper layer unified communication dependencies for the client and the server;

[0030] It also includes remote call components, configuration files, interface identifiers and service middleware; among them,

[0031] Remote call component, used for client initialization, creation of upper-layer interface proxy objects, reading of configuration files, and creation and monitoring of message queues and transmission channels; also used for server initialization, creation of thread pools, and creation and monitoring of message return queues and transmission return channels;

[0032] Configuration file, used to complete the IP port configuration, account password configuration and request timeout configuration of the service middleware;

[0033] Interface identifier, which is used to define and configure the unique identifier of the upper-layer interface;

[0034] Service middleware is used to complete the communication between the client and the server.

[0035] The present invention deploys remote call components, configuration files, interface identifiers and service middleware on the basis of the original remote procedure call protocol technical structure, so as to break the policy restrictions of the government side network that allow the intranet area to directly call the Internet area, and solve the problem that the remote procedure call protocol technical architecture cannot be adapted in the government network environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0037] Figure 1 This is a schematic diagram of the high-speed remote call system between microservices;

[0038] Figure 2 This is a principle diagram of the high-speed remote call method between microservices;

[0039] Figure 3 A flowchart of the high-speed remote call method between microservices;

[0040] Figure 4 Deployment schematic for service middleware. DETAILED DESCRIPTION

[0041] The present invention is described in detail below with reference to the accompanying drawings and embodiments:

[0042] like Figures 2 to 3 As shown, a high-speed remote calling method between microservices described in the present invention includes the following steps:

[0043] S1: In a distributed network environment, initialize M servers and N clients respectively;

[0044] In the present invention, the distributed network environment is divided into an Internet area and an intranet area; the initialization of the server is a process of starting and loading memory on the server in the intranet area, and the initialization of the client is a process of starting and loading memory on the client in the Internet area; the initialization sequence of the server and the client is:

[0045] A: If the server is initialized first, it will create a message queue based on a unique identifier and send a request to the service middleware to create the message queue. It will also create M transmission channels under the message queue according to the number of servers M identified by the corresponding interface.

[0046] B: If the client is initialized first, it will create a message queue based on the unique identifier and send a request to the service middleware to create the message queue. When the server is initialized and creates a message queue with a unique identifier, it will first check the message queue. If a message queue with the same identifier already exists, it will not be created again. Instead, it will directly create M transmission channels under the identifier list according to the number of servers M with the corresponding interface identifier.

[0047] S2: M servers send requests to the service middleware to create or inspect message queues and transmission channels between N clients and M servers;

[0048] In the present invention, the service end identifies the upper layer interface to be processed to form an interface identifier Name=A, and sends a request to the service middleware to pass in the interface identifier Name=A, and creates a message queue and a transmission channel according to the interface identifier;

[0049] S3: The target services corresponding to the M servers are connected and automatically monitor the M transmission channels in the message queue. At the same time, the upper layer interfaces corresponding to the N clients are connected to the message queue.

[0050] In the present invention, the service middleware creates a message queue according to the interface identifier passed in, and creates a transmission channel under the message queue, and at the same time periodically inspects the survival status of the target service in the transmission channel according to preset parameters to dynamically control the creation and disappearance of the transmission channel; the message queue is a storage mechanism channel set with a set of first-in-first-out specific parameter capacity; the number of transmission channels contained in the message queue is equal to the number of service terminals corresponding to the interface identifier, and the number of transmission channels is M;

[0051] In this embodiment, the scheduled inspection of the service middleware is to monitor the client and the server every X seconds according to the preset parameters on the service middleware, and send a health check request to the service in the transmission channel; if a target service has no health response for more than C seconds, the transmission channel in the message queue of the interface identifier where the service is located is destroyed; the process of the server monitoring the transmission channel is as follows: the servers of the X interface identifiers respectively start the scheduled tasks, pull the message body of the corresponding transmission channel every 1ms, and create a corresponding number of thread pools to process the message body according to the configuration number M of each upper-layer interface on the server;

[0052] S4: N clients create message return queues according to the interface identifier of the message queue, and create and monitor N transmission return channels;

[0053] In the present invention, the client checks or creates a message queue corresponding to the interface identifier, and the client does not monitor and pull the sent message body, nor does it monitor the message queue; the interface identifier Name=A of the client is the same as the interface identifier of the corresponding server;

[0054] S5: N clients send messages to the message return queue through the upper layer interface, and use the load balancing device to select a unique channel from the M stable transmission return channels in the message return queue to send the message body;

[0055] In the present invention, the client sends a message body to the service middleware according to the interface identifier of the message queue, and the upper layer interface where the client is located sends the interface identifier Name=A and the message to be sent to the service middleware, and then selects the corresponding message queue according to the interface identifier, and obtains the message bodies of all transmission channels under the message queue to send the message body; if the transmission channel is channel, and the number of message bodies in the transmission channel is Y, then the channel selection algorithm is: channel=channel(min(Y)), so as to select the transmission channel with the least number of message bodies to send the message body;

[0056] In this embodiment, a unique message identification ID is assigned to the message body when it is encapsulated; after the client sends the message body to the service middleware, it starts the message return queue timing monitoring task created for the message identification ID according to the message identification ID, and calculates the return message receiving timeout D seconds according to the message identification ID; after the server obtains and processes the message body from the service middleware, it creates a one-way temporary transmission return channel and a message return queue according to the message identification ID;

[0057] S6: M servers stably and uninterruptedly pull corresponding message bodies from M transmission return channels for processing, and send return messages to the target return queue;

[0058] S7: N client listeners automatically pull and process the return messages in N channels in the target return queue, and delete the temporary return queue according to the unique identifier of the return message;

[0059] In the present invention, the client calculates the timeout according to the message identification ID. The client configures the timeout parameter D seconds in the configuration file of the interface identification. After sending the message body, if the client monitors and does not obtain the return message after D seconds, the client sends a request to the service middleware, and the service middleware deletes the temporary message return queue and the transmission return channel of the message body, and the client monitors and closes;

[0060] like Figure 1 and Figure 4 As shown, it also includes a high-speed remote calling system between microservices, including a client, a server and an upper layer interface; wherein,

[0061] The client is used to accept user requests in the Internet area of ​​the government network and provide data responses;

[0062] The server is used to interact with the intranet database in the intranet area of ​​the government network to provide data support to the client;

[0063] In this embodiment, based on the microservice RPC structure, the client and the server add the dependency of the remote call method component package; the client adds the scanning fixed component package com.xaca.rpc.client, and the server adds the scanning fixed component package com.xaca.rpc.server to make the corresponding component API take effect when the service is initialized;

[0064] The client adds the tag reference to the interface attribute of the request forwarding instance for remote call, and configures the attribute parameters related to name, replyTimeout, and groupName;

[0065] The server adds the tag service to the implementation of the remote call interface, and configures the name, currentConsumer, groupName, and interfaceClass related attribute parameters;

[0066] The original configuration files of client and server microservices add the IP address and port of the connection service middleware, custom account password, and connection timeout related parameters; deploy the connection service persistence database on the Internet side to provide metadata persistence for the service middleware; deploy the service middleware cluster on the Internet side to connect to the same set of persistence database clusters; open the network policy from the intranet side server to the Internet side connection service middleware cluster;

[0067] The upper layer interface is used to provide upper layer unified communication dependencies for the client and the server;

[0068] It also includes remote call components, configuration files, interface identifiers and service middleware; among them,

[0069] Remote call component, used for client initialization, creation of upper-layer interface proxy objects, reading of configuration files, and creation and monitoring of message queues and transmission channels; also used for server initialization, creation of thread pools, and creation and monitoring of message return queues and transmission return channels;

[0070] In the present invention, the remote call component includes a server that remotely calls the service middleware according to the interface identifier Name=A to initialize the message queue, creates a thread pool with a capacity of M according to the interface identifier server number M, and sends a request to the service middleware. According to the identifier of the message queue, M message queues and transmission channels are created on the service middleware. The server creates M threads based on the thread pool and opens M listening threads that correspond to the transmission channels of the service middleware one by one. After one of the listening threads obtains the message body, it calls the upper interface to implement service processing, and transmits a unidirectional temporary transmission channel and message queue according to the message identifier ID, and returns the service processing result; it also includes the client initialization that creates a traditional rpc upper interface proxy object according to the client interface identifier Name=A, reads the configuration file and connects with the service middleware in combination with the interface identifier, and creates a message return queue and a transmission return channel at the same time; sends a message to the corresponding message queue and creates a listener according to the interface identifier;

[0071] Configuration file, used to complete the IP port configuration, account password configuration and request timeout configuration of the service middleware;

[0072] Interface identifier, which is used to define and configure the unique identifier of the upper-layer interface;

[0073] In this embodiment, the interface identifier includes a client interface identifier and a server interface identifier, and the client interface identifier includes: a unique identifier name, a timeout time for receiving a return request replyTimeout, and a group groupName;

[0074] groupName is used to distinguish different service implementations called by the same interface on the server side. The unique identifier of the message queue created on the service middleware is q_name, and the unique identifier of the transmission channel is c_name_num; num is the number of listening threads on the server side, starting from 1 and increasing by one at a time, for example: c_name_1; the unique identifier of the client is reference(),

[0075] For example: reference(name=A, replyTimeout=20, groupName=XXX);

[0076] The server interface identifier includes: the unique identifier name is the same as the corresponding interface client unique identifier name and is used to create and monitor the q_name message queue;

[0077] currentConsumer is used to specify that the server creates a thread pool with the currentConsumer capacity corresponding to the upper-layer interface and the same number of listening threads to perform regular monitoring of the q_name message queue;

[0078] groupName, if there are two different service implementations for the same interface on the server side, the different identifiers of groupName are used to distinguish the different service implementations of the upper-layer interface when making RPC calls; interfaceClass, specifies the upper-layer interface type corresponding to the server-side implementation; for example: service(name=A,currentConsumer=10,groupName=xx,interfaceClass=yyy);

[0079] Service middleware, used to complete the communication between the client and the server;

[0080] In this embodiment, the service middleware is distributed and scalable, and n service middleware clusters are connected to the same persistent database cluster at the same time to ensure real-time sharing and synchronization of queue and channel metadata, and improve the throughput of the remote calling solution; multi-tenant identity authentication, the connection service middleware defaults to a built-in super-management account root / root; if a distributed application needs to adopt the distributed calling solution, use the root super-management account to create an account belonging to this application, and create a message queue and transmission channel under this application account; and according to the configuration information timeout, the corresponding name message queue channel on the accumulated messages that exceed the timeout time are cleared periodically.

[0081] The external APIs can also be provided, including: creating and destroying message queues and transmission channels according to the name; sending messages to the channel with the least message accumulation in the corresponding queue according to the name; obtaining the relevant parameters of the message body in the corresponding message queue according to the name, such as the message body accumulation amount and the message body processing amount, etc.

[0082] Example:

[0083] The Internet area on the government side deploys client service clusters, service middleware, persistent database clusters and load balancing devices respectively; the client cluster calls the load balancing device, the load balancing device calls the service middleware cluster, and the service middleware calls the persistent database cluster; the government side intranet deploys the server application cluster; the server cluster calls the Internet side load balancing device;

[0084] If the time it takes for the client or server to create a connection with the service middleware exceeds the connection timeout in the configuration file, the service initialization fails;

[0085] During the service startup process, the server remotely calls the initialization function in the component to scan all upper-level interface implementations and selects interface implementation objects with the service tag. According to the attribute name in the service, the server sends a request to the connection service middleware to create a q_name queue; the server sends a request to the service middleware according to the attributes currentCosumer and name in the service, and creates a corresponding number of c_name transmission channels under the q_name message queue; the server service initializes the corresponding capacity thread pool according to the currentConsumer attribute, starts the corresponding number of listening threads, starts the scheduled task in each listening thread, and listens to the same number of channels of the service middleware; the server caches the interfaceClass and groupName attributes in the service tag in the memory, and uses the interfaceClass+groupName as the key and the corresponding upper-level interface implementation object as the value of the data structure;

[0086] At the same time, during the service startup process, the client remotely calls the initialization function in the component to scan all request forwarding objects, screens out some objects with reference tags on their attributes, and sends a request to the service middleware based on the attribute name in the reference to create a q_name message return queue; for all objects containing reference-tagged attributes, the reference-tagged attributes create dynamic proxy objects based on the type of the attribute interface and the groupName in the reference tag, and the dynamic proxy objects replace the original attributes marked with reference;

[0087] If the user sends a request to the client interface in the Internet area of ​​the government side, the client request forwarding object calls the corresponding interface, and the corresponding interface passes the user request parameters to the dynamic proxy object corresponding to the interface. The dynamic proxy object encapsulates the user request parameters, interface function name, interface parameter type, interface type, groupName, and message body unique identifier into a message and sends it to the corresponding q_name message queue of the service middleware. The client starts timed monitoring based on the message body unique identifier to monitor the transmission return channel of the service middleware.

[0088] If the time for the client to listen to the transmission return channel to obtain the return message exceeds the replyTimeout timeout in the reference, an abnormal call timeout is returned; if the client has different upper-layer interfaces, the name attribute value in the reference is the same, and different upper-layer interfaces share the same message queue for message transmission; if the client has different upper-layer interfaces, the name attribute value in the reference is different, and different interfaces use separate message queues for message transmission; the transmission channels in the message queue correspond to the number of scheduled listening threads enabled;

[0089] The service middleware obtains all corresponding c_name transmission channels based on the q_name message queue, and selects the channel with the least message accumulation for message transmission; the service middleware creates a temporary message return queue and transmission return channel based on the unique identifier in the message; the server parses the message content, calls the corresponding upper-level interface implementation to process the message, and sends the return result to the corresponding message return queue based on the unique identifier of the message body; the client obtains the return message in the transmission return channel corresponding to the message return queue, and responds to the user at the same time.

Claims

1. A high-speed remote calling method between microservices, characterized in that: The following steps are involved: S1: In a distributed network environment, initialize M servers and N clients respectively; S2: M servers send requests to the service middleware to create or inspect message queues and transmission channels between N clients and M servers; S3: The target services corresponding to the M servers are connected and automatically monitor the M transmission channels in the message queue. At the same time, the upper layer interfaces corresponding to the N clients are connected to the message queue. S4: N clients create message return queues according to the interface identifier of the message queue, and create and monitor N transmission return channels; S5: N clients send messages to the message return queue through the upper layer interface, and use the load balancing device to select a unique channel from the M stable transmission return channels in the message return queue to send the message body; S6: M servers stably and uninterruptedly pull corresponding message bodies from M transmission return channels for processing, and send return messages to the target return queue; S7: N client listeners automatically pull and process the return messages in N channels in the target return queue, and delete the temporary return queue according to the unique identifier of the return message; In step S5, a unique message identification ID is assigned to the message body when it is encapsulated; after the client sends the message body to the service middleware, it starts the message return queue timer monitoring task created for the message identification ID according to the message identification ID, and calculates the return message reception timeout D seconds for the message identification ID; after the server obtains and processes the message body from the service middleware, it creates a one-way temporary transmission return channel and a message return queue according to the message identification ID.

2. The high-speed remote calling method between microservices according to claim 1 is characterized in that: In step S1, the distributed network environment is divided into an Internet area and an intranet area; the initialization of the server is a process of starting and loading memory on the server in the intranet area, and the initialization of the client is a process of starting and loading memory on the client in the Internet area; the initialization order of the server and the client is: A: If the server is initialized first, it will create a message queue based on a unique identifier and send a request to the service middleware to create the message queue. It will also create M transmission channels under the message queue according to the number of servers M identified by the corresponding interface. B: If the client is initialized first, a message queue based on a unique identifier is created, and a request is sent to the service middleware to create the message queue; When the server is initialized and creates a message queue with a unique identifier, it first checks the message queue. If a message queue with the same identifier already exists, it will not be created again. Instead, M transmission channels will be created directly under the identifier list according to the number of servers M with the corresponding interface identifier.

3. The high-speed remote calling method between microservices according to claim 1 or 2, characterized in that: The server identifies the upper layer interface to be processed to form an interface identifier Name=A, and sends a request to the service middleware to pass in the interface identifier Name=A, and creates a message queue and a transmission channel according to the interface identifier.

4. The high-speed remote calling method between microservices according to claim 1, characterized in that: The service middleware creates a message queue according to the interface identifier passed in, and creates a transmission channel under the message queue. At the same time, it regularly inspects the survival status of the target service in the transmission channel according to preset parameters to dynamically control the creation and disappearance of the transmission channel; the message queue is a storage mechanism channel set with a set of first-in-first-out specific parameter capacity; The number of transmission channels included in the message queue is equal to the number of servers identified by the corresponding interface, and the number of transmission channels is M.

5. The high-speed remote calling method between microservices according to claim 1, characterized in that: The scheduled inspection of the service middleware is to monitor the client and the server every X seconds according to preset parameters on the service middleware, and send a health check request to the service in the transmission channel; if a target service has no health response for more than C seconds, the transmission channel in the message queue of the interface identifier where the service is located is destroyed; the process of the server monitoring the transmission channel is as follows: the servers of the X interface identifiers respectively start the scheduled tasks, pull the message body of the corresponding transmission channel every 1ms, and create a corresponding number of thread pools to process the message body according to the configuration number M of each upper-layer interface on the server.

6. The high-speed remote calling method between microservices according to claim 1, characterized in that: In step S4, the client checks or creates a message queue corresponding to the interface identifier. The client does not listen to and pull the sent message body, nor does it listen to the message queue. The interface identifier Name=A of the client is the same as the interface identifier of the corresponding server.

7. The high-speed remote calling method between microservices according to claim 1 or 6, characterized in that: The client sends the message body to the service middleware according to the interface identifier of the message queue. The upper layer interface where the client is located sends the interface identifier Name=A and the message to be sent to the service middleware, and then selects the corresponding message queue according to the interface identifier, and obtains the message bodies of all transmission channels under the message queue to send the message body; if the transmission channel is channel, and the number of message bodies in the transmission channel is Y, the channel selection algorithm is: , to select the transmission channel with the least number of message bodies to send the message body.

8. The high-speed remote calling method between microservices according to claim 7, characterized in that: The client calculates the timeout based on the message identification ID. The client configures the timeout parameter D seconds in the configuration file of the interface identification. After sending the message body, if the client listener does not obtain a return message after D seconds, the client sends a request to the service middleware, and the service middleware deletes the temporary message return queue and transmission return channel of the message body, and the client listener is closed.

9. A high-speed remote call system according to any one of the methods of claims 1 to 8, comprising a client, a server and an upper layer interface; wherein: The client is used to accept user requests in the Internet area of ​​the government network and provide data responses; The server is used to interact with the intranet database in the intranet area of ​​the government network to provide data support to the client; The upper layer interface is used to provide upper layer unified communication dependencies for the client and the server; It is characterized by: it also includes remote call components, configuration files, interface identifiers and service middleware; wherein, Remote call component, used for client initialization, creation of upper-layer interface proxy objects, reading of configuration files, and creation and monitoring of message queues and transmission channels; also used for server initialization, creation of thread pools, and creation and monitoring of message return queues and transmission return channels; Configuration file, used to complete the IP port configuration, account password configuration and request timeout configuration of the service middleware; Interface identifier, which is used to define and configure the unique identifier of the upper-layer interface; Service middleware is used to complete the communication between the client and the server.

Citation Information

Patent Citations

  • Intranet and extranet interaction method, self-service tax payment system, extranet apparatus and intranet apparatus

    CN106060011A

  • Message transmission method and device

    CN110290139A