Message processing method, system and equipment and storage medium

By introducing a consumer distribution mechanism in the distributed message processing system, responding to the to-be-consuming messages and forwarding them to the target consumption environment, the problem of message loss when switching the consumption environment in the prior art is solved, and smooth switching and efficient message processing are achieved.

CN120238565APending Publication Date: 2025-07-01SF TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311850906.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-28
Publication Date
2025-07-01

AI Technical Summary

Technical Problem

The prior art can only restart the server when switching the message consumption environment, resulting in message loss and the inability to smoothly switch the specified consumption environment.

Method used

Through the consumption distribution mechanism, respond to the messages to be consumed and read preset configuration rules, match the topic and consumption environment, forward messages to the target consumption environment in a direction, and achieve flexible switching.

Benefits of technology

It avoids message loss, realizes the ability to smoothly switch consumption environments in multiple environments, and solves the problem of message loss caused by publishing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120238565A_ABST
    Figure CN120238565A_ABST
Patent Text Reader

Abstract

The invention discloses a message processing method, system and device and a storage medium, and is applied to a distributed message processing system, the distributed message processing system comprises a plurality of pre-deployed message processing objects, and the method comprises the following steps: for any message processing object, reading a preset configuration rule by responding to a received to-be-consumed message, and sending the to-be-consumed message to the distributed message processing system; the to-be-consumed message is matched with the theme of the message processing object; the configuration rules comprise configuration rules for the theme to adapt to different consumption environments; according to a current configuration rule corresponding to the theme, obtaining a target consumption environment corresponding to the current configuration rule; and forwarding the message to be consumed to the target consumption environment for consumption. Through a consumption distribution mechanism, the to-be-consumed message is forwarded directionally, and the consumption environment of the message is switched flexibly. The problems of message loss and incapability of smoothly switching a specified consumption environment due to edition issuing in a plurality of sets of environments are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and particularly to a message processing method, system, device, and storage medium. Background Art

[0002] With the development of the big data field, for message processing of more and more message producers and message consumers, various distributed message processing systems have emerged as the times require. A typical distributed message processing system includes producers, consumers, and brokers. When a producer generates a new message, it will be classified and assigned to a certain topic. Each topic is divided into multiple partitions, and these partitions are deployed on multiple brokers. The producer continuously sends messages to a certain type of topic. The proxy server caches messages of different topics and then forwards them to the consumers. Finally, the consumers process the messages generated by the producers.

[0003] The message data structures stored in the topics are all coupled with their respective business systems, and the two are tightly coupled. This makes it impossible to simply and quickly share and exchange their respective data between different business systems; the data cannot be cross-operated, and it is often necessary to switch the consumption environment in a timely manner during application to avoid affecting subsequent business logics. However, in the prior art, when switching the consumption environment, only restarting the server can be selected, and restarting the server will cause the loss of messages of the topic being consumed. Summary of the Invention

[0004] The main purpose of the present invention is to provide a message processing method, system, device, and storage medium. Through a consumption distribution mechanism, the messages to be consumed are directionally forwarded to achieve flexible switching of the message consumption environment. Solve the problems of message loss caused by release and inability to smoothly switch to a specified consumption environment in multiple environments.

[0005] To achieve the above object, the embodiments of the present application provide the following technical solutions:

[0006] According to the first aspect of the embodiments of the present application, a message processing method is provided, which is applied to a distributed message processing system. The distributed message processing system includes multiple pre-deployed message processing objects. The method includes:

[0007] For any message processing object, in response to receiving a message to be consumed, read a pre-set configuration rule, and the message to be consumed matches the topic of the message processing object; the configuration rule includes the configuration rule for the topic to adapt to different consumption environments;

[0008] Obtain a target consumption environment corresponding to the current configuration rule according to the current configuration rule corresponding to the topic;

[0009] Forward the to-be-consumed message to the target consumption environment for consumption.

[0010] Optionally, the method further includes:

[0011] Receiving an environment switching instruction for the to-be-consumed message; the environment switching instruction carries information about the target consumption environment after switching; selecting the configuration rule for consuming the message of the topic in the switched environment as the new current configuration rule.

[0012] Optionally, obtaining the target consumption environment corresponding to the current configuration rule according to the current configuration rule corresponding to the topic includes:

[0013] Determining a distribution topic configuration table according to the current configuration rule; searching for the corresponding message sending object and the target consumption environment in the distribution topic configuration table.

[0014] Optionally, forwarding the to-be-consumed message to the target consumption environment for consumption includes:

[0015] Invoking the message sending object to forward the to-be-consumed message to the target consumption environment so as to perform consumption based on the service type indicated by the to-be-consumed message.

[0016] Optionally, forwarding the to-be-consumed message to the target consumption environment for consumption further includes:

[0017] If the forwarding of the to-be-consumed message fails, recording the result of the forwarding failure in the database and timing; when the timing duration reaches the set duration, invoking the message processing object to re-forward the to-be-consumed message;

[0018] If the re-forwarding is successful, modifying the record of the failure of sending the to-be-consumed message in the database to a success.

[0019] According to the second aspect of the embodiments of the present application, a message processing system is provided. The message processing system includes a plurality of pre-deployed message processing objects. For any message processing object, the system includes:

[0020] A message receiving module, configured to read a pre-set configuration rule in response to receiving a to-be-consumed message, where the to-be-consumed message matches the topic of the message processing object; the configuration rule includes the configuration rule for adapting the topic to any consumption environment;

[0021] An environment determining module, configured to obtain a target consumption environment corresponding to the current configuration rule according to the current configuration rule corresponding to the topic;

[0022] The message sending module is used to forward the message to be consumed to the target consumption environment for consumption.

[0023] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.

[0024] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. The computer-readable instructions can be executed by a processor to implement the method described in the first aspect above.

[0025] In summary, the embodiments of the present application provide a message processing method, system, device and storage medium, which are applied to a distributed message processing system, wherein the distributed message processing system includes a plurality of pre-deployed message processing objects, and for any message processing object, by responding to receiving a message to be consumed, a pre-set configuration rule is read, and the message to be consumed matches the subject of the message processing object; the configuration rule includes a configuration rule for adapting the subject to different consumption environments; according to the current configuration rule corresponding to the subject, a target consumption environment corresponding to the current configuration rule is obtained; and the message to be consumed is forwarded to the target consumption environment for consumption. Through the consumption distribution mechanism, the message to be consumed is forwarded in a targeted manner to realize flexible switching of the message consumption environment. This solves the problem of message loss and inability to smoothly switch the specified consumption environment due to version release in multiple environments. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0027] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.

[0028] Figure 1 A flow chart of a message processing method provided in an embodiment of the present application;

[0029] Figure 2 Schematic diagram of the message distribution and consumption process provided by the embodiment of the present application;

[0030] Figure 3 Block diagram of a message processing system provided by the embodiment of the present application;

[0031] Figure 4 Schematic diagram of the structure of an electronic device provided by the embodiment of the present application;

[0032] Figure 5 Schematic diagram of a computer-readable storage medium provided by the embodiment of the present application.

[0033] The realization, functional characteristics and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. Detailed implementation manners

[0034] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0035] It should be noted that all directional indications (such as up, down, left, right, front, back...) in the embodiments of the present invention are only used to explain the relative positional relationship and movement conditions between components in a specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indications will also change accordingly.

[0036] In addition, the descriptions such as "first" and "second" in the present invention are only for descriptive purposes, and cannot be understood as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In the description of the present invention, "a plurality" means at least two, such as two, three, etc., unless otherwise specifically defined.

[0037] In the present invention, unless otherwise clearly defined and limited, the terms "connected", "fixed", etc. shall be understood in a broad sense. For example, "fixed" may be a fixed connection, a detachable connection, or integrated; it may be a mechanical connection or an electrical connection; it may be directly connected or indirectly connected through an intermediate medium, and it may be the internal connection of two components or the interaction relationship between two components, unless otherwise clearly limited. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.

[0038] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the ability of those of ordinary skill in the art to implement. When the combination of technical solutions results in contradictions or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0039] Figure 1 A message processing method provided by an embodiment of the present application is shown, which is applied to a distributed message processing system. The distributed message processing system includes a plurality of pre-deployed message processing objects. The method includes:

[0040] Step 101: For any message processing object, in response to receiving a message to be consumed, read a pre-set configuration rule, where the message to be consumed matches the topic of the message processing object; the configuration rule includes configuration rules for adapting the topic to different consumption environments;

[0041] Step 102: Obtain a target consumption environment corresponding to the current configuration rule according to the current configuration rule corresponding to the topic;

[0042] Step 103: Forward the message to be consumed to the target consumption environment for consumption.

[0043] In a possible implementation manner, the method further includes:

[0044] Receiving an environment switching instruction for the message to be consumed; the environment switching instruction carries information about the target consumption environment after switching; selecting the configuration rule for consuming the message of the topic in the switched environment as the new current configuration rule.

[0045] In a possible implementation manner, in step 102, the obtaining a target consumption environment corresponding to the current configuration rule according to the current configuration rule corresponding to the topic includes:

[0046] Determine a distribution topic configuration table according to the current configuration rule; find the corresponding message sending object and the target consumption environment in the distribution topic configuration table.

[0047] In a possible implementation manner, in step 103, the forwarding the message to be consumed to the target consumption environment for consumption includes:

[0048] Call the message sending object to forward the message to be consumed to the target consumption environment, so as to perform consumption based on the service type indicated by the message to be consumed.

[0049] In a possible implementation, the distribution topic configuration table includes configuration information of several topics, message sending objects corresponding to each topic, and an environment code, where the environment code characterizes the corresponding consumption environment.

[0050] In a possible implementation, the method further includes:

[0051] Receiving a distribution topic configuration table modification instruction, where the distribution topic configuration table modification instruction is used to trigger at least one modification to the distribution topic configuration table: adding a new configuration rule, deleting a configuration rule, and modifying a configuration rule; and updating the distribution topic configuration table in real time according to the modification instruction.

[0052] In a possible implementation, after step 103, it further includes:

[0053] If the forwarding of the message to be consumed fails, record the result of the forwarding failure in the database and start timing; when the timing duration reaches the set duration, call the message processing object to re-forward the message to be consumed; if the re-forwarding is successful, modify the record of the failure to send the message to be consumed in the database to a successful send.

[0054] The message processing method provided by the embodiments of this application is applied to the Kafka system architecture.

[0055] Kafka is a distributed message storage and consumption system. A Kafka Cluster contains multiple servers, and the server nodes are called Brokers. Kafka uses topics as the basic logical units to perform operations such as storing and consuming messages. To linearly improve the throughput, Kafka physically divides a topic into multiple Partitions, and each Partition supports fault tolerance by creating a certain number of replicas and dispersing them for storage on different Brokers. Kafka integrates the distributed coordination service ZooKeeper to implement functions such as metadata storage and cluster management, thereby supporting the dynamic horizontal expansion of the cluster. Based on the Kafka-based message publishing and subscribing service system, the registered publisher creates a topic, the subscriber subscribes to the topic, and the publisher publishes messages to the topic.

[0056] Figure 2 It shows a schematic diagram of the application of the method provided by the embodiments of this application to the Kafka message distribution process.

[0057] When the consumer object of the source consumer group called by the dispatch service of the scheduler receives the Kafka message sent by the upstream system, it determines the configuration table in the local database based on the target topic name of TOPIC1 carried in the kafla message, and obtains the corresponding configuration information of the target topic. The configuration information includes the target environment, for example, TOPIC1 = PAR or TOPIC1 = PROD. Forward the Kafka message to the target environment for consumption.

[0058] The consumption services include business services such as the log service command-prod, the coupon service ditrib-prod, and the integral gift service claim-prod. Each environment includes the above consumption service modules respectively.

[0059] When the upstream "EOS_AWSM_CORE_HASTEN_REPORT" topic reaches the shunt service, it reads the configuration from the configuration table to determine which environment to forward to for consumption, and then calls the bean of the producer in that environment to forward the message. For example, if the configured environment is PAR, it calls the producer in the PAR environment to send a message to the "EOS_AWSM_CORE_HASTEN_REPORT_PAR" topic, and the command-par service can consume it.

[0060] The composition in the database provided by the embodiments of the present application includes:

[0061] 1. Environment configuration table: environment name, environment code, whether enabled.

[0062] 2. Source topic configuration table: topic name, topic description, MOM address, verification code, consumer group, number of consumer threads. The Kafka listener is configured in this table.

[0063] 3. Distribution topic configuration table: topic name, topic description, MOM address, verification code, cluster name, number of threads, environment code. To be forwarded out, use the data in this table to create a producer and register it with Kafka.

[0064] Among them, the environment configuration table and the distribution topic configuration table are in a one-to-many (multiple environments) relationship.

[0065] In a possible implementation, the embodiments of the present application can also perform visual configuration. Developers can directly configure the rules through the interface. After the rules are configured, they will take effect immediately. The system monitors the configuration changes of each configuration table in the local cache in real time; if a change occurs, the cache is updated and refreshed in real time according to the configuration change. For example, a new BinlogListener class is added to listen to the binlog logs of the MySQL database. When the distribution topic configuration table changes, the topicConfigMap cache is immediately refreshed. The next time a message is consumed, it can be forwarded to the newly configured template environment.

[0066] The front-end interface design includes the following aspects:

[0067] 1. Environment configuration. The names, encodings, and whether to enable information of multiple environments can be configured;

[0068] 2. Source TOPIC configuration. Relevant information such as the MOM address, TOPIC name, and description of the source TOPIC can be configured. The back-end creates a Bean for the consumer of the source KAFKA based on these configurations;

[0069] 3. Distribution TOPIC configuration. The basic information of the distribution KAFKA can be configured for the TOPIC under each environment. The back-end creates a Bean for the producer of the distribution KAFKA based on these configurations;

[0070] 4. Shunt management. Displays all enabled source TOPICs and their currently consumed environment encodings. Provides functions to switch all TOPICs with one key and batch-switch TOPICs to a specified environment. Through simple switching, the messages of the TOPIC can be distributed to the specified environment for consumption.

[0071] Create a Bean when the service starts. The following details the creation and caching definition of the Bean:

[0072] 1. Define a configuration class using @Configuration, and define a Bean named topicConfigMap inside, whose data structure is ConcurrentHashMap.

[0073] 2. Obtain the configuration of the source topic consumer from the database, create a bean for the source topic consumer, and put the bean into the topicConfigMap cache.

[0074] 3. Obtain the configuration of the distribution topic producers of all environments from the database, create beans for the distribution topic producers, and put the beans into the topicConfigMap cache.

[0075] A bean is a Java object that can be called in a Java program. A bean defines some methods, and other places that need to use these methods can implement the corresponding logic by calling the methods of this bean. For example, there is a user bean. The user can be created by calling the add method of this bean, and a specific user can be deleted by calling the delete method.

[0076] The consumption of messages includes the following aspects:

[0077] 1. Add a Kafka message consumption class KafkaListener. The name of the topic and the message can be obtained in this class. Messages sent by the upstream to topicA can only be received by the KafkaListener of topicA. By establishing a corresponding binding relationship, it will be known which KafkaListener to use. Different "classes" are used to distinguish which topic.

[0078] 2. Obtain the bean of the distribution producer through topicConfigMap.get("topic"); when the Spring container is loaded, the database configuration will create the corresponding bean of the distribution producer and put this rule bean into the topicConfigMap cache. When there is an upstream message, the bean of the producer is directly obtained from this map. Call the send method of this bean to forward the message to the target environment.

[0079] 3. Call the send method of this bean to forward the message to the target environment for consumption.

[0080] The dispatch service needs to be designed with multiple nodes to ensure that when a certain node cannot be used normally, Kafka will distribute the unprocessed messages to other nodes in the same consumer group for processing. Facing multiple dispatch service nodes, when the upstream system sends a message to Kafka, Kafka will select a node for consumption. The selection principle can be load balancing, etc.

[0081] If the consumption process fails, it needs to be logged in the database and the status of the log is changed to failed; scan the messages that failed to be sent through a scheduled task and try to send them again. If the sending is successful, the status is changed to successful.

[0082] In summary, the embodiment of the present application provides a message processing method, which is applied to a distributed message processing system. The distributed message processing system includes multiple pre-deployed message processing objects. For any message processing object, by responding to the received message to be consumed, a pre-set configuration rule is read, and the message to be consumed matches the topic of the message processing object; the configuration rule includes the configuration rule for the topic to adapt to different consumption environments; according to the current configuration rule corresponding to the topic, a target consumption environment corresponding to the current configuration rule is obtained; the message to be consumed is forwarded to the target consumption environment for consumption. Through the consumption distribution mechanism, the message to be consumed is directed and forwarded to achieve flexible switching of the message consumption environment. This solves the problems of message loss caused by version release and inability to smoothly switch to a specified consumption environment in multiple environments.

[0083] Based on the same technical concept, the embodiment of the present application also provides a message processing system, as Figure 3 shown. The message processing system includes multiple pre-deployed message processing objects. For any message processing object, the system includes:

[0084] A message receiving module 301, configured to respond to the received message to be consumed and read a pre-set configuration rule, where the message to be consumed matches the topic of the message processing object; the configuration rule includes the configuration rule for the topic to adapt to any consumption environment;

[0085] An environment determination module 302, configured to obtain a target consumption environment corresponding to the current configuration rule according to the current configuration rule corresponding to the topic;

[0086] A message sending module 303, configured to forward the message to be consumed to the target consumption environment for consumption.

[0087] The embodiment of the present application also provides an electronic device corresponding to the method provided in the foregoing embodiment. Please refer to Figure 4 . It shows a schematic diagram of an electronic device provided in some embodiments of the present application. The electronic device 20 may include: a processor 200, a memory 201, a bus 202, and a communication interface 203. The processor 200, the communication interface 203, and the memory 201 are connected through the bus 202; a computer program that can run on the processor 200 is stored in the memory 201, and when the processor 200 runs the computer program, it executes the method provided in any foregoing embodiment of the present application.

[0088] Among them, the memory 201 may include high-speed random access memory (RAM), and may also include non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is implemented through at least one physical port 203 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used.

[0089] The bus 202 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. Among them, the memory 201 is used to store a program, and after receiving an execution instruction, the processor 200 executes the program. Any implementation manner of the method disclosed in any embodiment of the present application can be applied to the processor 200 or implemented by the processor 200.

[0090] The processor 200 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor 200 or by an instruction in software form. The above-mentioned processor 200 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and combines its hardware to complete the steps of the above method.

[0091] The electronic device provided in the embodiments of the present application and the method provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, run, or implemented by it.

[0092] The embodiments of the present application also provide a computer-readable storage medium corresponding to the method provided in the foregoing embodiments. Please refer to Figure 5, which shows that the computer-readable storage medium is an optical disc 30, on which a computer program (i.e., program product) is stored. When the computer program is run by a processor, it will execute the methods provided in any of the foregoing embodiments.

[0093] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory, or other optical and magnetic storage media, which will not be elaborated here one by one.

[0094] The computer-readable storage medium provided by the above embodiments of the present application and the method provided by the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run, or implemented by the application programs stored thereon.

[0095] It should be noted that:

[0096] The algorithms and displays provided herein are not inherently related to any particular computer, virtual device, or other equipment. Various general-purpose devices can also be used in conjunction with the teachings herein. Based on the above description, the structures required to construct such devices are obvious. In addition, the present application is not directed to any specific programming language. It should be understood that the content of the present application described herein can be implemented using various programming languages, and the description of the specific language above is to disclose the best implementation mode of the present application.

[0097] In the specification provided herein, a large number of specific details are set forth. However, it can be understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures, and technologies have not been shown in detail so as not to obscure the understanding of this specification.

[0098] Similarly, it should be understood that, in order to streamline the present application and assist in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be construed as reflecting the intention that the claimed present application requires more features than those expressly recited in each claim. Rather, as reflected in the following claims, the inventive aspects lie in less than all the features of the single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into the detailed description, where each claim itself serves as a separate embodiment of the present application.

[0099] Those skilled in the art can understand that the modules in the devices in the embodiments can be adaptively changed and set in one or more devices different from the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and in addition, they can be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive, any combination can be adopted to combine all the features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all the processes or units of any method or device so disclosed. Unless otherwise explicitly stated, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) can be replaced by an alternative feature that provides the same, equivalent, or similar purpose.

[0100] In addition, those skilled in the art can understand that although some of the embodiments described herein include certain features included in other embodiments rather than other features, the combination of the features of different embodiments means that it is within the scope of this application and forms different embodiments. For example, in the following claims, any one of the claimed embodiments can be used in any combination.

[0101] Each component embodiment of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) can be used in practice to implement some or all of the functions of some or all of the components in the virtual machine creation device according to the embodiments of the present application. The present application can also be implemented as a device or device program (such as a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0102] It should be noted that the above embodiments are illustrative of the present application rather than restrictive of the present application, and those skilled in the art can design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in the claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application can be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim listing several devices, several of these devices may be embodied by the same item of hardware. The use of the words first, second, and third, etc. does not denote any order. These words can be interpreted as names.

[0103] As described above, the above are only preferred specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the said claims.

[0104] The above are only preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structural transformation made by using the content of the specification and drawings of the present invention under the concept of the present invention, or directly / indirectly applied to other related technical fields, is included in the patent protection scope of the present invention.

Claims

1. A message processing method, characterized in that, Applied to a distributed message processing system, the distributed message processing system includes a plurality of pre-deployed message processing objects, and the method includes: For any message processing object, in response to receiving a message to be consumed, read a preset configuration rule, where the message to be consumed matches the topic of the message processing object; the configuration rule includes configuration rules for the topic adapting to different consumption environments; Obtain a target consumption environment corresponding to the current configuration rule according to the current configuration rule corresponding to the topic; Forward the message to be consumed to the target consumption environment for consumption.

2. The method according to claim 1, wherein The method further includes: Receive an environment switching instruction for the message to be consumed; the environment switching instruction carries information about the target consumption environment after switching; Select the configuration rule for consuming the message of the topic in the switched environment as the new current configuration rule.

3. The method according to claim 1, wherein The obtaining a target consumption environment corresponding to the current configuration rule according to the current configuration rule corresponding to the topic includes: Determine a distribution topic configuration table according to the current configuration rule; Find the corresponding message sending object and the target consumption environment in the distribution topic configuration table.

4. The method according to claim 3, characterized in that, The forwarding the message to be consumed to the target consumption environment for consumption includes: Call the message sending object to forward the message to be consumed to the target consumption environment so that consumption is performed based on the service type indicated by the message to be consumed.

5. The method according to claim 3, characterized in that, The distribution topic configuration table includes configuration information of several topics, a message sending object corresponding to each topic, and an environment code, and the environment code represents the corresponding consumption environment.

6. The method according to claim 3, wherein The method further includes: Receive a distribution topic configuration table modification instruction, which is used to trigger at least one modification to the distribution topic configuration table: adding a new configuration rule, deleting a configuration rule, and modifying a configuration rule; Update the distribution topic configuration table in real time according to the modification instruction.

7. The method according to claim 1, characterized in that, The forwarding the message to be consumed to the target consumption environment for consumption further includes: If the forwarding of the message to be consumed fails, record the result of the forwarding failure in the database and start timing; When the timing duration reaches a set duration, call the message processing object to re-forward the message to be consumed; If the re-forwarding is successful, modify the record of the message to be consumed sent failed in the database to sent successfully.

8. A message processing system, characterized in that, The message processing system includes a plurality of pre-deployed message processing objects. For any message processing object, the system includes: A message receiving module, configured to, in response to receiving a message to be consumed, read a preset configuration rule, where the message to be consumed matches the topic of the message processing object; the configuration rule includes configuration rules for the topic adapting to any consumption environment; An environment determining module, configured to obtain a target consumption environment corresponding to the current configuration rule according to the current configuration rule corresponding to the topic; A message sending module, configured to forward the message to be consumed to the target consumption environment for consumption.

9. An electronic device, comprising: A memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor runs the computer program, it is executed to implement the method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, Computer-readable instructions are stored thereon, and the computer-readable instructions can be executed by a processor to implement the method according to any one of claims 1-7.