Movatterモバイル変換


[0]ホーム

URL:


CN113138868A - Message processing method and device - Google Patents

Message processing method and device
Download PDF

Info

Publication number
CN113138868A
CN113138868ACN202110466376.1ACN202110466376ACN113138868ACN 113138868 ACN113138868 ACN 113138868ACN 202110466376 ACN202110466376 ACN 202110466376ACN 113138868 ACN113138868 ACN 113138868A
Authority
CN
China
Prior art keywords
message
processing
state
environment identifier
storage device
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
CN202110466376.1A
Other languages
Chinese (zh)
Other versions
CN113138868B (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 Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun 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 Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co LtdfiledCriticalBeijing Jingdong Century Trading Co Ltd
Priority to CN202110466376.1ApriorityCriticalpatent/CN113138868B/en
Publication of CN113138868ApublicationCriticalpatent/CN113138868A/en
Application grantedgrantedCritical
Publication of CN113138868BpublicationCriticalpatent/CN113138868B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The application provides a message processing method and device. The method comprises the following steps: monitoring the messages in the message queue according to a preset rule; the preset rules cause each processing device to monitor different messages; when a message is monitored, analyzing an environment identifier carried in the message, and storing the environment identifier and the message in a storage device in a correlation manner; and when monitoring that the timing task corresponding to the environment identifier configured by the processing equipment is started, acquiring a message corresponding to the environment identifier in the storage equipment for logic processing. The method can reduce the pressure of processing equipment and improve the message processing efficiency.

Description

Message processing method and device
Technical Field
The present invention relates to the field of information processing technologies, and in particular, to a method and an apparatus for processing a message.
Background
At present, messages in a message queue are processed through a broadcast message mode, each processing device receives all broadcast messages, determines whether the messages are processed by the consumption device according to environment identification in the messages, and performs logic processing if the messages are processed by the consumption device.
In the process of implementing the present application, the inventor finds that the above-mentioned way of processing messages causes the processing equipment to be stressed and inefficient.
Disclosure of Invention
In view of this, the present application provides a message processing method and device, which can reduce the pressure on processing devices and improve the message processing efficiency.
In order to solve the technical problem, the technical scheme of the application is realized as follows:
in one embodiment, a message processing method is provided and applied to a processing device, and the method includes:
monitoring the messages in the message queue according to a preset rule; the preset rules cause each processing device to monitor different messages;
when a message is monitored, analyzing an environment identifier carried in the message, and storing the environment identifier and the message in a storage device in a correlation manner;
and when monitoring that the timing task corresponding to the environment identifier configured by the processing equipment is started, acquiring a message corresponding to the environment identifier in the storage equipment for logic processing.
In another embodiment, there is provided a message processing apparatus applied to a processing device, the apparatus including: the system comprises a configuration unit, a first monitoring unit, a first processing unit, a second monitoring unit and a second processing unit;
the configuration unit is used for configuring preset rules and timing tasks; wherein the preset rules cause each processing device to listen to different messages;
the first monitoring unit is used for monitoring the messages in the message queue according to the preset rule of the configuration unit;
the first processing unit is configured to, when the first monitoring unit monitors a message, analyze an environment identifier carried in the message, and store the environment identifier and the message in a storage device in an associated manner;
the second monitoring unit is configured to monitor whether a timing task configured by the configuration unit corresponding to the environment identifier configured by the processing device is started;
and the second processing unit is configured to acquire a message corresponding to the environment identifier in the storage device for logic processing when the second monitoring unit monitors that the timing task corresponding to the environment identifier configured by the processing device is started.
In another embodiment, an electronic device is provided, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the message processing method when executing the program.
In another embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the message processing method.
According to the technical scheme, each processing device monitors the messages in the message queue according to the preset rule, and the preset rule enables each processing device not to repeatedly acquire the messages in the message queue, and after the messages in the message queue are acquired, the message processing is realized by adopting a first-storage-falling and then-processing mode. The method can reduce the pressure of processing equipment and improve the message processing efficiency.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
FIG. 1 is a schematic diagram of a message processing flow in a first embodiment of the present application;
FIG. 2 is a schematic diagram of a message processing flow in a second embodiment of the present application;
fig. 3 is a schematic diagram of an association relationship for storing a message in a storage device in an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a message processing apparatus according to an embodiment of the present application;
fig. 5 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements explicitly listed, but may include other steps or elements not explicitly listed or inherent to such process, method, article, or apparatus.
The technical solution of the present invention will be described in detail with specific examples. Several of the following embodiments may be combined with each other and some details of the same or similar concepts or processes may not be repeated in some embodiments.
The embodiment of the application provides a message processing method, which is applied to a message processing scene based on a message queue. The method can reduce the pressure of processing equipment and improve the message processing efficiency.
The message processing system applied in the embodiment of the application comprises: the system comprises a generating device, an MQ server, a processing device and a storage device;
the generating device is used for generating a message, and when the message is generated, the environment identifier configured for the environment is acquired according to the environment where the message is located, and the message carries the environment identifier.
And the messages generated by each generating device are stored in the MQ server through the message queue, and the messages generated by each generating device are sequentially stored in the message queue according to the sequence of the generation.
The message queue is a communication mode between applications, and a message can be returned immediately after being sent, and a message system is provided to ensure reliable delivery of information.
The processing equipment acquires the message needing to be primarily processed by the equipment from the message queue according to a preset rule; and after the message is acquired, only the environment identifier is analyzed and stored in the storage device.
The storage device is used for storing the mapping relation between the message and the environment identifier.
The processing equipment configures an environment identifier and processing logic corresponding to the environment identifier; the message is used for indicating the processing of the message corresponding to the environment identification; when the corresponding environment identifier is processed, starting a timing task aiming at the environment identifier;
here, the timed task is similar to an alarm clock, i.e. the corresponding task is executed at a set time.
The processing logic for different environment identification settings may be the same or different.
The processing equipment monitors whether a timing task corresponding to the configured environment identifier is started or not;
and when the starting of the timing task is monitored, acquiring a message corresponding to the environment identifier in the database of the storage equipment for logic processing.
In the embodiment of the present application, the implementation of the warehousing operation and the logic processing may be implemented by a processing device, or may be implemented by a warehousing device and a logic processing device, respectively.
The following describes in detail a process of implementing message processing in the embodiment of the present application with reference to the drawings.
Example one
Referring to fig. 1, fig. 1 is a schematic view illustrating a message processing flow in a first embodiment of the present application. The method comprises the following specific steps:
step 101, monitoring messages in a message queue according to a preset rule; the preset rules cause each processing device to listen for different messages.
In the embodiment of the application, the preset rule may be that the processing device polls and monitors the messages in the message queue; when polling the message, one message can be polled at a time, or a plurality of messages can be polled; some processing devices may also be selected to poll for messages, which is not limited in this embodiment of the present application.
The preset rule is an example in the embodiment of the present application, and is not limited to the limit of the preset rule.
Here, each message in the message queue carries an environment identifier.
The environment identifier is a unique identifier of the environment where the generating device is located, such as a production environment: pro; pre-foaming environment 1: pre 1; pre-emergence environment 2: pre2, etc.
And 102, when the message is monitored, analyzing the environment identifier carried in the message, and storing the environment identifier and the message in a storage device in a correlation manner.
The step is realized by storing the environment identifier and the message in the storage device in an associated manner, rather than determining whether the environment identifier corresponds to the environment identifier corresponding to the processing device, to determine whether to perform logic processing on the message.
103, when monitoring that the timing task corresponding to the environment identifier configured by the processing device is started, acquiring a message corresponding to the environment identifier in the storage device to perform logic processing.
And monitoring whether a timing task corresponding to the configured environment identifier is started or not, and processing the message corresponding to the environment identifier in the storage equipment when monitoring that the timing task corresponding to the environment identifier configured by the processing equipment is started.
In the embodiment of the application, each processing device monitors the messages in the message queue according to a preset rule, and the preset rule enables each processing device not to repeatedly acquire the messages in the message queue, and after the messages in the message queue are acquired, the message processing is realized by adopting a mode of first falling from a library and then processing. The method can reduce the pressure of processing equipment and improve the message processing efficiency.
Example two
Referring to fig. 2, fig. 2 is a schematic view illustrating a message processing flow in the second embodiment of the present application. The method comprises the following specific steps:
step 201, monitoring messages in a message queue according to a preset rule; the preset rules cause each processing device to listen for different messages.
In the embodiment of the application, the preset rule may be that the processing device polls and monitors the messages in the message queue; when polling the message, one message can be polled at a time, or a plurality of messages can be polled; some processing devices may also be selected to poll for messages, which is not limited in this embodiment of the present application.
The preset rule is an example in the embodiment of the present application, and is not limited to the limit of the preset rule.
Here, each message in the message queue carries an environment identifier.
The environment identifier is a unique identifier of the environment where the generating device is located, such as a production environment: pro; pre-foaming environment 1: pre 1; pre-emergence environment 2: pre2, etc.
Step 202, when a message is monitored, analyzing an environment identifier carried in the message, storing the environment identifier and the message in a storage device in an associated manner, and storing the state of the message in an associated manner as a to-be-processed state and creating time.
Referring to fig. 3, fig. 3 is a schematic diagram of an association relationship for storing a message in a storage device in the embodiment of the present application.
In fig. 3, the message body may be a message with a stripped environment identifier, or may be a received message; the state of the message can use 0 to represent the pending state, 1 to represent the in-process state, and 2 to represent the message processing completion state, and the specific implementation is not limited; the environment identification and the creation time can be described by using specific fields.
The step is realized by storing the environment identifier, the message, the state and the creation time in the storage device in an associated manner, rather than determining whether the environment identifier corresponds to the environment identifier corresponding to the processing device, to determine whether to perform logic processing on the message.
And step 203, monitoring whether a timing task corresponding to the configured environment identifier is started.
And 204, when monitoring that the timing task corresponding to the environment identifier configured by the processing device is started, acquiring the message of which the state corresponding to the environment identifier in the storage device is the to-be-processed state according to the sequence of the creation time, and performing logic processing.
And monitoring whether a timing task corresponding to the configured environment identifier is started or not, and processing the message corresponding to the environment identifier in the storage equipment when monitoring that the timing task corresponding to the environment identifier configured by the processing equipment is started.
Step 205, when the message is acquired for logic processing, updating the state corresponding to the message to a processing state.
Step 206, when the logic processing of the message is completed, updating the state corresponding to the message to a processing completed state.
In the embodiment of the application, each processing device monitors the messages in the message queue according to a preset rule, and the preset rule enables each processing device not to repeatedly acquire the messages in the message queue, after the messages in the message queue are acquired, the message processing is realized by adopting a mode of first database dropping and then processing, and the state of the messages and the database dropping time are maintained in the storage device, so that the messages are reasonably processed according to the state of the messages. The method can reduce the pressure of processing equipment and improve the message processing efficiency.
Based on the same inventive concept, the embodiment of the application also provides a message processing device. Referring to fig. 4, fig. 4 is a schematic structural diagram of a message processing apparatus in the embodiment of the present application. The device comprises: aconfiguration unit 401, afirst listening unit 402, afirst processing unit 403, asecond listening unit 404 and asecond processing unit 405;
aconfiguration unit 401, configured to configure preset rules and timing tasks; wherein the preset rules cause each processing device to listen to different messages;
afirst monitoring unit 402, configured to monitor messages in the message queue according to a preset rule of theconfiguration unit 401;
afirst processing unit 403, configured to, when thefirst monitoring unit 402 monitors a message, parse an environment identifier carried in the message, and store the environment identifier and the message in a storage device in an associated manner;
asecond monitoring unit 404, configured to monitor whether a timing task configured by theconfiguration unit 401 corresponding to the environment identifier configured by the processing device is started;
thesecond processing unit 405 is configured to, when thesecond monitoring unit 404 monitors that the timing task corresponding to the environment identifier configured in the processing device is started, acquire a message corresponding to the environment identifier in the storage device and perform logic processing.
Preferably, the first and second electrodes are formed of a metal,
thefirst processing unit 403, further configured to, when storing the environment identifier in association with the message in the storage device, associate and store a state of the message and a creation time; wherein, the corresponding state of the message is a state to be processed when the message is stored; the creation time is the time stored in the storage device;
thesecond processing unit 405 is specifically configured to, when obtaining the message corresponding to the environment identifier in the storage device for logic processing, obtain the message in the storage device whose state corresponding to the environment identifier is the to-be-processed state according to the sequence of creation time, and perform logic processing.
Preferably, the first and second electrodes are formed of a metal,
asecond processing unit 405, configured to, when the message is acquired to perform logic processing, update a state corresponding to the message in a storage device to a processing state; and when the logic processing of the message is completed, updating the state corresponding to the message into a processing completed state in the storage device.
Preferably, the first and second electrodes are formed of a metal,
theconfiguration unit 401 is further configured to start a corresponding timing task when the configured timing task is due.
The units of the above embodiments may be integrated into one body, or may be separately deployed; may be combined into one unit or further divided into a plurality of sub-units.
In another embodiment, an electronic device is also provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the message processing method when executing the program.
In another embodiment, a computer readable storage medium is also provided, having stored thereon computer instructions, which when executed by a processor, may implement the steps in the message processing method.
Fig. 5 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention. As shown in fig. 5, the electronic device may include: a Processor (Processor)510, a communication Interface (Communications Interface)520, a Memory (Memory)530 and acommunication bus 540, wherein theProcessor 510, thecommunication Interface 520 and theMemory 530 communicate with each other via thecommunication bus 540.Processor 510 may call logic instructions inmemory 530 to perform the following method:
monitoring the messages in the message queue according to a preset rule; the preset rules cause each processing device to monitor different messages;
when a message is monitored, analyzing an environment identifier carried in the message, and storing the environment identifier and the message in a storage device in a correlation manner;
and when monitoring that the timing task corresponding to the environment identifier configured by the processing equipment is started, acquiring a message corresponding to the environment identifier in the storage equipment for logic processing.
Furthermore, the logic instructions in thememory 530 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

CN202110466376.1A2021-04-282021-04-28Message processing method and deviceActiveCN113138868B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202110466376.1ACN113138868B (en)2021-04-282021-04-28Message processing method and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202110466376.1ACN113138868B (en)2021-04-282021-04-28Message processing method and device

Publications (2)

Publication NumberPublication Date
CN113138868Atrue CN113138868A (en)2021-07-20
CN113138868B CN113138868B (en)2024-04-05

Family

ID=76816306

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202110466376.1AActiveCN113138868B (en)2021-04-282021-04-28Message processing method and device

Country Status (1)

CountryLink
CN (1)CN113138868B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
KR20070106317A (en)*2006-04-282007-11-01엔에이치엔(주) Queue capacity expansion method and message processing unit that can expand queue capacity
CN103581966A (en)*2013-10-082014-02-12北京工商大学Real-time monitoring optimizing configuration method for smart phone
CN106708418A (en)*2015-11-162017-05-24腾讯科技(深圳)有限公司Message storage method and device in game environment
CN108255620A (en)*2018-01-082018-07-06北京奇艺世纪科技有限公司A kind of business logic processing method, apparatus, service server and system
CN110245008A (en)*2018-03-092019-09-17阿里巴巴集团控股有限公司Timed task processing method, system and equipment
CN110300050A (en)*2019-05-232019-10-01中国平安人寿保险股份有限公司Information push method, device, computer equipment and storage medium
CN111666145A (en)*2020-06-242020-09-15深圳壹账通智能科技有限公司Message processing method and system of message queue and computer equipment
CN111770128A (en)*2020-02-072020-10-13北京沃东天骏信息技术有限公司Message management method and device
WO2021022710A1 (en)*2019-08-022021-02-11平安科技(深圳)有限公司Message queue processing method, device, electronic apparatus, and computer readable non-volatile storage medium
CN112433832A (en)*2020-11-172021-03-02北京沃东天骏信息技术有限公司Task triggering method, device, equipment and computer readable storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
KR20070106317A (en)*2006-04-282007-11-01엔에이치엔(주) Queue capacity expansion method and message processing unit that can expand queue capacity
CN103581966A (en)*2013-10-082014-02-12北京工商大学Real-time monitoring optimizing configuration method for smart phone
CN106708418A (en)*2015-11-162017-05-24腾讯科技(深圳)有限公司Message storage method and device in game environment
CN108255620A (en)*2018-01-082018-07-06北京奇艺世纪科技有限公司A kind of business logic processing method, apparatus, service server and system
CN110245008A (en)*2018-03-092019-09-17阿里巴巴集团控股有限公司Timed task processing method, system and equipment
CN110300050A (en)*2019-05-232019-10-01中国平安人寿保险股份有限公司Information push method, device, computer equipment and storage medium
WO2021022710A1 (en)*2019-08-022021-02-11平安科技(深圳)有限公司Message queue processing method, device, electronic apparatus, and computer readable non-volatile storage medium
CN111770128A (en)*2020-02-072020-10-13北京沃东天骏信息技术有限公司Message management method and device
CN111666145A (en)*2020-06-242020-09-15深圳壹账通智能科技有限公司Message processing method and system of message queue and computer equipment
CN112433832A (en)*2020-11-172021-03-02北京沃东天骏信息技术有限公司Task triggering method, device, equipment and computer readable storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
SUPRIYA, S 等: "A Novel Two Phase Authentication Mechanism for Integrated Messaging Intelligent Transport System", 2018 4TH INTERNATIONAL CONFERENCE ON COMPUTING COMMUNICATION AND AUTOMATION (ICCCA)*
丁振凡;: "基于Spring Integration消息流程的文件监控", 吉首大学学报(自然科学版), no. 02*
屈志坚;刘明光;陈秋琳;王健;杨罡;: "基于监听代理的突发信息柔性回调技术", 电力系统自动化, no. 21*

Also Published As

Publication numberPublication date
CN113138868B (en)2024-04-05

Similar Documents

PublicationPublication DateTitle
CN108287751B (en)Task execution method and device and distributed system
CN111045893B (en)Method, device and system for executing monitoring task, storage medium and electronic device
CN102014348A (en)Method and terminal for setting alarm clock remotely
CN112883261B (en) Configuration data push method, device, electronic device and medium
CN106550101B (en)Event reminding method and device
CN107798039A (en)A kind of method of data synchronization and device
CN110009273B (en)Information processing method and device, storage medium, and electronic device
CN111355802A (en)Information pushing method and device
CN108616668B (en)Method for monitoring dialing task, electronic device and computer readable storage medium
CN105210039A (en)Terminal and method for synchronizing application thereof
CN113138868A (en)Message processing method and device
CN108268498B (en)Processing method and device for batch crawler tasks
CN106708737B (en)Test method and device
CN110827079B (en)Order following processing method, device and storage medium
CN109376054B (en)Data distribution method and device, terminal equipment and storage medium
CN107273275B (en)Method and device for dynamically refreshing progress bar in multiple data units
CN106776753B (en)Service data processing method and device
CN111782684B (en)Distribution network electronic handover information matching method and device
CN112000492B (en)Public number user tag management system and method
CN113742052A (en)Batch task processing method and device
CN111061701B (en)Information processing method, device, server and computer readable medium
CN110543470A (en)Message early warning method and device, storage medium and electronic device
CN109150951B (en)Method and device for starting Activity of Android system
CN110458626B (en)Information data processing method and device
CN105072561A (en)Method, device and system for sharing friend information

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp