A method and system for implementing calls between modules within a system

By introducing the central exchange idea into the computer system and using the message bus service and module mapping service, the indirect coupling between business modules is realized, which solves the problem of high coupling between modules and improves the maintainability and changeability of the system.

CN115297072BActive Publication Date: 2024-10-29SUZHOU SICUI IND INTERNET TECH RES INST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210889022.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-27
Publication Date
2024-10-29
Estimated Expiration
2042-07-27

AI Technical Summary

Technical Problem

In the process of computer program development, as the code grows, the coupling degree between modules increases, resulting in a decrease in the maintainability and changeability of the system, and affecting the stability and flexibility of the system.

Method used

Adopting the central exchange idea, the modules in the system are defined as control modules and business modules. The indirect coupling between modules is realized through the message bus service and module mapping service. The mapping between business modules is maintained using message sending, message receiving and message response methods. Relationships to achieve low coupling and high cohesion calls between modules.

Benefits of technology

It simplifies the association between business modules, achieves low coupling and high cohesion between business modules, improves the maintainability and changeability of the system, and reduces the dependencies between modules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115297072B_ABST
    Figure CN115297072B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for implementing calls between modules within a system, and relates to the technical field of general digital computer systems. The modules within the system are defined as control modules and business modules, the control module controls the execution of a message bus service and a module mapping service, provides message sending, message receiving and message replying methods through the message bus service, maintains the mapping relationship between all business modules through the module mapping service, and the business modules use the message sending, message receiving and message replying methods of the message bus service to call each other according to the mapping relationship in the module mapping service.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention discloses a method and a system, and relates to the technical field of general digital computer systems, in particular to a method and a system for implementing calls between modules within a system. Background Art

[0002] In the process of developing computer programs, as the program continues to develop, the code will become longer and longer, and it will become more and more difficult to maintain. In order to write maintainable code, the system is usually divided into different functions. For each function, it can be called by other codes, which provides code reusability and coupling between codes. The code collection of each function is called a module.

[0003] Functional modularization is to divide the program into several functional modules, each of which completes a sub-function, and then these functional modules are combined into a whole to meet the required functions of the entire system. Multiple modules are inevitably related to each other, and coupling is a measure of the degree of connection between modules. The problem caused by coupling is that when a function is changed or does not exist, it will affect the normal operation of another function, thereby affecting the maintainability and changeability of the system. Summary of the invention

[0004] In view of the problems of the prior art, the present invention provides a method and system for implementing calls between modules within a system, which utilizes the idea of ​​central exchange to simplify the association between various functional modules. The connection between the functional modules is completed through the exchange of central programs, thereby realizing non-direct coupling of the functional modules, that is, low coupling and high cohesion between modules.

[0005] The specific scheme proposed by the present invention is:

[0006] The present invention provides a method for implementing calls between modules within a system, wherein the modules within the system are defined as control modules and business modules, the control module controls the execution of a message bus service and a module mapping service, provides message sending, message receiving and message replying methods through the message bus service, and maintains the mapping relationship between all business modules through the module mapping service, wherein the mapping relationship includes a mapping relationship using a business module name as a key and a message queue corresponding to the business module as a value, and a mapping relationship using a business group name as a key and an array of names of all business modules under the business group as a value,

[0007] The business modules use the message sending, message receiving and message reply methods of the message bus service to call each other according to the mapping relationship in the module mapping service.

[0008] The calling process between business modules is:

[0009] Initialize the system, the business module registers the business module information with the control module through the registration method, the business module information includes the business module name, the business group to which the business module belongs and whether the business module is enabled,

[0010] The service module that initiates the call sends a call message to the control module, and the control module obtains the target service module or target service group according to the call message.

[0011] If the destination business module is obtained, the module mapping service in the control module searches for the message queue corresponding to the destination business module according to the destination business module name. If the destination business group is obtained, the module mapping service in the control module searches for the corresponding destination business module name according to the destination business group name, and then searches for all corresponding message queues according to the destination business module name.

[0012] The control module sends the calling message to the message queue obtained after the search, and establishes a temporary message queue for receiving the reply message.

[0013] The destination business module receives the called message in the message queue through the message receiving method, completes the corresponding operation according to the called message, and constructs the corresponding response message.

[0014] The destination service module sends a response message to the control module through the message response method.

[0015] The control module receives the reply message, sends the reply message to the corresponding temporary message queue, and returns the reply message to the calling business module through the temporary message queue.

[0016] Furthermore, in the implementation method of calling between modules within the system, the business module is defined as a system function module, the business module registers the business module information to the control module through a registration method, and the business module deletes the business module information to the control module through a deletion method.

[0017] Furthermore, in the method for implementing the call between modules within the system, the message includes a message header, a message route and a message content.

[0018] The message header includes message ID, message parent ID, message creation time, and response timeout.

[0019] The message routing includes the name of the service module initiating the call, the name of the target service module, the name of the target service group, the name of the operation and the operation object.

[0020] The message content is the current state of the object currently to be operated.

[0021] Furthermore, in the method for implementing the call between modules within the system, the control module sends the called message to the message queue obtained after the search, and establishes a temporary message queue according to the message ID of the called message;

[0022] The destination business module receives the calling message in the message queue through the message receiving method, completes the corresponding operation according to the message route and message content in the calling message, and constructs the corresponding response message: sets the calling message ID to the message parent ID of the response message, sets the operation name in the message route to response, and sets the message content to the operation object state after the operation is completed;

[0023] The destination service module sends a response message to the control module through the message response method.

[0024] The control module receives the reply message, searches for the temporary message queue according to the message parent ID in the reply message header, sends the reply message to the corresponding temporary message queue, and returns the reply message to the calling business module through the temporary message queue.

[0025] Furthermore, in the method for implementing the inter-module call within the system, after the control module finds the message queue, it determines whether the target service module exists and has been enabled.

[0026] If the target service module exists and is enabled, the control module sends the calling message to the message queue obtained after the search, and establishes a temporary message queue for receiving the reply message.

[0027] If the destination service module does not exist or is not enabled, the control module constructs an exception message indicating that the destination service module is not enabled, and sends the exception message to a temporary message queue.

[0028] Furthermore, in the method for implementing the inter-module call within the system, the control module starts the timer while establishing the temporary message queue, and sets the timeout time to the response timeout time of the current message.

[0029] The destination business module receives the message called in the message queue through the message receiving method, completes the corresponding operation according to the called message, and constructs the corresponding response message, and sends the response message to the control module through the message response method.

[0030] After receiving the response message, the control module determines whether the response time of the current message has timed out.

[0031] If the current message response time has not timed out, the reply message is sent to the corresponding temporary message queue as the return reply of the calling business module.

[0032] If the current message response time has timed out, the temporary message queue is closed, and an exception message of message timeout is returned to the calling business module as a return response.

[0033] Furthermore, in the method for implementing the inter-module call within the system, the business module initiating the call obtains the returned response,

[0034] If the returned response is an abnormal message, the error log will be printed.

[0035] If the response is a normal response message, it means the call is completed.

[0036] The present invention provides a system for implementing calls between modules within a system. The modules within the system are defined as control modules and business modules. The control module controls the execution of a message bus service and a module mapping service. The message bus service provides message sending, message receiving and message replying methods. The module mapping service maintains the mapping relationship between all business modules. The mapping relationship includes a mapping relationship with a business module name as a key and a message queue corresponding to the business module as a value, and a mapping relationship with a business group name as a key and an array of names of all business modules under the business group as a value.

[0037] The business modules use the message sending, message receiving and message reply methods of the message bus service to call each other according to the mapping relationship in the module mapping service.

[0038] The calling process between business modules is:

[0039] Initialize the system, the business module registers the business module information with the control module through the registration method, the business module information includes the business module name, the business group to which the business module belongs and whether the business module is enabled,

[0040] The service module that initiates the call sends a call message to the control module, and the control module obtains the target service module or target service group according to the call message.

[0041] If the destination business module is obtained, the module mapping service in the control module searches for the message queue corresponding to the destination business module according to the destination business module name. If the destination business group is obtained, the module mapping service in the control module searches for the corresponding destination business module name according to the destination business group name, and then searches for all corresponding message queues according to the destination business module name.

[0042] The control module sends the calling message to the message queue obtained after the search, and establishes a temporary message queue for receiving the reply message.

[0043] The destination business module receives the called message in the message queue through the message receiving method, completes the corresponding operation according to the called message, and constructs the corresponding response message.

[0044] The destination service module sends a response message to the control module through the message response method.

[0045] The control module receives the reply message, sends the reply message to the corresponding temporary message queue, and returns the reply message to the calling business module through the temporary message queue.

[0046] The present invention also provides a device for implementing the call between modules within the system, comprising: at least one memory and at least one processor;

[0047] The at least one memory is used to store a machine-readable program;

[0048] The at least one processor is used to call the machine-readable program to execute the method for implementing the calling between modules within the system.

[0049] The benefits of the present invention are:

[0050] The method of the present invention utilizes the idea of ​​central exchange to simplify the association between various business modules. The connection between various business modules is completely completed through the exchange of message bus service and module mapping service by the control module, thereby realizing non-direct coupling of business modules and realizing a process of low coupling and high cohesion between business modules. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0052] Figure 1 It is a schematic diagram of the message instruction structure involved in the method of the present invention.

[0053] Figure 2 It is a schematic diagram of the application framework flow of the method of the present invention. DETAILED DESCRIPTION

[0054] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.

[0055] The present invention provides a method for implementing calls between modules within a system, wherein the modules within the system are defined as control modules and business modules, the control module controls the execution of a message bus service and a module mapping service, provides message sending, message receiving and message replying methods through the message bus service, and maintains the mapping relationship between all business modules through the module mapping service, wherein the mapping relationship includes a mapping relationship using a business module name as a key and a message queue corresponding to the business module as a value, and a mapping relationship using a business group name as a key and an array of names of all business modules under the business group as a value,

[0056] The business modules use the message sending, message receiving and message reply methods of the message bus service to call each other according to the mapping relationship in the module mapping service.

[0057] The calling process between business modules is:

[0058] Initialize the system, the business module registers the business module information with the control module through the registration method, the business module information includes the business module name, the business group to which the business module belongs and whether the business module is enabled,

[0059] The service module that initiates the call sends a call message to the control module, and the control module obtains the target service module or target service group according to the call message.

[0060] If the destination business module is obtained, the module mapping service in the control module searches for the message queue corresponding to the destination business module according to the destination business module name. If the destination business group is obtained, the module mapping service in the control module searches for the corresponding destination business module name according to the destination business group name, and then searches for all corresponding message queues according to the destination business module name.

[0061] The control module sends the calling message to the message queue obtained after the search, and establishes a temporary message queue for receiving the reply message.

[0062] The destination business module receives the called message in the message queue through the message receiving method, completes the corresponding operation according to the called message, and constructs the corresponding response message.

[0063] The destination service module sends a response message to the control module through the message response method.

[0064] The control module receives the reply message, sends the reply message to the corresponding temporary message queue, and returns the reply message to the calling business module through the temporary message queue.

[0065] Because of the various disadvantages of coupling, efforts should be made to pursue low coupling when designing system software. The control module of the method of the present invention is essentially a central program, and the control module includes a message bus service and a module mapping service. The message bus service is responsible for realizing the mutual call between each business module, and the message bus service provides message sending, message receiving, and message reply methods. When a business module needs to interact with other business modules, it only needs to call the corresponding method and publish the message to the message bus. The module mapping service is mainly responsible for maintaining the relationship between all business modules. Once a business module needs to interact with other business modules, it notifies the corresponding other one or more business modules according to the mapping relationship in the module mapping service.

[0066] In specific applications, in some embodiments of the method of the present invention, the business module can be considered as a system function module, which is mainly responsible for completing the implementation of various functions in the system. The business module can register the current business module information to the control module through the registration method, and the business module can delete the current business module information to the control module through the deletion method. The business module information includes the name of the business module, the business group to which the business module belongs, and whether the business module is enabled;

[0067] Furthermore, when the system is started, it is initialized and the control module and all existing business modules are started immediately.

[0068] After the service module is started, the current service module information is registered with the control module through the service module registration method at the first time.

[0069] After the control module receives the business module registration information, the module mapping service is responsible for maintaining two mapping relationships, wherein the first mapping relationship uses the business module name as the key and initializes a message queue for each business module as the value; the second mapping relationship uses the business group name as the key and the array of all business module names under the current business group as the value;

[0070] Above, system initialization is completed.

[0071] In some other embodiments of the method of the present invention, the composition of the message is specifically described, wherein when the service module initiating the call needs to interact with other service modules, the service module initiating the call sends a call message to the control module;

[0072] The message instruction of the call includes three parts: message header, message route and message content;

[0073] The message header includes message ID, message parent ID, message creation time, and response timeout;

[0074] The message routing includes the name of the service module initiating the call, the name of the target service module, the name of the target service group, the name of the operation and the operation object;

[0075] The message content is the current state of the object to be operated.

[0076] Furthermore, in the method for implementing the call between modules within the system, the control module sends the called message to the message queue obtained after the search, and establishes a temporary message queue according to the message ID of the called message;

[0077] The destination business module receives the calling message in the message queue through the message receiving method, completes the corresponding operation according to the message route and message content in the calling message, and constructs the corresponding response message: sets the calling message ID to the message parent ID of the response message, sets the operation name in the message route to response, and sets the message content to the operation object state after the operation is completed;

[0078] The destination service module sends a response message to the control module through the message response method.

[0079] The control module receives the reply message, searches for the temporary message queue according to the message parent ID in the reply message header, sends the reply message to the corresponding temporary message queue, and returns the reply message to the calling business module through the temporary message queue.

[0080] In other embodiments of the method of the present invention, after the control module finds the message queue, it determines whether the destination service module exists and has been enabled.

[0081] If the target service module exists and is enabled, the control module sends the calling message to the message queue obtained after the search, and establishes a temporary message queue for receiving the reply message.

[0082] If the destination service module does not exist or is not enabled, the control module constructs an exception message indicating that the destination service module is not enabled, and sends the exception message to a temporary message queue.

[0083] Furthermore, in the method for implementing the inter-module call within the system, the control module starts the timer while establishing the temporary message queue, and sets the timeout time to the response timeout time of the current message.

[0084] The destination business module receives the message called in the message queue through the message receiving method, completes the corresponding operation according to the called message, and constructs the corresponding response message, and sends the response message to the control module through the message response method.

[0085] After receiving the response message, the control module determines whether the response time of the current message has timed out.

[0086] If the current message response time has not timed out, the reply message is sent to the corresponding temporary message queue as the return reply of the calling business module.

[0087] If the current message response time has timed out, the temporary message queue is closed, and an exception message of message timeout is returned to the calling business module as a return response.

[0088] Furthermore, in the method for implementing the inter-module call within the system, the business module initiating the call obtains the returned response,

[0089] If the returned response is an abnormal message, the error log will be printed.

[0090] If the response is a normal response message, it means the call is completed.

[0091] A detailed process of the calling process between business modules of the method of the present invention, with the first business module representing the business module that initiates the call, can be referred to as follows:

[0092] S01: The first business module sends a call message to the control module through a message sending method of a message bus service;

[0093] S02: The control module parses the call message and obtains the destination service module or destination service group of the message;

[0094] S03: If the destination business module is a specific business module, the module mapping service in the control module searches for the message queue corresponding to the destination business module according to the name of the destination business module; if the destination business module is a business group, the module mapping service in the control module searches for the corresponding destination business module name according to the name of the destination business group, and then searches for all corresponding message queues according to the name of the destination business module;

[0095] S04: If the destination service module exists and has been enabled, the control module obtains all destination message queues according to the module mapping service, and sends message messages to all destination message queues at the same time;

[0096] S05: The control module initializes a temporary message queue according to the message ID in the message header to receive the reply message;

[0097] S06: If the destination service module does not exist or is not enabled, the control module constructs an abnormal message indicating that the destination service module is not enabled, and sends the message to a temporary message queue;

[0098] S06: The control module starts the timer at the same time and sets the timeout period to the response timeout period of the current message;

[0099] S07: The destination service module receives the call message in the message queue of the current service module through the message receiving method;

[0100] S08: The destination business module completes the corresponding operation according to the message route and message content in the call message, and constructs the corresponding response message, wherein the main modifications are: setting the request message ID to the message parent ID of the response message, setting the operation name in the message route to response, and setting the message content to the operation object state after the operation is completed;

[0101] S09: The destination service module sends a response message to the control module through a message response method;

[0102] S10: After receiving the response message, the control module determines whether the response time of the current message has timed out;

[0103] S11: If the current message response time has not timed out, the temporary message queue is searched according to the message parent ID in the response message header, and the response message is sent to the corresponding temporary message queue.

[0104] The control module processes the temporary message queue and returns all the reply messages in the message queue to the first service module;

[0105] S12: If the current message response time has timed out, the temporary message queue is closed, and an abnormal message indicating a message timeout is returned to the first service module;

[0106] S13: The first business module obtains a response message during this operation. If the response message is an abnormal message, an error log is printed; if the response message is a normal message, this call ends.

[0107] The present invention provides a system for implementing calls between modules within a system. The modules within the system are defined as control modules and business modules. The control module controls the execution of a message bus service and a module mapping service. The message bus service provides message sending, message receiving and message replying methods. The module mapping service maintains the mapping relationship between all business modules. The mapping relationship includes a mapping relationship with a business module name as a key and a message queue corresponding to the business module as a value, and a mapping relationship with a business group name as a key and an array of names of all business modules under the business group as a value.

[0108] The business modules use the message sending, message receiving and message reply methods of the message bus service to call each other according to the mapping relationship in the module mapping service.

[0109] The calling process between business modules is:

[0110] Initialize the system, the business module registers the business module information with the control module through the registration method, the business module information includes the business module name, the business group to which the business module belongs and whether the business module is enabled,

[0111] The service module that initiates the call sends a call message to the control module, and the control module obtains the target service module or target service group according to the call message.

[0112] If the destination business module is obtained, the module mapping service in the control module searches for the message queue corresponding to the destination business module according to the destination business module name. If the destination business group is obtained, the module mapping service in the control module searches for the corresponding destination business module name according to the destination business group name, and then searches for all corresponding message queues according to the destination business module name.

[0113] The control module sends the calling message to the message queue obtained after the search, and establishes a temporary message queue for receiving the reply message.

[0114] The destination business module receives the called message in the message queue through the message receiving method, completes the corresponding operation according to the called message, and constructs the corresponding response message.

[0115] The destination service module sends a response message to the control module through the message response method.

[0116] The control module receives the reply message, sends the reply message to the corresponding temporary message queue, and returns the reply message to the calling business module through the temporary message queue.

[0117] The information interaction, execution process and other contents between the modules in the above-mentioned system are based on the same concept as the embodiment of the method of the present invention. For the specific contents, please refer to the description in the embodiment of the method of the present invention, and no further description is given here.

[0118] Similarly, the system of the present invention utilizes the concept of central exchange to simplify the association between various business modules. The connection between the business modules is completely completed through the control module using the exchange of message bus service and module mapping service, thereby realizing non-direct coupling of business modules and achieving low coupling and high cohesion between business modules.

[0119] It should be noted that not all steps and modules in the above-mentioned processes and system structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.

[0120] The present invention also provides a device for implementing the call between modules within the system, comprising: at least one memory and at least one processor;

[0121] The at least one memory is used to store a machine-readable program;

[0122] The at least one processor is used to call the machine-readable program to execute the method for implementing the calling between modules within the system.

[0123] As the information interaction, execution of readable program process and other contents of the processor in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.

[0124] Similarly, the device of the present invention utilizes the concept of central exchange to simplify the association between various business modules. The connection between the business modules is completed by executing the corresponding program and utilizing the exchange of message bus service and module mapping service, thereby realizing non-direct coupling of business modules and achieving low coupling and high cohesion between business modules.

[0125] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.

Claims

1. A method for implementing calls between modules within a system, characterized in that The modules in the system are defined as control modules and business modules. The control module controls the execution of the message bus service and the module mapping service. The message bus service provides methods for sending, receiving and replying messages. The module mapping service maintains the mapping relationship between all business modules. The mapping relationship includes a mapping relationship with the business module name as the key and the message queue corresponding to the business module as the value, and a mapping relationship with the business group name as the key and the array of all business module names under the business group as the value. The business modules use the message sending, message receiving and message reply methods of the message bus service to call each other according to the mapping relationship in the module mapping service. The calling process between business modules is: Initialize the system, the business module registers the business module information with the control module through the registration method, the business module information includes the business module name, the business group to which the business module belongs and whether the business module is enabled, The service module that initiates the call sends a call message to the control module, and the control module obtains the target service module or target service group according to the call message. If the destination business module is obtained, the module mapping service in the control module searches for the message queue corresponding to the destination business module according to the destination business module name. If the destination business group is obtained, the module mapping service in the control module searches for the corresponding destination business module name according to the destination business group name, and then searches for all corresponding message queues according to the destination business module name. The control module sends the calling message to the message queue obtained after the search, and establishes a temporary message queue for receiving the reply message. While establishing the temporary message queue, the control module starts the timer and sets the timeout time to the response timeout time of the current message. The destination business module receives the message called in the message queue through the message receiving method, completes the corresponding operation according to the called message, and constructs the corresponding response message, and sends the response message to the control module through the message response method. After receiving the response message, the control module determines whether the response time of the current message has timed out. If the current message response time has not timed out, the reply message is sent to the corresponding temporary message queue as the return reply of the calling business module. If the current message response time has timed out, the temporary message queue is closed, and an exception message of message timeout is returned to the calling business module as a return response; The reply message is returned to the calling business module through the temporary message queue.

2. The method for implementing the inter-module call in a system according to claim 1, characterized in that The business module is defined as a system function module. The business module registers the business module information to the control module through the registration method, and the business module deletes the business module information to the control module through the deletion method.

3. The method for implementing the inter-module call in a system according to claim 1, characterized in that The message includes the message header, message routing and message content. The message header includes message ID, message parent ID, message creation time, and response timeout. The message routing includes the name of the service module initiating the call, the name of the target service module, the name of the target service group, the name of the operation and the operation object. The message content is the current state of the object currently to be operated.

4. The method for implementing the inter-module call in a system according to claim 3, characterized in that The control module sends the called message to the message queue obtained after the search, and establishes a temporary message queue according to the message ID of the called message; The destination business module receives the calling message in the message queue through the message receiving method, completes the corresponding operation according to the message route and message content in the calling message, and constructs the corresponding response message: sets the calling message ID to the message parent ID of the response message, sets the operation name in the message route to response, and sets the message content to the operation object state after the operation is completed; The destination service module sends a response message to the control module through the message response method. The control module receives the reply message, searches for the temporary message queue according to the message parent ID in the reply message header, sends the reply message to the corresponding temporary message queue, and returns the reply message to the calling business module through the temporary message queue.

5. The method for implementing the inter-module call in a system according to claim 1, characterized in that After the control module finds the message queue, it determines whether the target business module exists and is enabled. If the target service module exists and is enabled, the control module sends the calling message to the message queue obtained after the search, and establishes a temporary message queue for receiving the reply message. If the destination service module does not exist or is not enabled, the control module constructs an exception message indicating that the destination service module is not enabled.

6. The method for implementing the inter-module call in a system according to claim 1, characterized in that The business module that initiates the call obtains the returned response. If the returned response is an abnormal message, the error log will be printed. If the response is a normal response message, it means the call is completed.

7. A system for implementing calls between modules within a system, characterized by The modules in the system are defined as control modules and business modules. The control module controls the execution of the message bus service and the module mapping service, provides message sending, message receiving and message replying methods through the message bus service, and maintains the mapping relationship between all business modules through the module mapping service. The mapping relationship includes a mapping relationship with the business module name as the key and the message queue corresponding to the business module as the value, and a mapping relationship with the business group name as the key and the array of all business module names under the business group as the value. The business modules use the message sending, message receiving and message reply methods of the message bus service to call each other according to the mapping relationship in the module mapping service. The calling process between business modules is: Initialize the system, the business module registers the business module information with the control module through the registration method, the business module information includes the business module name, the business group to which the business module belongs and whether the business module is enabled, The service module that initiates the call sends a call message to the control module, and the control module obtains the target service module or target service group according to the call message. If the destination business module is obtained, the module mapping service in the control module searches for the message queue corresponding to the destination business module according to the destination business module name. If the destination business group is obtained, the module mapping service in the control module searches for the corresponding destination business module name according to the destination business group name, and then searches for all corresponding message queues according to the destination business module name. The control module sends the calling message to the message queue obtained after the search, and establishes a temporary message queue for receiving the reply message. While establishing the temporary message queue, the control module starts the timer and sets the timeout time to the response timeout time of the current message. The destination business module receives the message called in the message queue through the message receiving method, completes the corresponding operation according to the called message, and constructs the corresponding response message, and sends the response message to the control module through the message response method. After receiving the response message, the control module determines whether the response time of the current message has timed out. If the current message response time has not timed out, the reply message is sent to the corresponding temporary message queue as the return reply of the calling business module. If the current message response time has timed out, the temporary message queue is closed, and an exception message of message timeout is returned to the calling business module as a return response; The reply message is returned to the calling business module through the temporary message queue.

8. A device for implementing calls between modules within a system, characterized in that include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is used to call the machine-readable program to execute a method for implementing calls between modules within the system as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Data collecting self-organizing architecture construction based on enterprise service bus

    CN101364924A

  • Data transmission method and device in different systems

    CN114051055A