Routing method, system, storage medium and computer device

By combining a dynamic configuration center and a consistent hash ring, the problem of inflexible configuration of mail receiving routing rules in existing technologies is solved, enabling dynamic updates and load balancing of mail receiving service instances and improving the processing efficiency of scheduled tasks.

CN116471254BActive Publication Date: 2026-02-13SHENZHEN XIAOMAN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310365632.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-30
Publication Date
2026-02-13
Estimated Expiration
2043-03-30

AI Technical Summary

Technical Problem

The existing incoming mail routing solution's routing rules are configured in a local configuration file and cannot be dynamically updated, resulting in inflexible expansion and wasted time and effort.

Method used

By obtaining the routing rules published by the dynamic configuration center, the receiving service instance is dynamically configured, the latest receiving service instance is determined by the consistent hash ring, and the scheduled task processing is updated when necessary to avoid redeploying the service version.

Benefits of technology

It enables dynamic configuration updates for mail receiving service instances, providing flexible configuration, saving time and effort, load balancing, and improving the processing efficiency of scheduled tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116471254B_ABST
    Figure CN116471254B_ABST
Patent Text Reader

Abstract

Embodiments of the application disclose a routing method, which comprises: obtaining a routing rule released by a dynamic configuration center; obtaining a latest receiving service instance according to the routing rule; judging whether the latest receiving service instance is same as a current receiving service instance; when the latest receiving service instance is same as the current receiving service instance, starting a timing task of a mailbox by using the current receiving service instance; and when the latest receiving service instance is different from the current receiving service instance, starting the timing task of the mailbox by using the latest receiving service instance. The application realizes dynamic configuration update of the receiving service instance by obtaining a new routing rule, so that the configuration update of the mailbox is more flexible and time-saving. Embodiments of the application also disclose a routing system, a computer readable storage medium and a computer device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of email task management technology, and more particularly to a routing method, system, storage medium, and computer device. Background Technology

[0002] In existing technologies, mail receiving routing schemes can be compared to the hash slot allocation scheme in Redis Cluster. Each mail receiving service node takes over a portion of the hash slots, and then determines which node to start a scheduled task to process the mail by calculating the hash value of the email ID. However, the routing rules in existing mail receiving routing schemes cannot be dynamically updated in local configuration files. Adding or removing nodes requires modifying the configuration, necessitating a redeployment of the service version. This makes the configuration inflexible, time-consuming, labor-intensive, and difficult to scale. Summary of the Invention

[0003] Therefore, it is necessary to propose a routing method, system, storage medium, and computer device to address the aforementioned problems. This application achieves dynamic configuration updates of the mail receiving service instance by obtaining new routing rules, making mailbox configuration updates more flexible and saving time and effort.

[0004] A routing method, the method comprising:

[0005] Retrieve routing rules published by the dynamic configuration center;

[0006] The latest mail receiving service instance is obtained based on the routing rules; it is then determined whether the latest mail receiving service instance is the same as the current mail receiving service instance.

[0007] When the latest mail receiving service instance is the same as the current mail receiving service instance, start the mailbox's scheduled task using the current mail receiving service instance; and,

[0008] When the latest mail receiving service instance is different from the current mail receiving service instance, start the scheduled task of the mailbox using the latest mail receiving service instance.

[0009] Optionally, the latest mail receiving service instance is obtained according to the routing rules, specifically including:

[0010] Determine whether there are any conflicts among the first receiving service instances contained in the routing rules published by the dynamic configuration center;

[0011] When there are conflicts among several first mail receiving service instances, a consistent hash ring is constructed based on multiple first mail receiving service instances;

[0012] The latest mail receiving service instance is obtained based on the consistent hash ring.

[0013] Optionally, before retrieving the routing rules published by the dynamic configuration center, the following steps are also included:

[0014] Register the mail service instance in the registration center;

[0015] Obtain a mail service instance list from the registration center, the mail service instance list including a plurality of mail service instances.

[0016] Optionally, before obtaining the routing rules published by the dynamic configuration center, further comprising:

[0017] Listen to whether the service list of the dynamic configuration center is updated, the service list including a plurality of routing rules;

[0018] When the service list is updated, all the mail service instances in the mail service instance list obtain the routing rules published by the dynamic configuration center.

[0019] Optionally, judging whether the latest mail service instance is same as the current mail service instance, specifically comprising:

[0020] According to the latest mail service instance, scanning a mailbox list, the mailbox list including a plurality of mailbox information of mailboxes;

[0021] According to the mailbox information, judging whether the latest mailbox requiring to start a timing task is same as the current mailbox requiring to start a timing task;

[0022] When the latest mailbox requiring to start a timing task is same as the current mailbox requiring to start a timing task, determining that the latest mail service instance is same as the current mail service instance;

[0023] When the latest mailbox requiring to start a timing task is different from the current mailbox requiring to start a timing task, determining that the latest mail service instance is different from the current mail service instance.

[0024] Optionally, starting the timing task of the mailbox by using the current mail service instance, specifically comprising:

[0025] Judging whether the timing task of the mailbox is started;

[0026] When the timing task of the mailbox is not started, starting the timing task of the mailbox.

[0027] Optionally, starting the timing task of the mailbox by using the latest mail service instance, specifically comprising:

[0028] According to the mailbox information, judging whether the timing task of the mailbox is started by using the latest mail service instance;

[0029] When the timing task of the mailbox is not started by using the latest mail service instance, judging whether the timing task of the mailbox is started;

[0030] When the timing task of the above mailbox is started, closing the timing task;

[0031] When the mailbox starts a timing task by using the latest mail receiving service instance, the timing task of the mailbox is started.

[0032] A routing system, the system comprising:

[0033] An acquisition module is configured to acquire a routing rule published by a dynamic configuration center.

[0034] A receiving module is configured to obtain a latest mail receiving service instance according to the routing rule.

[0035] A judging module is configured to judge whether the latest mail receiving service instance is the same as a current mail receiving service instance.

[0036] A first starting module is configured to start a timing task of the mailbox by using the current mail receiving service instance when the latest mail receiving service instance is the same as the current mail receiving service instance.

[0037] A second starting module is configured to start the timing task of the mailbox by using the latest mail receiving service instance when the latest mail receiving service instance is different from the current mail receiving service instance.

[0038] A computer readable storage medium stores a computer program, and the computer program is executed by a processor to make the processor execute steps of any one of the methods.

[0039] A computer device comprises a memory and a processor, and the memory stores a computer program, and the computer program is executed by the processor to make the processor execute steps of any one of the methods.

[0040] The embodiments of the present application have the following beneficial effects:

[0041] The routing rule published by the dynamic configuration center is acquired, the latest mail receiving service instance is obtained according to the routing rule, it is judged whether the latest mail receiving service instance is the same as the current mail receiving service instance, the timing task is started according to the current mail receiving service instance to process the timing mail receiving when the latest mail receiving service instance is the same as the current mail receiving service instance, the latest mail receiving service instance is cached, and the timing task is started according to the latest mail receiving service instance to process the timing mail receiving when the latest mail receiving service instance is different from the current mail receiving service instance, so that the version of the service instance does not need to be republished, the dynamic configuration update of the mail receiving service instance can be realized only by updating the routing rule, the configuration is flexible, time and labor are saved, the new routing rule is more in line with the current situation, the load of each service node can be more balanced, and the processing efficiency of the timing task of the mail is effectively improved. BRIEF DESCRIPTION OF DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings described below only show some of the embodiments of the present application, and all other drawings obtained by those of ordinary skill in the art without creative effort based on these drawings also belong to the protection scope of the present application.

[0043] In the above embodiments of the present application, the following steps are included.

[0044] Figure 1 The flow chart of the routing method in the first embodiment of the present application;

[0045] Figure 2 The flow chart of step S102 in the first embodiment of the present application;

[0046] Figure 3 The sub-flow chart of the routing method in the second embodiment of the present application;

[0047] Figure 4 The sub-flow chart of the routing method in the third embodiment of the present application;

[0048] Figure 5 The flow chart of step S103 in the first embodiment of the present application;

[0049] Figure 6 The flow chart of step S104 in the first embodiment of the present application;

[0050] Figure 7 The flow chart of step S105 in the first embodiment of the present application;

[0051] Figure 8 The schematic diagram of the routing system in the first embodiment of the present application;

[0052] Figure 9 The structural schematic diagram of the computer device in the first embodiment of the present application. DETAILED DESCRIPTION

[0053] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort belong to the protection scope of the present application.

[0054] Please refer to Figure 1 The flow chart of the routing method in the first embodiment of the present application; in which, the routing method provided by the embodiments of the present application specifically includes the following steps.

[0055] When the result of the routing is the same as the current instance of the receiving service, the current instance of the receiving service starts a timing task to process the timing receiving and saves the timing task; and when the routing is not the same as the current instance of the receiving service, it is further determined whether the current instance of the receiving service has started a timing task, and if so, the timing task is closed and deleted.

[0056] In step S101, a routing rule published by a dynamic configuration center is obtained. In the embodiment, a Name and Config Service (Nacos) platform is used as the configuration center. Further, the Nacos is also used as a service registry center to implement the registration and discovery of services. Some enterprises have contributed a sub-project called SpringCloud Alibaba to SpringCloud, which includes several basic components in microservice development, and the Nacos is a technology in the project. The Nacos dynamic configuration realizes the configuration of a custom routing rule (RouteConfig), which can realize the configuration of rules at the granularity of a client ID, a user ID and an email, and specifically, the routing target can be a single instance of a receiving service (Instance) or a list of multiple instances (Instance) of a certain cluster, and the routing rule (RouteConfig) is listened to and updated in real time. The receiving service node obtains the routing rule published by the dynamic configuration center.

[0057] In the embodiment, the Nacos has the functions of the dynamic configuration center and the service registry center, which can reduce the dependent components. The Nacos registry center function implements the registration and online-offline listening of services. When the instance of the receiving service is started, it is registered to the Nacos registry center, and all instances of the receiving service are listened to. When all the instances are online, each instance of the receiving service pulls the list of all instances of the receiving service from the Nacos registry center to build the same consistent hash ring, and the consistent hash algorithm can realize the multi-instance node load balancing effect more obviously, which is convenient for subsequent updating of the routing rule.

[0058] In some feasible embodiments, the dynamic configuration center can also use apollo. The service registry center can use Eureka or zookeeper, etc.

[0059] Step S102, obtaining the latest receiving service instance according to the routing rule. In the embodiment, the receiving service node obtains the latest receiving service instance according to the routing rule. The receiving service instance corresponds to the mailbox. When the mailbox configuration is matched to multiple receiving service instances through the routing rule (RouteConfig), the latest receiving service instance is found through the consistent hash ring built by the multiple receiving service instances, the final consistent routing is realized, and the timing task processing receiving of the mail is started on the finally determined receiving service instance. In the embodiment, a final receiving service instance (Instance) is determined, which is the latest receiving service instance.

[0060] Step S103, judging whether the latest receiving service instance is the same as the current receiving service instance. In the embodiment, it is needed to judge whether the new receiving service instance obtained according to the latest routing rule is the current receiving service instance. For details, please refer to step S1031-step S1034.

[0061] Step S104, when the latest receiving service instance is the same as the current receiving service instance, starting the timing task of the mailbox by using the current receiving service instance. In the embodiment, when the latest receiving service instance is the same as the current receiving service instance, it is indicated that the current receiving service instance is the latest receiving service instance, and no change is needed. Therefore, the timing task is started to process the timing receiving according to the current receiving service instance. For details, please refer to step S1041-step S1042.

[0062] Step S105, when the latest receiving service instance is different from the current receiving service instance, starting the timing task of the mailbox by using the latest receiving service instance. In the embodiment, the timing receiving task of the i-th mailbox configuration is started, and the task is saved to the cache area. Further, it is judged whether there is the previous timing receiving task of the mailbox in the cache area. If yes, the timing task of the mailbox in the cache area is cleared, and the timing receiving task is stopped. For details, please refer to step S1051-step S1054.

[0063] In the above embodiment, the route rule published by the dynamic configuration center is acquired, the latest receiving service instance is obtained according to the route rule, it is judged whether the latest receiving service instance is same as the current receiving service instance, when the latest receiving service instance is same as the current receiving service instance, the timer task is started according to the current receiving service instance to process the timed receiving, when the latest receiving service instance is not same as the current receiving service instance, the latest receiving service instance is cached, and the timer task is started according to the latest receiving service instance to process the timed receiving, the technical scheme does not need to republish the version of the service instance, and only by updating the route rule, the dynamic configuration update of the receiving service instance can be realized, the configuration is flexible, time and labor are saved, the new route rule is more in line with the current situation, the load of each service node can be more balanced, and the processing efficiency of the timer task is effectively improved.

[0064] Please refer to Figure 2 which is a flowchart of step S102 in the first embodiment of the application. In step S102, the latest receiving service instance is obtained according to the route rule, and the step specifically includes the following steps.

[0065] In step S1021, it is judged whether there is a conflict between a plurality of first receiving service instances contained in the route rule published by the dynamic configuration center. In the embodiment, it is judged whether there is a same mailbox between the plurality of first receiving service instances.

[0066] In step S1022, when there is a conflict between the plurality of first receiving service instances, a consistent hash ring is constructed according to the plurality of first receiving service instances. Specifically, when there is a same mailbox between two or more first receiving service instances.

[0067] In step S1023, the latest receiving service instance is obtained according to the consistent hash ring. Specifically, the closest receiving service instance on the consistent hash ring is selected as the latest receiving service instance.

[0068] Specifically, first, the Nacos dynamic configuration center pulls all the receiving service instance lists to construct a consistent hash ring. The receiving service center pulls the route configuration from the Nacos dynamic configuration center and listens to the configuration change. A timer task of pulling the mailbox configuration list is started, the interval is N minutes, all the mailbox configuration lists are pulled, and the iteration starts from the i=1th. Further, the self-defined rule configuration of the dynamic configuration technology of Nacos is flexible, simple and easy to use, the granularity can be large or small, the route switching is convenient, and different levels of gray policies can be supported.

[0069] In the embodiment, the mail receiving service is also associated with other associated services, for example, mailbox account configuration adding, deleting and modifying, mailbox configuration parameter querying and the like. Specifically, according to the instruction of the client, the specified mailbox is added to the specified mail receiving service. All mailbox configuration records are queried and pulled. The mailbox configuration parameter is related to a Relational Database Service (RDS). The RDS database is an online database service which is easy to use, stable and reliable, and can be elastically scaled. The RDS database is used to store the mailbox configuration record. One mailbox account corresponds to one configuration record. The above embodiment can effectively control the mail processing flow, so that each service instance is optimally utilized, and the timing task of each mailbox can be smoothly executed.

[0070] Please refer to Figure 3 which is a flowchart of the routing method in the second embodiment of the application. The difference between the routing method provided by the second embodiment and the routing method provided by the first embodiment is that before the routing rule published by the dynamic configuration center is obtained, the routing method provided by the embodiment of the application specifically includes the following steps.

[0071] In step S301, the mail receiving service instance is registered in the registration center. In the embodiment, each service instance needs to be registered in the registration center before being subsequently assigned for use.

[0072] In step S302, the mail receiving service instance list is obtained from the registration center. The mail receiving service instance list includes a plurality of mail receiving service instances. In the embodiment, when one mail receiving service instance is obtained from the registration center, the mail receiving service instance is the latest mail receiving service instance. When a plurality of mail receiving service instances are obtained from the registration center, the optimal mail receiving service instance is determined as the latest mail receiving service instance by using a consistent hash ring.

[0073] In the embodiment, when one mail receiving service instance is obtained from the registration center, the mail receiving service instance is the latest mail receiving service instance. When a plurality of mail receiving service instances are obtained from the registration center, the optimal mail receiving service instance is determined as the latest mail receiving service instance by using a consistent hash ring. The mail receiving service instance can be ensured to run in an optimal manner, and the mailbox starting the mail receiving task on the current service instance can be ensured to start the timing mail receiving task on time.

[0074] Please refer to Figure 4 which is a flowchart of the routing method in the third embodiment of the application. The difference between the routing method provided by the third embodiment and the routing method provided by the first embodiment is that before the routing rule published by the dynamic configuration center is obtained, the routing method provided by the embodiment of the application specifically includes the following steps.

[0075] Step S401, listen to whether the service list of the dynamic configuration center is updated, and the service list includes a plurality of routing rules.

[0076] Step S402, when the service list is updated, all the receiving service instances in the receiving service instance list acquire the routing rules published by the dynamic configuration center.

[0077] In the embodiment, the gray release is used to update the routing rules, wherein the gray release, also known as canary release, is a release method between black and white, which can be smoothly transitioned. The receiving service listens to whether the service list of the configuration center is updated, and when the service list is updated, all the receiving service instances acquire the routing rules published by the dynamic configuration center. The gray release can ensure the stability of the whole system, and problems can be found and adjusted at the initial gray release time to ensure the influence degree, which will not affect other routing rules being implemented.

[0078] In the above embodiment, the gray release method is used to update the routing rules, which can smoothly handle the influence of the routing rule update on the receiving service instances being implemented, and ensure that other receiving service instances are not affected when the routing rules are issued.

[0079] Please refer to Figure 5 which is a flowchart of step S103 in the first embodiment of the present application. In step S103, it is judged whether the latest receiving service instance is the same as the current receiving service instance, which specifically includes the following steps.

[0080] Step S1031, the mailbox list is scanned according to the latest receiving service instance, and the mailbox list includes the mailbox information of a plurality of mailboxes. Specifically, the mailbox information includes the address of the mailbox and which receiving service instance needs to be started by the mailbox. The mailbox list contains 100,000 pieces of mailbox information, and the latest receiving service instance scans the 100,000 pieces of mailbox information in turn. Further, the latest receiving service instance scans the mailbox list is a timing task, and ten minutes is set as the time for scanning the mailbox list once. In the embodiment, the data is only used as an example and is not limited.

[0081] Step S1032, it is judged whether the latest mailbox needing to start the timing task is the same as the current mailbox needing to start the timing task according to the mailbox information. Specifically, it is judged whether the timing receiving task of the mailbox is started by the latest receiving service instance according to all the mailbox information obtained by scanning.

[0082] Step S1033, when the latest mailbox needing to start the timing task is the same as the current mailbox needing to start the timing task, it is determined that the latest receiving service instance is the same as the current receiving service instance. Specifically, when the timing receiving task of all the mailboxes is started by the latest receiving service instance, it is determined that the latest receiving service instance is the same as the current receiving service instance.

[0083] Step S1034, when the mailbox that needs to start the latest timing task is different from the mailbox that needs to start the current timing task, it is determined that the latest mail service instance is different from the current mail service instance. Specifically, when the timing mail task of a mailbox is not started by the latest mail service instance, it is determined that the latest mail service instance is different from the current mail service instance.

[0084] In the embodiment, the mailbox information is stored in the RDS database, and the latest mailbox information of the plurality of timing tasks in the latest mail service instance is obtained. The mailbox information includes the mailbox ID and the mailbox ID hash value, and the configuration information of the mailbox is found from the RDS database according to the mailbox ID. Further, the mailbox ID, the mailbox ID hash value and the configuration information of the current mailbox are obtained. Whether the information contained in the latest mailbox information and the current mailbox information is consistent is compared respectively. In some embodiments, part of the information in the mailbox can be compared according to the needs, for example, the configuration parameters of the mailbox, the hash value of the mailbox ID, etc. All parameters of the mailbox obtained can also be compared. The mailbox information to be compared is set according to the needs. The parameters appearing here are only examples and are not limited. When the latest mailbox information is consistent with the current mailbox information, it indicates that the plurality of timing tasks in the latest mail service instance is the same as the plurality of timing tasks in the current mail service instance, and further indicates that the latest mail service instance is the same as the current mail service instance. When the latest mailbox information is inconsistent with the current mailbox information, it is determined that the plurality of timing tasks in the latest mail service instance is different from the plurality of timing tasks in the current mail service instance, and further indicates that the latest mail service instance is different from the current mail service instance.

[0085] In the above embodiment, the registration center function of Nacos listens to the online and offline of the instance, and cooperates with the known number of instances. Even if an instance is offline or restarted due to service upgrade, it does not affect other running instance nodes, and the influence of restarting during service upgrade is minimized.

[0086] In the above embodiment, it is ensured that each mailbox that starts the timing mail task is controlled by a unique mail service instance, so as to prevent multiple service instances from controlling a mailbox, resulting in that the timing mail task of the mailbox cannot be successfully performed.

[0087] Please refer to Figure 6 which is a flowchart of step S104 in the first embodiment of the application. In step S104, the timing task of the mailbox is started by the current mail service instance, which specifically includes the following steps.

[0088] Step S1041, it is determined whether the timing task of the mailbox has been started.

[0089] Step S1042, when the mailbox's timing task is not started, starting the mailbox's timing task.

[0090] In the above embodiment, when the latest incoming mail service instance has been started, firstly scanning whether the timing task of the mailbox which is responsible by the latest incoming mail service instance has been started, when the mailbox's timing task is not started, starting the mailbox's timing task; when the mailbox's timing task has been started, keeping the timing task started state, and no other processing is done.

[0091] Please refer to Figure 7 which is the flow chart of step S105 in the first embodiment of the present application. In step S105, starting the mailbox's timing task by the latest incoming mail service instance, which specifically includes the following steps.

[0092] Step S1051, judging whether the mailbox starts the timing task by the latest incoming mail service instance according to the mailbox information.

[0093] Step S1052, when the mailbox does not start the timing task by the latest incoming mail service instance, judging whether the mailbox has started the timing task.

[0094] Step S1053, when the above mailbox has started the timing task, closing the timing task.

[0095] Step S1054, when the mailbox starts the timing task by the latest incoming mail service instance, starting the mailbox's timing task.

[0096] In the above embodiment, when the latest incoming mail service instance has been started but the latest incoming mail service instance is not the current incoming mail service instance, firstly scanning whether the timing task of the mailbox which is not responsible by the latest incoming mail service instance has been started, when the mailbox's timing task is not started, no processing is done; when the mailbox's timing task has been started, closing the mailbox's timing task. When the mailbox starts the timing task according to the latest incoming mail service instance, starting the mailbox's timing task according to step S1041-step S1042.

[0097] The above embodiment ensures that one mailbox is controlled by one incoming mail service instance, ensures the dynamic configuration update of the incoming mail service instance, the configuration is flexible, time and labor are saved, the new routing rule is more in line with the current situation, which can make the load of each service node more balanced, and effectively improve the processing efficiency of the mail timing task.

[0098] Please refer to Figure 8 The embodiment of the present application also provides a routing system 800, which comprises an acquisition module 810, a receiving module 820, a judging module 830, a first starting module 840 and a second starting module 850.

[0099] The acquisition module 810 is configured to acquire a routing rule published by a dynamic configuration center.

[0100] The receiving module 820 is configured to obtain a latest mail receiving service instance according to the routing rule.

[0101] The judging module 830 is configured to judge whether the latest mail receiving service instance is the same as a current mail receiving service instance.

[0102] The first starting module 840 is configured to start a timing task of the mailbox by using the current mail receiving service instance when the latest mail receiving service instance is the same as the current mail receiving service instance.

[0103] The second starting module 850 is configured to start the timing task of the mailbox by using the latest mail receiving service instance when the latest mail receiving service instance is different from the current mail receiving service instance.

[0104] The above embodiment does not need to republish a version of a mail receiving service instance, and can realize dynamic configuration update of the mail receiving service instance by only updating a routing rule, is flexible in configuration, saves time and effort, a new routing rule is more in line with a current situation, can make a load of each service node more balanced, and effectively improves processing efficiency of a timing task.

[0105] The embodiment of the application further provides a computer readable storage medium which stores a computer program, and the computer program is executed by a processor to make the processor execute steps of any one of the above methods. Specifically, the program can be stored in a non-volatile computer readable storage medium, and the program can include the flow of the above method when executed. Any reference to memory, storage, database or other medium used in each embodiment provided by the application can include non-volatile and / or volatile memory. The non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. The volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM) and memory bus dynamic RAM (RDRAM).

[0106] Please refer to Figure 9Fig. 9 is a schematic diagram of an internal structure of a computer device in one embodiment. The computer device 900 includes a memory 910 and a processor 920. The memory 910 stores a computer program. The computer program is executed by the processor 920 to cause the processor 920 to perform the steps of any of the above methods.

[0107] The computer device 900 further includes the processor 920, the memory 910 and a network interface 940 connected by a system bus 930. The memory 910 includes a nonvolatile storage medium and an internal memory. The nonvolatile storage medium of the computer device 900 stores an operating system and can further store a computer program. The computer program is executed by the processor 920 to cause the processor 920 to implement the routing method. The internal memory 910 can also store a computer program. The computer program is executed by the processor to cause the processor to perform the routing method.

[0108] The memory 910 includes at least one type of computer readable storage medium including a flash memory, a hard disk, a multimedia card micro type memory, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. The memory 910 can be an internal storage unit of the computer device 900 in some embodiments, such as a hard disk of the computer device 900. The memory 910 can also be an external storage device of the computer device 900 in other embodiments, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD), a flash card, etc. Further, the memory 910 can include both an internal storage unit and an external storage device of the computer device 900. The memory 910 can be used to store application software and various data installed in the computer device 900, such as a computer program of the routing method, and can also be used to temporarily store data that has been output or will be output, such as data generated by the routing method. The processor 920 can be a central processing unit (CPU) in some possible embodiments, and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0109] Specifically, the processor 920 executes a computer program of the routing method to control the computer device 900 to implement the routing method.

[0110] Further, the computer device 900 can also include a system bus 930 which can be a peripheral component interconnect (PCI) bus or 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 ease of representation, Figure 9 In the figure, only one thick line is used to represent, but it does not mean that there is only one bus or one type of bus.

[0111] Specifically, the computer device 900 can also include a network interface 940 which can optionally include a wired network interface and / or a wireless network interface (such as a WI-FI network interface, a Bluetooth network interface, etc.), and is usually used to establish a communication connection between the computer device 900 and other devices, for example, a communication connection between the computer device 900 and the waveform display device.

[0112] In some other possible embodiments, the computer device 900 can also include a display component (not shown in the figure). The display component can be an LED (Light Emitting Diode) display, a liquid crystal display, a touch liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, etc. Among them, the display component can also be appropriately called a display device or a display unit, which is used to display information processed in the computer device 900 and to display a visualized user interface.

[0113] Figure 9 Only the computer device 900 with components 910-940 and implementing the routing method is shown, and those skilled in the art can understand that, Figure 9 The structure shown does not constitute a limitation on the computer device 900, and can include fewer or more components than shown, or combine certain components, or different component arrangements. Since the computer device 900 adopts all the technical solutions of the above-mentioned embodiments, it at least has all the beneficial effects brought by the technical solutions of the above-mentioned embodiments, which will not be repeated here.

[0114] In addition, the method according to the present application can also be implemented as a computer program or a computer program product, which includes computer program code instructions for executing part or all of the steps in the above-mentioned method of the present application.

[0115] Any combination of the technical features in the above embodiments can be made. For the sake of brevity, the foregoing description has not described all possible combinations of the technical features in the above embodiments. However, as long as the combination of the technical features does not contradict, it should be considered within the scope of the present disclosure.

[0116] The above embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the patent scope of the present application. It should be pointed out that, for ordinary skilled persons in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the patent protection scope of the present application should be subject to the appended claims.

Claims

1. A routing method characterized by, The method comprises: obtaining a routing rule published by a dynamic configuration center; obtaining a latest receiving service instance according to the routing rule; judging whether the latest receiving service instance is the same as a current receiving service instance; when the latest receiving service instance is the same as the current receiving service instance, starting a timing task of a mailbox by using the current receiving service instance; and when the latest receiving service instance is different from the current receiving service instance, starting the timing task of the mailbox by using the latest receiving service instance. The judgment of whether the latest receiving service instance is the same as the current receiving service instance comprises: scanning a mailbox list according to the latest receiving service instance, the mailbox list comprising mailbox information of a plurality of mailboxes; judging whether a latest mailbox needing to start a timing task is the same as a current mailbox needing to start a timing task according to the mailbox information; when the latest mailbox needing to start a timing task is the same as the current mailbox needing to start a timing task, judging that the latest receiving service instance is the same as the current receiving service instance; 2. The routing method of claim 1, wherein, when the latest mailbox needing to start a timing task is different from the current mailbox needing to start a timing task, judging that the latest receiving service instance is different from the current receiving service instance. The obtaining of the latest receiving service instance according to the routing rule comprises: judging whether there is a conflict among a plurality of first receiving service instances contained in the routing rule published by the dynamic configuration center; when there is a conflict among the plurality of first receiving service instances, constructing a consistent hash ring according to the plurality of first receiving service instances; 3. The routing method of claim 1, wherein, obtaining the latest receiving service instance according to the consistent hash ring. Before the obtaining of the routing rule published by the dynamic configuration center, the method further comprises: registering a receiving service instance in a registration center; 4. The routing method of claim 3, wherein, obtaining a receiving service instance list from the registration center, the receiving service instance list comprising a plurality of receiving service instances. Before the obtaining of the routing rule published by the dynamic configuration center, the method further comprises: listening to whether a service list of the dynamic configuration center is updated, the service list comprising a plurality of routing rules; 5. The routing method of claim 1, wherein, when the service list is updated, all receiving service instances in a receiving service instance list obtain the routing rule published by the dynamic configuration center. The starting of the timing task of the mailbox by using the current receiving service instance comprises: judging whether the timing task of the mailbox has been started; 6. The routing method of claim 1, wherein, when the timing task of the mailbox has not been started, starting the timing task of the mailbox. The starting of the timing task of the mailbox by using the latest receiving service instance comprises: judging whether the mailbox starts a timing task by using the latest receiving service instance according to the mailbox information; when the mailbox does not start the timing task by using the latest receiving service instance, judging whether the mailbox has started the timing task; when the mailbox has started the timing task, closing the timing task; 7. A routing system characterized in that, when the mailbox starts the timing task by using the latest receiving service instance, starting the timing task of the mailbox. The system comprises: an obtaining module, configured to obtain a routing rule published by a dynamic configuration center; receive a latest receiving service instance according to the routing rule; determine whether the latest receiving service instance is the same as a current receiving service instance; wherein the determination of whether the latest receiving service instance is the same as the current receiving service instance comprises: scanning a mailbox list according to the latest receiving service instance, the mailbox list comprising mailbox information of a plurality of mailboxes; determining whether a latest mailbox requiring a timing task to be started is the same as a current mailbox requiring a timing task to be started according to the mailbox information; determining that the latest receiving service instance is the same as the current receiving service instance when the latest mailbox requiring a timing task to be started is the same as the current mailbox requiring a timing task to be started; and determining that the latest receiving service instance is different from the current receiving service instance when the latest mailbox requiring a timing task to be started is different from the current mailbox requiring a timing task to be started; start a timing task of a mailbox using the current receiving service instance when the latest receiving service instance is the same as the current receiving service instance; and start the timing task of the mailbox using the latest receiving service instance when the latest receiving service instance is different from the current receiving service instance.

8. A computer-readable storage medium, characterized in that, A computer program is stored, and the computer program is executed by a processor to make the processor execute steps of the method in any one of claims 1 to 6.

9. A computer device, comprising: A memory and a processor are included, and the memory stores a computer program, which is executed by the processor to make the processor execute steps of the method in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Route information updating method and device, gateway and storage medium

    CN109617807A