CN112114845A - Method and device for processing gray scale message, storage medium and computer equipment - Google Patents

Method and device for processing gray scale message, storage medium and computer equipment Download PDF

Info

Publication number
CN112114845A
CN112114845A CN202010782659.2A CN202010782659A CN112114845A CN 112114845 A CN112114845 A CN 112114845A CN 202010782659 A CN202010782659 A CN 202010782659A CN 112114845 A CN112114845 A CN 112114845A
Authority
CN
China
Prior art keywords
message
gray scale
consuming
gray
dyeing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010782659.2A
Other languages
Chinese (zh)
Other versions
CN112114845B (en
Inventor
田雪峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Absolute Health Ltd
Original Assignee
Beijing Absolute Health Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Absolute Health Ltd filed Critical Beijing Absolute Health Ltd
Priority to CN202010782659.2A priority Critical patent/CN112114845B/en
Publication of CN112114845A publication Critical patent/CN112114845A/en
Application granted granted Critical
Publication of CN112114845B publication Critical patent/CN112114845B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software

Abstract

The application discloses a method and a device for processing gray scale messages, a storage medium and computer equipment, wherein the method comprises the following steps: acquiring a first dyeing identifier corresponding to a service production end, and sending a gray level message to a preset topic through the service production end, wherein the gray level message is the service message with the first dyeing identifier; monitoring the gray level message in the preset topic through a monitor corresponding to a gray level consuming end, and consuming the gray level message when a first dyeing identifier of the gray level message is matched with a second dyeing identifier corresponding to the gray level consuming end; and monitoring the gray level message in the preset topic through a monitor corresponding to a default consumption end, and consuming the gray level message when a first dyeing identifier of the gray level message is not matched with a second dyeing identifier of the gray level message. The method and the device realize message isolation in the same test environment and enhance the fault tolerance of the test system.

Description

Method and device for processing gray scale message, storage medium and computer equipment
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method and an apparatus for processing a grayscale message, a storage medium, and a computer device.
Background
When the system is upgraded and released, for a system which involves using a message queue, for example, kafka, gray scale release is performed first, and a tester verifies the correctness of the system function on a gray scale example, so that the new version function can be fully released.
In the prior art, for a common internet application architecture, in order to solve large concurrency, based on consideration of one-step and peak clipping, a message queue is required to be used for caching large flow, and at this time, if the message queue does not support gray scale publishing, even if a remote procedure call request can be correctly routed to a gray scale example, a produced message flows into a normal application example, and complete data isolation is not achieved, so that error data affecting services can be generated, different testers share one environment for testing, and test resources cannot be isolated.
Disclosure of Invention
In view of the above, the present application provides a method and an apparatus for processing a grayscale message, a storage medium, and a computer device.
According to an aspect of the present application, there is provided a method for processing a grayscale message, including:
acquiring a first dyeing identifier corresponding to a service production end, and sending a gray level message to a preset topic through the service production end, wherein the gray level message is the service message with the first dyeing identifier;
monitoring the gray level message in the preset topic through a monitor corresponding to a gray level consuming end, and consuming the gray level message when a first dyeing identifier of the gray level message is matched with a second dyeing identifier corresponding to the gray level consuming end;
and monitoring the gray level message in the preset topic through a monitor corresponding to a default consumption end, and consuming the gray level message when a first dyeing identifier of the gray level message is not matched with a second dyeing identifier of the gray level message.
Specifically, the monitoring, by a listener corresponding to a gray scale consuming end, a gray scale message in the preset topic, and consuming the gray scale message when a first dyeing identifier of the gray scale message matches a second dyeing identifier corresponding to the gray scale consuming end specifically includes:
monitoring the service message in the preset topic through a monitor corresponding to the gray level consuming end, and acquiring the first dyeing identification corresponding to the gray level message when the service message belongs to the gray level message;
and reading a second dyeing identifier corresponding to the gray scale consuming end from a preset consuming end path, and filtering and consuming the gray scale message through the gray scale consuming end when the first dyeing identifier is matched with the second dyeing identifier.
Specifically, the monitoring the gray scale message in the preset topic through a monitor corresponding to the default consuming end, and consuming the gray scale message when the first dyeing identifier of the gray scale message is not matched with the second dyeing identifier of the preset topic, specifically includes:
monitoring the gray level message in the preset topic through a monitor corresponding to the default consuming end, and acquiring the first dyeing identification corresponding to the gray level message when the business message belongs to the gray level message;
and reading a second dyeing identifier corresponding to the gray scale consuming end from a preset consuming end path, and consuming the gray scale message through the default consuming end when the first dyeing identifier is not matched with the second dyeing identifier.
Specifically, the preset topic is further configured to receive a common message; after the monitoring of the gray scale message in the preset topic is performed by the monitor corresponding to the default consuming end, the method further includes:
and when the service message belongs to a common message, consuming the common message through the default consuming terminal, wherein the common message is the service message carrying a common identifier.
Specifically, the method further comprises:
when the content corresponding to the preset consuming end path changes, reading a third dyeing identifier corresponding to the changed gray level consuming end from the preset consuming end path;
and determining a fourth dyeing identifier based on the first dyeing identifier and the third dyeing identifier, so that the gray scale message is consumed when the monitor corresponding to the default consuming end monitors the gray scale message carrying the fourth dyeing identifier.
Specifically, the consuming of the gray scale message by the gray scale consuming end specifically includes:
when a first dyeing identifier of the gray scale message is matched with a second dyeing identifier corresponding to the gray scale consuming terminal, adding the gray scale message into a gray scale message consuming queue list corresponding to the gray scale consuming terminal;
and the gray scale consuming end consumes the gray scale message in the gray scale message consuming queue list.
Specifically, the method further comprises:
when the gray scale consuming end is abnormal, acquiring the consumption progress of the gray scale message consumption queue list corresponding to the gray scale consuming end;
and according to the consumption progress, compensating and consuming the unconsumed gray scale message in the gray scale message consumption queue list through the default consuming end.
According to another aspect of the present application, there is provided a processing apparatus of a grayscale message, including:
the gray scale message sending module is used for acquiring a first dyeing identifier corresponding to a service production end and sending a gray scale message to a preset topic through the service production end, wherein the gray scale message is the service message with the first dyeing identifier;
the first gray scale message consumption module is used for monitoring the gray scale message in the preset topic through a monitor corresponding to a gray scale consumption end and consuming the gray scale message when a first dyeing identifier of the gray scale message is matched with a second dyeing identifier corresponding to the gray scale consumption end;
and the second gray message consumption module is used for monitoring the gray messages in the preset topic through a monitor corresponding to a default consumption end and consuming the gray messages when the first dyeing identification of the gray messages is not matched with the second dyeing identification.
Specifically, the first grayscale message consumption module specifically includes:
the first monitoring unit is used for monitoring the service message in the preset topic through a monitor corresponding to the gray level consuming end, and acquiring the first dyeing identifier corresponding to the gray level message when the service message belongs to the gray level message;
and the first gray scale message consumption unit is used for reading a second dyeing identifier corresponding to the gray scale consumption end from a preset consumption end path, and filtering and consuming the gray scale message through the gray scale consumption end when the first dyeing identifier is matched with the second dyeing identifier.
Specifically, the second gray scale message consumption module specifically includes:
the second monitoring unit is used for monitoring the gray level message in the preset topic through a monitor corresponding to the default consuming end, and acquiring the first dyeing identifier corresponding to the gray level message when the business message belongs to the gray level message;
and the second gray scale message consumption unit is used for reading a second dyeing identifier corresponding to the gray scale consumption end from a preset consumption end path and consuming the gray scale message through the default consumption end when the first dyeing identifier is not matched with the second dyeing identifier.
Specifically, the preset topic is further configured to receive a common message; the second gray scale message consumption module further comprises:
and the common message consumption unit is used for consuming the common message through the default consumption end when the service message belongs to the common message after the monitor corresponding to the default consumption end monitors the gray scale message in the preset topic, wherein the common message is the service message carrying the common identifier.
Specifically, the apparatus further comprises:
the third dyeing identifier acquisition module is used for reading a third dyeing identifier corresponding to the changed gray scale consuming end from the preset consuming end path when the content corresponding to the preset consuming end path is changed;
and the fourth dyeing identifier determining module is configured to determine a fourth dyeing identifier based on the first dyeing identifier and the third dyeing identifier, so that the gray scale message is consumed when the monitor corresponding to the default consuming end monitors the gray scale message carrying the fourth dyeing identifier.
Specifically, the first grayscale message consuming unit is specifically configured to:
when a first dyeing identifier of the gray scale message is matched with a second dyeing identifier corresponding to the gray scale consuming terminal, adding the gray scale message into a gray scale message consuming queue list corresponding to the gray scale consuming terminal;
and the gray scale consuming end consumes the gray scale message in the gray scale message consuming queue list.
Specifically, the apparatus further comprises:
the consumption progress acquisition module is used for acquiring the consumption progress of the gray scale message consumption queue list corresponding to the gray scale consumption end when the gray scale consumption end is abnormal;
and the gray scale message compensation module is used for compensating and consuming the unconsumed gray scale message in the gray scale message consumption queue list through the default consuming end according to the consumption progress.
According to yet another aspect of the present application, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the above-described method of processing a greyscale message.
According to yet another aspect of the present application, there is provided a computer device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, the processor implementing the above method of processing a greyscale message when executing the program.
By means of the technical scheme, when a service production end has a service message to send to a preset topic, the gray scale message is generated based on the first dyeing identification of the environment variable and then sent to the corresponding topic, so that the gray scale message can be read when the gray scale consumption end monitors the gray scale message matched with the second dyeing identification of the gray scale message, and the gray scale message is consumed through the set default consumption end when the gray scale consumption end which is not matched with the gray scale message does not exist. According to the embodiment of the application, the gray level messages carrying the specific dyeing marks are consumed through the specific gray level consuming ends, message isolation under the same test environment is achieved, the default consuming ends are set to consume the gray level messages which cannot be consumed by the gray level consuming ends, each gray level message is guaranteed to be consumed, message omission is avoided, and the fault tolerance of the test system is enhanced.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic flowchart illustrating a method for processing a grayscale message according to an embodiment of the present application;
fig. 2 is a schematic flowchart illustrating another grayscale message processing method according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart illustrating another grayscale message processing method according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram illustrating a processing apparatus for gray scale messages according to an embodiment of the present application;
fig. 5 is a schematic structural diagram illustrating another processing apparatus for gray scale messages according to an embodiment of the present application;
fig. 6 shows a schematic diagram of a correspondence relationship between a message publisher and a message consumer according to an embodiment of the present application.
Detailed Description
The present application will be described in detail below with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
In this embodiment, a method for processing a grayscale message is provided, as shown in fig. 1, the method includes:
step 101, acquiring a first dyeing identifier corresponding to a service production end, and sending a gray level message to a preset topic (preset path) through the service production end, wherein the gray level message is the service message with the first dyeing identifier;
the foregoing step 101 provides a method for issuing a grayscale message, where when a service application (i.e., a service production end) is started, a first dyeing identifier trafic _ label in a service application environment variable is read, for example, the first dyeing identifier is a, the first dyeing identifier is transmitted into a context of a service application producer object after the identifier is read, and when a producer sends a service message to a topic corresponding to a service, the read first dyeing identifier is attached to the service message. In addition, the service production side may also send a common message, that is, a service message without a coloring identifier, if the identifier read from the service application environment variable is a common identifier (master/normal), the service application is used to produce the common message, and further, a gray scale message production rule may be written in advance in the program, for example, which of the production sides can send the gray scale message to the preset topic is recorded in the path file, and the write path is/rocktmq/$ { namesrv-addr }/$ { topic }/canaryProducers/$ { trafficLabel }/$ { producerGroup } - $ { clientId }. And generating a gray scale message carrying a specific dyeing identifier according to the dyeing identifier of the environment variable so that a consumer can distinguish various messages according to the message identifier to avoid message pollution.
Step 102, monitoring a gray level message in a preset topic through a monitor corresponding to a gray level consuming end, and consuming the gray level message when a first dyeing identifier of the gray level message is matched with a second dyeing identifier corresponding to the gray level consuming end;
the foregoing step 102 provides a message consumption method of a gray scale consuming end, where when the gray scale consuming end is started, the second dyeing identifier trafic _ label in the environment variable is read, and the second dyeing identifier is transmitted into a context of the consuming end, the gray scale consuming end is dyed, according to the topic provided by the spring configuration item, the service message in the topic provided by the configuration item is monitored, if the identifier carried by the service message is a common identifier, the service message is discarded, if the identifier carried by the service message is a dyeing identifier, that is, the service message belongs to a gray scale message, the first dyeing identifier corresponding to the gray scale message is obtained, whether the current gray scale consuming end can consume the gray scale message is further determined, specifically, when the second dyeing identifier corresponding to the current gray scale consuming end is consistent with the first dyeing identifier carried by the gray scale message, it is determined that the current consuming end is a consumer corresponding to the gray scale message, the gray scale message can be consumed through the current gray scale consuming end, and if the second dyeing identification corresponding to the current gray scale consuming end is inconsistent with the first dyeing identification carried by the gray scale message, which indicates that the current gray scale consuming end is not the consumer of the gray scale message, the gray scale message is discarded, so that the real consumer of the gray scale message consumes the gray scale message, thereby ensuring that different gray scale messages can be consumed by specific consumers when a system environment is tested, ensuring that test resources can be isolated, and avoiding the generation of wrong service data.
And 103, monitoring the gray level message in the preset topic through a monitor corresponding to the default consuming end, and consuming the gray level message when the first dyeing identification and the second dyeing identification of the gray level message are not matched.
Step 103 provides a message consumption method of a default consuming end, where an identifier corresponding to the default consuming end is a common identifier, and when it is monitored that an identifier carried by a service message in a preset topic is the common identifier, the default consuming end may consume the common message, and in some application scenarios, the default consuming end may also consume some gray scale messages, specifically, when the identifier carried by the monitored service message is a dyeing identifier, that is, the monitored service message is a gray scale message, if a second dyeing identifier corresponding to the gray scale consuming end set by the system is not consistent with a first dyeing identifier carried by the gray scale message, the gray scale message may be consumed by the default consuming end, thereby ensuring that each gray scale message can be consumed even if a specific consumer without the gray scale message set in the system is not present, enhancing fault tolerance of message consumption.
By applying the technical scheme of the embodiment, when a service message needs to be sent to the preset topic, the gray scale message is generated based on the first dyeing identifier of the environment variable and then sent to the corresponding topic, so that the gray scale message can be read when the gray scale consuming terminal monitors the gray scale message matched with the second dyeing identifier of the gray scale consuming terminal, and the gray scale message is consumed through the set default consuming terminal when the gray scale consuming terminal not matched with the gray scale message exists. According to the embodiment of the application, the gray level messages carrying the specific dyeing marks are consumed through the specific gray level consuming ends, message isolation under the same test environment is achieved, the default consuming ends are set to consume the gray level messages which cannot be consumed by the gray level consuming ends, each gray level message can be consumed to avoid message omission, and the fault tolerance of the test system is enhanced.
In this embodiment of the present application, specifically, as shown in fig. 2, step 102 may include:
step 102-1, monitoring a service message in a preset topic through a monitor corresponding to a gray level consumption end, and acquiring a first dyeing identifier corresponding to a gray level message when the service message belongs to the gray level message;
and 102-2, reading a second dyeing identifier corresponding to the gray scale consuming end from the preset consuming end path, and filtering and consuming the gray scale message through the gray scale consuming end when the first dyeing identifier is matched with the second dyeing identifier.
In the above embodiment, when the gray scale consuming side service is started, the stain identifier trafic _ LABEL in the environment variable is read, for example, the value is a, and is introduced into the context of the consumer object, the service message in the topic provided by the spring configuration item is monitored, when the corresponding identifier of the service message is not the normal identifier, a different ConsumerGroup is used to consume the gray scale message, specifically, through syntax SQL (TAGS in (' Tag1') and TRAFFIC _ LABEL ═ someLabel ') filtering, so that a specific gray scale consuming side only consumes the message containing the specific stain identifier, that is, if the stain identifier corresponding to the gray scale consuming side is a, the gray scale consuming side only consumes the carried stain identifier a gray scale message. The second dyeing identifier corresponding to the gray scale consuming end is stored in the preset path, and for example, the second dyeing identifier is read from the preset path/rocketmq/$ { namesrv-addr }/$ { topic }/canaryConsumers/$ { consumerGroup }/$ { bridge }/$ { clientId }.
In this embodiment of the application, specifically, as shown in fig. 3, step 103 may include:
103-1, monitoring the gray level message in the preset topic through a monitor corresponding to a default consumption end, and acquiring a first dyeing identifier corresponding to the gray level message when the service message belongs to the gray level message;
103-2, reading a second dyeing identifier corresponding to the gray scale consuming end from the preset consuming end path, and consuming the gray scale message through a default consuming end when the first dyeing identifier is not matched with the second dyeing identifier;
and 103-3, when the service message belongs to the common message, consuming the common message through the default consuming terminal, wherein the common message is the service message carrying the common identifier.
In the above embodiment, when the default consumer side starts, the value normal of the environment variable "trapic _ label" is read, and is transmitted to the context of the default consumer side, and a path corresponding to the preset topic, for example,/rocketmq/$ { namesrv-addr }/$ { topic }/canarysusumers/$ { consumerGroup }, is monitored. The default consuming terminal defaultConsumer still consumes according to the rules set in the program, that is, if the identifier corresponding to the received service message is the same as the identifier corresponding to the consuming terminal, the service message is consumed, and if the dyeing identifier corresponding to the received service message is different from the dyeing identifier corresponding to the dyed gray level consuming terminal, the service message is consumed.
The default message that the consumption end cannot consume is a service message that carries a dyeing identifier and the dyeing identifier carried by the default message is the same as the dyeing identifier corresponding to the dyed gray level consumption end, namely, the service message does not process the dyeing identifier carried by the service message when the dyeing identifier exists in a/ricketmq/$ { namesrv-addr }/$ { topic }/canaryConsumers/$ { consumerGroup } path. The message consumption logic described above should be provided in the listener.
In any embodiment of the present application, specifically, when the content corresponding to the preset consuming end path changes, the third dyeing identifier corresponding to the changed gray level consuming end is read from the preset consuming end path; and determining a fourth dyeing identifier based on the first dyeing identifier and the third dyeing identifier so as to consume the gray-scale message when the monitor corresponding to the default consuming end monitors the gray-scale message carrying the fourth dyeing identifier.
In the above embodiment, when the content in the preset consuming end path changes, for example, the gray consuming end is added or deleted, the monitoring logic of each gray consuming end and the default consuming end is dynamically updated, for example, the gray consuming end with the dyeing identifier C is added in the system, and when the default consuming end monitors the gray message with the dyeing identifier C, the gray message should be discarded, and the gray message should be consumed by the gray consuming end with the dyeing identifier C. In a specific embodiment, when a monitoring path is changed, third dyeing identifiers corresponding to all gray level consuming ends and first dyeing identifiers corresponding to all business producing ends after the change are obtained, and dyeing identifiers in which a producing end exists but a consuming end does not exist are defined as fourth dyeing identifiers, that is, the fourth dyeing identifiers are dyeing identifiers which are not matched or consistent with the third dyeing identifiers in the first dyeing identifiers, the business producing end can produce gray level messages carrying the fourth dyeing identifiers, but no specific gray level consuming end capable of consuming the gray level messages exists in the system, at this time, monitoring logic of a default consuming end should be modified, so that the gray level messages carrying the fourth dyeing identifiers can be directly consumed by the default consuming end after being monitored by the default consuming end, omission of consumption of the gray level messages is avoided, and recognition speed of the default consuming end to the gray level messages is improved, the consumption speed of the gray scale message is improved.
In any embodiment of the present application, specifically, when a first dyeing identifier of a grayscale message matches a second dyeing identifier corresponding to a grayscale consuming end, adding the grayscale message to a grayscale message consuming queue list corresponding to the grayscale consuming end; and the gray scale consuming end consumes the gray scale messages in the gray scale message consuming queue list.
In the above embodiment, a list may be established based on the messages that can be consumed by the consuming end, and the consuming end sequentially consumes the messages in the list according to the list when consuming the messages, so as to avoid confusion of consumption.
Further, in order to avoid message consumption omission caused by abnormal exit of the consumption end, in the embodiment of the application, specifically, when the gray scale consumption end is abnormal, the consumption progress of the gray scale message consumption queue list corresponding to the gray scale consumption end is obtained; and according to the consumption progress, compensating and consuming the unconsumed gray scale message in the gray scale message consumption queue list through the default consuming end.
In the above embodiment, if a certain gray-scale consuming side draws a batch of messages, the messages are not consumed yet, the process exits abnormally, and is not restarted later. The compensation consumption logic is as follows: querying brokeerOffset and consumerOffset corresponding to a gray scale consuming terminal canaryConsumergroup; inquiring a local consumption Queue list Message Queue corresponding to a default consumption end defaultConsumergroup; and the consumption end starts a message pulling mode, and uses a specific consumerGroup (or a default consumption end) to pull the messages in the corresponding interval from the consumption queues by SQL syntax filtering to perform compensation consumption, so as to ensure that each produced message can be consumed.
Fig. 6 shows a schematic diagram of a correspondence relationship between a message publisher and a message consumer according to an embodiment of the present application. As shown in fig. 6, the production end and the consumption end in the scene a both include common nodes and gray nodes, the production end in the scene b includes common nodes and gray nodes, the consumption end only includes common nodes, the production end in the scene c includes common nodes and gray nodes, and the consumption end only includes gray nodes. The basic logic of message publishing and consuming is shown in the figure, that is, a gray publisher can publish a gray message, a common publisher can publish a common message, a gray consuming end can consume a gray message, and a common consumer can consume a common message, and what is not shown in the figure is that when a gray message does not have a corresponding gray consuming end, a gray message can be consumed by a default consuming end.
Further, as a specific implementation of the method in fig. 1, an embodiment of the present application provides a processing apparatus for a grayscale message, as shown in fig. 4, the apparatus includes:
the gray scale message sending module 41 is configured to obtain a first dyeing identifier corresponding to a service production end, and send a gray scale message to a preset topic through the service production end, where the gray scale message is a service message with the first dyeing identifier attached;
the first gray scale message consumption module 42 is configured to monitor a gray scale message in a preset topic through a monitor corresponding to a gray scale consumption end, and consume the gray scale message when a first dyeing identifier of the gray scale message matches a second dyeing identifier corresponding to the gray scale consumption end;
and a second gray message consuming module 43, configured to monitor a gray message in the preset topic through a monitor corresponding to the default consuming end, and consume the gray message when the first dyeing identifier of the gray message is not matched with the second dyeing identifier.
In a specific application scenario, as shown in fig. 5, the first grayscale message consumption module 42 specifically includes:
the first monitoring unit 421 is configured to monitor a service message in a preset topic through a monitor corresponding to a grayscale consuming end, and acquire a first dyeing identifier corresponding to the grayscale message when the service message belongs to the grayscale message;
and the first gray scale message consuming unit 422 is configured to read a second dyeing identifier corresponding to the gray scale consuming end from the preset consuming end path, and filter and consume the gray scale message through the gray scale consuming end when the first dyeing identifier is matched with the second dyeing identifier.
In a specific application scenario, as shown in fig. 5, the second grayscale message consumption module 43 specifically includes:
the second monitoring unit 431 is configured to monitor the grayscale message in the preset topic through a monitor corresponding to the default consuming end, and acquire the first dyeing identifier corresponding to the grayscale message when the service message belongs to the grayscale message;
and the second gray message consuming unit 432 is configured to read a second dyeing identifier corresponding to the gray consuming end from the preset consuming end path, and consume the gray message through the default consuming end when the first dyeing identifier is not matched with the second dyeing identifier.
In a specific application scenario, as shown in fig. 5, the preset topic is also used for receiving a common message; the second gray message consumption module 43 further includes:
and the common message consuming unit 433 is configured to, after monitoring the grayscale message in the preset topic through a monitor corresponding to the default consuming end, consume the common message through the default consuming end when the service message belongs to the common message, where the common message is a service message carrying a common identifier.
In a specific application scenario, as shown in fig. 5, the apparatus further includes:
a third dyeing identifier obtaining module 44, configured to, when the content corresponding to the preset consuming end path changes, read a third dyeing identifier corresponding to the changed gray-scale consuming end from the preset consuming end path;
and a fourth dyeing identifier obtaining module 45, configured to determine a fourth dyeing identifier based on the first dyeing identifier and the third dyeing identifier, so that the listener corresponding to the default consuming end consumes the gray scale message when monitoring the gray scale message carrying the fourth dyeing identifier.
Specifically, the first grayscale message consuming unit 422 is specifically configured to:
when a first dyeing identifier of the gray scale message is matched with a second dyeing identifier corresponding to the gray scale consuming terminal, adding the gray scale message into a gray scale message consuming queue list corresponding to the gray scale consuming terminal;
and the gray scale consuming end consumes the gray scale messages in the gray scale message consuming queue list.
In a specific application scenario, as shown in fig. 5, the apparatus further includes:
a consumption progress acquiring module 46, configured to acquire, when the grayscale consumption end is abnormal, a consumption progress of a grayscale message consumption queue list corresponding to the grayscale consumption end;
and the gray scale message compensation module 47 is used for compensating and consuming the unconsumed gray scale messages in the gray scale message consumption queue list through a default consuming end according to the consumption progress.
It should be noted that other corresponding descriptions of the functional units related to the processing apparatus for gray scale messages provided in the embodiment of the present application may refer to the corresponding descriptions in the methods in fig. 1 to fig. 3, and are not described herein again.
Based on the methods shown in fig. 1 to 3, correspondingly, the present application further provides a storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the method for processing the grayscale message shown in fig. 1 to 3.
Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the implementation scenarios of the present application.
Based on the above methods shown in fig. 1 to fig. 3 and the virtual device embodiments shown in fig. 4 and fig. 5, in order to achieve the above object, an embodiment of the present application further provides a computer device, which may specifically be a personal computer, a server, a network device, and the like, where the computer device includes a storage medium and a processor; a storage medium for storing a computer program; a processor for executing a computer program to implement the above-described method of processing a greyscale message as shown in figures 1 to 3.
Optionally, the computer device may also include a user interface, a network interface, a camera, Radio Frequency (RF) circuitry, sensors, audio circuitry, a WI-FI module, and so forth. The user interface may include a Display screen (Display), an input unit such as a keypad (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (e.g., a bluetooth interface, WI-FI interface), etc.
It will be appreciated by those skilled in the art that the present embodiment provides a computer device architecture that is not limiting of the computer device, and that may include more or fewer components, or some components in combination, or a different arrangement of components.
The storage medium may further include an operating system and a network communication module. An operating system is a program that manages and maintains the hardware and software resources of a computer device, supporting the operation of information handling programs, as well as other software and/or programs. The network communication module is used for realizing communication among components in the storage medium and other hardware and software in the entity device.
Through the description of the above embodiment, those skilled in the art can clearly understand that the present application can be implemented by software plus a necessary general hardware platform, and also can be implemented by hardware, when a service message needs to be sent to a preset topic at a service production end, a gray scale message is generated by a first dyeing identifier based on an environment variable and then sent to the corresponding topic, so that the gray scale message can be read when a gray scale consuming end monitors a gray scale message matched with a second dyeing identifier of the gray scale consuming end, and the gray scale message is consumed by a set default consuming end when there is no gray scale consuming end matched with the gray scale message. According to the embodiment of the application, the gray level messages carrying the specific dyeing marks are consumed through the specific gray level consuming ends, message isolation under the same test environment is achieved, the default consuming ends are set to consume the gray level messages which cannot be consumed by the gray level consuming ends, each gray level message can be consumed to avoid message omission, and the fault tolerance of the test system is enhanced.
Those skilled in the art will appreciate that the figures are merely schematic representations of one preferred implementation scenario and that the blocks or flow diagrams in the figures are not necessarily required to practice the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the present implementation scenario with corresponding changes. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above application serial numbers are for description purposes only and do not represent the superiority or inferiority of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of the present application, but the present application is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present application.

Claims (10)

1. A method for processing a grayscale message, comprising:
acquiring a first dyeing identifier corresponding to a service production end, and sending a gray level message to a preset topic through the service production end, wherein the gray level message is the service message with the first dyeing identifier;
monitoring the gray level message in the preset topic through a monitor corresponding to a gray level consuming end, and consuming the gray level message when a first dyeing identifier of the gray level message is matched with a second dyeing identifier corresponding to the gray level consuming end;
and monitoring the gray level message in the preset topic through a monitor corresponding to a default consumption end, and consuming the gray level message when a first dyeing identifier of the gray level message is not matched with a second dyeing identifier of the gray level message.
2. The method according to claim 1, wherein the monitoring of the gray scale message in the preset topic by a monitor corresponding to a gray scale consuming end, and consuming the gray scale message when a first dyeing identifier of the gray scale message matches a second dyeing identifier corresponding to the gray scale consuming end, specifically comprises:
monitoring the service message in the preset topic through a monitor corresponding to the gray level consuming end, and acquiring the first dyeing identification corresponding to the gray level message when the service message belongs to the gray level message;
and reading a second dyeing identifier corresponding to the gray scale consuming end from a preset consuming end path, and filtering and consuming the gray scale message through the gray scale consuming end when the first dyeing identifier is matched with the second dyeing identifier.
3. The method according to claim 1, wherein the monitoring, by a listener corresponding to a default consuming end, a gray scale message in the preset topic, and consuming the gray scale message when a first coloring identifier of the gray scale message is not matched with a second coloring identifier of the gray scale message, specifically includes:
monitoring the service message in the preset topic through a monitor corresponding to the default consuming end, and acquiring the first dyeing identifier corresponding to the gray message when the service message belongs to the gray message;
and reading a second dyeing identifier corresponding to the gray scale consuming end from a preset consuming end path, and consuming the gray scale message through the default consuming end when the first dyeing identifier is not matched with the second dyeing identifier.
4. The method of claim 3, wherein the preset topic is further configured to receive a general message; after the monitoring of the gray scale message in the preset topic is performed by the monitor corresponding to the default consuming end, the method further includes:
and when the service message belongs to a common message, consuming the common message through the default consuming terminal, wherein the common message is the service message carrying a common identifier.
5. The method according to any one of claims 1 to 4, further comprising:
when the content corresponding to the preset consuming end path changes, reading a third dyeing identifier corresponding to the changed gray level consuming end from the preset consuming end path;
and determining a fourth dyeing identifier based on the first dyeing identifier and the third dyeing identifier, so that the gray scale message is consumed when the monitor corresponding to the default consuming end monitors the gray scale message carrying the fourth dyeing identifier.
6. The method according to claim 5, wherein the consuming of the gray scale message by the gray scale consuming end specifically comprises:
when a first dyeing identifier of the gray scale message is matched with a second dyeing identifier corresponding to the gray scale consuming terminal, adding the gray scale message into a gray scale message consuming queue list corresponding to the gray scale consuming terminal;
and the gray scale consuming end consumes the gray scale message in the gray scale message consuming queue list.
7. The method of claim 6, further comprising:
when the gray scale consuming end is abnormal, acquiring the consumption progress of the gray scale message consumption queue list corresponding to the gray scale consuming end;
and according to the consumption progress, compensating and consuming the unconsumed gray scale message in the gray scale message consumption queue list through the default consuming end.
8. A device for processing a grayscale message, comprising:
the gray scale message sending module is used for acquiring a first dyeing identifier corresponding to a service production end and sending a gray scale message to a preset topic through the service production end, wherein the gray scale message is the service message with the first dyeing identifier;
the first gray scale message consumption module is used for monitoring the gray scale message in the preset topic through a monitor corresponding to a gray scale consumption end and consuming the gray scale message when a first dyeing identifier of the gray scale message is matched with a second dyeing identifier corresponding to the gray scale consumption end;
and the second gray message consumption module is used for monitoring the gray messages in the preset topic through a monitor corresponding to a default consumption end and consuming the gray messages when the first dyeing identification of the gray messages is not matched with the second dyeing identification.
9. A storage medium having stored thereon a computer program, characterized in that the computer program, when being executed by a processor, implements the method of processing a greyscale message according to any of claims 1 to 7.
10. A computer device comprising a storage medium, a processor and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the method of processing a greyscale message according to any of claims 1 to 7 when executing the computer program.
CN202010782659.2A 2020-08-06 2020-08-06 Gray message processing method and device, storage medium and computer equipment Active CN112114845B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010782659.2A CN112114845B (en) 2020-08-06 2020-08-06 Gray message processing method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010782659.2A CN112114845B (en) 2020-08-06 2020-08-06 Gray message processing method and device, storage medium and computer equipment

Publications (2)

Publication Number Publication Date
CN112114845A true CN112114845A (en) 2020-12-22
CN112114845B CN112114845B (en) 2023-08-11

Family

ID=73798814

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010782659.2A Active CN112114845B (en) 2020-08-06 2020-08-06 Gray message processing method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN112114845B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113315839A (en) * 2021-05-28 2021-08-27 武汉悦学帮网络技术有限公司 Message processing method, system, device, computer equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020136214A1 (en) * 2000-08-14 2002-09-26 Consumer Direct Link Pervasive computing network architecture
US20140279476A1 (en) * 2013-03-15 2014-09-18 Visa International Service Association Multiple Account Dynamic Card Apparatuses, Methods and Systems
CN108427581A (en) * 2018-02-07 2018-08-21 平安普惠企业管理有限公司 System micro services method and terminal device
US20190114971A1 (en) * 2017-10-17 2019-04-18 Microsoft Technology Licensing, Llc Pulse-width modulation based on image gray portion
CN110362974A (en) * 2019-05-31 2019-10-22 杭州恩牛网络技术有限公司 Service gray scale dissemination method, device, medium and electronic equipment
CN110781015A (en) * 2019-10-28 2020-02-11 深圳前海微众银行股份有限公司 Message queue distribution method, device, equipment and computer readable storage medium
CN110781013A (en) * 2019-10-25 2020-02-11 湖南御家科技有限公司 Gray scale publishing method, device, equipment and medium
CN111163085A (en) * 2019-12-29 2020-05-15 北京车与车科技有限公司 Gray level release scene optimization method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020136214A1 (en) * 2000-08-14 2002-09-26 Consumer Direct Link Pervasive computing network architecture
US20140279476A1 (en) * 2013-03-15 2014-09-18 Visa International Service Association Multiple Account Dynamic Card Apparatuses, Methods and Systems
US20190114971A1 (en) * 2017-10-17 2019-04-18 Microsoft Technology Licensing, Llc Pulse-width modulation based on image gray portion
CN108427581A (en) * 2018-02-07 2018-08-21 平安普惠企业管理有限公司 System micro services method and terminal device
CN110362974A (en) * 2019-05-31 2019-10-22 杭州恩牛网络技术有限公司 Service gray scale dissemination method, device, medium and electronic equipment
CN110781013A (en) * 2019-10-25 2020-02-11 湖南御家科技有限公司 Gray scale publishing method, device, equipment and medium
CN110781015A (en) * 2019-10-28 2020-02-11 深圳前海微众银行股份有限公司 Message queue distribution method, device, equipment and computer readable storage medium
CN111163085A (en) * 2019-12-29 2020-05-15 北京车与车科技有限公司 Gray level release scene optimization method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
凌雨尘: "灰度发布策略", pages 1, Retrieved from the Internet <URL:https://www.cnblogs.com/lyc94620/p/11483736.html> *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113315839A (en) * 2021-05-28 2021-08-27 武汉悦学帮网络技术有限公司 Message processing method, system, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN112114845B (en) 2023-08-11

Similar Documents

Publication Publication Date Title
US20090313603A1 (en) System And Method For Creating Virtual Callback Objects
CN109815105A (en) Applied program testing method and device based on Btrace
CN112463634A (en) Software testing method and device under micro-service architecture
CN111782470A (en) Distributed container log data processing method and device
CN113076253A (en) Test method and test device
CN112364744A (en) TensorRT-based accelerated deep learning image recognition method, device and medium
CN104978276B (en) Method, apparatus and system for inspection software
CN104809054A (en) Method and system for realizing program testing
CN113434173B (en) Data processing method, device, storage medium and electronic equipment
CN112114845A (en) Method and device for processing gray scale message, storage medium and computer equipment
CN111897737B (en) Missing detection method and device for program test of micro-service system
CN111008865A (en) Coupon synchronous display method and device, server and storage medium
CN109218338A (en) Information processing system, method and apparatus
CN113360413A (en) Code testing method and device
CN107229565B (en) Test method and device
CN115276844B (en) Communication module testing method and device, storage medium and electronic equipment
CN110266610B (en) Traffic identification method and device and electronic equipment
CN110221958B (en) Application testing method, device, computing equipment and computer readable storage medium
CN113434384B (en) Pressure testing method and device
GB2424498A (en) Test simulation using live real-world characteristics
CN112905457A (en) Software testing method and device
CN113760715A (en) Method and device for testing system
CN113704079A (en) Interface testing method and device based on Protobuf
CN113407445B (en) End-to-end automatic testing method and device and electronic equipment
CN111831530A (en) Test method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100102 201 / F, block C, 2 lizezhong 2nd Road, Chaoyang District, Beijing

Applicant after: Beijing Shuidi Technology Group Co.,Ltd.

Address before: 100102 201, 2 / F, block C, No.2 lizezhong 2nd Road, Chaoyang District, Beijing

Applicant before: Beijing Health Home Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant