CN112084042B - Message processing method and device - Google Patents

Message processing method and device Download PDF

Info

Publication number
CN112084042B
CN112084042B CN201910510154.8A CN201910510154A CN112084042B CN 112084042 B CN112084042 B CN 112084042B CN 201910510154 A CN201910510154 A CN 201910510154A CN 112084042 B CN112084042 B CN 112084042B
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.)
Active
Application number
CN201910510154.8A
Other languages
Chinese (zh)
Other versions
CN112084042A (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

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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 a message type to be processed; determining a message queue corresponding to the message type according to the message type; when the message processing request indicates consumption of the message, acquiring a message corresponding to the message type from the message queue; when the message processing request indicates to produce a message, pushing the message to a message queue corresponding to the message type. The embodiment reduces the configuration times of the message queues corresponding to different message types and improves the efficiency of message processing.

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 adopted to realize the processing of the service system on the message, such as the pushing of the message, the acquisition of the message and the like. Because of 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 a connection.
In the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art: the connection modes of different message queues are different, so that when the type of the message to be processed is changed, connection needs to be established with the corresponding message queue again, and therefore, multiple configurations are required, redundancy of a service system is caused, and the efficiency of message processing is reduced.
Disclosure of Invention
In view of this, the embodiments of the present invention provide a method and an apparatus for processing a message, which implement processing of a message in multiple message queues by a service system, and reduce redundancy generated by multiple configurations of multiple message queues required by the service system, thereby improving efficiency of processing a message by the service system.
To achieve the above object, according to a first aspect of an embodiment 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 a message type to be processed; determining a message queue corresponding to the message type according to the message type; when the message processing request indicates consumption of the message, acquiring a message corresponding to the message type from the message queue; when the message processing request indicates to produce a message, pushing the message to a message queue corresponding to the message type.
Optionally, the method further comprises: before the message processing request is received, a connection with the message queue is established, and the connection is used for monitoring the state of the message queue.
Optionally, the method further comprises: receiving a message of a first message type from a first message queue in the message queues; converting the message of the first message type into a message of a second message type; 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: the message is pulled from the message queue periodically or upon request of the business system.
Optionally, the obtaining the message in the message queue corresponding to the message type from the message queue includes: subscribing to the message queue for changes with respect 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 state 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, comprising: 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 a message type 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; when the message processing request indicates to produce a message, pushing the message to a message queue corresponding to the message type.
To achieve the above object, according to a third aspect of an embodiment of the present invention, there is provided a server for message processing, including: one or more processors; and storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement any of the methods of message processing 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 having stored thereon a computer program which, when executed by a processor, implements any one of the message processing methods described above.
One embodiment of the above invention has the following advantages or benefits: according to different message types of the requirements of the service system, the message queue corresponding to the message type can be determined, and then the message is acquired from the message queue or pushed to the message queue, so that the service system processes the messages in various message queues, redundancy generated by the service system needing to perform multiple configuration on the various message queues is reduced, and the efficiency of processing the messages of the service system is improved.
Further effects of the above-described non-conventional alternatives are 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 the main flow of a message processing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the main flow of another message processing method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the main modules 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 applied;
fig. 5 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered 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, a message handling request from a service system is received, the message handling request indicating a message type to be handled.
Since the service system needs to deal with various services, the types of messages that the service system communicates or interacts with other service systems or network terminals are also various. 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.
Step S102, according to the message type, determining a message queue corresponding to the message type.
In processing messages of different message types, the requirements for stand-alone throughput, message processing frequency, message reliability, message security, etc. are all different, and thus different message queues (e.g. RabbitMQ, activeMQ, zeroMQ, kafka, etc.) need to be used for processing. If the message processing request indicates that the type of the message to be processed is a log, then the message processing request can select a Kafka message queue with long processing log to process; when the message type indicated by the message processing request is management information or transaction information needing to be persisted, an ActiveMQ message queue can be selected, and a zeroMQ message queue which does not support persistence can not 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 will be appreciated that to implement processing of messages of different message types, including receiving messages, listening for messages, etc., it is necessary to first establish a connection with a message queue corresponding to the different message types, and then implement receiving messages from the message queue or pushing messages to the message queue based on the established connection. It is noted that different message types have one message queue corresponding to them, and the connection modes of the different message queues are different, so that it is necessary to establish a connection separately for each message queue.
In an alternative embodiment, a connection with the message queue is established prior to the receiving of the message processing request, the connection being for listening to a status of the message queue. The status of the snoop message queue includes, but is not limited to: the number of messages in the message queues, the throughput of the messages, whether the message queues work normally, the message processing number of the message queues and the like, so that the selected message queues can be adjusted in time according to the monitored state, and load balancing 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 the throughput of the message as an example for illustration, a throughput threshold (for example, 1 ten thousand) can be set for each message queue according to actual requirements, and when the throughput of the message queue is monitored to exceed 1 ten thousand, that is, when the message queue is heavy in load, a message queue of the same type can be newly added; when the throughput of the message queue is monitored to be less than 1 ten thousand, the message can be continuously received and pushed through the message queue.
Step S103, when the message processing request indicates consumption of the message, acquiring a message corresponding to the message type from the message queue; when the message processing request indicates to produce a message, pushing the message to a message queue corresponding to the message type.
Specifically, the service system may receive the message sent by the external or other service systems, or may send the message to other service systems, so that the message processing request may indicate consumption information, that is, information needs to be acquired, or may indicate production information, that is, push the message to other service systems, or the like.
In an optional embodiment, the obtaining the message corresponding to the message type from the message queue includes: the message is pulled from the message queue periodically or upon request of the business system. Specifically, the description is made by taking the message type indicated by the message processing request sent by the service system as a log, when the message processing request indicates to consume the 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 or not 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 a service system for consumption.
In an optional embodiment, 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 with respect to the message; and receiving the message pushed by the message queue. Specifically, the description is still made with the type of the message indicated by the message processing request as a log, and the Kafka message queue is subscribed to the change of the message therein, including but not limited to the change of the message content, the change of the message number, etc., when there is a change of the subscribed message in the Kafka message queue, the Kafka message queue actively pushes the message in the Kafka message queue through the connection with the establishment, 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; pushing the message of the second message type to a second message queue in the message queues. In particular, since a service system generally needs to receive or push messages of multiple message types, and different message types correspond to different message queues, conversion of different message types is required if message inter-conversion between different message queues is to be achieved. Taking Kafka message queue and RabbitMQ message queue as an example for explanation, when a service system needs to push the message received from the Kafka message queue to the RabbitMQ message queue, it needs to convert the message type corresponding to the message received from the Kafka message queue into the message type applicable to the RabbitMQ message queue, and then push the converted message applicable to the RabbitMQ message queue, thereby realizing the receiving and pushing of the messages among different message queues or among the messages of different message types.
In an alternative embodiment, 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 message of the preset type can be any format message set according to actual requirements, for example, a message of the preset type is taken as JMQ message, and when the message received by the Kafka message queue or the message of the log type from the service system is received, the received message is converted into JMQ message; when the converted JMQ message needs to be pushed to the message queues such as RabbitMQ, kafka, activeMQ, zeroMQ, the unified JMQ message is converted into the message type corresponding to the message queue such as RabbitMQ, kafka, activeMQ, zeroMQ, and then the message type is pushed to each message queue correspondingly.
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 acquire the message from the message queue or push the message to the message queue, thereby implementing the processing of the message in the message queue corresponding to multiple message types by the service system, and the forwarding of the message between different message queues, reducing the redundancy generated by the service system in need of configuring multiple message queues, and improving the efficiency of message processing of the service system. Besides, the message queues can be increased or decreased based on the monitored state of the message queues, so that the load balance of the message queues is realized, and the resource consumption is reduced.
Referring to fig. 2, based on the above embodiment, the embodiment of the present invention provides a message processing method, which may be roughly divided into four stages: configuration phase, initialization phase, push message phase and message acquisition phase, wherein before entering the push message phase and accepting the message phase, the configuration and initialization should be advanced, specifically as follows:
configuration phase:
one or more message queues to be used, such as RabbitMQ, activeMQ, zeroMQ, kafka, are determined according to the actual requirement of a service system for processing services and the message types or the characteristics of the messages possibly related to the service system, and unified configuration information for one or more message queues is integrated according to information required when a connection is established with different message queues, wherein the unified configuration information comprises a message theme (topic), an mqType message type, a bussId (service code), a register center and the like. And then based on the configuration information actually required by different message queues, different parameters or values corresponding to the parameters are called in or transmitted in when the message queues are configured, so that the different message queues can be configured by using a unified configuration file, a caller does not need to care about which message queue is specifically used, and the resource waste caused when different message queues of different types need to be configured by using different configuration files is reduced. It will be appreciated that the configuration file may be stored in any format, such as ini, cfg, config, xml, and in this embodiment, an xml format is used as an example.
An initialization stage:
loading configuration information, establishing connection with the message types corresponding to each message type according to the number of the message types in the configuration information, and monitoring the state of the message queue, 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 acquire messages from or send messages to multiple message queues simultaneously.
It can be understood that the connection with the message queue can be established based on the received requirement of the service system, or the connection with different message queues can be automatically established in advance for the service system, and the health state of the connection is maintained all the time after the connection is established, so that the service system can acquire or push the message from different message queues according to the service requirement at any time, and further the efficiency of the message processing of the service system can be improved.
Push message stage:
after establishing connection with the message queue, calling an API for pushing the message according to the received requirement of the service system, namely when the received message processing request from the service system indicates to produce the message, and pushing the message. At this time, the called push message API includes push methods corresponding to one or more message queues, respectively. The incoming object includes messages from the business system and also includes messages retrieved from the message queues that need to be forwarded to other message queues. When the type of the incoming object is inconsistent with the type of the message to be sent, the information in the incoming object needs to be converted into the type of the message to be pushed, such as the message of analyzing the incoming object into a log type; then, the API corresponding to the message type needing pushing is selected to be called, namely, the message needing pushing is pushed to the corresponding message queue by using the message pushing method. For example, taking the analysis of the incoming object as a log as an example, after the log to be pushed is obtained, an API corresponding to the message queue for processing the log (such as the API of the Kafka message queue) is called, that is, the log is pushed to the Kafka message queue through the connection with the Kafka message queue.
The message acquisition stage:
after establishing a connection with the message queue, the acquire message API is called to acquire a message from the message queue according to the requirements of the received service system, namely when the received message processing request from the service system indicates consumption of the message. At this time, the called message acquisition API includes a plurality of classes or methods for acquiring messages from different message queues. Because the types of the messages to be acquired are numerous, the method in the API corresponding to the message type needs to be further called according to the message type indicated by the message processing request, and the messages are acquired from the corresponding message queue. After the corresponding message is acquired, the received message can be converted into an object according to actual requirements and further transmitted to a service system.
For example, when a message processing request indicates that a log message is acquired, an API for acquiring the message is called when the message processing request from the service system is received, and at this time, the API may be used to select to acquire the message from a Kafka message queue, or may select to acquire the message from a message queue such as RabbitMQ, activeMQ, zeroMQ; since the message processing requests the message type to be a log, it is preferable to acquire a message from the Kafka message queue processing the log, that is, call an API corresponding to the Kafka message queue, and acquire a corresponding message therefrom through a connection with the Kafka message queue.
It will be appreciated that in addition to invoking the get message API based on the needs of the receiving business system, the get message API may be autonomously and periodically automatically invoked to pull messages from the message queue. 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 obtained.
Further, in the case that the consuming place message needs to be forwarded to other message queues, after the message obtaining API is called to obtain the corresponding message, the message is parsed into an object, the message is packaged, the request is called to push the message API, and then a message pushing stage is entered 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; wherein, 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 to be processed; the message queue determining module 302 is configured to determine a message queue corresponding to the message type according to the message type; the message processing module 303 is configured to obtain, when the message processing request indicates that a message is consumed, a message corresponding to the message type from the message queue; when the message processing request indicates to produce a message, pushing the message to a message queue corresponding to the message type.
Fig. 4 illustrates an exemplary system architecture 400 to which a message processing method or message processing apparatus of an embodiment 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 is used as a medium to provide communication links between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 405 via the network 404 using the terminal devices 401, 402, 403 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on the terminal devices 401, 402, 403.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 405 may be a server providing various services, such as a background management server providing support for shopping-type websites browsed by the user using the terminal devices 401, 402, 403. The background management server may analyze and process the received data such as the product information query request, and feed back the processing result (e.g., the generated message) to the terminal device.
It should be noted that, the message processing method provided in 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, there is illustrated a schematic diagram of a computer system 500 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU) 501, which 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 required for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other through 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 section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; 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 drive 510 is also connected to the I/O interface 505 as needed. 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 needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to 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 shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 501.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any 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 context of this document, 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, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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 flowcharts 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 involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor comprising: a message processing request receiving module 301, a message queue determining module 302, and a message processing module 303. The names of these modules do not constitute a limitation on the module itself in some cases, for example, the message queue determining module may also be described as "determine 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 present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include: receiving a message processing request from a service system, wherein the message processing request indicates a message type to be processed; determining a message queue corresponding to the message type according to the message type; when the message processing request indicates consumption of the message, acquiring a message corresponding to the message type from the message queue; when the message processing request indicates to produce a message, 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, so that the message is obtained from the message queue or pushed to the message queue, the processing of the message in the message queue corresponding to various message types by the service system and the forwarding of the message among different message queues are realized, the redundancy generated by the service system for configuring various message queues for many times is reduced, and the message processing efficiency of the service system is improved. Besides, the message queues can be increased or decreased based on the monitored state of the message queues, so that the load balance of the message queues is realized, and the resource consumption is reduced.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (8)

1. A message processing method, comprising:
receiving a message processing request from a service system, wherein the message processing request indicates a message type to be processed;
determining a message queue corresponding to the message type according to the message type;
when the message processing request indicates consumption of the message, acquiring a message corresponding to the message type from the message queue;
pushing the message to a message queue corresponding to the message type when the message processing request indicates to produce the message;
receiving a message of a first message type from a first message queue in the message queues; converting the message of the first message type into a message of a second message type; pushing the information of the second information type to a second information queue in the information queues;
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.
2. The message processing method according to claim 1, further comprising:
before the message processing request is received, a connection with the message queue is established, and the connection is used for monitoring the state of the message queue.
3. The message processing method according to claim 1, wherein the obtaining the message corresponding to the message type from the message queue includes:
the message is pulled from the message queue periodically or upon request of the business system.
4. The method according to claim 1, wherein the obtaining the message in the message queue corresponding to the message type from the message queue includes:
subscribing to the message queue for changes with respect to the message;
and receiving the message pushed by the message queue.
5. The message processing method according to claim 2, further comprising:
and determining whether to change the number of the message queues according to the state of the message queues.
6. A message processing apparatus, comprising: 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 a message type 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; pushing the message to a message queue corresponding to the message type when the message processing request indicates to produce the message;
and is further configured to receive a message of a first message type from a first one of the message queues; converting the message of the first message type into a message of a second message type; pushing the information of the second information type to a second information queue in the information queues;
the message processing unit is also used for 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.
7. A server for message processing, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-5.
8. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-5.
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 CN112084042A (en) 2020-12-15
CN112084042B true 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)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN115866286B (en) * 2023-01-31 2023-05-16 北京微吼时代科技有限公司 Method and system for message service in live broadcast business

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9450906B2 (en) * 2013-11-08 2016-09-20 International Business Machines Corporation Managing a messaging queue in an asynchronous messaging system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
基于海量数据的消息队列的性能对比与优化方案;刘峰;鄂海红;;软件(第10期);全文 *

Also Published As

Publication number Publication date
CN112084042A (en) 2020-12-15

Similar Documents

Publication Publication Date Title
CN112084042B (en) Message processing method and device
CN110874227B (en) Distribution method, system and electronic equipment for realizing gray level release of API gateway
CN109995801B (en) Message transmission method and 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
CN112445868A (en) Service message processing method and device
CN114979295B (en) Gateway management method and device
CN111831503B (en) Monitoring method based on monitoring agent and monitoring agent device
US11463549B2 (en) Facilitating inter-proxy communication via an existing protocol
CN113742389A (en) Service processing method and device
CN112685481B (en) Data processing method and device
CN112860447B (en) Interaction method and system between different applications
CN112688982B (en) User request processing method and device
CN110909269B (en) Log reporting method and device
CN113448652A (en) Request processing method and device
CN113760487A (en) Service processing method and device
CN113779018A (en) Data processing method and device
CN113760693A (en) Method and apparatus for local debugging of microservice systems
CN111193656A (en) Message pushing method and device
CN113778504B (en) Publishing method, publishing system and routing device
CN113760886B (en) Method, apparatus, device and computer readable medium for providing data service
CN113472565B (en) Method, apparatus, device and computer readable medium for expanding server function
CN113497783B (en) Method and device for processing data
CN113766437B (en) Short message sending method and device
CN116756449A (en) Method and device for loading product information data

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