Message forwarding method and device in multiple environments, equipment and medium
By using the same message device in the business accounting system to communicate with multiple test environments and using parameters to configure the device to store interface service information, the high cost problems caused by the addition of the test environment and interface modification are solved, and cost saving and maintenance simplification is achieved.
Patent Information
- Application Number
- CN202311844235.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2025-07-01
AI Technical Summary
In a business accounting system in multiple environments, every time a new set of test environment is added or interface parameters is modified, new message equipment and update jar packages need to be invested, resulting in high development and maintenance costs.
By using the same message device to communicate with each test environment in a production environment, and setting parameter configuration devices to store interface service information of the gateway device, the message device only needs to pull interface service information from the parameter configuration device, determine the target interface service information and call the corresponding service, reducing the impact on the message device.
It realizes that when adding a new test environment or modifying the interface, there is no need to deploy new message devices separately, saving development, machine usage and maintenance costs, and reducing maintenance complexity.
Smart Images

Figure CN120238550A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of distributed technology, and in particular to a message forwarding method, device, equipment and medium in multiple environments. Background Art
[0002] The business accounting system is a system that provides business accounting functions and is composed of distributed services such as gateway devices, business acceptance devices, accounting devices, and accounting devices. By deploying the business accounting system in the production environment and at least one test environment, the stable version is deployed in the production environment, and the version to be verified is deployed in the test environment, which reduces the impact on the production environment's external services and ensures business continuity. After the production environment receives a request from an external system (such as a business system, etc.), the gateway device routes the request to the downstream device (such as a business acceptance device, etc.), and directs the request to each test environment through the message middleware, so as to achieve the purpose of grayscale verification of the function to be put into production in the test environment.
[0003] The message device in the test environment is used to consume the request in the message middleware. The request carries the parameter type of the input parameter. The message device is deployed with a jar package, which contains multiple interfaces provided by the gateway device in the test environment. Accordingly, the message device determines the corresponding interface from the jar package according to the parameter type and calls the service corresponding to the interface, thereby sending the request to the gateway device. When there are other test environments, the message device will also forward the request to the message devices in other test environments, so that the message devices in other test environments will direct the request to the gateway device in this environment.
[0004] In this way, each new test environment requires the investment of new message devices, which has high development and maintenance costs. In addition, each time a gateway device adds a new interface or modifies the parameters of an interface, the message device needs to update the jar package it depends on, which increases maintenance costs. Summary of the invention
[0005] The present application provides a message forwarding method, device, equipment and medium in multiple environments, which reduces maintenance costs.
[0006] In a first aspect, the present application provides a message forwarding method in multiple environments, wherein the multiple environments include a production environment and at least one test environment, wherein a business accounting system is deployed in each environment, wherein the business accounting system in the production environment communicates with an external system through a gateway device; the business accounting system in the production environment communicates with the business accounting systems in each test environment through the same message device, wherein the method is applied to the message device, and the method includes:
[0007] Obtain request-related messages sent by a gateway device in a production environment. The request-related messages are generated by the gateway device after receiving a service request sent by an external system through a first interface. The request-related messages include the service request and first interface identification information;
[0008] Obtain pre-configured gateway device interface service information pulled from a parameter configuration device; the gateway device interface service information includes multiple preset interface service information, and the preset interface service information includes the identification of the test environment to which it belongs, the second interface identification information of the second interface to which it belongs, and the service identification information of the service to which it belongs; the second interface is the interface of the gateway device in at least one test environment;
[0009] Based on the gateway device interface service information, determine at least one target interface service information that matches the first interface identification information;
[0010] Call the corresponding service according to the target interface service information to send the service request to the gateway device in at least one test environment.
[0011] Optionally, the determining at least one target interface service information that matches the first interface identification information based on the gateway device interface service information includes:
[0012] Query, from the gateway device interface service information, at least one target interface service information whose second interface identification information matches the first interface identification information.
[0013] Optionally, the calling the corresponding service according to the target interface service information to send the service request to the gateway device in at least one test environment includes:
[0014] Adopt the dubbo generalization call technology to call the corresponding service according to the target interface service information to send the service request to the gateway device in at least one test environment.
[0015] Optionally, the method further includes:
[0016] Regularly pull the latest gateway device interface service information from the parameter configuration device and store the pulled gateway device interface service information in a cache;
[0017] The obtaining the pre-configured gateway device interface service information pulled from the parameter configuration device includes:
[0018] Read the stored gateway device interface service information from the cache.
[0019] Optionally, before invoking the corresponding service according to the target interface service information to send the service request to the gateway device in at least one test environment, the method further includes:
[0020] Establish a communication connection with the service referred to by the target interface service information;
[0021] The target interface service information further includes a call timeout and a preset retry count; the method further includes:
[0022] When establishing the communication connection, if the connection establishment duration exceeds the call timeout and the connection is not successful, retry;
[0023] If the retry count reaches the preset retry count and the connection is not successful, confirm that the communication connection establishment fails;
[0024] Output a prompt message, where the prompt message is used to prompt that the communication connection with the service fails.
[0025] In a second aspect, the present application provides a message forwarding method in multiple environments. The multiple environments include a production environment and at least one test environment. A business accounting system is deployed in each environment. In the production environment, the business accounting system communicates with an external system through a gateway device; in the production environment, the business accounting system communicates with the business accounting systems in each test environment through the same message device. The method is applied to a parameter configuration device, and the method includes:
[0026] Receive a configuration request sent by a user terminal; the configuration request carries preset interface service information; the preset interface service information includes an identifier of the test environment to which it belongs, second interface identifier information of the second interface to which it belongs, and service identifier information of the service to which it belongs; the second interface is an interface of the gateway device in at least one test environment;
[0027] Add the preset interface service information to the pre-configured gateway device interface service information;
[0028] When receiving a get request sent by the message device, send the latest gateway device interface service information to the message device.
[0029] In a third aspect, the present application provides a message forwarding device in multiple environments. The multiple environments include a production environment and at least one test environment. A business accounting system is deployed in each environment. In the production environment, the business accounting system communicates with an external system through a gateway device; in the production environment, the business accounting system communicates with the business accounting systems in each test environment through the same message device. The device is set in the message device, and the device includes:
[0030] A first acquisition module, configured to acquire request-related messages sent by a gateway device in a production environment, where the request-related messages are generated after the gateway device receives a service request sent by an external system through a first interface, and the request-related messages include the service request and first interface identification information;
[0031] A second acquisition module, configured to acquire pre-configured gateway device interface service information pulled from a parameter configuration device; the gateway device interface service information includes a plurality of preset interface service information, and the preset interface service information includes an identification of the test environment to which it belongs, second interface identification information of a second interface, and service identification information of the service to which it belongs; the second interface is an interface of a gateway device in at least one test environment;
[0032] A determination module, configured to determine at least one target interface service information that matches the first interface identification information based on the gateway device interface service information;
[0033] A sending module, configured to call a corresponding service according to the target interface service information to send the service request to a gateway device in at least one test environment.
[0034] In a fourth aspect, the present application provides a message forwarding device in multiple environments, where the multiple environments include a production environment and at least one test environment, and a business accounting system is respectively deployed in each environment. In the production environment, the business accounting system communicates with an external system through a gateway device; in the production environment, the business accounting system communicates with the business accounting systems in each test environment through the same message device. The device is arranged in a parameter configuration device, and the device includes:
[0035] A receiving module, configured to receive a configuration request sent by a user terminal; the configuration request carries preset interface service information; the preset interface service information includes an identification of the test environment to which it belongs, second interface identification information of a second interface, and service identification information of the service to which it belongs; the second interface is an interface of a gateway device in at least one test environment;
[0036] An adding module, configured to add the preset interface service information to the pre-configured gateway device interface service information;
[0037] A sending module, configured to send the latest gateway device interface service information to the message device when receiving an acquisition request sent by the message device.
[0038] In a fifth aspect, the present application provides an electronic device, including: a processor and a memory communicatively connected to the processor;
[0039] The memory stores computer-executable instructions;
[0040] The processor executes the computer-executable instructions stored in the memory to implement the message forwarding method in multiple environments according to any one of the first aspect or the message forwarding method in multiple environments according to the second aspect.
[0041] In a sixth aspect, the present application provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the message forwarding method in multiple environments according to any one of the first aspect or the message forwarding method in multiple environments according to the sixth aspect when executed by a processor.
[0042] In a seventh aspect, the present application provides a computer program product including computer-executable instructions, which implement the message forwarding method in multiple environments according to any one of the first aspect when executed by a processor.
[0043] For the message forwarding method, device, equipment and medium provided by the present application, at least one test environment shares a message device. In this way, even if a new test environment is added, there is no need to separately deploy a new message device, saving development costs, machine usage costs and maintenance costs. On this basis, the present application also pre-configures gateway device interface service information through a parameter configuration device. The gateway device interface service information includes multiple preset interface service information. The preset interface service information includes the identifier of the test environment to which it belongs, the identifier information of the second interface of the gateway device in the test environment, and the identifier information of the service provided by the second interface. After the message device obtains the request-related message sent by the gateway device in the production environment, by obtaining the gateway device interface service information pulled from the parameter configuration device, it determines at least one target interface service information that matches the first interface identifier information included in the request-related message, and thus calls the corresponding service according to the target interface service information to achieve the purpose of sending a service request to the gateway device in at least one test environment. It can be seen that in the case of adding a new interface to the gateway device or changing the parameters of the interface, it is only necessary to update the gateway device interface service information through the parameter configuration device, which has little impact on the message device and reduces the maintenance cost. Description of the Drawings
[0044] The drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0045] Figure 1 It is a schematic diagram of an architecture of multiple environments provided by the present application;
[0046] Figure 2 It is a schematic diagram of an application scenario provided by the present application;
[0047] Figure 3It is a schematic flowchart of a message forwarding method in multiple environments provided by this application;
[0048] Figure 4 It is a schematic flowchart of another message forwarding method in multiple environments provided by this application;
[0049] Figure 5 It is a schematic flowchart of yet another message forwarding method in multiple environments provided by this application;
[0050] Figure 6 It is a schematic structural diagram of a message forwarding device in multiple environments provided by this application;
[0051] Figure 7 It is a schematic structural diagram of another message forwarding device in multiple environments provided by this application;
[0052] Figure 8 It is a schematic structural diagram of an electronic device provided by this application.
[0053] Through the above-mentioned drawings, specific embodiments of this application have been shown, and there will be more detailed descriptions hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of this application in any way, but to illustrate the concept of this application to those skilled in the art by referring to specific embodiments. Detailed Embodiments
[0054] Here, exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. On the contrary, they are merely examples of devices and methods consistent with some aspects of this application as detailed in the appended claims.
[0055] Terms such as "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. In the description of the following embodiments, "a plurality of" means more than two unless otherwise specifically defined.
[0056] First, the nouns involved in this application are explained:
[0057] Business accounting system: A system that provides accounting processing and fund accounting, consisting of distributed services such as a gateway module, a business acceptance module, an accounting module, an accounting module, and a reporting module. Among them, one module refers to a distributed cluster. Exemplarily, the gateway module includes multiple gateway devices, and these multiple gateway devices form a distributed cluster to jointly provide gateway services.
[0058] Multi - environment: including a production environment and at least one test environment. Exemplarily, the at least one test environment includes a trial calculation environment and an information and communication technology (ICT) environment built to meet the domestic substitution requirements.
[0059] To clearly understand the technical solution of this application, the solutions of the prior art will be introduced in detail first.
[0060] The business accounting system is a system that provides business accounting functions and consists of distributed services such as gateway devices, business acceptance devices, accounting devices, and accounting equipment. By deploying the business accounting system in the production environment and at least one test environment respectively, a stable version is deployed in the production environment and a version to be verified is deployed in the test environment, reducing the impact on the services provided by the production environment externally and ensuring business continuity.
[0061] Figure 1 It is a schematic diagram of the architecture of a multi - environment provided by this application. As Figure 1 shown, the multi - environment includes a production environment, a trial calculation environment, and an ICT environment. Among them, the production environment can communicate with external systems, and the external systems include business systems, operation systems, and operation and maintenance systems. After the production environment receives a request from an external system, the gateway device routes the request to downstream devices (such as business acceptance devices, etc.) and writes the request into the message middleware. The request is diverted to each test environment through the message middleware, achieving the purpose of gray - scale verification of the function to be put into production in the test environment.
[0062] Message devices are respectively deployed in each test environment. The message device in the trial calculation environment is used to consume the requests in the message middleware. The requests carry the parameter types of the input parameters. The message device is deployed with a jar package, and the jar package contains multiple interfaces provided by the gateway device in the trial calculation environment. Correspondingly, the message device determines the corresponding interface from the jar package according to the parameter type and calls the service corresponding to the interface, thereby sending the request to the gateway device.
[0063] In this case, every time a new interface is added to the gateway device or the parameters of the interface are modified, such as adding an attribute field to the input parameter, a new version needs to be released, the version number of the interface on which the message device depends needs to be upgraded, and the dependent jar package needs to be updated, increasing the maintenance cost. As the number of interfaces continues to increase, the maintenance cost becomes higher and higher.
[0064] When there are other test environments, such as the ICT environment built for domestic substitution transformation, after the message device undergoes adaptation transformation and new interfaces are opened, the message device in the trial calculation environment forwards the request to the message device in the ICT environment, enabling the message device in the ICT environment to divert the request to the gateway device in this environment. In this case, custom development is required for each new set of test environments, and new message devices need to be invested, increasing the development cost, machine usage cost, and maintenance cost.
[0065] In view of the technical problems existing in the related art, the inventors of the present application found in their research that at least one message device in a test environment can be separately deployed, so that the business accounting system in the production environment communicates with the business accounting systems in each test environment through the same message device. Moreover, a parameter configuration device can be separately set, and the parameter configuration device stores the interface service information of the gateway device in the test environment, so that the interface service information is decoupled from the message device. In this way, the addition or update of the interface service information is implemented by the parameter configuration device, and the message device only needs to pull the interface service information from the parameter configuration device.
[0066] Specifically, in the present application, at least one test environment shares a message device. In this way, even if a new test environment is added, there is no need to separately deploy a new message device, saving development costs, machine usage costs, and maintenance costs. On this basis, the present application also pre-configures the gateway device interface service information through a parameter configuration device. The gateway device interface service information includes multiple preset interface service information. The preset interface service information includes the identifier of the test environment to which it belongs, the identifier information of the second interface of the gateway device in the test environment, and the identifier information of the service provided by the second interface. After the message device obtains the request-related message sent by the gateway device in the production environment, by obtaining the gateway device interface service information pulled from the parameter configuration device, it determines at least one target interface service information that matches the first interface identifier information included in the request-related message, and then calls the corresponding service according to the target interface service information to achieve the purpose of sending a business request to the gateway device in at least one test environment. It can be seen that in the case of adding a new interface to the gateway device or changing the parameters of the interface, it is only necessary to update the gateway device interface service information through the parameter configuration device, which has less impact on the message device and reduces the maintenance cost.
[0067] Next, the application scenario of the message forwarding method in multiple environments provided by the embodiments of the present application will be introduced.
[0068] Figure 2 is a schematic diagram of an application scenario provided by the present application. As Figure 2 shown, the application scenario includes multiple environments, which include a production environment and at least one test environment. Business accounting systems are respectively deployed in each environment. The business accounting system in the production environment communicates with an external system through a gateway device, and the business accounting system in the production environment communicates with the business accounting systems in each test environment through the same message device. Among them, the external system can be a business system, an operation and maintenance system, and an operation system. At least one test environment includes a trial calculation environment and a Xinchuang environment.
[0069] After the gateway device in the production environment receives a service request sent by an external system, it writes the request-related message into the message middleware. The message device consumes the request-related message in the message middleware, pulls the gateway device interface service information from the parameter configuration device, and based on the gateway interface service information, determines at least one target interface service information that matches the first interface identification information in the request-related message. Thus, it calls the corresponding service according to the target interface service information to send a service request to the gateway device in the test environment. After the gateway device in the test environment receives the service request, it routes the service request to the downstream device.
[0070] It should be noted that an external system such as a business system cannot directly communicate with the test environment, while the operation system and the operation and maintenance system can communicate with the test environment in some scenarios, but cannot directly communicate with the test environment in other scenarios. When unable to directly communicate with the test environment, the request of the external system can be forwarded to the test environment by executing the message forwarding method in multiple environments provided by this application.
[0071] The following uses specific embodiments to elaborate in detail on the technical solution of this application and how the technical solution of this application solves the above technical problems. These several specific embodiments below can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0072] Figure 3 It is a schematic flowchart of a message forwarding method in multiple environments provided by this application. The execution subject of this method is a message forwarding device in multiple environments, and this device is integrated in the message device. As Figure 3 shown, the message forwarding method in multiple environments provided in this embodiment includes the following steps:
[0073] Step S101, obtain the request-related message sent by the gateway device in the production environment. The request-related message is generated after the gateway device receives a service request sent by an external system through the first interface. The request-related message includes the service request and the first interface identification information.
[0074] In this embodiment, after the gateway device in the production environment receives a service request sent by an external system, it writes the request-related message into the message middleware, and the message device consumes the request-related message in the message middleware.
[0075] The gateway devices in each environment are corresponding. The gateway device in the production environment provides multiple first interfaces. Correspondingly, the gateway device in the test environment provides multiple second interfaces, and the first interface corresponds to the second interface. Exemplarily, the multiple first interfaces provided by the gateway device in the production environment include A, B, and C, then the multiple second interfaces provided by the gateway device in the test environment are A', B', and C'.
[0076] The first interface identification information is used to identify the first interface. Exemplarily, the first interface identification information includes the fully qualified name of the first interface, the method name, and the parameter types of the input parameters. These three pieces of information can be regarded as the three elements for locating an interface. Exemplarily, if the number of parameter types of the input parameters is multiple, they are represented in the form of an array, and multiple parameter types are separated by commas.
[0077] Step S102: Obtain the pre-configured gateway device interface service information pulled from the parameter configuration device; the gateway device interface service information includes multiple preset interface service information, and the preset interface service information includes the identification of the test environment to which it belongs, the second interface identification information of the second interface to which it belongs, and the service identification information of the service to which it belongs; the second interface is the interface of the gateway device in at least one test environment.
[0078] In this embodiment, the gateway device interface service information is pre-configured in the parameter configuration device. Exemplarily, the gateway device interface service information exists in the form of a configuration table. The gateway device interface service information includes multiple preset interface service information. The gateway device in the test environment provides multiple second interfaces, and each second interface has corresponding second interface identification information. The preset interface service information includes the identification (IDC) of the test environment to which it belongs, the second interface identification information of the second interface to which it belongs, and the service identification information of the service to which it belongs.
[0079] Among them, the second interface identification information is used to identify the second interface. Exemplarily, the second interface identification information includes the fully qualified name of the second interface, the method name, and the parameter types of the input parameters. In this embodiment, the interface identification information of the first interface in the production environment is the same as that of the corresponding second interface in the test environment, that is, the first interface identification information of the first interface is the same as the second interface identification information of the corresponding second interface. Exemplarily, the first interface identification information of the first interface A is the same as the second interface identification information of the second interface A', the first interface representation information of the first interface B is the same as the second interface identification information of the second interface B', and the first interface identification information of the first interface C is the same as the second interface identification information of the second interface C'.
[0080] Among them, each interface provides at least one service, and the service has corresponding service identification information. Exemplarily, the service identification information includes the service group and the service version number.
[0081] Exemplarily, the identifier of the test environment is Environment 1. The second interface identification information corresponding to a second interface of the gateway device in this test environment includes the fully qualified name, method name, and parameter types of the input parameters. The service identification information corresponding to the service provided by this second interface includes the service group and service version number. Accordingly, the corresponding preset interface service information includes Environment 1, fully qualified name, method name, parameter types of the input parameters, service group, and service version number.
[0082] Accordingly, the gateway device interface service information includes the preset interface service information of each second interface provided by the gateway device in each test environment.
[0083] In this embodiment, the message device can communicate with the parameter configuration device. After the message device obtains the request-related message, it pulls the gateway device interface service information from the parameter configuration device. Alternatively, the message device can also regularly pull the gateway device interface service information from the parameter configuration device and store it in the gateway device interface service information, so that after obtaining the request-related message, it reads the stored gateway device interface service information.
[0084] Among them, the way for the message device to pull the gateway device interface service information from the parameter configuration device is: the message device sends a fetch request to the parameter configuration device, and the parameter configuration device, in response to receiving this fetch request, sends the latest gateway device interface service information to the message device.
[0085] Step S103, based on the gateway device interface service information, determine at least one target interface service information that matches the first interface identification information.
[0086] Among them, since the number of test environments is at least one, and the number of services provided by an interface is also at least one, in the gateway device interface service information, the number of preset interface service information that matches the first interface identification information is at least one. In this embodiment, the preset interface service information that matches the first interface identification information is regarded as the target interface service information.
[0087] Step S104, call the corresponding service according to the target interface service information to send a service request to the gateway device in at least one test environment.
[0088] Among them, after determining the target interface service information, the message device can call the corresponding service, so as to send a service request to the gateway device in at least one test environment. One target interface service information can locate a service. The message device calls the services located by each target interface service information respectively to send a service request. Alternatively, the message device can also randomly call any service belonging to a test environment for each test environment to send a service request.
[0089] In this embodiment, at least one test environment shares a message device. In this way, even if a new test environment is added, there is no need to separately deploy a new message device, saving development costs, machine usage costs, and maintenance costs. On this basis, the present application also pre-configures gateway device interface service information through a parameter configuration device. The gateway device interface service information includes multiple preset interface service information. The preset interface service information includes the identifier of the test environment to which it belongs, the identifier information of the second interface of the gateway device in the test environment, and the identifier information of the service provided by the second interface. After the message device obtains a request-related message sent by the gateway device in the production environment, by obtaining the gateway device interface service information pulled from the parameter configuration device, it determines at least one target interface service information that matches the first interface identifier information included in the request-related message, and thus calls the corresponding service according to the target interface service information to achieve the purpose of sending a service request to the gateway device in at least one test environment. It can be seen that in the case where a new interface is added to the gateway device or the parameters of the interface are changed, it is only necessary to update the gateway device interface service information through the parameter configuration device, which has little impact on the message device and reduces the maintenance cost.
[0090] Figure 4 is a schematic flowchart of another message forwarding method in multiple environments provided by the present application, as Figure 4 shown, the message forwarding method in multiple environments provided in this embodiment includes the following steps:
[0091] Step S201, obtain a request-related message sent by the gateway device in the production environment. The request-related message is generated after the gateway device receives a service request sent by an external system through the first interface. The request-related message includes the service request and the first interface identifier information.
[0092] In this embodiment, the implementation manner of step S201 is the same as that of step S101 in the previous embodiment, and will not be elaborated here.
[0093] Step S202, obtain the pre-configured gateway device interface service information pulled from the parameter configuration device; the gateway device interface service information includes multiple preset interface service information. The preset interface service information includes the identifier of the test environment to which it belongs, the second interface identifier information of the second interface to which it belongs, and the service identifier information of the service to which it belongs; the second interface is the interface of the gateway device in at least one test environment.
[0094] In the first case, after the message device obtains the request-related message, it pulls the gateway device interface service information from the parameter configuration device. In this case, the gateway device interface service information pulled by the message device each time is the latest.
[0095] In the second case, the message device periodically pulls the gateway device interface service information from the parameter configuration device and stores it in the gateway device interface service information, so that after obtaining the request-related message, the stored gateway device interface service information is read.
[0096] In an optional implementation manner, the message forwarding method in multiple environments provided by this application further includes the following steps:
[0097] Periodically pull the latest gateway device interface service information from the parameter configuration device, and store the pulled gateway device interface service information in the cache; correspondingly, the implementation manner of step S202 includes: reading the stored gateway device interface service information from the cache.
[0098] Among them, the frequency of periodic pulling can be set as needed. Exemplarily, it is pulled once every 24 hours.
[0099] In this embodiment, since the update frequency of the gateway device interface service information is relatively low, it is not necessary to pull from the parameter configuration device every time a request-related message is obtained. Instead, the gateway device interface service information is pulled periodically and stored in the cache. In this way, after obtaining the request-related message, the gateway device interface service information can be directly read from the cache, which is faster and reduces the interaction with the parameter configuration device.
[0100] In the third case, the message device can also pull and store the gateway device interface service information from the parameter configuration device only when receiving a user instruction. Exemplarily, the user sends a user instruction to the message device through the user terminal to instruct to pull the gateway device interface service information. This way of manual user refresh enables the user to flexibly instruct the message device according to actual needs.
[0101] It should be noted that the message device can pull the gateway device interface service information from the parameter configuration device in the manner provided in any of the above cases, and this embodiment does not limit this.
[0102] After step S202, the message device determines at least one target interface service information that matches the first interface identification information based on the gateway device interface service information. Optionally, the implementation manner of this step includes the following step S203.
[0103] Step S203, query at least one target interface service information from the gateway device interface service information whose second interface identification information matches the first interface identification information.
[0104] Among them, matching means that the first interface identification information is the same as the second interface identification information in the preset interface service information. If the first interface identification information corresponding to the first interface is the same as the second interface identification information corresponding to a certain second interface, it means that the first interface corresponds to the second interface, and the message device can send a service request to the gateway device in the test environment by invoking the service provided by the second interface.
[0105] In this step, the at least one determined target interface service information includes the target interface service information related to the second interface corresponding to the first interface in the gateway devices in each test environment.
[0106] In this embodiment, since the gateway device interface service information includes the preset interface service information related to the second interface in the gateway devices in each test environment, and the second interface identified by the second interface identification information that matches the first interface identification information is the interface corresponding to the first interface, the preset interface service information where the second interface identification information is located is determined as the target interface service information, so that the determined target interface service information is relatively accurate.
[0107] After step S203, the message device invokes the corresponding service according to the target interface service information to send a service request to the gateway device in at least one test environment. Optionally, the implementation manner of this step includes the following step S204.
[0108] Step S204, using the dubbo generic call technology, invokes the corresponding service according to the target interface service information to send a service request to the gateway device in at least one test environment.
[0109] Among them, the message device realizes the automatic forwarding of service requests in different test environments, different interfaces, different groups, and different version numbers through the dubbo generic call method. The dubbo generic call method can be referred to the related technology and will not be elaborated here.
[0110] In this embodiment, the target interface service information includes the identification of the test environment, the second interface identification information of the second interface, and the service identification information of the service. Therefore, through the dubbo generic call method, it is possible to invoke the corresponding service without relying on the jar package, thereby realizing the sending of service requests and reducing the maintenance cost.
[0111] In this embodiment, before invoking the corresponding service according to the target interface service information to send a service request to the gateway device in at least one test environment, the message forwarding method in multiple environments provided by this application further includes the following steps:
[0112] Establish a communication connection with the service referred to by the target interface service information. Correspondingly, the target interface service information further includes a call timeout and a preset number of retry attempts; then, when establishing the communication connection, if the connection establishment duration exceeds the call timeout and the connection is not successfully established, retry; if the number of retry attempts reaches the preset number of retry attempts and the connection is not successfully established, confirm that the communication connection establishment fails and output a prompt message, where the prompt message is used to prompt that the communication connection with the service fails.
[0113] Among them, the call timeout and the preset number of retry attempts can be set as needed, and this embodiment does not limit this. For example, the call timeout is 20 seconds, 30 seconds, 40 seconds, etc., and for example, the preset number of retry attempts is 2 times, 3 times, or 4 times, etc.
[0114] Among them, the specific manner for the message device to output the prompt message may be for the message device to send the prompt message to the user terminal so that the user terminal can display the prompt message, facilitating the user operating the user terminal to view.
[0115] In this embodiment, when establishing a communication connection with the service, there may be a situation of connection timeout or connection establishment failure. For this situation, a call timeout and a preset number of retry attempts are also set, so that the operation of repeatedly establishing a connection can be performed according to the call timeout and the preset number of retry attempts, reducing the number of connection establishment failures.
[0116] Figure 5 is a schematic flowchart of another message forwarding method provided by this application in a multi-environment, as Figure 5 shown. The execution subject of this method is a message forwarding device in a multi-environment, and this device is integrated in a parameter configuration device. The message forwarding method provided by this embodiment includes the following steps:
[0117] Step S301, receive a configuration request sent by the user terminal; the configuration request carries preset interface service information; the preset interface service information includes an identifier of the belonging test environment, second interface identifier information of the belonging second interface, and service identifier information of the belonging service; the second interface is an interface of a gateway device in at least one test environment.
[0118] Exemplarily, the parameter configuration device is a background server of a parameter configuration center. The user logs in to the parameter configuration center through the user terminal. In the case where a new interface needs to be added to the gateway device or the interface parameters need to be modified, the user inputs the preset interface service information through the user terminal and triggers the user terminal to send a configuration request to the parameter configuration device. Correspondingly, the parameter configuration device receives the configuration request and executes the method provided by this embodiment.
[0119] Step S302, add the preset interface service information to the pre-configured gateway device interface service information.
[0120] After receiving the configuration request, the parameter configuration device adds the preset interface service information to the gateway device interface service information. It should be noted that if the preset interface service information is related to a newly added interface, it is directly added. If the preset interface service information is related to an existing interface, the stored preset interface service information corresponding to the interface in the gateway device interface service information is deleted, and then the preset interface service information carried in the configuration request is added to update the preset interface service information.
[0121] Step S303: When receiving a get request sent by the message device, send the latest gateway device interface service information to the message device.
[0122] Among them, the process of the message device sending a get request to the parameter configuration device is as described in the above embodiment, which will not be elaborated here.
[0123] In this embodiment, by additionally setting a parameter configuration device to store the gateway device interface service information, when a new interface is added to the gateway device or the parameters of the interface are changed, only the gateway device interface service information needs to be updated through the parameter configuration device, which has little impact on the message device and reduces the maintenance cost.
[0124] In this application, by writing the three elements of the interface (fully qualified name of the interface, method name, parameter type of the input parameter) and the class information of the input parameter into the message middleware, rather than directly converting a POJO (a type of Java object) into a string form in the prior art, the automatic forwarding of request messages is realized through the generalization call method, enabling the addition of a new interface to the gateway device with zero modification to the message device, reducing the maintenance cost of the message device. By using IDC, grouping, version number, etc. as configuration parameters, the configurable message forwarding in multiple environments is realized, saving the transformation cost of the message device.
[0125] Figure 6 It is a schematic structural diagram of a message forwarding device in multiple environments provided by this application. As Figure 6 shown, in this embodiment, the device 400 is set in the message device. The device 400 includes:
[0126] The first acquisition module 401 is used to acquire request-related messages sent by the gateway device in the production environment. The request-related messages are generated after the gateway device receives a service request sent by an external system through the first interface. The request-related messages include the service request and the first interface identification information.
[0127] A second acquisition module 402, configured to acquire pre-configured gateway device interface service information pulled from a parameter configuration device; the gateway device interface service information includes a plurality of preset interface service information, and the preset interface service information includes an identifier of the test environment to which it belongs, a second interface identifier information of the second interface to which it belongs, and a service identifier information of the service to which it belongs; the second interface is an interface of a gateway device in at least one test environment;
[0128] A determination module 403, configured to determine at least one target interface service information that matches the first interface identifier information based on the gateway device interface service information;
[0129] A sending module 404, configured to call a corresponding service according to the target interface service information, so as to send a service request to a gateway device in at least one test environment.
[0130] Optionally, the determination module 403 is configured to:
[0131] Query at least one target interface service information in the gateway device interface service information whose second interface identifier information matches the first interface identifier information.
[0132] Optionally, the sending module 404 is configured to:
[0133] Adopt the dubbo generalization call technology to call a corresponding service according to the target interface service information, so as to send a service request to a gateway device in at least one test environment.
[0134] Optionally, the device 400 further includes:
[0135] A third acquisition module, configured to periodically pull the latest gateway device interface service information from the parameter configuration device and store the pulled gateway device interface service information in a cache;
[0136] The second acquisition module 402 is configured to:
[0137] Read the stored gateway device interface service information from the cache.
[0138] Optionally, the device 400 further includes a connection module, configured to:
[0139] Establish a communication connection with the service referred to by the target interface service information;
[0140] The target interface service information further includes a call timeout time and a preset number of retry times;
[0141] The connection module is further configured to:
[0142] When establishing a communication connection, if the connection establishment duration exceeds the call timeout time and the connection is not successful, retry;
[0143] If the number of retries reaches the preset number of retries but the connection is not successfully established, it is confirmed that the communication connection establishment fails.
[0144] Output a prompt message, which is used to prompt that the communication connection with the service fails to be established.
[0145] The message forwarding device in multiple environments provided in this embodiment can execute the technical solutions of the corresponding method embodiments. The implementation principles and technical effects are similar to those of the corresponding method embodiments, and will not be elaborated here one by one.
[0146] Figure 7 It is a schematic structural diagram of another message forwarding device in multiple environments provided by this application. As Figure 7 shown, in this embodiment, the device 500 is set in the parameter configuration device. The device 500 includes:
[0147] A receiving module 501, configured to receive a configuration request sent by a user terminal; the configuration request carries preset interface service information; the preset interface service information includes an identifier of the belonging test environment, second interface identifier information of the belonging second interface, and service identifier information of the belonging service; the second interface is an interface of a gateway device in at least one test environment.
[0148] An adding module 502, configured to add the preset interface service information to the pre-configured gateway device interface service information.
[0149] A sending module 503, configured to send the latest gateway device interface service information to the message device when receiving a fetch request sent by the message device.
[0150] The message forwarding device in multiple environments provided in this embodiment can execute the technical solutions of the corresponding method embodiments. The implementation principles and technical effects are similar to those of the corresponding method embodiments, and will not be elaborated here one by one.
[0151] An embodiment of this application also provides an electronic device. The electronic device is intended to be various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers.
[0152] Figure 8 It is a schematic structural diagram of an electronic device provided by this application. As Figure 8 shown, the electronic device 600 includes: a processor 601 and a memory 602 communicatively connected to the processor 601.
[0153] The memory 602 stores computer-executable instructions; the processor 601 executes the computer-executable instructions stored in the memory 602 to implement the message forwarding method in multiple environments provided by this application.
[0154] Among them, in the embodiments of the present application, the memory 602 and the processor 601 are connected through a bus. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0155] The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein. The various components are interconnected using different buses and can be mounted on a common motherboard or otherwise installed as needed.
[0156] In an exemplary embodiment, there is also provided a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, are used to implement the message forwarding method in multiple environments provided by the present application.
[0157] In an exemplary embodiment, there is also provided a computer program product including computer-executable instructions that, when the computer-executable instructions in the computer program product are executed by a processor, are used to implement the message forwarding method in multiple environments provided by the present application.
[0158] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to the present application.
[0159] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential either, but can be executed alternately or in rotation with at least some of the sub-steps or stages of other steps or other steps.
[0160] It should be understood that the above-described device embodiments are merely illustrative, and the devices of the present application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units, modules, or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0161] In addition, unless otherwise specified, in each embodiment of the present application, each functional unit / module can be integrated into one unit / module, or each unit / module can exist physically alone, or two or more units / modules can be integrated together. The above-integrated unit / module can be implemented in the form of hardware or in the form of a software program module.
[0162] When the integrated unit / module is implemented in the form of hardware, the hardware can be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a controller, a microcontroller, a microprocessor, or other electronic components. Unless otherwise specified, the memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a USB flash drive, a Random-Access Memory (RAM), a Static Random-Access Memory (SRAM), a Dynamic Random-Access Memory (DRAM), an Enhanced Dynamic Random-Access Memory (EDRAM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), an Erasable Programmable Read-Only Memory (EPROM), a Programmable read-only memory (PROM), a Read-Only Memory (ROM), a Resistive Random Access Memory (RRAM), a High-Bandwidth Memory (HBM), a Hybrid Memory Cube (HMC), a magnetic memory, a flash memory, a disk, an optical disk, a mobile hard disk, or a magnetic disk, etc., which are various media that can store program codes.
[0163] When the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions for causing an electronic device to execute all or part of the steps of the methods in the various embodiments of the present application.
[0164] In the above embodiments, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as within the scope described in this specification.
[0165] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include well-known knowledge or conventional technical means in the technical field not disclosed in the present application. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present application are pointed out by the following claims.
[0166] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.
Claims
1. A message forwarding method in multiple environments, characterized in that, The multi-environment includes a production environment and at least one test environment. The business accounting system is deployed in each environment respectively. In the production environment, the business accounting system communicates with the external system through a gateway device; In the production environment, the business accounting system communicates with the business accounting systems in each test environment through the same message device. The method is applied to the message device and includes: Obtain a request-related message sent by the gateway device in the production environment. The request-related message is generated after the gateway device receives a business request sent by the external system through the first interface. The request-related message includes the business request and the first interface identification information; Obtain the pre-configured gateway device interface service information pulled from the parameter configuration device; the gateway device interface service information includes multiple preset interface service information. The preset interface service information includes the identification of the test environment to which it belongs, the second interface identification information of the second interface to which it belongs, and the service identification information of the service to which it belongs; the second interface is the interface of the gateway device in at least one test environment; Based on the gateway device interface service information, determine at least one target interface service information that matches the first interface identification information; Call the corresponding service according to the target interface service information to send the business request to the gateway device in at least one test environment.
2. The method according to claim 1, wherein The determining at least one target interface service information that matches the first interface identification information based on the gateway device interface service information includes: Query at least one target interface service information from the gateway device interface service information whose second interface identification information matches the first interface identification information.
3. The method according to claim 1, characterized in that, The calling the corresponding service according to the target interface service information to send the business request to the gateway device in at least one test environment includes: Adopt the dubbo generalization call technology to call the corresponding service according to the target interface service information to send the business request to the gateway device in at least one test environment.
4. The method according to claim 1, wherein The method further includes: Regularly pull the latest gateway device interface service information from the parameter configuration device and store the pulled gateway device interface service information in the cache; The obtaining the pre-configured gateway device interface service information pulled from the parameter configuration device includes: Read the stored gateway device interface service information from the cache.
5. The method according to claim 1, characterized in that, Before calling the corresponding service according to the target interface service information to send the business request to the gateway device in at least one test environment, the method further includes: Establish a communication connection with the service referred to by the target interface service information; The target interface service information further includes a call timeout time and a preset retry count; the method further includes: When establishing a communication connection, if the connection establishment duration exceeds the call timeout time and the connection is not successful, retry; If the retry count reaches the preset retry count and the connection is not successful, confirm that the communication connection establishment fails; Output a prompt message, which is used to prompt that the communication connection with the service fails.
6. A message forwarding method in multiple environments, characterized in that, The multi - environment includes a production environment and at least one test environment. Business accounting systems are respectively deployed in each environment. In the production environment, the business accounting system communicates with an external system through a gateway device; In the production environment, the business accounting system communicates with the business accounting systems in each test environment through the same message device. The method is applied to a parameter configuration device, and the method includes: Receiving a configuration request sent by a user terminal; the configuration request carries preset interface service information; the preset interface service information includes the identifier of the test environment it belongs to, the second interface identifier information of the second interface it belongs to, and the service identifier information of the service it belongs to; the second interface is the interface of the gateway device in at least one test environment; Adding the preset interface service information to the pre - configured gateway device interface service information; When receiving a fetch request sent by the message device, sending the latest gateway device interface service information to the message device.
7. A message forwarding device in multiple environments, characterized in that, The multi - environment includes a production environment and at least one test environment. Business accounting systems are respectively deployed in each environment. In the production environment, the business accounting system communicates with an external system through a gateway device; In the production environment, the business accounting system communicates with the business accounting systems in each test environment through the same message device. The device is set in the message device, and the device includes: A first fetch module, configured to fetch request - related messages sent by the gateway device in the production environment. The request - related messages are generated after the gateway device receives a business request sent by an external system through a first interface. The request - related messages include the business request and the first interface identifier information; A second fetch module, configured to fetch the pre - configured gateway device interface service information pulled from the parameter configuration device; the gateway device interface service information includes multiple preset interface service information. The preset interface service information includes the identifier of the test environment it belongs to, the second interface identifier information of the second interface it belongs to, and the service identifier information of the service it belongs to; the second interface is the interface of the gateway device in at least one test environment; A determination module, configured to determine at least one target interface service information that matches the first interface identifier information based on the gateway device interface service information; A sending module, configured to call the corresponding service according to the target interface service information to send the business request to the gateway device in at least one test environment.
8. A message forwarding device in multiple environments, characterized in that, The multi - environment includes a production environment and at least one test environment. Business accounting systems are respectively deployed in each environment. In the production environment, the business accounting system communicates with an external system through a gateway device; in the production environment, the business accounting system communicates with the business accounting systems in each test environment through the same message device. The device is set in the parameter configuration device, and the device includes: A receiving module, configured to receive a configuration request sent by a user terminal; the configuration request carries preset interface service information; the preset interface service information includes the identifier of the test environment it belongs to, the second interface identifier information of the second interface it belongs to, and the service identifier information of the service it belongs to; the second interface is the interface of the gateway device in at least one test environment; An adding module, configured to add the preset interface service information in the pre-configured gateway device interface service information; A sending module, configured to send the latest gateway device interface service information to the message device when receiving a fetch request sent by the message device.
9. An electronic device, characterized in that, Comprising: A processor and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the message forwarding method in multiple environments according to any one of claims 1 to 5 or the message forwarding method in multiple environments according to claim 6.
10. A computer-readable storage medium, characterized in that, Computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by a processor, they are used to implement the message forwarding method in multiple environments according to any one of claims 1 to 5 or the message forwarding method in multiple environments according to claim 6.