A message transmission method and device under multiple test environments

By using message middleware in a multi-microservice system to forward messages between different test environments and using tags to determine the destination recipient, the problem of limited test environment and mutual interference between data is solved, the test efficiency and isolation are improved, and the Development and testing requirements.

CN113254235BActive Publication Date: 2025-01-10XINGIN INFORMATION TECH (WUHAN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110636928.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-08
Publication Date
2025-01-10
Estimated Expiration
2041-06-08

AI Technical Summary

Technical Problem

In multi-microservice systems, the testing environment is limited, which causes developers and testers to queue up for use, which is inefficient, and the data of different test projects may interfere with each other, affecting the test results.

Method used

The message delivery method in a multi-test environment is adopted, and messages are forwarded between different test environments through message middleware, and the message destination recipient is determined using tags to achieve isolation of service calls in an asynchronous environment to ensure that tests do not interfere with each other.

Benefits of technology

Improves testing efficiency, allowing each developer or tester to test multiple services at the same time in his own testing environment, meets development and testing needs, and only takes effect in the test environment, without affecting the online environment, and the risks are controllable. No need to modify the business code, it can be enabled by upgrading the middleware version.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113254235B_ABST
    Figure CN113254235B_ABST
Patent Text Reader

Abstract

The present application relates to the field of computer technology, and discloses a message transmission method in a multi-test environment, wherein the multi-test environment includes a first test environment and a second test environment, wherein the first test environment and the second test environment include at least one sender and at least one receiver, and the message is forwarded between the sender and the receiver through a message middleware, and the sender sends a message, wherein the message includes a first tag for indicating the sender; the message middleware receives the message, and determines a receiver as the message destination from the receivers connected to the message middleware according to the first tag; the receiver as the destination obtains the message via the message middleware. The present application enables each developer or tester to implement simultaneous testing of multiple services in their own test environment, greatly improving the efficiency of the test, effectively meeting the needs of developers and testers, and being convenient, fast and efficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a message transmission method, device, equipment and medium in a multi-test environment. Background Art

[0002] There are many microservices in a system, and the implementation of a system requires the joint efforts of multiple development teams. When the development team has developed a microservice, it is necessary to load the newly designed microservice into the test environment (that is, only some of the many microservices are adjusted) and test the developed microservice to confirm whether it can operate normally. Only one developer or tester can test at the same time. Often, the number of test environments deployed is limited. After a test environment is occupied by a developer, other testers need to queue up to use the test environment. This leads to a lot of waiting time, a waste of time, and low efficiency. Moreover, if the operation is improper, the data between different test projects may interfere with each other, which in turn affects the test results. Summary of the invention

[0003] The embodiments of the present application provide a message transmission method, apparatus, device and medium in a multi-test environment.

[0004] In a first aspect, an embodiment of the present application provides a message transmission method in a multi-test environment, which is used for an electronic device, wherein the multi-test environment includes a first test environment and a second test environment, and the first test environment and the second test environment include at least one sender and at least one receiver, and the message is forwarded between the sender and the receiver through a message middleware, and the method includes:

[0005] The sender sends the message, wherein the message includes a first tag indicating the sender;

[0006] The message middleware receives the message and determines a receiver as a destination of the message from the receivers connected to the message middleware according to the first tag;

[0007] The recipient as the destination obtains the message via the message middleware.

[0008] In a possible implementation of the first aspect above, the message is a first message sent by a first sender of the first test environment, and the first message is acquired by a first receiver of the first test environment.

[0009] In a possible implementation of the first aspect above, the message is a second message sent by a second sender of the second test environment, and the second message is received by the first receiver in the first test environment or the second receiver in the second test environment based on the control of the message middleware.

[0010] In a possible implementation of the first aspect, a second sender in the second test environment sends the second message, and when the message middleware detects a second receiver as a message destination in the second test environment, the second message is acquired by the second receiver.

[0011] In a possible implementation of the first aspect above, a second sender in the second test environment sends the second message, and when the message middleware does not detect a second receiver as the message destination in the second test environment, the second message is acquired by a third receiver in the first test environment.

[0012] In a possible implementation of the first aspect above, a receiver as a message destination is determined from the receivers connected to the message middleware according to a first tag in the message, including: the message middleware determines the receiver as the message destination by matching a second tag included in the receiver with the first tag.

[0013] In a possible implementation of the first aspect above, the message middleware determines the receiver as the message destination by matching the second tag included by the receiver with the first tag, including: when the second tag of the receiver is the same as the first tag, the message middleware determines the receiver as the receiver as the message destination.

[0014] In a possible implementation of the first aspect above, the message middleware determines the receiver as the message destination by matching the second tag included in the receiver with the first tag, including: when the second tag and the first tag satisfy a preset conversion rule, the message middleware determines the receiver as the receiver as the message destination.

[0015] In a possible implementation of the first aspect above, after determining the destination of the message, the message middleware forwards the message to the receiver serving as the message destination.

[0016] In a possible implementation of the first aspect above, after determining the destination of the message, the receiver as the destination queries and obtains the message from the message middleware based on the second tag.

[0017] In a possible implementation of the first aspect above, the first tag and the second tag are added to a message header of the message.

[0018] In a possible implementation of the first aspect above, the first mark and the second mark are marked by modifying the switch and the message queue name through the message middleware.

[0019] In a possible implementation of the first aspect above, after the second message is acquired by a third receiver in the first test environment, when the message middleware detects a second receiver as the message destination in the second test environment, the second message is acquired again by the second receiver and idempotent processing is performed.

[0020] In a second aspect, an embodiment of the present application provides a message transmission method in a multi-test environment, which is used for an electronic device, wherein the multi-test environment includes a first test environment and a second test environment, and the first test environment and the second test environment include at least one sender and at least one receiver, and the message is forwarded between the sender and the receiver through a message middleware, and the device includes:

[0021] A sending module, wherein the sender sends the message, wherein the message includes a first mark indicating the sender;

[0022] A delivery module, wherein the message middleware receives the message and determines a recipient as a destination of the message from the recipients connected to the message middleware according to the first tag;

[0023] The receiving module, as the destination receiver, obtains the message via the message middleware.

[0024] In a possible implementation of the second aspect, the message is a first message sent by a first sender of the first test environment, and the first message is acquired by a first receiver of the first test environment.

[0025] In a possible implementation of the second aspect above, the message is a second message sent by a second sender of the second test environment, and the second message is received by the first receiver in the first test environment or the second receiver in the second test environment based on the control of the message middleware.

[0026] In a possible implementation of the second aspect, a second sender in the second test environment sends the second message, and when the message middleware detects a second receiver as a message destination in the second test environment, the second message is acquired by the second receiver.

[0027] In a possible implementation of the second aspect above, a second sender in the second test environment sends the second message, and when the message middleware does not detect a second receiver as the message destination in the second test environment, the second message is acquired by a third receiver in the first test environment.

[0028] In a possible implementation of the second aspect above, a receiver as a message destination is determined from the receivers connected to the message middleware according to a first tag in the message, including: the message middleware determines the receiver as the message destination by matching a second tag included in the receiver with the first tag.

[0029] In a possible implementation of the second aspect above, the message middleware determines the receiver as the message destination by matching the second tag included by the receiver with the first tag, including: when the second tag of the receiver is the same as the first tag, the message middleware determines the receiver as the receiver as the message destination.

[0030] In a possible implementation of the second aspect above, the message middleware determines the receiver as the message destination by matching the second tag included in the receiver with the first tag, including: when the second tag and the first tag satisfy a preset conversion rule, the message middleware determines the receiver as the receiver as the message destination.

[0031] In a possible implementation of the second aspect above, after determining the destination of the message, the message middleware forwards the message to the receiver serving as the destination of the message.

[0032] In a possible implementation of the second aspect above, after determining the destination of the message, the receiver as the destination queries and obtains the message from the message middleware based on the second tag.

[0033] In a possible implementation of the second aspect above, the first tag and the second tag are added to a message header of the message.

[0034] In a possible implementation of the second aspect, the first mark and the second mark are marked by modifying the switch and the message queue name through the message middleware.

[0035] In a possible implementation of the second aspect above, after the second message is acquired by a third receiver in the first test environment, when the message middleware detects a second receiver as the message destination in the second test environment, the second message is acquired again by the second receiver and idempotent processing is performed.

[0036] In a third aspect, an embodiment of the present application provides a message delivery device in a multi-test environment, wherein the message delivery device in the multi-test environment includes:

[0037] a memory for storing instructions to be executed by one or more processors of the system, and

[0038] The processor is one of the processors of the system, and is used to execute the instructions to implement any possible method of the first aspect mentioned above.

[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having instructions stored thereon, which, when executed on a computer, can enable the computer to execute any possible method of the first aspect described above.

[0040] Compared with the prior art, the present application has the following effects:

[0041] In the prior art, all asynchronous tests can only be done by one developer or tester, which greatly affects work efficiency. The message transmission method in a multi-test environment disclosed in this application enables each developer or tester to implement simultaneous testing of multiple services in his or her own test environment, greatly improving the efficiency of the test and effectively meeting the needs of developers and testers. At the same time, this method is only effective in the test environment and has no impact on the online environment. The risk is controllable and transparent to the user. No business code needs to be modified. It can be enabled by simply upgrading the middleware version. It is convenient, fast and efficient, and has good integration with the distributed remote call framework. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 According to some embodiments of the present application, an application scenario diagram of a message delivery method in a multi-test environment is shown;

[0043] Figure 2 According to some embodiments of the present application, a hardware structure block diagram of a message transmission method in a multi-test environment is shown;

[0044] Figure 3 According to some embodiments of the present application, a schematic diagram of a message transmission method in a multi-test environment is shown;

[0045] Figure 4 According to some embodiments of the present application, a flow chart of a message delivery method in a multi-test environment is shown;

[0046] FIG5 shows three different message delivery methods in a test process according to some embodiments of the present application;

[0047] Figure 6According to some embodiments of the present application, a schematic diagram of marking in the message middleware RabbitMQ is shown;

[0048] Figure 7 According to some embodiments of the present application, a schematic structural diagram of a message transmission device in a multi-test environment is shown. DETAILED DESCRIPTION

[0049] The illustrative embodiments of the present application include but are not limited to a message transmission method, apparatus, device and medium in a multi-test environment.

[0050] It can be understood that the message transmission method under the multi-test environment provided by the present application can be implemented on various electronic devices, including but not limited to servers, distributed server clusters consisting of multiple servers, mobile phones, tablet computers, laptop computers, desktop computers, wearable devices, head-mounted displays, mobile email devices, portable game consoles, portable music players, reader devices, personal digital assistants, virtual reality or augmented reality devices, televisions and other electronic devices in which one or more processors are embedded or coupled, etc.

[0051] It is understood that in each embodiment of the present application, the processor may be a microprocessor, a digital signal processor, a microcontroller, etc., and / or any combination thereof. According to another aspect, the processor may be a single-core processor, a multi-core processor, etc., and / or any combination thereof.

[0052] The embodiments of the present application will be described in further detail below in conjunction with the accompanying drawings.

[0053] Figure 1 According to some embodiments of the present application, a scenario diagram of message transmission in a multi-test environment is shown. Specifically, Figure 1 As shown, the message transmission method under multiple test environments is applied to a message transmission system under multiple test environments. The message transmission system under multiple test environments includes a terminal 110, a server 120, and a terminal 130. The terminal 110, the server 120, and the terminal 130 are connected via a network, and the network connection may include various connection types, such as wired, wireless communication links, clouds, or optical fiber cables, etc. The specific examples of the above-mentioned network may include the Internet provided by the communication providers of the terminal 110 and the terminal 130. The terminal 110 and the terminal 130 may also be connected in other ways, such as through a data line, so that the received audio can be transmitted to the terminal 110.

[0054] Terminal 110 and terminal 130 may be devices installed with messaging software in an end-to-end multi-test environment, specifically desktop terminals or mobile terminals. Mobile terminals may be, but are not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.

[0055] The server 120 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0056] First, a test environment is deployed on both the terminal 110 and the terminal 130. Developers or testers can test multiple services simultaneously on the terminal 110 and / or the terminal 130 based on the message transmission method in the multi-test environment, and each test is isolated from each other through asynchronous message transmission to maintain data stability. The terminal 110 and / or the terminal 130 sends the test requirement information to the server 120. The server 120 calls and configures the physical resources required by the test environment according to the test resource requirement information.

[0057] As an example, only two terminals are shown here, but the present application is not limited to this. Multiple test environments can be built on one terminal device, and multiple test environments can also be built on multiple terminals.

[0058] The following describes in detail some embodiments of the present application. Figure 1 The message transmission technical scheme under the multi-test environment of the scenario shown. The multi-test environment includes a public test environment (as an instance of the first test environment) and a personal test environment (as an instance of the second test environment), wherein the test environment can be deployed on the terminal 110 and / or the terminal 130, and the server 120 calls and configures the physical resources required by the test environment according to the test requirements on the terminal 110 and / or the terminal 130. The first test environment and the second test environment include at least one sender and at least one receiver, and the message is forwarded between the sender and the receiver through the message middleware. First, the sender sends a message including a first tag indicating the sender, and then the message middleware receives the message and determines the receiver as the message destination from the receivers connected to it according to the first tag in the message, and then the receiver as the destination obtains the message through the message middleware to complete the message transmission under the multi-test environment. The technical scheme in the present application, by adding a tag to the message, enables the receiver to receive the test message sent by the sender in the same test environment, thereby realizing the isolation of service calls between different test environments in the asynchronous environment of the message queue, so that each test can be carried out synchronously without interfering with each other.

[0059] The method implementation provided by the present application may be executed in the terminal 110 and / or the terminal 130. Figure 2According to some embodiments of the present application, a hardware structure block diagram of a message transmission method in a multi-test environment is shown. Figure 2 As shown, the terminal 110 (also applicable to the terminal 130) may include one or more (only one is shown in the figure) processors 111 (the processor 111 may include but is not limited to a central processing unit CPU, a graphics processor GPU, a digital signal processor DSP, a microprocessor MCU or a programmable logic device FPGA, etc.), an input and output interface 112 for interacting with a user, a memory 113 for storing data, and a transmission device 114 for communication functions. Those skilled in the art will understand that Figure 2 The structure shown is for illustration only and does not limit the structure of the above electronic device. Figure 2 More or fewer components as shown, or with Figure 2 Different configurations are shown.

[0060] The processor 111 executes various functional applications and data processing by running the software programs and modules stored in the memory 113 , that is, implements the message transmission method in the above-mentioned multi-test environment.

[0061] The input / output interface 112 may be connected to one or more displays, touch screens, etc., for displaying data transmitted from the terminal 110 , and may also be connected to a keyboard, stylus, touchpad and / or mouse, etc., for inputting user instructions such as selection, creation, and editing.

[0062] The memory 113 can be used to store software programs and modules of databases, queues, application software, such as program instructions / modules corresponding to the message delivery method under the multi-test environment in some embodiments of the present application. The memory 113 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 113 may further include a memory remotely arranged relative to the processor 111, and these remote memories may be connected to the terminal 110 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0063] The transmission device 114 is used to receive data transmitted by the server 120 to the server 120 via a network, which may include various connection types, such as wired, wireless communication links, clouds, or optical fiber cables, etc. The specific example of the above network may include the Internet provided by the communication provider of the terminal 110.

[0064] In some embodiments, there is only one public environment (the public environment is an instance of the first test environment), and the services in the public environment are relatively stable versions and should include all required services; there can be multiple personal environments (the personal environment is an instance of the second test environment), and when testing different services, a personal environment can be established. Each developer can have his own personal environment, and his personal environment generally only includes the services he is responsible for. For developers, if they only need to test the sender, they only need to deploy the sender in the test environment. If they need to test the receiver, they need to deploy both the sender and the receiver in the test environment.

[0065] According to an embodiment of the present application, both the public environment and the personal environment are connected to RocketMQ (which is an instance of the message middleware) for communication. In the process of RocketMQ message transmission, five roles are involved, namely, the sender (producer), the receiver (consumer), the message server (broker), the topic (topic) and the queue (queue). Among them, the sender is used to produce and send messages, and the senders who produce and send the same message for the same service are combined to obtain the sender group (Producer Group); the receiver is used to obtain the same message sent by the sender through RocketMQ, and supports receiving messages in both push and pull modes, and the receivers who receive the coupon message are combined to obtain the receiver group (Consumer Group); the message server is mainly responsible for the storage, delivery and query of messages and the high availability of services; the topic is a logical concept, composed of multiple queues, representing a class of messages, such as coupon messages in order services, logistics messages, payment messages, etc.; the queue is one of the shards of the topic on a message server divided into a specified number of copies, and is the basic unit of resource allocation in the load balancing process. A topic is composed of multiple queues, and multiple queues are evenly distributed on multiple message servers. Multiple topics can also be configured on a message server. In some embodiments, when developers need to test the coupon issuing service, one of the sub-services in the order service, the sender produces and sends the coupon issuing message to the same topic on the message server, and the receiver pulls the coupon issuing message from the same topic on the message server and consumes it.

[0066] Figure 3 Figure 1 shows a schematic diagram of message transmission in a multi-test environment. Figure 3As shown, the multiple test environments include a public environment and a personal environment, wherein the public environment includes sender 1, receiver 1 and receiver 2, and the personal environment includes sender 2, sender 3 and receiver 3. It is assumed that all senders and receivers are connected to the same topic of RocketMQ, and the same topic can be stored in different queues of different message servers.

[0067] Sender 1 sends message 1 with tag 1 to the topic of the message middleware; RocketMQ receives message 1. When RocketMQ finds receiver 1 that can be the destination receiver through tag 1 in message 1, receiver 1 receives message 1 sent by sender 1.

[0068] Sender 2 sends message 2 with tag 2 to the topic. When RocketMQ does not find the corresponding receiver from the receivers, RocketMQ forwards message 2 to the receiver in the public environment, and is received by receivers 1 and 2 in the public environment.

[0069] Sender 3 sends message 3 with tag 3 to the topic. When RocketMQ finds receiver 3 that can be the destination receiver in the personal environment, receiver 3 receives message 3 sent by sender 3.

[0070] Through the message transmission method in this application, the message sent in the personal environment can be received by the recipient in the same personal environment, and the business code does not need to be changed, thereby completing the isolation of service calls between different test environments based on asynchronous message transmission.

[0071] Figure 4 According to some embodiments of the present application, a flowchart of a message transmission method in a multi-test environment is shown.

[0072] like Figure 4 As shown, in some embodiments, the method may include:

[0073] Step 401: A sender sends a message with a first tag.

[0074] Specifically, in step 401, in some embodiments, the first mark or the second mark is implemented by adding a lane mark to the message header of the message. For example, an environment variable is added to the message header in the key_value mode, where the key is fixed, which is env. The env is an external command, and all environment variables and their values ​​can be listed through the program file / bin / env. The value can be customized within a range of no more than 20 bytes, such as fayouhuiquan, which means that the test environment is created to test the coupon issuance sub-service in the order service. In order to facilitate viewing the pinyin and full spelling definitions of the sub-service, users can also customize it according to their preferences. In some embodiments, when a developer needs to test the coupon issuance service, which is one of the sub-services in the order service, the sender sends a message with a message header marked with fayouhuiquan to the topic of the message middleware.

[0075] Step 402: The message middleware receives the message and determines a recipient as the destination according to the first tag.

[0076] Specifically, in step 402, RocketMQ receives the coupon message, and determines the recipient as the message destination from the recipients connected to RocketMQ based on whether the recipient's second tag matches the fayouhuiquan tag. Further, when any of the following conditions are met, the second tag is considered to match the first tag: when the recipient's second tag is the same as the first tag, that is, the second tag is also the environment variable of fayouhuiquan; when the second tag and the first tag meet the preset conversion rules, for example, when the sender sends a message with the first tag as fayouhuquan, the receiver's second tag is fayouhuiquan-1, that is, when the second tag is the first tag plus a suffix such as "-1", the preset conversion rule is met, the second tag is considered to match the first tag. For example, regular matching, specifically, when the second tag defined by the regular expression can be converted with the first tag, the two are considered to match. The above is only an exemplary explanation, and any method that meets the preset conversion rules can be used as a condition for the second tag to match the first tag.

[0077] Step 403: The recipient as the destination obtains the message via the message middleware.

[0078] Specifically, in step 403, in some embodiments, after RocketMQ determines the recipient as the message destination, it forwards the message with the fayouhuiquan tag to the recipient as the message destination, that is, the recipient is pushed to obtain the message with the fayouhuiquan tag. In some embodiments, the recipient can determine the message that matches it by querying RocketMQ whether the tag fayouhuiquan matches its second tag, and then obtain the message with the fayouhuiquan tag from RocketMQ, that is, the recipient actively pulls the message with the fayouhuiquan tag.

[0079] In the prior art, if the message is not marked, the message generated by the coupon service will be sent to the receivers of all sub-services in the order service, including the order service, SMS service, coupon service, payment service and other receivers, which not only makes the entire system complicated and disorderly, but also reduces the efficiency of the service. In more serious cases, it will cause a crash. Once the service is launched, users will not be able to get feedback in time, which seriously reduces the user experience. Through the technical solution in this application, message transmission in multiple test environments is realized, so that the isolation test of sub-services without mutual interference can be completed, which greatly improves the efficiency of the test. When the test is stable, it will be updated to the public environment for the next approval and launch process.

[0080] In the process of testing the sub-service, various situations may occur. The following is a detailed description of different message transmission situations that occur in the test process in conjunction with FIG. 5 .

[0081] FIG. 5 shows three different scenarios of message transmission during testing according to some embodiments of the present application. Figure 5a The case where the receiver exists only in the personal environment is shown. Figure 5a As shown in the figure, for the coupon service, a sub-service of the order service, the developer has developed a new function to send coupons to users after the order is completed. At this time, there is no coupon function in the original order service. Corresponding to the multi-test environment, there is no receiver corresponding to the coupon service in the public environment, so there is only a receiver in the developer's personal environment that can receive coupon messages. At this time, the developer will create a new receiver corresponding to the coupon activity when establishing the personal environment.

[0082] When the sender sends a message with the fayouhuiquan tag, RocketMQ, as the message middleware, receives the message and queries the receiver connected to it. It finds that the second tag of the receiver in the same personal environment as the sender is fayouhuiquan-1, and determines that it matches the fayouhuiquan tag, so the receiver is determined to be the destination receiver. Next, the destination receiver obtains the message with the fayouhuiquan tag, completes a message delivery, and then completes the test. When the service is stable and approved, it can be stabilized in the public environment and put into use as a coupon issuing sub-service of the online order service.

[0083] Figure 5b The case where there are only receivers in the public environment is shown. Figure 5b As shown in the figure, for the coupon issuing service, a sub-service of the order service, a stable test environment already exists in the public environment for issuing coupons worth RMB 10 off for spending RMB 200 or more after the order is completed. However, due to the needs of activities such as 618 and Double 11, developers need to issue coupons worth RMB 15 off for spending RMB 200 or more after the order is completed, that is, only the specific amount of the coupons is changed, but the type remains unchanged. At this point, the original order service already has the coupon issuing function, and the existing coupon issuing function can meet the new requirements after adjusting the parameters.

[0084] Corresponding to the multi-test environment, the existing receiver corresponding to the coupon issuing service in the public environment can realize the new coupon issuing service. Therefore, when the developer establishes a personal environment, he will correspond the existing receiver corresponding to the coupon issuing service in the public environment to the sender. When the sender sends a message with the fayouhuiquan200-15 tag, RocketMQ receives the message and queries the receiver connected to it. It is found that the second tag of the existing receiver corresponding to the coupon issuing service in the public environment is fayouhuiquan-1, which matches the fayouhuiquan200-15 tag. Therefore, the receiver as the destination receives the message with the fayouhuiquan200-15 tag, and the message transmission is completed without creating a new receiver, thereby completing the test.

[0085] Figure 5c The situation where the receiver exists in both a public environment and a personal environment is shown. Figure 5cAs shown in the figure, for the coupon issuing service, a sub-service of the order service, there is already a coupon in the public environment that gives customers a 10 yuan discount on purchases of 200 yuan or more. However, due to the needs of activities such as 618 and Double 11, developers need to issue a coupon for a 30% discount on purchases of three or more items to users after the order is completed, that is, the type of coupon issued has been changed. At this time, the existing coupon issuing function in the original order service can only provide discounts on purchases of three or more items, and cannot meet the new type of coupon issuing method of 30% discount on purchases of three or more items. Corresponding to the multi-test environment, the existing receiver corresponding to the coupon issuing service in the public environment cannot implement the new coupon issuing service. At this time, the developer needs to create a new receiver corresponding to the coupon activity when setting up the personal environment. When the sender sends a message with the fayouhuiquan3-7 tag, RocketMQ receives the message and queries the receiver connected to it. It is found that the second tag of the receiver in the same personal environment as the sender is fayouhuiquan3-7, which matches the fayouhuiquan3-7 tag. Therefore, the receiver obtains the message with the fayouhuiquan3-7 tag for the receiver as the destination, completes the message delivery, and then completes the test. When the service is stable and approved, it can be added to the coupon sub-service in the public environment, and the coupon sub-service of the online order service can be updated and put into use.

[0086] In some embodiments, the message middleware RocketMQ first detects whether there is a matching receiver in the same personal environment as the sender. If there is, the message is first delivered to the receiver. If not, the message is delivered to the receiver in the public environment. And, after being delivered to the receiver in the public environment, if it is detected that there is a matching receiver in the same personal environment as the sender, the message is delivered again to the matching receiver in the same personal environment as the sender. At this time, according to the configuration, the receiver may receive the message that has been received in the public environment, so the business side needs to perform idempotent processing.

[0087] In some embodiments, the first tag and the second tag are marked by modifying the switch and the message queue name through the message middleware.

[0088] Figure 6According to some embodiments of the present application, a schematic diagram of marking in the message middleware RabbitMQ is shown. In the prior art, senders in the personal environment and the public environment will send messages to different queues, thereby isolating the messages. Specifically, for the coupon service, a sub-service of the order service, when the developer updates the function of sending coupons to users after the order is completed, at this time, there is a coupon function in the original order service. When it corresponds to the multi-test environment, that is, when there are senders and receivers in the personal environment, the sender jiaxu_producer in the personal environment will send the message to the exchange by default ( Figure 6 In the personal environment, the receiver jiaxu_consumer will listen to the messages sent by the personal environment in the queue personal_jiaxu_queue by default. When the developer develops a new function to send coupons to users after the order is completed, there is no coupon function in the original order service. In the multi-test environment, that is, there is only a sender but no receiver in the personal environment, the sender jiaxu_producer in the personal environment will send the message to the exchange by default. Figure 6 exch) and through the alternate exchange (alternate exchange, Figure 6 In the example, the message is forwarded to another message queue queue1 (personal_jiaxu_exch1), and finally received by the receiver consumer1. That is, when there is no receiver in the personal environment, the message will be routed to the public environment. At this time, RabbitMQ, which is the message middleware, only serves as a transitional transfer function. The message is not filtered on the receiver side, but directly filtered in RabbitMQ, which improves the efficiency of the entire message transmission process and enhances the throughput of the system. Therefore, when the names of the exchanger and the message queue are marked, the message transmission in the personal environment can be realized. Furthermore, for fanout type messages, if there are 3 receivers, and only one receiver is established in the personal environment (the other two receivers are in the public environment), then the message will only be consumed by this receiver in the personal environment. In this case, all receivers related to fanout will be started in the personal environment.

[0089] In some embodiments, the message middleware may be, but is not limited to, RoMQ, RabbitMQ, ActiveMQ, or Kafka.

[0090] In the prior art, all asynchronous tests can only be done by one developer or tester, which greatly affects work efficiency. The message transmission method in a multi-test environment disclosed in this application enables each developer or tester to implement simultaneous testing of multiple services in his or her own test environment, greatly improving the efficiency of the test and effectively meeting the needs of developers and testers. At the same time, this method is only effective in the test environment and has no impact on the online environment. The risk is controllable and transparent to the user. No business code needs to be modified. It can be enabled by simply upgrading the middleware version. It is convenient, fast and efficient, and has good integration with the distributed remote call framework.

[0091] According to some embodiments of the present application, a message transmission device 700 in a multi-test environment is provided. Figure 7 According to some embodiments of the present application, a schematic diagram of the structure of a message transmission device in a multi-test environment is shown. Figure 7 As shown, the message transmission device 700 in the multi-test environment is as follows:

[0092] In the sending module 701, a sender sends a message with a first tag.

[0093] In the delivery module 702, the message middleware receives the message and determines the recipient as the destination according to the first tag.

[0094] The receiving module 703, as the destination receiver, obtains the message via the message middleware.

[0095] The first embodiment is a method implementation method corresponding to the present embodiment, and the present embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in the present embodiment, and are not repeated here to reduce repetition. Accordingly, the relevant technical details mentioned in the present embodiment can also be applied in the first embodiment.

[0096] A third embodiment of the present application relates to a message delivery device in a multi-test environment, comprising:

[0097] a memory for storing instructions to be executed by one or more processors of the system, and

[0098] The processor is one of the processors of the system, and is used to execute the instructions to implement any possible method of the first aspect mentioned above.

[0099] The first embodiment is a method implementation method corresponding to the present embodiment, and the present embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in the present embodiment, and are not repeated here to reduce repetition. Accordingly, the relevant technical details mentioned in the present embodiment can also be applied in the first embodiment.

[0100] The fourth embodiment of the present application relates to a computer storage medium encoded with a computer program, wherein instructions are stored on the computer-readable medium, and when the instructions are executed on a computer, the computer can execute any possible method of the first aspect described above.

[0101] The first embodiment is a method implementation method corresponding to the present embodiment, and the present embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in the present embodiment, and are not repeated here to reduce repetition. Accordingly, the relevant technical details mentioned in the present embodiment can also be applied in the first embodiment.

[0102] It should be noted that the various method implementations of the present application can be implemented in software, hardware, firmware, etc. Regardless of whether the present application is implemented in software, hardware, or firmware, the instruction code can be stored in any type of computer-accessible memory (e.g., permanent or modifiable, volatile or non-volatile, solid or non-solid, fixed or replaceable media, etc.). Similarly, the memory can be, for example, a programmable array logic (PAL), a random access memory (RAM), a programmable read-only memory (PROM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a disk, an optical disk, a digital versatile disc (DVD), etc.

[0103] It should be noted that the units / modules mentioned in the various device implementations of the present application are all logical units / modules. Physically, a logical unit can be a physical unit, or a part of a physical unit, or can be implemented as a combination of multiple physical units. The physical implementation of these logical units themselves is not the most important. The combination of functions implemented by these logical units is the key to solving the technical problems raised by the present application. In addition, in order to highlight the innovative parts of the present application, the above-mentioned device implementations of the present application do not introduce units that are not closely related to solving the technical problems raised by the present application, which does not mean that there are no other units in the above-mentioned device implementations.

[0104] It should be noted that in the claims and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0105] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be apparent to those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application.

Claims

1. A message transmission method in a multi-test environment, used in an electronic device, wherein: The multiple test environments include a first test environment and a second test environment, the first test environment and the second test environment include at least one sender and at least one receiver, the message is forwarded between the sender and the receiver through a message middleware, Characterized in that the method comprises: The sender sends the message, wherein the message includes a first tag indicating the sender; The message middleware receives the message and determines a receiver as a destination of the message from the receivers connected to the message middleware according to the first tag; The receiver as the destination obtains the message via the message middleware; The first mark is implemented by adding a swimlane mark to the message header of the message, or the first mark is marked by modifying the switch and message queue name through the message middleware.

2. The method according to claim 1, characterized in that: The message is a first message sent by a first sender of the first test environment, and the first message is acquired by a first receiver of the first test environment.

3. The method according to claim 1, characterized in that The message is a second message sent by a second sender in the second test environment, and the second message is received by a first receiver in the first test environment or a second receiver in the second test environment based on the control of the message middleware.

4. The method according to claim 3, characterized in that The method comprises: The second sender of the second test environment sends the second message, When the messaging middleware detects the second receiver as the message destination in the second test environment, the second message is acquired by the second receiver.

5. The method according to claim 3, characterized in that: The method comprises: The second sender of the second test environment sends the second message, In a case where the message middleware does not detect the second receiver as the message destination in the second test environment, the second message is acquired by a third receiver in the first test environment.

6. The method according to claim 1, characterized in that Determining a receiver as a message destination from the receivers connected to the message middleware according to the first tag in the message includes: The message middleware determines the recipient as the message destination by matching the second tag included in the recipient with the first tag; The second mark is implemented by adding a swimlane mark to the message header of the message, or the second mark is marked by modifying the switch and message queue name through the message middleware.

7. The method according to claim 6, characterized in that The message middleware determines the recipient as the message destination by matching the second tag included in the recipient with the first tag, including: In a case where the second tag of the receiver is the same as the first tag, the message middleware determines the receiver as the receiver serving as the message destination.

8. The method according to claim 6, characterized in that The message middleware determines the recipient as the message destination by matching the second tag included in the recipient with the first tag, including: In the case that the second tag and the first tag satisfy a preset conversion rule, the message middleware determines the receiver as the receiver serving as the message destination.

9. The method according to claim 1, characterized in that: After determining the destination of the message, the message middleware forwards the message to the receiver serving as the destination of the message.

10. The method according to claim 6, characterized in that After determining the destination of the message, the receiver as the destination queries and obtains the message from the message middleware based on the second tag.

11. The method according to claim 4, characterized in that After the second message is acquired by the third receiver in the first test environment, when the message middleware detects the second receiver as the message destination in the second test environment, the second message is acquired by the second receiver again and idempotent processing is performed.

12. A message transmission device in a multi-test environment, wherein: The multiple test environments include a first test environment and a second test environment, the first test environment and the second test environment include at least one sender and at least one receiver, the message is forwarded between the sender and the receiver through a message middleware, Characterized in that the device comprises: A sending module, wherein the sender sends the message, wherein the message includes a first tag indicating the sender; A delivery module, wherein the message middleware receives the message and determines a recipient as a destination of the message from the recipients connected to the message middleware according to the first tag; A receiving module, a receiver as a destination, obtains the message via the message middleware; The first mark is implemented by adding a swimlane mark to the message header of the message, or the first mark is marked by modifying the switch and message queue name through the message middleware.

13. A message delivery device in a multi-test environment, characterized in that: include: a memory for storing instructions to be executed by one or more processors of the system, and The processor is one of the processors of the system, and is used to execute the instructions to implement the message transmission method in the multi-test environment according to any one of claims 1-11.

14. A computer-readable storage medium encoded with a computer program, characterized in that The computer-readable medium stores instructions, which, when executed on a computer, enable the computer to execute the message transmission method in a multi-test environment according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Method for performing real-time communication between manufacturing execution system (MES) and process control system (PCS) and middleware

    CN102006309A

  • Message distribution method and device, electronic equipment and medium

    CN110347520A