[go: up one dir, main page]

CN112084042A - Message processing method and device - Google Patents

Message processing method and device Download PDF

Info

Publication number
CN112084042A
CN112084042A CN201910510154.8A CN201910510154A CN112084042A CN 112084042 A CN112084042 A CN 112084042A CN 201910510154 A CN201910510154 A CN 201910510154A CN 112084042 A CN112084042 A CN 112084042A
Authority
CN
China
Prior art keywords
message
type
queue
processing request
queues
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
CN201910510154.8A
Other languages
Chinese (zh)
Other versions
CN112084042B (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 Jingdong Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi Information Technology Co 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 Jingdong Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN201910510154.8A priority Critical patent/CN112084042B/en
Publication of CN112084042A publication Critical patent/CN112084042A/en
Application granted granted Critical
Publication of CN112084042B publication Critical patent/CN112084042B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a message processing method and device, and relates to the technical field of computers. The specific implementation mode of the method comprises the following steps: receiving a message processing request from a service system, wherein the message processing request indicates the type of a message to be processed; determining a message queue corresponding to the message type according to the message type; when the message processing request indicates to consume the message, obtaining the message corresponding to the message type from the message queue; and when the message processing request indicates that the message is produced, pushing the message to a message queue corresponding to the message type. The implementation mode reduces the configuration times of the message queues corresponding to different message types and improves the message processing efficiency.

Description

Message processing method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a message.
Background
Currently, in order to complete normal processing of services, each service system often needs to perform message transmission with other service systems and the like. In order to ensure the communication efficiency of the service system, a message queue mode is often used to implement the processing of the message by the service system, such as the pushing of the message, the obtaining of the message, and the like. Due to the wide variety of service requirements, the same service system often needs to process multiple types of messages, and thus multiple message queues are needed to establish connections.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art: different message queues are connected in different ways, so that when the type of a message to be processed is changed, connection with the corresponding message queue needs to be established again, and multiple configuration needs to be performed, which causes redundancy of a service system and reduces the efficiency of message processing.
Disclosure of Invention
In view of this, embodiments of the present invention provide a message processing method and apparatus, which implement that a service system processes messages in multiple message queues, and reduce redundancy generated when the service system needs to configure multiple message queues multiple times, thereby improving the message processing efficiency of the service system.
In order to achieve the above object, according to a first aspect of the embodiments of the present invention, there is provided a message processing method, including: receiving a message processing request from a service system, wherein the message processing request indicates the type of a message to be processed; determining a message queue corresponding to the message type according to the message type; when the message processing request indicates to consume the message, obtaining the message corresponding to the message type from the message queue; and when the message processing request indicates that the message is produced, pushing the message to a message queue corresponding to the message type.
Optionally, the method further comprises: before the message processing request is received, establishing a connection with the message queue, wherein the connection is used for monitoring the state of the message queue.
Optionally, the method further comprises: receiving messages of a first message type from a first message queue of the message queues; converting the message of the first message type into a message of a second message type; and pushing the message of the second message type to a second message queue in the message queues.
Optionally, the method further comprises: converting the message of the first message type into a message of a preset message type; converting the message of the preset message type into a message of a second message type, and pushing the message to a message queue corresponding to the second message type; wherein the message of the first message type is from the service system or a message queue corresponding to the first message type.
Optionally, the obtaining the message corresponding to the message type from the message queue includes: and periodically or according to the request of the service system, pulling the message from the message queue.
Optionally, the obtaining, from the message queue, a message in the message queue corresponding to the message type includes: subscribing to the message queue for changes to the message; and receiving the message pushed by the message queue.
Optionally, the method further comprises: and determining whether to change the number of the message queues according to the states of the message queues.
To achieve the above object, according to a second aspect of an embodiment of the present invention, there is provided a message processing apparatus, including: the system comprises a message processing request receiving module, a message queue determining module and a message processing module; the message processing request receiving module is used for receiving a message processing request from a service system, wherein the message processing request indicates the type of a message to be processed; the message queue determining module is used for determining a message queue corresponding to the message type according to the message type; the message processing module is used for acquiring a message corresponding to the message type from the message queue when the message processing request indicates to consume the message; and when the message processing request indicates that the message is produced, pushing the message to a message queue corresponding to the message type.
To achieve the above object, according to a third aspect of embodiments of the present invention, there is provided a server for message processing, including: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out any of the message processing methods as described above.
To achieve the above object, according to a fourth aspect of embodiments of the present invention, there is provided a computer-readable medium on which a computer program is stored, the program, when executed by a processor, implementing any one of the message processing methods described above.
One embodiment of the above invention has the following advantages or benefits: the message queues corresponding to the message types can be determined according to different message types required by the service system, and then the messages are acquired from the message queues or pushed to the message queues, so that the processing of the service system on the messages in various message queues is realized, meanwhile, the redundancy generated when the service system needs to configure various message queues for multiple times is reduced, and the message processing efficiency of the service system is improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of a main flow of a message processing method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a main flow of another message processing method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of main blocks of a message processing apparatus according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Referring to fig. 1, an embodiment of the present invention provides a message processing method, which may specifically include the following steps:
step S101, receiving a message processing request from a service system, wherein the message processing request indicates a message type needing to be processed.
Because the business system needs to process various tasks, the business system has various communication or interactive message types with other business systems or network terminals. Message types include, but are not limited to: logs of the business system, transaction information of the business system, management information of the business system, notifications related to the business system, and the like.
And step S102, determining a message queue corresponding to the message type according to the message type.
When messages of different message types are processed, the requirements on stand-alone throughput, message processing frequency, message reliability, message security and the like are different, so that different message queues (such as RabbitMQ, ActiveMQ, zeroMQ, Kafka and the like) are required to be used for processing. If the message processing request indicates that the message type needing to be processed is the log, the Kafka message queue which is known to process the log can be selected for processing; when the message type indicated by the message processing request is management information or transaction information which needs to be stored persistently, the ActiveMQ message queue can be selected, and the zeroMQ message queue which does not support the persistence cannot be selected for processing; when the message type indicated by the message processing request is high concurrent transaction information, the RabbitMQ message queue can be used for processing.
It can be understood that, in order to implement processing of messages of different message types, including receiving messages, monitoring messages, etc., it is necessary to establish a connection with a message queue corresponding to a different message type, and then implement receiving messages from the message queue or pushing messages to the message queue based on the established connection. It should be noted that different message types have one message queue corresponding to them, and the connection modes of different message queues are different, so that connection needs to be established separately for each message queue.
In an alternative embodiment, before the receiving of the message processing request, a connection to the message queue is established, and the connection is used for monitoring the state of the message queue. The status of the snoop message queue includes, but is not limited to: the number of messages in the message queue, the throughput of the messages, whether the message queue works normally, the message processing number of the message queue and the like, so that the selected message queue can be adjusted in time according to the monitored state, and the load balance among the message queues and the like are realized.
In an alternative embodiment, it is determined whether to change the number of message queues based on the status of the message queues. Specifically, taking throughput of the message as an example for explanation, a throughput threshold (e.g., 1 ten thousand) may be set for each message queue according to actual requirements, and when it is monitored that the throughput of the message queue exceeds 1 ten thousand, that is, when the load of the message queue is heavy, a new message queue of the same type may be considered; when the throughput of the message queue is monitored to be still below 1 ten thousand, the receiving and pushing of the messages and the like can be continued through the message queue.
Step S103, when the message processing request indicates to consume the message, obtaining the message corresponding to the message type from the message queue; and when the message processing request indicates that the message is produced, pushing the message to a message queue corresponding to the message type.
Specifically, the service system may receive a message sent by an external or other service system, or may send a message to other service systems, so that the message processing request may indicate consumption information, that is, information that needs to be acquired, or may indicate production information, that is, a message is pushed to other service systems.
In an optional implementation manner, the obtaining, from the message queue, a message corresponding to the message type includes: and periodically or according to the request of the service system, pulling the message from the message queue. Specifically, the message type indicated by the message processing request sent by the service system is taken as a log for explanation, and when the message processing request indicates a consumption message, the message required by the request is pulled from the Kafka message queue and then sent to the service system for consumption. In addition, whether the Kafka message queue has the message to be consumed can be monitored periodically or in real time through the connection established with the Kafka message queue, if so, the message to be consumed is pulled from the Kafka message queue, and then the message is sent to the service system for consumption.
In an optional implementation manner, the obtaining, from the message queue, a message in the message queue corresponding to the message type includes: subscribing to the message queue for changes to the message; and receiving the message pushed by the message queue. Specifically, still taking the message type indicated by the message processing request as a log, subscribing to the Kafka message queue for changes of messages therein, including but not limited to changes of message content, changes of message quantity, and the like, and when there is a subscribed message change in the Kafka message queue, actively pushing the message in the Kafka message queue through the connection with the established one, so that the pushed message can reach the service system and be consumed.
In an alternative embodiment, a message of a first message type is received from a first one of the message queues; converting the message of the first message type into a message of a second message type; and pushing the message of the second message type to a second message queue in the message queues. Specifically, since a service system generally needs to receive or push messages of multiple message types, different message types correspond to different message queues, and thus, if a user wants to implement mutual conversion of messages between different message queues, the user needs to convert different message types. Taking Kafka message queues and RabbitMQ message queues as an example for explanation, when a service system needs to push messages received from the Kafka message queues to the RabbitMQ message queues, the message type corresponding to the messages received from the Kafka message queues needs to be converted into a message type applicable to the RabbitMQ message queues, and then the converted messages applicable to the RabbitMQ message queues are pushed into the RabbitMQ message queues, so that the receiving and pushing of messages between different message queues or messages of different message types are realized.
In an optional implementation, the message of the first message type is converted into a message of a preset message type; converting the message of the preset message type into a message of a second message type, and pushing the message to a message queue corresponding to the second message type; wherein the message of the first message type is from the service system or a message queue corresponding to the first message type. The preset type message may be any format message set according to actual requirements, for example, the preset type message is JMQ message, and when a message received by the Kafka message queue or a log type message from the service system is received, the received message is converted into JMQ message; when the converted JMQ messages need to be pushed to message queues such as RabbitMQ, Kafka, ActiveMQ, and zeroMQ, the unified JMQ messages are converted into message types corresponding to message queues such as RabbitMQ, Kafka, ActiveMQ, and zeroMQ, and then are correspondingly pushed to the message queues.
Based on the above embodiment, the technical solution of message processing provided by the present invention can determine the message queue corresponding to the message type according to different message types required by the service system, and further obtain the message from the message queue or push the message to the message queue, so that the service system can process the messages in the message queues corresponding to multiple message types and forward the messages between different message queues, thereby reducing redundancy generated when the service system needs to configure multiple message queues for multiple times, and improving the message processing efficiency of the service system. In addition, the message queues can be increased or decreased based on the states of the monitored message queues, so that the load balance of the message queues is realized, and the resource consumption is reduced.
Referring to fig. 2, on the basis of the foregoing embodiment, an embodiment of the present invention provides a message processing method, which can be roughly divided into four stages: the method comprises a configuration stage, an initialization stage, a message pushing stage and a message acquiring stage, wherein the configuration and the initialization are required to be carried out firstly before entering the message pushing stage and the message receiving stage, and the specific steps are as follows:
a configuration stage:
according to the actual requirement of the business system for processing the business, the message types or the characteristics of the messages possibly involved by the business system and the like, determining one or more message queues to be used, such as RabbitMQ, ActiveMQ, ZeroMQ, Kafka and the like, and integrating unified configuration information aiming at the one or more message queues according to the information required when connection is established with different message queues, wherein the unified configuration information comprises message subjects (topic), mqType message types, bussId (business code), register center (registry) and the like. And then based on the configuration information actually needed by different message queues, different parameters or values corresponding to the parameters are called or transmitted when the message queues are configured, so that different message queues can be configured by using a uniform configuration file, and a caller does not need to care which message queue is specifically used, thereby reducing the resource waste caused when different types of message queues need to be configured by using different configuration files. It is understood that the configuration file may be saved in any format such as ini, cfg, config, and xml, and the xml format is used as an example in this embodiment.
An initialization stage:
loading configuration information, respectively establishing connection with the message types corresponding to each message type according to the number of the message types in the configuration information, monitoring the state of the message queue by the connection, such as the number of messages in the message queue, the throughput of the messages, whether the message queue works normally, the message processing number of the message queue and the like, and increasing, reducing or maintaining the number of the message queue according to the monitored state in the later message processing process. Specifically, when only one message type is indicated in the configuration information, establishing connection with a message queue corresponding to the message type; when two or more message types are indicated in the configuration information, connection is respectively established for the message queues corresponding to each message type, so that the service system can simultaneously acquire messages from various message queues or send messages to various message queues.
It can be understood that, the connection with the message queue may be established based on the received requirement of the service system, or the connection with different message queues may be spontaneously established for the service system in advance, and the health state of the connection is maintained after the connection is established, so that the service system may acquire or push messages from different message queues at any time according to the service requirement, and further, the message processing efficiency of the service system may be improved.
And a message pushing stage:
after establishing connection with the message queue, according to the requirement of the received service system, namely when the received message processing request from the service system indicates to produce the message, calling the API of the message to be pushed to push the message. At this time, the called push message API includes push methods respectively corresponding to one or more message queues. The incoming objects comprise messages from the business system and also messages which are acquired from the message queue and need to be forwarded to other message queues. When the incoming object is inconsistent with the message type to be sent, the information in the incoming object needs to be converted into the message type to be pushed, for example, the incoming object is analyzed into a log type message; and then, selecting and calling an API corresponding to the type of the message to be pushed, namely pushing the message to be pushed to a corresponding message queue by using a message pushing method. As described by taking the example of parsing the incoming object into the log, after the log to be pushed is obtained, an API corresponding to a message queue for processing the log (e.g., an API of a Kafka message queue) is called, that is, the log is pushed into the Kafka message queue through a connection with the Kafka message queue.
A message acquisition stage:
after establishing connection with the message queue, according to the requirement of the received service system, namely when the received message processing request from the service system indicates to consume the message, calling the message obtaining API to obtain the message from the message queue. At this time, the called get message API includes a plurality of classes or methods for getting messages from different message queues. Because many types of messages need to be acquired, a method in the API corresponding to the type of the message needs to be further invoked according to the type of the message indicated by the message processing request, so as to acquire the message from the corresponding message queue. After the corresponding message is obtained, the received message can be converted into an object according to actual requirements and further transmitted to a service system.
For example, explaining that the message processing request indicates to acquire the log message, when the message processing request from the service system is received, the message acquiring API is called, and at this time, the API can be used to select to acquire the message from the Kafka message queue, or select the RabbitMQ, ActiveMQ, ZeroMQ and other message queues to acquire the message; since the message processing requests that the message type is the log, the message is preferentially acquired from the Kafka message queue for processing the log, namely, the API corresponding to the Kafka message queue is called, and the corresponding message is acquired from the Kafka message queue through connection with the Kafka message queue.
It will be appreciated that in addition to invoking the get message API according to the received requirements of the business system, the get message API may be automatically invoked to pull messages from the message queue on a spontaneous, periodic basis. In addition, the change of the message can be subscribed from the message queue, and then the message of the message change in the message queue is passively received, so that the corresponding message is acquired.
Furthermore, under the condition that the message of the consumption place needs to be forwarded to other message queues, after the message API is called and obtained to obtain the corresponding message, the message is analyzed into an object, the message is packaged and then the message API is requested to be called, and then a message pushing stage is started until the message is pushed to the corresponding message queue. In this way, forwarding of messages between different message queues can be achieved.
Referring to fig. 3, on the basis of the above embodiment, an embodiment of the present invention provides a message processing apparatus 300, including: a message processing request receiving module 301, a message queue determining module 302 and a message processing module 303; the message processing request receiving module 301 is configured to receive a message processing request from a service system, where the message processing request indicates a message type that needs to be processed; the message queue determining module 302 is configured to determine, according to the message type, a message queue corresponding to the message type; the message processing module 303 is configured to, when the message processing request indicates to consume a message, obtain a message corresponding to the message type from the message queue; and when the message processing request indicates that the message is produced, pushing the message to a message queue corresponding to the message type.
Fig. 4 shows an exemplary system architecture 400 to which the message processing method or the message processing apparatus of the embodiments of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 401, 402, 403 to interact with a server 405 over a network 404 to receive or send messages or the like. The terminal devices 401, 402, 403 may have various communication client applications installed thereon, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, and the like.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 405 may be a server that provides various services, such as a background management server that supports shopping websites browsed by users using the terminal devices 401, 402, and 403. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (e.g., a generated message) to the terminal device.
It should be noted that the message processing method provided by the embodiment of the present invention is generally executed by the server 405, and accordingly, the message processing apparatus is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, shown is a block diagram of a computer system 500 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprising: a message processing request receiving module 301, a message queue determining module 302 and a message processing module 303. Where the names of these modules do not in some cases constitute a limitation on the module itself, for example, the message queue determination module may also be described as "determining the message queue module corresponding to the message type".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: receiving a message processing request from a service system, wherein the message processing request indicates the type of a message to be processed; determining a message queue corresponding to the message type according to the message type; when the message processing request indicates to consume the message, obtaining the message corresponding to the message type from the message queue; and when the message processing request indicates that the message is produced, pushing the message to a message queue corresponding to the message type.
According to the technical scheme of the embodiment of the invention, the message queue corresponding to the message type can be determined according to different message types required by the service system, and then the message is acquired from the message queue or pushed into the message queue, so that the processing of the message in the message queue corresponding to various message types and the forwarding of the message among different message queues by the service system are realized, the redundancy generated when the service system needs to carry out multiple configuration on various message queues is reduced, and the message processing efficiency of the service system is improved. In addition, the message queues can be increased or decreased based on the states of the monitored message queues, so that the load balance of the message queues is realized, and the resource consumption is reduced.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A message processing method, comprising:
receiving a message processing request from a service system, wherein the message processing request indicates the type of a message to be processed;
determining a message queue corresponding to the message type according to the message type;
when the message processing request indicates to consume the message, obtaining the message corresponding to the message type from the message queue;
and when the message processing request indicates that the message is produced, pushing the message to a message queue corresponding to the message type.
2. The message processing method according to claim 1, further comprising:
before the message processing request is received, establishing a connection with the message queue, wherein the connection is used for monitoring the state of the message queue.
3. The message processing method according to claim 1, further comprising:
receiving messages of a first message type from a first message queue of the message queues;
converting the message of the first message type into a message of a second message type;
and pushing the message of the second message type to a second message queue in the message queues.
4. The message processing method according to claim 1, further comprising:
converting the message of the first message type into a message of a preset message type;
converting the message of the preset message type into a message of a second message type, and pushing the message to a message queue corresponding to the second message type; wherein the message of the first message type is from the service system or a message queue corresponding to the first message type.
5. The message processing method according to claim 1, wherein the obtaining the message corresponding to the message type from the message queue comprises:
and periodically or according to the request of the service system, pulling the message from the message queue.
6. The message processing method according to claim 1, wherein the obtaining the message in the message queue corresponding to the message type from the message queue comprises:
subscribing to the message queue for changes to the message;
and receiving the message pushed by the message queue.
7. The message processing method according to claim 2, further comprising:
and determining whether to change the number of the message queues according to the states of the message queues.
8. A message processing apparatus, comprising: the system comprises a message processing request receiving module, a message queue determining module and a message processing module; wherein,
the message processing request receiving module is used for receiving a message processing request from a service system, wherein the message processing request indicates the type of a message to be processed;
the message queue determining module is used for determining a message queue corresponding to the message type according to the message type;
the message processing module is used for acquiring a message corresponding to the message type from the message queue when the message processing request indicates to consume the message; and when the message processing request indicates that the message is produced, pushing the message to a message queue corresponding to the message type.
9. A server for message processing, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN201910510154.8A 2019-06-13 2019-06-13 Message processing method and device Active CN112084042B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910510154.8A CN112084042B (en) 2019-06-13 2019-06-13 Message processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910510154.8A CN112084042B (en) 2019-06-13 2019-06-13 Message processing method and device

Publications (2)

Publication Number Publication Date
CN112084042A true CN112084042A (en) 2020-12-15
CN112084042B CN112084042B (en) 2023-09-22

Family

ID=73733291

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910510154.8A Active CN112084042B (en) 2019-06-13 2019-06-13 Message processing method and device

Country Status (1)

Country Link
CN (1) CN112084042B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113836184A (en) * 2021-09-18 2021-12-24 深圳前海微众银行股份有限公司 A business persistence method and device
CN113961379A (en) * 2021-12-22 2022-01-21 零犀(北京)科技有限公司 Message processing method and device based on man-machine conversation
CN114979257A (en) * 2022-05-24 2022-08-30 树根互联股份有限公司 Message pushing method and device, computer equipment and computer readable storage medium
CN115658285A (en) * 2022-09-15 2023-01-31 北京百度网讯科技有限公司 Message processing method, device, equipment and storage medium
CN115866286A (en) * 2023-01-31 2023-03-28 北京微吼时代科技有限公司 Method and system for message service in live broadcast service

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150134747A1 (en) * 2013-11-08 2015-05-14 International Business Machines Corporation Managing a messaging queue in an asynchronous messaging system
EP3113451A1 (en) * 2015-07-01 2017-01-04 Honeywell International Inc. Systems and methods for air-ground message prioritization
CN108089915A (en) * 2016-11-22 2018-05-29 北京京东尚科信息技术有限公司 The method and system of business controlization processing based on message queue
CN108306815A (en) * 2017-12-28 2018-07-20 五八有限公司 A kind of method, apparatus, equipment and computer readable storage medium obtaining message
CN108449410A (en) * 2018-03-19 2018-08-24 深信服科技股份有限公司 Information management method, system and relevant apparatus in a kind of cloud platform
CN108897607A (en) * 2018-06-05 2018-11-27 中国平安人寿保险股份有限公司 Message treatment method, device, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150134747A1 (en) * 2013-11-08 2015-05-14 International Business Machines Corporation Managing a messaging queue in an asynchronous messaging system
EP3113451A1 (en) * 2015-07-01 2017-01-04 Honeywell International Inc. Systems and methods for air-ground message prioritization
CN108089915A (en) * 2016-11-22 2018-05-29 北京京东尚科信息技术有限公司 The method and system of business controlization processing based on message queue
CN108306815A (en) * 2017-12-28 2018-07-20 五八有限公司 A kind of method, apparatus, equipment and computer readable storage medium obtaining message
CN108449410A (en) * 2018-03-19 2018-08-24 深信服科技股份有限公司 Information management method, system and relevant apparatus in a kind of cloud platform
CN108897607A (en) * 2018-06-05 2018-11-27 中国平安人寿保险股份有限公司 Message treatment method, device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘峰;鄂海红;: "基于海量数据的消息队列的性能对比与优化方案", 软件, no. 10 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113836184A (en) * 2021-09-18 2021-12-24 深圳前海微众银行股份有限公司 A business persistence method and device
CN113961379A (en) * 2021-12-22 2022-01-21 零犀(北京)科技有限公司 Message processing method and device based on man-machine conversation
CN113961379B (en) * 2021-12-22 2022-04-12 零犀(北京)科技有限公司 Message processing method and device based on man-machine conversation
CN114979257A (en) * 2022-05-24 2022-08-30 树根互联股份有限公司 Message pushing method and device, computer equipment and computer readable storage medium
CN115658285A (en) * 2022-09-15 2023-01-31 北京百度网讯科技有限公司 Message processing method, device, equipment and storage medium
CN115866286A (en) * 2023-01-31 2023-03-28 北京微吼时代科技有限公司 Method and system for message service in live broadcast service
CN115866286B (en) * 2023-01-31 2023-05-16 北京微吼时代科技有限公司 Method and system for message service in live broadcast business

Also Published As

Publication number Publication date
CN112084042B (en) 2023-09-22

Similar Documents

Publication Publication Date Title
CN112084042B (en) Message processing method and device
CN112445868B (en) Service message processing method and device
CN113742389A (en) Service processing method and device
CN111767157B (en) Request processing method and device based on service grid
CN111831503B (en) Monitoring method based on monitoring agent and monitoring agent device
CN109271259B (en) Enterprise service bus system, data processing method, terminal and storage medium
CN111786939B (en) Method, device and system for testing management platform of Internet of things
CN114979295A (en) Gateway management method and device
CN110147285A (en) Message treatment method and device based on message queue
CN112685481A (en) Data processing method and device
CN111427899A (en) Method, device, equipment and computer readable medium for storing file
CN113779122B (en) Method and device for exporting data
CN113760482B (en) Task processing method, device and system
CN113238808B (en) Message pushing method and device
CN113778499A (en) Method, device, equipment and computer readable medium for publishing service
CN113722115A (en) Method, device, equipment and computer readable medium for calling interface
CN113778504B (en) Publishing method, publishing system and routing device
CN113132480B (en) Data transmission method, device and system
CN112732417B (en) Method and device for processing application request
CN113760487B (en) Service processing method and device
CN113761433B (en) Service processing method and device
CN113760714B (en) Software testing method and device
CN112860447B (en) Interaction method and system between different applications
CN112688982B (en) User request processing method and device
CN115840601A (en) Task speed limiting 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
GR01 Patent grant
GR01 Patent grant