Message processing system
By implementing automatic detection and update mechanisms in producer and consumer servers, and dynamically managing TOPIC, the error problems caused by changes in environment and business types are solved, and the automatic adaptation and stability of the message processing system is achieved.
Patent Information
- Application Number
- CN202411381303.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-30
AI Technical Summary
In a message processing system, when the test environment or business type of the producer server and consumer server changes, the TOPIC needs to be manually updated in the prior art, resulting in errors and confusion, and it is impossible to automatically adapt to changes in the environment and business type.
By implementing automatic detection and update mechanisms in producer servers and consumer servers, TOPICs are dynamically generated and managed based on preset test environments and business type relationships, ensuring the correct transmission and processing of messages between message center servers.
The TOPIC of the producer server and consumer server can be automatically adjusted without manual participation, avoiding errors and confusion, improving system stability and testing quality, and ensuring the correctness and consistency of message processing.
Smart Images

Figure CN119211179A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a message processing system. Background Art
[0002] The test system includes multiple producer servers, a message center server and multiple consumer servers; the producer server is used to produce messages carrying TOPICs and store the produced messages in the message center server; the consumer server is used to obtain messages with TOPICs subscribed by itself from the message center server and process them.
[0003] The above-mentioned related technologies have the following problems: if the R&D personnel need to produce messages through producer server A and process the messages through consumer server B, then the consumer server B and producer server A are pre-set to have the same TOPIC; if the R&D personnel change "consumer server B consumes messages produced by producer server A" to "consumer server C consumes messages produced by producer server A", but the R&D personnel fail to change "consumer server B and producer server A have the same TOPIC" to "consumer server C and producer server A have the same TOPIC", it will cause consumer server B to be able to obtain messages produced by producer server A from the message center server, and cause consumer server C to not be able to obtain messages produced by producer server A from the message center server, resulting in an error. Summary of the invention
[0004] In view of the above problems, this application provides a message processing system. The specific solution is as follows:
[0005] The first aspect of the present application provides a message processing system, including:
[0006] A producer server is used to determine a first test environment corresponding to the producer server; find a first environment number corresponding to the first test environment from a preset correspondence between the test environment and the environment number; determine a first service type corresponding to the producer server; find a first service number corresponding to the first service type from a preset correspondence between the service type and the service number; obtain a first TOPIC including the first environment number and the first service number; generate a message carrying the first TOPIC; and send the message to a message center server;
[0007] The message center server is used to store storage spaces corresponding to multiple TOPICs respectively; the message is stored in the storage space corresponding to the first TOPIC;
[0008] A consumer server, used to determine a second test environment corresponding to the consumer server; search for a second environment number corresponding to the second test environment from a preset correspondence between the test environment and the environment number; determine a second service type corresponding to the consumer server; search for a second service number corresponding to the second service type from a preset correspondence between the service type and the service number; obtain a second TOPIC including the second environment number and the second service number; and obtain a message carrying the second TOPIC from the message center server.
[0009] By means of the above technical solution, the present application provides a message processing system, in which the producer server can determine the first TOPIC carried by the message it produces based on its corresponding first test environment and first business type; if the first test environment corresponding to the producer server changes or the corresponding first business type changes, the determined first TOPIC will also change automatically. The producer server produces a message carrying the first TOPIC and stores it in the message center server. The consumer server can determine the second TOPIC carried by the message it consumes based on its corresponding second test environment and second business type; if the second test environment corresponding to the consumer server changes or the corresponding second business type changes, the determined second TOPIC will also change automatically. The consumer server can obtain the message carrying the second TOPIC from the message center server and process it. In the present application, if the test environment corresponding to the producer server or the consumer server changes or the corresponding business type changes, the first TOPIC corresponding to the producer server and the second TOPIC corresponding to the consumer server will automatically change. No personnel participation is required, which avoids the occurrence of errors existing in the relevant technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0011] Figure 1 A schematic diagram of a system architecture provided for this application;
[0012] Figure 2 A schematic diagram of an optional hardware structure of a terminal provided in this application;
[0013] Figure 3 A schematic diagram of the structure of a server provided for this application;
[0014] Figure 4A signaling diagram of a message processing system provided in an embodiment of the present application;
[0015] Figure 5 A schematic diagram of a code for a consumer server processing a message provided in an embodiment of the present application;
[0016] Figure 6 A code diagram of producer server initialization provided in an embodiment of the present application;
[0017] Figure 7 A schematic diagram of the code for initializing a consumer server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0018] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0019] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0020] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0021] See also Figure 1 , Figure 1 A schematic diagram of a system architecture is shown. The system may include one or more producer servers 100 , a message center server 200 , and one or more consumer servers 300 .
[0022] Exemplarily, the producer server 100 may be one server or a cluster including a plurality of servers.
[0023] Exemplarily, the message center server 200 may be a server or a cluster including multiple servers. Exemplarily, the message center server may be a BROKER server, which stores ROCKETMQ.
[0024] Exemplarily, the consumer server 300 may be one server or a cluster including multiple servers.
[0025] Exemplarily, the message center server may correspond to a first terminal, and the first terminal may display an interface, through which the R&D personnel may set the TOPIC stored in the consumption center server.
[0026] Exemplarily, one or more producer servers 100 may constitute a producer cluster. Each producer cluster corresponds to a cluster number; different producer clusters correspond to different cluster numbers. Exemplarily, the business types corresponding to different producer clusters may be different or may be the same.
[0027] Exemplarily, one or more consumer servers 300 may constitute a consumer cluster. Each consumer cluster corresponds to a cluster number; different consumer clusters correspond to different cluster numbers. Different consumer clusters may correspond to different or the same service types.
[0028] Exemplarily, the same test environment corresponds to one or more producer clusters; the same test environment corresponds to one or more consumer clusters.
[0029] The following is an explanation of the testing environment. The testing environment is the description of the software and hardware environment on which the test is run, as well as any other software that interacts with the software under test, including drivers and stubs. The testing environment is the general term for the computer hardware, software, network equipment, and historical data required to complete the software testing work.
[0030] For example, the test environment can be: sit (System Integration Testing Environment, system integration testing environment), uat (User Acceptance Testing Environment, user acceptance testing environment).
[0031] Figure 1 Three producer clusters are shown in the figure, and the test environments corresponding to the three producer clusters are: sitA, sitB, and uat. Figure 1 This is only an example and does not limit the number of producer clusters included in the system. Figure 1 Three consumer clusters are shown, and the test environments corresponding to the three consumer clusters are: sitA, sitB, and uat. Figure 1 This is only an example and does not limit the number of consumer clusters included in the system.
[0032] Exemplarily, the producer server 100 corresponds to a second terminal, which can display an interface through which the R&D personnel can set the test environment corresponding to the producer server 100. The producer server 100 can store the correspondence between the preset test environment and the environment number, and the correspondence between the preset business type and the business number.
[0033] Exemplarily, the consumer server 300 may correspond to a third terminal, and the third terminal may display an interface, through which the R&D personnel may set the TOPIC of the message subscribed by the consumer server 300. After subscribing to the message through the third terminal, the correspondence between the GID (groupId) of the consumer server 300 and the subscribed TOPIC may be sent by the consumer server 300 to the message center server. The consumer server 300 may store the correspondence between the preset test environment and the environment number, and the correspondence between the preset business type and the business number.
[0034] It is understandable that if a producer server 100 and a consumer server 300 have the same test environment and the same business type, the TOPICs obtained by the producer server 100 and the consumer server 300 are the same.
[0035] Exemplarily, the same test environment corresponds to one or more producer clusters; the same test environment corresponds to one or more consumer clusters.
[0036] The producer server 100 is used to produce messages and store the messages in the message center server; the consumer server obtains the messages from the message center server.
[0037] The following describes the interaction process between the producer server 100, the message center server 200 and the consumer server 300 in combination with the application scenario.
[0038] Assume that a customer has purchased an insurance product from an insurance company, and then needs to redeem the insurance product and has completed a redemption transaction; the redemption transaction includes the customer's bank card A's card number and the redemption time, and the redemption transaction is recorded in the insurance company. When the redemption time arrives, the insurance company will deposit the funds into the bank, and the bank will then deposit the funds into the card number of bank card A carried in the redemption transaction.
[0039] In the case where the redemption transaction has been completed but the redemption time has not been reached, that is, the insurance company has not deposited the funds into the bank, the customer's bank card A is lost and the customer has applied for a card replacement service at the bank. The bank provides the user with a new bank card B. At this time, the card number of bank card A in the redemption transaction stored by the insurance company needs to be changed to the card number of bank card B. In the above application scenario, the producer server 100 can be a bank's server, and the message produced by the producer server 100 can be a message for replacing the card number of the customer's bank card A with the card number of bank card B. The consumer server 300 can be a server of the insurance company. The insurance company obtains the above message and changes the card number of bank card A in the redemption transaction to the card number of bank card B.
[0040] Next, a product form of any one of the first terminal, the second terminal, and the third terminal is described.
[0041] The terminal in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any restrictions on this.
[0042] Figure 2 An optional hardware structure diagram of a terminal is shown.
[0043] refer to Figure 2 As shown, the terminal may include a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), an earphone jack 163 (optional), a processor 170, an external interface 180, a power supply 190 and other components. Those skilled in the art will appreciate that Figure 2 This is merely an example of a terminal and does not constitute a limitation on the terminal. The terminal may include more or fewer components than shown in the figure, or a combination of certain components, or different components.
[0044] The input unit 130 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the terminal. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can collect the user's touch operations on or near it (such as the user's operation on or near the touch screen using any suitable object such as fingers, joints, stylus, etc.), and drive the corresponding connection device according to a pre-set program. The touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 170, and can receive and execute the command sent by the processor 170; the touch signal at least includes the touch point coordinate information. The touch screen 131 can provide an input interface and an output interface between the terminal and the user. In addition, the touch screen can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch screen 131, the input unit 130 can also include other input devices. Specifically, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.
[0045] Among them, the input device 132 can receive input data and the like.
[0046] The display unit 140 can be used to display information input by the user or information provided to the user, various menus of the terminal, interactive interfaces, file display and / or playback of any multimedia file. In the embodiment of the present application, the display unit 140 can be used to display interfaces, processing results, etc.
[0047] The memory 120 can be used to store instructions and data. The memory 120 can mainly include an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files, texts, etc.; the instruction storage area can store software units such as operating systems, applications, instructions required for at least one function, or their subsets and extensions. It can also include a non-volatile random access memory; provide the processor 170 with hardware, software and data resources including management of computing and processing equipment, and support control software and applications. It is also used for the storage of multimedia files, and the storage of running programs and applications.
[0048] The processor 170 is the control center of the terminal. It uses various interfaces and lines to connect various parts of the entire terminal. By running or executing instructions stored in the memory 120 and calling data stored in the memory 120, it executes various functions of the terminal and processes data, thereby controlling the terminal device as a whole. Optionally, the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 170. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips. The processor 170 may also be used to generate corresponding operation control signals, send them to corresponding components of the computing and processing device, read and process data in the software, especially read and process data and programs in the memory 120, so that each functional module therein performs corresponding functions, thereby controlling the corresponding components to act according to the requirements of the instructions.
[0049] The memory 120 may be used to store software codes, the processor 170 may execute the software codes, and may also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to implement corresponding functions.
[0050] The radio frequency unit 110 (optional) can be used for receiving and sending information or receiving and sending signals during a call, for example, after receiving the downlink information of the base station, it is sent to the processor 170 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the radio frequency unit 110 can also communicate with network devices and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.
[0051] In this embodiment of the present application, the RF unit 110 can send data to a server and receive a processing result sent by the server.
[0052] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.
[0053] The terminal also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, so that the power management system can manage charging, discharging, power consumption and other functions.
[0054] The terminal also includes an external interface 180, which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal to communicate with other devices, or to connect a charger to charge the terminal.
[0055] Although not shown, the terminal may also include a flashlight, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which will not be described in detail here. Some or all of the methods described below may be applied in the following embodiments. Figure 2 in the terminal shown.
[0056] Next, the product form of any server among the producer server, message center server and consumer server is described.
[0057] Figure 3 A schematic diagram of the structure of a server is provided, such as Figure 3 As shown, the server includes a bus 201, a processor 202, a communication interface 203 and a memory 204. The processor 202, the memory 204 and the communication interface 203 communicate with each other via the bus 201.
[0058] The bus 201 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0059] The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0060] The memory 204 may include a volatile memory, such as a random access memory (RAM). The memory 204 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0061] The memory 204 may be used to store software codes, the processor 202 may execute the software codes, and may also schedule other units to implement corresponding functions.
[0062] It should be understood that the above-mentioned terminals and servers can be centralized or distributed devices, and the processors in the above-mentioned terminals and servers (such as processor 170 and processor 202) can be hardware circuits (such as application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), general-purpose processors, digital signal processors (DSP), microprocessors or microcontrollers, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0063] In the embodiment of the present application, the consumer cluster and the producer cluster corresponding to the same TOPIC can be referred to as a group; that is, the TOPIC of the message produced by the producer belonging to the same group is the same as the TOPIC of the message processed by the consumer. The consumer cluster belonging to a group is used to consume the message produced by the producer cluster of the group. In the related art, it is necessary to set up the producer cluster and the consumer cluster of the same group. For example, the R&D personnel need to set the TOPIC A that the message produced by the producer cluster needs to carry through the terminal corresponding to the producer cluster, so that the producer server in the producer cluster can produce messages carrying TOPIC A; the R&D personnel need to set the TOPIC A that the message consumed by the consumer cluster needs to carry through the terminal corresponding to the consumer cluster, so that the consumer server in the consumer cluster knows that it needs to consume messages carrying TOPIC A. If the consumer cluster in the same group is changed to another consumer cluster, or the producer cluster in the same group is changed to another producer cluster, but the R&D personnel do not modify the TOPIC for the terminal of the consumer cluster or the terminal of the producer cluster, confusion will result. The following is an example.
[0064] Assume that producer cluster A and consumer cluster B belong to the same group, and producer cluster A and consumer cluster B correspond to the same TOPIC A; if "producer cluster A and consumer cluster B belong to the same group" is changed to "producer cluster A and consumer cluster C belong to the same group", but TOPIC A corresponding to consumer cluster B is not changed to other TOPICs, consumer cluster B will still obtain messages carrying TOPIC A from the message center server. After the message carrying TOPIC A is obtained by consumer cluster B, it cannot be obtained by consumer cluster C. If other TOPICs corresponding to consumer cluster C are not changed to TOPIC A, consumer cluster C will not obtain messages carrying TOPIC A from the message center server.
[0065] In order to solve the above problems, the embodiment of the present application provides a message processing system. The applicant found the following during the research process:
[0066] Case 1: The consumer cluster and producer cluster belonging to the same group have the same test environment and the same business type.
[0067] Case 2: The test environments corresponding to consumer clusters and producer clusters belonging to different groups are different, and the business types corresponding to consumer clusters and producer clusters belonging to different groups are different; or, the test environments corresponding to consumer clusters and producer clusters belonging to different groups are the same, and the business types corresponding to consumer clusters and producer clusters belonging to different groups are different; or, the test environments corresponding to consumer clusters and producer clusters belonging to different groups are different, and the business types corresponding to consumer clusters and producer clusters belonging to different groups are the same.
[0068] Combining situations 1 and 2, each group of consumer clusters and producer clusters can be uniquely identified by the test environment and the business type. Based on this, the embodiment of the present application characterizes the TOPIC corresponding to each group of consumer clusters and producer clusters with the test environment and business type corresponding to the group.
[0069] The message processing system of the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0070] Reference Figure 4 , Figure 4 A signaling diagram of a message processing system provided in an embodiment of the present application, such as Figure 4 As shown, a message processing system provided by an embodiment of the present application may include steps S401 to S413, and these steps are described in detail below.
[0071] Step S401: The producer server 100 determines a first test environment corresponding to the producer server.
[0072] Exemplarily, the test environment of the producer server 100 can be changed through the interface displayed by the second terminal corresponding to the producer server 100. That is, the producer server 100 can obtain its corresponding test environment through the interface of the second terminal.
[0073] Exemplarily, each time the producer server 100 is started or during the start-up process, steps S401 to S405 are executed. In this way, after the R&D personnel modify the test environment through the second terminal corresponding to the producer server 100, the producer server 100 can automatically sense the changed test environment without manual operation.
[0074] Exemplarily, the project version numbers (versions) of different test environments may be different, and the test environment may be determined by the project version number in the producer server 100 .
[0075] Step S402: the producer server 100 searches for the first environment number corresponding to the first test environment from the correspondence between the preset test environments and environment numbers.
[0076] Assumptions Figure 1 The test environments corresponding to the three producer clusters in the system shown are: sitA, sit B and uat; the correspondence between the three test environments and the environment numbers includes: the environment number corresponding to the test environment sitA is 001001%, the environment number corresponding to the test environment sitB is 001002%, and the environment number corresponding to the test environment uat is 001003%.
[0077] Step S403: The producer server 100 determines the first service type corresponding to the producer server.
[0078] Exemplarily, a corresponding service code is set in each producer server 100, and the service code includes the service type corresponding to the producer server. The service codes set for multiple producer servers belonging to the same producer cluster are the same; the service codes set for producer servers belonging to different producer clusters are different.
[0079] The following examples illustrate the business types. For example, business types include but are not limited to: card opening business, card replacement business for changing bank card numbers, payment business, and batch reconciliation business.
[0080] Step S404: the producer server 100 searches for the first business number corresponding to the first business type from the preset correspondence between the business type and the business number.
[0081] Exemplarily, the business number may be composed of one or more of letters, numbers and special symbols.
[0082] Step S405: The producer server 100 obtains a first TOPIC including the first environment number and the first business number.
[0083] Exemplarily, the first TOPIC consists of a first environment number and a first business number. Assuming that the first environment number is 001001% and the first business number is @11, the first TOPIC is 001001%@11.
[0084] Step S406: the producer server 100 generates a message carrying the first TOPIC; and sends the message to the message center server 200.
[0085] Exemplarily, after the producer server 100 generates a message, before sending the message, the message can be intercepted and the TOPIC carried by the message can be set as the first TOPIC.
[0086] Step S407: the message center server 200 stores storage spaces corresponding to a plurality of TOPICs respectively; the message is stored in the storage space corresponding to the first TOPIC.
[0087] For example, before the consumer center server 200 is started, the R&D personnel can obtain multiple TOPICs based on the test environment and business type corresponding to the existing producer cluster, so that the storage space corresponding to multiple TOPICs can be created through the first terminal setting corresponding to the consumer center server 200. The process of the R&D personnel obtaining TOPICs is the same as the process of the producer server obtaining the first TOPIC.
[0088] Exemplarily, the message center server stores an MQ (MessageQueue) queue. Exemplarily, the storage space corresponding to each TOPIC is an MQ.
[0089] Step S408: the consumer server 300 determines a second test environment corresponding to the consumer server.
[0090] Illustratively, the second test environment may be the same as or different from the first test environment.
[0091] Exemplarily, the consumer server 300 executes steps S408 to S412 after each startup or during the startup process.
[0092] Step S409: the consumer server 300 searches for the second environment number corresponding to the second test environment from the preset correspondence between the test environment and the environment number.
[0093] Step S410: the consumer server 300 determines a second service type corresponding to the consumer server.
[0094] Illustratively, the second service type may be the same as or different from the first service type.
[0095] Step S411: the consumer server 300 searches for the second service number corresponding to the second service type from the preset correspondence between the service type and the service number.
[0096] Exemplarily, each consumer server 300 is provided with a corresponding service code, and the service code includes the service type corresponding to the consumer server 300. The service codes provided to multiple consumer servers belonging to the same consumer cluster are the same; the service codes provided to consumer servers belonging to different consumer clusters are different.
[0097] The following examples illustrate the business types. For example, business types include but are not limited to: card opening business, card replacement business for changing bank card numbers, payment business, and batch reconciliation business.
[0098] Step S412: the consumer server 300 obtains a second TOPIC including the second environment number and the second service number.
[0099] Exemplarily, the second TOPIC is composed of the second environment number and the second business number. Assuming that the second environment number is 001002% and the second business number is @21, the second TOPIC is 001002%@21.
[0100] Illustratively, the second TOPIC may be the same as or different from the first TOPIC.
[0101] Step S413: the consumer server 300 obtains the message carrying the second TOPIC from the message center server.
[0102] The embodiment of the present application provides a message processing system, in which the producer server can determine the first TOPIC carried by the message it produces based on its corresponding first test environment and first business type; if the first test environment corresponding to the producer server changes or the corresponding first business type changes, the determined first TOPIC will also change automatically. The producer server produces a message carrying the first TOPIC and stores it in the message center server. The consumer server can determine the second TOPIC carried by the message it consumes based on its corresponding second test environment and second business type; if the second test environment corresponding to the consumer server changes or the corresponding second business type changes, the determined second TOPIC will also change automatically. The consumer server can obtain the message carrying the second TOPIC from the message center server and process it. In the present application, if the test environment corresponding to the producer server or the consumer server changes or the corresponding business type changes, the first TOPIC corresponding to the producer server and the second TOPIC corresponding to the consumer server will automatically change. No human involvement is required, avoiding the occurrence of errors existing in the relevant technology.
[0103] In a possible implementation, there are multiple implementations of step S413, and the embodiments of the present application provide but are not limited to the following two.
[0104] The first implementation of step S413 includes the following steps A11 to A12.
[0105] Step A11: the consumer server 300 sends a request for obtaining a message to the message center server 200, wherein the request for obtaining a message carries the second TOPIC.
[0106] Step A12: the message center server 200 sends the message carrying the second TOPIC to the consumer server 200 .
[0107] The second implementation of step S413 includes the following steps A21 to 24.
[0108] Step A21: the consumer server 300 obtains a target GID including a cluster identifier of the cluster to which the consumer server belongs and the second environment number.
[0109] The same test environment may correspond to one or more consumer clusters. A consumer cluster includes one or more consumer servers. Messages consumed by different consumer clusters carry different TOPICs.
[0110] Step A22: the consumer server 300 generates a get message request, where the get message request includes the target GID and the second TOPIC.
[0111] Step A23: The consumer server 300 sends the message acquisition request to the message center server.
[0112] Step A24: the message center server 200 searches for the TOPIC corresponding to the target GID from the preset correspondence between the GID and TOPIC of the consumer server.
[0113] Exemplarily, the correspondence between the preset GID and TOPIC of the consumer server is uploaded to the message center server 200 by each consumer server. That is, the consumer server can subscribe to the message, and the process of the consumer server subscribing to the message carrying the second TOPIC includes: obtaining a subscription message instruction, the subscription message instruction includes the target GID and the second TOPIC; sending the subscription message instruction to the message center server. The message center server will store the correspondence between the target GID and the second TOPIC; if the consumer server has not subscribed to the message carrying the second TOPIC, the message center server 200 will not send the message carrying the second TOPIC to the consumer server.
[0114] Step A25: if the TOPIC corresponding to the target GID is the same as the second TOPIC, the message center server 200 sends the message in the storage space corresponding to the second TOPIC to the consumer server 200 .
[0115] In order to prevent the same message from being processed by consumer servers belonging to the same consumer cluster, the message center server 200 may set the status of the message sent to the consumer server to a consumed status.
[0116] It can be understood that the consumer server can update the subscription message, and the method for updating the subscription message includes the following steps B1 to B3.
[0117] Step B1: the consumer server 300 obtains an update subscription message instruction, wherein the update subscription message instruction includes the target GID and the second TOPIC.
[0118] Assume that the TOPIC carried by the message subscribed by the consumer server 300 before is the third TOPIC, and the developer needs to change the third TOPIC carried by the message subscribed by the consumer server 300 to the second TOPIC, so the subscription message needs to be updated.
[0119] Step B2: The consumer server 300 sends the update subscription message instruction to the message center server.
[0120] Step B3: the message center server 200 adds the correspondence between the target GID and the second TOPIC to the preset correspondence between the GID and TOPIC of the consumer server.
[0121] It is understandable that the update subscription message instruction is generated by triggering the development personnel. Exemplarily, the update subscription message is automatically generated, then before executing step B1, the following steps B11 to B13 may also be executed.
[0122] Step B11: If the second TOPIC obtained by the consumer server in step S412 is different from the TOPIC in the subscription message closest to the current time, it is determined that the subscription message of the consumer server has changed.
[0123] The consumer server stores the subscription message that is most recent to the current time.
[0124] Assume that the current time is 11:00 a.m. on September 23, 2024, and the consumer server sent the first subscription message to the message center server at 10:00 a.m. on August 1, 2024; the consumer server sent the second subscription message to the message center server at 10:00 a.m. on September 22, 2024, then the second subscription message is the subscription message closest to the current time.
[0125] It can be understood that the second TOPIC obtained through step S412 represents the test environment and business type currently corresponding to the consumer's server. If the second TOPIC is different from the TOPIC in the most recent subscription message at the current time, it means that the R&D personnel have forgotten to update the subscription message. If the subscription message is not updated in time, the consumer server cannot obtain the message carrying the second TOPIC from the message center server due to step A25.
[0126] Step B12: If the target GID obtained by the consumer server in step A21 is different from the GID in the subscription message closest to the current time, it is determined that the subscription message of the consumer server has changed.
[0127] It can be understood that if the target GID obtained in step A21 is different from the GID in the subscription message closest to the current time, it means that the test environment corresponding to the consumer server has changed.
[0128] The target GID can represent the test environment corresponding to the consumer server and the cluster identifier of the cluster where the consumer server is located.
[0129] The embodiment of the present application can determine whether the subscription message of the consumer server has changed through step B11 and / or step B12.
[0130] Step B13: If it is determined through step B11 that the subscription message of the consumer server has changed, or if it is determined through step B12 that the subscription message of the consumer server has changed, the consumer server is triggered to execute steps B1 to B2.
[0131] Exemplarily, if the GID of a consumer server in the related technology is changed, the R&D personnel need to change it manually, which will lead to the following problems: if the R&D personnel fail to change the GID of the consumer server in time, it may cause the GIDs of consumer servers belonging to different consumer clusters to be the same; for example, consumer cluster A corresponds to GIDA, and consumer cluster B corresponds to GIDB. Assuming that the GIDA corresponding to consumer cluster A needs to be changed to GIDB, and the GIDB corresponding to consumer cluster B needs to be changed to GIDC, the R&D personnel promptly changes the GIDA corresponding to consumer cluster A to GIDB but fails to promptly change the GIDB corresponding to consumer cluster B to GIDC, which results in the GIDs corresponding to both consumer cluster A and consumer cluster B being GIDB. If any consumer server in consumer cluster A first sends a subscription message to the message center server (including the correspondence between GIDB and TOPIC11), the message center server changes the TOPIC corresponding to GIB to TOPIC11 in the subscription message, and any consumer server in consumer cluster B then sends a subscription message to the message center server (including the correspondence between GIDB and TOPIC12), the message center server changes the TOPIC corresponding to GIB to TOPIC12 in the subscription message. However, in reality, since consumer cluster A corresponds to GIDB, the message center server should retain the "correspondence between GIDB and TOPIC11". Therefore, if the GID corresponding to the consumer cluster is not updated in time, the correspondence between GID and TOPIC stored in the message center server may be incorrect. Through steps B11 to B13, the consumer server can automatically perceive the changed GID and TOPIC, so that the problems in the related technology will not occur.
[0132] In an optional implementation, after the consumer server 200 obtains the message carrying the second TOPIC, it can process the message carrying the second TOPIC. The specific processing process includes but is not limited to the following steps C1 to C2.
[0133] Step C1: based on the message body type of the message carrying the second TOPIC, the message carrying the second TOPIC is parsed to obtain a parsed message.
[0134] The message body type (MIME type, Multipurpose Internet Mail Extensions type) is a standard used on the Internet to represent file formats. The MIME type consists of two parts, type and subtype, which are separated by a slash ( / ). Common MIME types include:
[0135] text / plain: indicates plain text files.
[0136] text / html: indicates a web page in HTML format.
[0137] image / jpeg: indicates an image in JPEG format.
[0138] image / png: indicates an image in PNG format.
[0139] application / json : indicates data in JSON format.
[0140] application / xml: indicates data in XML format.
[0141] application / pdf : Indicates a file in PDF format.
[0142] In the HTTP protocol, the MIME type is usually specified in the Content-Type header, telling the recipient how to process the received message.
[0143] Step C2: Process the parsed message through a preset template method pattern.
[0144] Exemplarily, step C2 includes but is not limited to the following methods: Initialize context (abstract method, implemented by actual consumers), which is implemented according to actual business. Message filtering (abstract method, implemented by actual consumers), which determines whether messages need to be filtered out according to actual business. Message processing (abstract method, implemented by actual consumers), which is implemented according to actual business. Message persistence, which persists messages to the database and stores unified messages in the database. Update the consumption result of the message, which updates the consumption status of the message according to the consumer's consumption situation. Context clearing (abstract method, implemented by actual consumers), which is implemented according to actual business.
[0145] For example, the template method pattern is an abstract parent class integrated by the consumer server. When the consumer server obtains a message, it automatically calls the onEvent template method in the abstract parent class, and then processes the message according to the steps defined by the onEvent template method. Figure 5 shown.
[0146] In an optional implementation, the reason why the message center server can store storage spaces corresponding to multiple TOPICs is that the R&D personnel upload multiple TOPICs to the message center server through the first terminal corresponding to the message center server, so that the message center server can divide the storage spaces corresponding to the multiple TOPICs. It is understandable that the test environment or business type corresponding to the same producer cluster may change, thereby causing the TOPIC corresponding to the producer cluster to change, for example, to TOPIC B. The message center server may not store the storage space corresponding to TOPIC B, so TOPIC B needs to be uploaded to the message center server in time. If it is manually uploaded, it may cause a missed transmission, resulting in the message center server being unable to store the message carrying TOPIC B. Based on this, the embodiment of the present application provides the following method, which includes but is not limited to the following steps D1 to D4.
[0147] Step D1: The message center server obtains the test environments corresponding to the multiple producer servers and the business types corresponding to the multiple producer servers.
[0148] Exemplarily, if a start instruction is detected, step D1 is executed.
[0149] Exemplarily, the test environments corresponding to the multiple producer servers and the business types corresponding to the multiple producer servers may be actively reported to the message center server by the producer servers after startup, or may be actively obtained by the message center server from the producer servers.
[0150] Exemplarily, one producer server among multiple producer servers belonging to the same producer cluster reports its corresponding test environment and business type to the message center server.
[0151] Step D2: The message center server searches for the environment numbers of the test environments corresponding to the multiple producer servers from the preset correspondence between the test environments and the environment numbers.
[0152] Step D3: The message center server searches for the service numbers of the multiple producer servers that respectively correspond to the service types from the preset correspondence between the service types and the service numbers.
[0153] Step D4: The message center server obtains a TOPIC for each producer server based on the environment number and the business type corresponding to the producer server; and creates a storage space for the TOPIC.
[0154] In the above embodiment, the message center server can automatically sense the changes in the test environment and business type corresponding to the producer cluster, so that it can automatically update multiple TOPICs stored in itself and create storage space for corresponding TOPICs.
[0155] In an optional implementation, the process of the generator server obtaining its own GID is the same as that of the consumer server, which is not repeated here.
[0156] In an optional implementation, the start method can be executed to initialize the producer server. The process of initializing the producer server includes: determining the test environment and business type corresponding to the producer server; determining the TOPIC corresponding to the producer server. Before the producer server sends a message, it needs to intercept the message and modify the TOPIC carried by the message to isolate the message from each other. Some codes are as follows: Figure 6 shown.
[0157] In an optional implementation, before the project starts to instantiate the consumer server, steps S408 to S412 need to be executed. The "correspondence between the preset test environment and the environment number" and the "correspondence between the preset business type and the business number" stored in the consumer server and the producer server are the same. When the consumer servers corresponding to different test environments and business types are started, their GIDs and TOPICs are different. In this way, the mutual isolation of consumption can be achieved. Since the "correspondence between the preset test environment and the environment number" and the "correspondence between the preset business type and the business number" stored in the consumer server and the producer server are the same, the one-to-one correspondence between the consumer cluster and the producer cluster is realized in disguise, as well as the isolation of the test environment. Part of the code is as follows Figure 7 shown.
[0158] In the embodiment of the present application, if the test environment or business type corresponding to the producer server or consumer server changes, there is no need to manually modify the configuration of the producer server or consumer server, which reduces the development workload to a certain extent. After the implementation of this application, there has never been a problem of message consumption failure due to switching the test environment or business type of the producer cluster or consumer cluster, which improves the test quality to a certain extent.
[0159] Exemplarily, the codes involved in this application can be packaged into a Jar (Java Archive) package, which can be used in the above system by introduction. If similar problems are encountered, it can be used as a solution and may be of certain reference and help.
[0160] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0161] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0162] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
Claims
1. A message processing system, characterized in that: include: A producer server, used to determine a first test environment corresponding to the producer server; From the correspondence between the preset test environment and the environment number, search for the first environment number corresponding to the first test environment; determine the first business type corresponding to the producer server; from the correspondence between the preset business type and the business number, search for the first business number corresponding to the first business type; obtain a first TOPIC including the first environment number and the first business number; generate a message carrying the first TOPIC; and send the message to the message center server; The message center server is used to store storage spaces corresponding to multiple TOPICs respectively; Storing the message in the storage space corresponding to the first TOPIC; A consumer server, used to determine a second test environment corresponding to the consumer server; search for a second environment number corresponding to the second test environment from a preset correspondence between the test environment and the environment number; determine a second service type corresponding to the consumer server; search for a second service number corresponding to the second service type from a preset correspondence between the service type and the service number; obtain a second TOPIC including the second environment number and the second service number; and obtain a message carrying the second TOPIC from the message center server.
2. The message processing system according to claim 1, characterized in that: The process in which the consumer server acquires the message carrying the second TOPIC from the message center server specifically includes: Obtain a target GID including a cluster identifier of a cluster to which the consumer server belongs and the second environment number; Generate an acquisition message request, wherein the acquisition message request includes the target GID and the second TOPIC; Sending the message acquisition request to the message center server; Receive a message carrying the second TOPIC fed back by the message center server.
3. The message processing system according to claim 2, characterized in that: The method for the message center server to feed back a message carrying the second TOPIC includes: Receiving the message acquisition request; From the correspondence between the GID and TOPIC of the preset consumer server, find the TOPIC corresponding to the target GID; If the TOPIC corresponding to the target GID is the same as the second TOPIC, the message in the storage space corresponding to the second TOPIC is sent to the consumer server.
4. The message processing system according to claim 3, characterized in that: The message center server is also used for: Set the state of the message sent to the consumer server to the consumed state.
5. The message processing system according to any one of claims 3 or 4, characterized in that: The consumer server is also used to: Obtain an update subscription message instruction, wherein the update subscription message instruction includes the target GID and the second TOPIC; Send the update subscription message instruction to the message center server.
6. The message processing system according to claim 5, characterized in that: The message center server is also used for: Receiving the update subscription message instruction; The corresponding relationship between the target GID and the second TOPIC is added to the preset corresponding relationship between the GID and TOPIC of the consumer server.
7. The message processing system according to claim 1, characterized in that: The message server is also used for: Process the message carrying the second TOPIC.
8. The message processing system according to claim 7, characterized in that: The process of the message server executing and processing the message carrying the second TOPIC includes: Parsing the message carrying the second TOPIC based on the message body type of the message carrying the second TOPIC to obtain a parsed message; The parsed message is processed by a preset template method mode.
9. The message processing system according to claim 1, characterized in that: The method for the message center server to set storage spaces corresponding to a plurality of TOPICs includes: Obtaining the test environments respectively corresponding to the plurality of producer servers and the business types respectively corresponding to the plurality of producer servers; From the correspondence between the preset test environment and the environment number, searching for the environment numbers of the test environments respectively corresponding to the multiple producer servers; From the preset correspondence between the business type and the business number, searching for the business numbers of the multiple producer servers corresponding to the business types respectively; For each of the producer servers, a TOPIC is obtained based on the environment number and the business type corresponding to the producer server; and a storage space for the TOPIC is created.
10. The message processing system according to claim 9, characterized in that: The message center server is also used for: If a start instruction is detected, the step of obtaining the test environments respectively corresponding to the multiple producer servers and the business types respectively corresponding to the multiple producer servers is executed.
Citation Information
Patent Citations
Message request processing method and device, electronic equipment and storage medium
CN116805946A
Message processing system, system and device and storage medium
CN117527892A
Message passing method and device in test environment, equipment and storage medium
CN117632546A
Message oriented middleware device for message communication processing using numeralized topic
KR101219637B1
