WO2016107456A1 - 一种处理消息的方法、装置及系统 - Google Patents

一种处理消息的方法、装置及系统 Download PDF

Info

Publication number
WO2016107456A1
WO2016107456A1 PCT/CN2015/098248 CN2015098248W WO2016107456A1 WO 2016107456 A1 WO2016107456 A1 WO 2016107456A1 CN 2015098248 W CN2015098248 W CN 2015098248W WO 2016107456 A1 WO2016107456 A1 WO 2016107456A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
processing
processing capability
receiving end
timeout
Prior art date
Application number
PCT/CN2015/098248
Other languages
English (en)
French (fr)
Inventor
程冬
Original Assignee
阿里巴巴集团控股有限公司
程冬
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 阿里巴巴集团控股有限公司, 程冬 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2016107456A1 publication Critical patent/WO2016107456A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present application relates to the field of computer applications, and in particular, to a method, device and system for processing a message.
  • message middleware is often used between applications and third-party applications to deliver a large number of messages.
  • the application that sends the message can be regarded as the message sender, and the application that receives the message can be regarded as the message receiver.
  • the message sender sends the message to the message middleware, and the message middleware stores the message in several queues, and forwards the message to the message receiving end when appropriate.
  • the message receiving end repeatedly processes the message, and each time a message is received, the deduplication logic is executed on the message.
  • the message related tag needs to be read from the cache to determine whether the message has been processed. If it has been processed, the message is discarded. If it is not processed, the message is marked as processed and stored in the cache. And the message processing flow is executed for the message.
  • the message receiving end performs deduplication logic every time a message is received, which occupies a large amount of computing resources, and needs to access the cache every time, which causes a strong dependence on the cache and increases the risk of the system.
  • the purpose of the present application is to provide a method, an apparatus, and a system for processing a message, so as to reduce the occupation of computing resources and reduce system risk.
  • a method of processing a message may include: monitoring message processing capability of the message receiving end, when the message processing capability is the first message processing capability, turning the message deduplication logic on, when the message processing capability is the second message processing capability, The message de-duplication logic is turned off, wherein the first message processing capability is smaller than the second message processing capability; if the message receiving end receives the message, it is determined whether the message de-duplication logic is enabled; if not, The message execution message processing flow.
  • an apparatus for processing a message may include: a switch control unit, configured to monitor message processing capability of the message receiving end, and when the message processing capability is the first message processing capability, turn off the message de-duplication logic, when the message processing capability is the second When the message processing capability is performed, the message de-duplication logic is turned off, wherein the first message processing capability is smaller than the second message processing capability.
  • the switch determining unit may be configured to determine whether the message deduplication logic is enabled if the message receiving end receives the message.
  • the message processing unit may be configured to perform a message processing flow for the message if the switch determines that the determination is negative.
  • a system for processing a message can include a message sender for transmitting a message to the message middleware.
  • a message middleware configured to store the message in a message queue, and forward the message to a message receiving end, where the message is forwarded to the message receiving again when the message satisfies the condition of repeated delivery end.
  • the message receiving end is configured to monitor its own message processing capability. When the message processing capability is the first message processing capability, the message deduplication logic is turned on.
  • the message receiving capability is The message de-duplication logic is closed, wherein the first message processing capability is smaller than the second message processing capability; if the message is received, determining whether the message de-duplication logic is enabled; if not, performing the message Message processing flow.
  • the message deduplication logic Since the present application monitors the message processing capability of the message receiving end, the message deduplication logic is switched between opening and closing. Therefore, when the message receiving end receives the message forwarded by the message middleware, if the message deduplication logic is closed The processing flow can be directly executed on the message without performing deduplication logic on the message, avoiding performing deduplication logic every time the message is received, and avoiding accessing the cache every time the message is received, thereby reducing the occupation of the computing resource and reducing System risk.
  • FIG. 1 is a schematic flowchart of a method for processing a message according to an embodiment of the present disclosure
  • FIG. 2 is a schematic flowchart of a method for processing a message according to another embodiment of the present disclosure
  • FIG. 3 is a schematic structural diagram of an apparatus for processing a message according to an embodiment of the present disclosure
  • FIG. 4 is a schematic structural diagram of a system for processing a message according to an embodiment of the present disclosure
  • FIG. 5 is a schematic structural diagram of a system for processing a message according to another embodiment of the present disclosure.
  • the inventor of the present application finds that in the case that the message processing capability of the message receiving end is normal, the message can be quickly processed by the message receiving end, and the message middleware can receive the feedback of the message processing in time. At this time, the same message is usually not repeatedly delivered. . Only when the message processing capability of the message receiving end is abnormal, the message cannot be processed quickly by the message receiving end, and the message middleware cannot receive the feedback of the message processing in time, and the same message is repeatedly delivered. Moreover, the general message receiving end has an idempotent operation on the received message, for example, a correction mechanism or a fault tolerance mechanism for the processing result when the same message is repeatedly processed.
  • the inventor of the present application finds that the message de-duplication logic can be switched between on and off by monitoring the message processing capability of the message receiving end, so that when the message receiving message processing capability is normal and the message deduplication logic is useless, The message de-duplication logic is turned off. At this time, the received message does not have to perform de-duplication logic, and the message processing flow can be directly executed on the message. Therefore, the logic switch can be de-duplicated according to the program message processing capability, that is, the running condition, and the message is automatically turned on or off, so that the deduplication logic is executed every time the message is received, so that the message is accessed every time the message is received, thereby reducing the occupation of the computing resource. To reduce the risk of systemic risks.
  • FIG. 1 it is a schematic flowchart of a method for processing a message according to an embodiment of the present application. As shown in FIG. 1, the method can include:
  • the message processing capability of the message receiving end is monitored. When the message processing capability is the first message processing capability, the message deduplication logic is turned on. When the message processing capability is the second message processing capability, the message is sent. The heavy logic is closed, wherein the first message processing capability is less than the second message processing capability.
  • the factor used to measure the message processing capability of the message receiving end can be based on the actual Need to set up. This application does not limit this.
  • message processing time can be used to measure message processing capabilities
  • message feedback can be used to measure message processing capabilities, and so on.
  • an implementation method for measuring message processing capability by using message timeout processing number is introduced.
  • the number of message timeouts processed at the message receiving end may be monitored. If the message timeout processing number of the message receiving end exceeds a preset threshold, it is determined that the message receiving end message processing capability is the first message processing capability. If the message timeout processing number of the message receiving end does not exceed the preset threshold, it is determined that the message receiving end message processing capability is the second message processing capability.
  • the message deduplication logic For example, if the message timeout processing number exceeds a preset threshold within a fixed time window, the message deduplication logic is turned on, and if the message timeout processing number is less than a preset threshold in a fixed time window, the message deduplication logic is turned off. .
  • the number of message timeout processing may be set to an initial value; and the time required for the message receiving end to process each message is monitored in real time, that is, the time consumption of each message is recorded; For each message that takes longer than the preset duration, the message timeout processing number is incremented by one; if the message timeout processing number exceeds the preset threshold in a time window, it is determined that the message receiving end message processing capability is the first message processing capability. And if the message timeout processing number does not exceed the preset threshold within a time window, determining that the message receiving end message processing capability is the second message processing capability.
  • the initial value of the message timeout processing may be zero
  • the preset duration may be 3 seconds
  • a time window may be 1 minute
  • the preset threshold may be 5 times. If the message receiving end detects that the number of message processing times exceeds 5 times in a time window, such as 1 minute, and the time exceeds 5 seconds, the message processing capability of the message receiving end is the first message processing capability, thereby de-emphasizing the message.
  • the logic is turned on.
  • the message processing capability of the message receiving end is the second message processing capability, thereby de-duplicating the message. shut down.
  • the initial value of the message timeout processing may be set; the time consumption of processing each message by the message receiving end is monitored in real time; for each message that takes longer than the preset duration, The message timeout processing number is increased by one; if the message timeout processing number is greater than the initial value, the message timeout processing number is decremented by one for each message that does not exceed the preset duration.
  • the initial value of the message timeout processing number may be zero. If the message receiving end is detected to take more than 5 times of the message timeout processing time, such as 3 seconds, the message receiving end The message processing capability is the first message processing capability, thereby turning the message de-duplication logic on. If the message processing capability of the message receiving end is improved, the number of messages that do not exceed 3 seconds in message processing may be increased, and the number of message timeout processing may be reduced. When the number of message timeout processing is less than or equal to 5 times, the message processing capability of the message receiving end is The second message processing capability, thereby turning off the message de-duplication logic.
  • the specific implementation manner of the message execution message processing flow of the present application is not limited.
  • the message processing flow may be different for different message receiving ends, or for different messages.
  • the message receiving end is related to the function to be implemented by the message, and the application is not limited thereto.
  • the message receiving end may be an application for implementing risk control.
  • the message processing flow may specifically be a process for performing risk assessment on the message.
  • the message receiving end may be an application of blacklist screening.
  • the message processing procedure may specifically be a process for performing blacklist screening on the message.
  • the message receiving end may be an application for mail sending. At this time, the message processing flow may specifically be a process for generating a mail for the message and sending, and the like.
  • the method may further include:
  • the message deduplication logic can be implemented by referring to general deduplication logic. For example, performing deduplication logic on the message may include: extracting a flag of the message from a cache, determining whether the message has been processed according to the flag; discarding the message if processed; if not processed The message is then marked as being processed and stored in the cache, and a message processing flow is performed for the message.
  • the message processing capability of the message receiving end is monitored, and the message deduplication logic is switched between opening and closing, so that the message processing capability is normal, and the message deduplication logic is normal.
  • the message de-duplication logic is turned off.
  • the received message does not have to perform de-duplication logic, and the message processing flow can be directly executed on the message. Therefore, the method provided by the embodiment of the present application can avoid performing deduplication logic every time receiving a message, avoiding each time The received messages are all accessed by the cache, which can reduce the occupation of computing resources and reduce the system risk.
  • the embodiment of the present application further provides an apparatus for processing a message.
  • FIG. 3 a schematic structural diagram of an apparatus for processing a message according to an embodiment of the present application is shown.
  • the apparatus may include:
  • the switch control unit 310 can be configured to monitor message processing capability of the message receiving end. When the message processing capability is the first message processing capability, the message deduplication logic is enabled, when the message processing capability is the second message processing capability. Deselecting the message de-duplication logic, wherein the first message processing capability is less than the second message processing capability.
  • the switch determining unit 320 can be configured to determine whether the message deduplication logic is enabled if the message receiving end receives the message.
  • the message processing unit 330 may be configured to perform a message processing flow for the message if the switch determination decision is negative.
  • the apparatus may further include: a de-duplication processing unit 340, configured to perform the message de-duplication logic for the message if the switch determines that the determination is yes.
  • a de-duplication processing unit 340 configured to perform the message de-duplication logic for the message if the switch determines that the determination is yes.
  • the number of message timeouts can be utilized to measure message processing capabilities.
  • the switch control unit 310 may include: a timeout monitoring sub-unit 311, which may be used to monitor the number of message timeout processing of the message receiving end.
  • the switch-on sub-unit 312 can be configured to de-assert the message if the number of message timeout processing of the message receiving end exceeds a preset threshold.
  • the switch off subunit 313 can be used to deactivate the message de-duplication logic if the message timeout processing number of the message receiving end does not exceed the preset threshold.
  • the timeout monitoring sub-unit 311 can be configured to set the number of message timeout processing to an initial value at the beginning of each time window; perform real-time monitoring on the time taken by the message receiving end to process each message; If the message exceeds the preset duration, the number of message timeouts is increased by one.
  • the switch-on sub-unit 312 can be configured to de-assert the message if the message timeout processing number exceeds a preset threshold within a time window.
  • the switch off subunit 313 can be used to deactivate the message de-duplication logic if the message timeout processing number of the message receiving end does not exceed the preset threshold.
  • the timeout monitoring sub-unit 311 can be used to set an initial value of the message timeout processing number; perform real-time monitoring on the time taken by the message receiving end to process each message; for each message that takes longer than the preset duration, The number of message timeouts is increased by one; if the number of message timeouts is greater than the number The initial value is reduced by one for each message that consumes less than the preset duration.
  • the switch control unit 310 can monitor the message processing capability of the message receiving end, and switch the message deduplication logic between opening and closing, so that the message processing capability is normal, and the message goes.
  • the message deduplication logic is turned off.
  • the received message does not have to perform deduplication logic, and the message processing unit 330 can directly execute the message processing flow on the message. Therefore, the method provided by the embodiment of the present application can avoid performing deduplication logic every time a message is received, and avoids accessing the cache every time the message is received, so as to reduce the occupation of the computing resource and reduce the system risk.
  • timeout monitoring sub-unit 311, the switch-on sub-unit 312, the switch-off sub-unit 313, and the de-duplication processing unit 340 in the embodiment of the present application are drawn in dashed lines in FIG. 3 to indicate that these units are not the present application.
  • the embodiment of the present application further provides a system for processing a message.
  • FIG. 4 it is a schematic structural diagram of a system for processing a message according to an embodiment of the present application.
  • the system can include:
  • the message sender 410 can be used to send a message to the message middleware.
  • the message middleware 420 can be configured to store the message in a message queue, and forward the message to the message receiving end, wherein when the message satisfies the condition of repeated delivery, the message is forwarded again to the message The message receiving end.
  • the message receiving end 430 can be used to monitor its own message processing capability.
  • the message processing capability is the first message processing capability
  • the message deduplication logic is enabled.
  • the message processing capability is the second message processing capability, De-duplicating the message, wherein the first message processing capability is less than the second message processing capability; if the message is received, determining whether the message de-duplication logic is enabled; if not, The message execution message processing flow.
  • the message receiving end 430 monitors the message processing capability of the message, the message deduplication logic is switched between on and off. Therefore, when the message processing capability is normal and the message deduplication logic is useless, the message deduplication logic can be placed. In the off state, at this time, the message receiving end 430 does not need to perform deduplication logic on the message forwarded by the message middleware 420, but directly performs a message processing flow on the message. Therefore, the system provided by the embodiment of the present application can prevent the message receiving end 430 from performing deduplication logic every time the message is received, and avoids accessing the buffer every time the message is received, so as to reduce the occupation of the computing resource and reduce the system risk.
  • the message middleware in the system for processing a message may be an intermediate server cluster, which is used to forward messages between applications of the website.
  • the message sending end in the embodiment of the present application may be a website inquiry application 510, and the website inquiry application 510 may receive a request for inquiry of the product detailed information or price information of the specified product or a specified enterprise by the user, and further request according to the inquiry.
  • An invocation message for one or more third party service applications 530 related to the item details or price information is sent to the intermediate server cluster 520, causing the intermediate server cluster 520 to forward the invocation message to the third party service application 530.
  • the message receiving end in the embodiment of the present application may be a third-party service application 530.
  • the third party business application 530 may include, for example, a wind control logic application, a blacklist screening application, an attachment delivery confirmation application, a mail delivery application, and the like.
  • the third-party service application 530 switches between the opening and closing of the message de-duplication logic according to the real-time monitored message processing capability. Therefore, the third-party service application 530 does not need to perform when the message processing capability is good.
  • the message de-duplication logic can directly execute the message processing flow on the message, thereby reducing the occupation of computing resources and reducing system risk.
  • the website inquiry application 510 can get the feedback after the third party service application 530 processes the message as soon as possible, and correspondingly improve the processing efficiency of the website inquiry application.
  • the present application can be implemented by means of software plus a necessary general hardware platform. Based on such understanding, the technical solution of the present application may be embodied in the form of a software product in essence or in the form of a software product, which may be stored in a storage medium such as a ROM/RAM or a disk. , an optical disk, etc., includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform the methods described in various embodiments of the present application or portions of the embodiments.
  • a computer device which may be a personal computer, server, or network device, etc.
  • This application can be used in a variety of general purpose or special purpose computing system environments or configurations.
  • personal meter Computer server computer, handheld or portable device, tablet device, multiprocessor system, microprocessor based system, set-top box, programmable consumer electronics device, network PC, small computer, mainframe computer, including any of the above A distributed computing environment of a system or device, and so on.
  • the application can be described in the general context of computer-executable instructions executed by a computer, such as a program module.
  • program modules include routines, programs, objects, components, data structures, and the like that perform particular tasks or implement particular abstract data types.
  • the present application can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network.
  • program modules can be located in both local and remote computer storage media including storage devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本申请公开了一种处理消息的方法,例如,该方法可以包括:监测消息接收端的消息处理能力,当所述消息处理能力为第一消息处理能力时,将消息去重逻辑开启,当消息处理能力为第二消息处理能力时,将消息去重逻辑关闭,其中,第一消息处理能力小于第二消息处理能力;如果消息接收端接收到消息,判断消息去重逻辑是否开启;如果否,针对消息执行消息处理流程。由于本申请根据消息处理能力将消息去重逻辑在开启与关闭之间切换,因此,如果消息去重逻辑关闭,消息接收端可以直接对消息执行处理流程,而不必对该消息执行去重逻辑,从而可以减少对计算资源的占用,降低系统风险。另外,本申请还公开了一种处理消息的装置及系统。

Description

一种处理消息的方法、装置及系统 技术领域
本申请涉及计算机应用领域,尤其涉及一种处理消息的方法、装置及系统。
背景技术
目前,在大型业务系统中,大部分应用都会涉及对第三方应用的依赖或调用。因此,应用与第三方应用之间通常会采用消息中间件来实现大量消息的传递。发送消息的应用可视为消息发送端,接收消息的应用可视为消息接收端。消息发送端将消息发送给消息中间件,消息中间件将消息存放在若干队列中,在合适的时候再将消息转发给消息接收端。
消息接收端为了防止消息中间件重复投递相同消息造成对消息的重复处理,每接收到一条消息时、都要对消息执行去重逻辑。在去重逻辑中,需要从缓存读取消息相关标记以判断消息是否被处理过,如已被处理,则丢弃该消息,如未被处理,则将消息标记为已被处理并存入缓存,并针对该消息执行消息处理流程。
但是,消息接收端每接收到一条消息都执行去重逻辑,会占用大量计算资源,而且每次都需要访问缓存,造成了对缓存的强依赖,增加了系统的风险。
发明内容
有鉴于此,本申请的目的在于提供一种处理消息的方法、装置及系统,以实现减少对计算资源的占用,降低系统风险的目的。
在本申请实施例的第一个方面中,提供了一种处理消息的方法。例如,该方法可以包括:监测消息接收端的消息处理能力,当所述消息处理能力为第一消息处理能力时,将消息去重逻辑开启,当所述消息处理能力为第二消息处理能力时,将所述消息去重逻辑关闭,其中,所述第一消息处理能力小于所述第二消息处理能力;如果消息接收端接收到消息,判断所述消息去重逻辑是否开启;如果否,针对所述消息执行消息处理流程。
在本申请实施例的第二个方面中,提供了一种处理消息的装置。例如, 该装置可以包括:开关控制单元,可以用于监测消息接收端的消息处理能力,当所述消息处理能力为第一消息处理能力时,将消息去重逻辑开启,当所述消息处理能力为第二消息处理能力时,将所述消息去重逻辑关闭,其中,所述第一消息处理能力小于所述第二消息处理能力。开关判断单元,可以用于如果消息接收端接收到消息,判断所述消息去重逻辑是否开启。消息处理单元,可以用于如果所述开关判断判定为否,针对所述消息执行消息处理流程。
在本申请实施例的第三个方面中,提供了一种处理消息的系统。例如,该系统可以包括:消息发送端,用于向消息中间件发送消息。消息中间件,用于将所述消息存放在消息队列中,以及,将所述消息转发给消息接收端,其中,当所述消息满足重复投递的条件时,再次将所述消息转发给消息接收端。消息接收端,用于监测自身的消息处理能力,当所述消息处理能力为第一消息处理能力时,将消息去重逻辑开启,当所述消息处理能力为第二消息处理能力时,将所述消息去重逻辑关闭,其中,所述第一消息处理能力小于所述第二消息处理能力;如果接收到所述消息,判断所述消息去重逻辑是否开启;如果否,针对所述消息执行消息处理流程。
可见,本申请具有如下有益效果:
由于本申请对消息接收端的消息处理能力进行监测,将消息去重逻辑在开启与关闭之间切换,因此,在消息接收端接收到消息中间件转发的消息时,如果所述消息去重逻辑关闭,则可以直接对消息执行处理流程,而不必对该消息执行去重逻辑,避免每次接收消息均执行去重逻辑,避免每次接收消息均访问缓存,从而可以减少对计算资源的占用,降低系统风险。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请一实施例提供的一种处理消息的方法流程示意图;
图2为本申请另一实施例提供的一种处理消息的方法流程示意图;
图3为本申请实施例提供的一种处理消息的装置结构示意图;
图4为本申请一实施例提供的一种处理消息的系统结构示意图;
图5为本申请另一实施例提供的一种处理消息的系统结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本申请中的技术方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。
本申请的发明人发现,在消息接收端消息处理能力正常的情况下,消息可以被消息接收端快速处理,消息中间件能够及时接收到消息处理的反馈,此时,通常不会重复投递相同消息。只有在消息接收端消息处理能力异常的情况下,消息无法被消息接收端快速处理,消息中间件不能及时接收到消息处理的反馈,才会重复投递相同消息。而且,一般消息接收端对接收到的消息的操作都具有幂等性,例如,设置有相同消息被重复处理时对处理结果的修正机制或者容错机制。基于此,本申请的发明人发现可以通过对消息接收端的消息处理能力进行监测,将消息去重逻辑在开启与关闭之间切换,从而在消息接收到消息处理能力正常,消息去重逻辑无用时,使消息去重逻辑处于关闭状态,此时接收到的消息不必执行去重逻辑,可直接对消息执行消息处理流程。因此,可以根据程序消息处理能力也即运行情况、自动开启或关闭消息去重逻辑开关,避免每次接收消息均执行去重逻辑,避免每次接收消息均访问缓存,达到减少对计算资源的占用,降低系统风险的目的。
例如,参见图1,为本申请实施例提供的一种处理消息的方法流程示意图。如图1所示,该方法可以包括:
S110、监测消息接收端的消息处理能力,当所述消息处理能力为第一消息处理能力时,将消息去重逻辑开启,当所述消息处理能力为第二消息处理能力时,将所述消息去重逻辑关闭,其中,所述第一消息处理能力小于所述第二消息处理能力。
需要说明的是,用于衡量消息接收端的消息处理能力的因子可以根据实 际需要设置。本申请对此并不进行限制。例如,可以利用消息超时处理数来衡量消息处理能力,可以利用消息反馈数衡量消息处理能力、等等。
下面,对利用消息超时处理数衡量消息处理能力的实施方式进行介绍。一些可能的实施方式中,可以对消息接收端的消息超时处理数进行监测。如果消息接收端的消息超时处理数超过预设阈值,确定消息接收端消息处理能力为第一消息处理能力。如果消息接收端的消息超时处理数未超过预设阈值,确定消息接收端消息处理能力为第二消息处理能力。
例如,具体地,如果消息超时处理数在固定时间窗内超过预设阀值,则打开消息去重逻辑,如果消息超时处理数在固定时间窗内小于预设阀值,则关闭消息去重逻辑。具体地,例如,可以在每个时间窗开始时,设置消息超时处理数为初始值;对消息接收端处理每条消息的耗时进行实时监测,也即对每条消息的耗时进行记录;针对每条耗时超过预设时长的消息,对消息超时处理数加一;如果所述消息超时处理数在一个时间窗内超过预设阈值,确定消息接收端消息处理能力为第一消息处理能力;如果所述消息超时处理数在一个时间窗内未超过预设阈值,确定消息接收端消息处理能力为第二消息处理能力。
基于上面提到的实施方式,例如,消息超时处理数初始值可以为零,预设时长可以为3秒,一个时间窗当度可以为1分钟,预设阈值可以为5次。如果监测到消息接收端在一个时间窗长度如1分钟内、耗时超过如3秒的消息处理数大于5次,则该消息接收端的消息处理能力为第一消息处理能力,从而将消息去重逻辑开启。如果监测到消息接收端在一个时间长度如1分钟内,耗时超过3秒的消息处理数小于等于5次,则该消息接收端的消息处理能力为第二消息处理能力,从而将消息去重逻辑关闭。
再例如,对消息超时进行监测的实施方式中,可以设置消息超时处理数初始值;对消息接收端处理每条消息的耗时进行实时监测;针对每条耗时超过预设时长的消息,对消息超时处理数加一;如果所述消息超时处理数大于所述初始值,针对每条耗时未超过预设时长的消息,对消息超时处理数减一。
基于上面提到的实施方式,消息超时处理数初始值可以为零,如果监测到消息接收端耗时超过如3秒的消息超时处理数大于5次,则该消息接收端 的消息处理能力为第一消息处理能力,从而将消息去重逻辑开启。如果消息接收端消息处理能力提高,则可以随消息处理耗时未超过3秒的消息数量增加,减少消息超时处理数,直到消息超时处理数小于等于5次时,该消息接收端的消息处理能力为第二消息处理能力,从而将消息去重逻辑关闭。
S120、如果消息接收端接收到消息,判断所述消息去重逻辑是否开启。
S130、如果否,针对所述消息执行消息处理流程。
需要说明的是,本申请对所述消息执行消息处理流程的具体实现方式不限。不同消息接收端、或者,针对不同消息,所述消息处理流程可以是不同的。具体与消息接收端针对所述消息要实现的功能有关,本申请对此并不进行限制,例如,一些可能的实施方式中,所述消息接收端可以是用于实现风险控制的应用。此时,所述消息处理流程具体可以为用于针对所述消息进行风险评估的流程。再例如,一些可能的实施方式中,所述消息接收端可以是黑名单筛查的应用。此时所述消息处理流程具体可以为用于针对所述消息进行黑名单筛查的流程。又例如,一些可能的实施方式中,所述消息接收端可以是邮件发送的应用。此时所述消息处理流程具体可以为用于针对所述消息生成邮件并发送的流程,等等。
另外,一些可能的实施方式中,如图2所示,所述方法还可以包括:
S140、如果所述消息去重逻辑开启,针对所述消息执行所述消息去重逻辑。
其中,所述消息去重逻辑可以参照一般的去重逻辑实现。例如,针对所述消息执行去重逻辑可以包括:从缓存中取出所述消息的标记,根据所述标记判断该消息是否被处理过;如果被处理过,则丢弃所述消息;如果未被处理过,则将所述消息标记为已被处理并存入缓存,并针对所述消息执行消息处理流程。
可见,应用本申请实施例提供的方法,通过对消息接收端的消息处理能力进行监测,将消息去重逻辑在开启与关闭之间切换,从而在消息接收到消息处理能力正常,消息去重逻辑无用时,使消息去重逻辑处于关闭状态,此时接收到的消息不必执行去重逻辑,可直接对消息执行消息处理流程。因此,本申请实施例提供的方法可以避免每次接收消息均执行去重逻辑,避免每次 接收消息均访问缓存,达到可以减少对计算资源的占用,降低系统风险的目的。
与上述一种处理消息的方法相对应地,本申请实施例还提供了一种处理消息的装置。
例如,如图3所示,本申请实施例提供的一种处理消息的装置结构示意图。如图3所示,该装置可以包括:
开关控制单元310,可以用于监测消息接收端的消息处理能力,当所述消息处理能力为第一消息处理能力时,将消息去重逻辑开启,当所述消息处理能力为第二消息处理能力时,将所述消息去重逻辑关闭,其中,所述第一消息处理能力小于所述第二消息处理能力。开关判断单元320,可以用于如果消息接收端接收到消息,判断所述消息去重逻辑是否开启。消息处理单元330,可以用于如果所述开关判断判定为否,针对所述消息执行消息处理流程。
一些可能的实施方式中,所述装置还可以包括:去重处理单元340,可以用于如果所述开关判断判定为是,针对所述消息执行所述消息去重逻辑。
一些可能的实施方式中,可以利用消息超时处理数来衡量消息处理能力。在该实施方式中,例如,所述开关控制单元310可以包括:超时监测子单元311,可以用于对消息接收端的消息超时处理数进行监测。开关开启子单元312,可以用于如果消息接收端的消息超时处理数超过预设阈值,将消息去重逻辑开启。开关关闭子单元313,可以用于如果消息接收端的消息超时处理数未超过预设阈值,将消息去重逻辑关闭。
例如,所述超时监测子单元311,可以用于在每个时间窗开始时,设置消息超时处理数为初始值;对消息接收端处理每条消息的耗时进行实时监测;针对每条耗时超过预设时长的消息,对消息超时处理数加一。所述开关开启子单元312,可以用于如果所述消息超时处理数在一个时间窗内超过预设阈值,将消息去重逻辑开启。所述开关关闭子单元313,可以用于如果消息接收端的消息超时处理数未超过预设阈值,将消息去重逻辑关闭。
再例如,所述超时监测子单元311,可以用于设置消息超时处理数初始值;对消息接收端处理每条消息的耗时进行实时监测;针对每条耗时超过预设时长的消息,对消息超时处理数加一;如果所述消息超时处理数大于所述 初始值,针对每条耗时未超过预设时长的消息,对消息超时处理数减一。
可见,配置本申请实施例提供的装置,可以由开关控制单元310通过对消息接收端的消息处理能力进行监测,将消息去重逻辑在开启与关闭之间切换,从而在消息处理能力正常,消息去重逻辑无用时,使消息去重逻辑处于关闭状态,此时接收到的消息不必执行去重逻辑,消息处理单元330可直接对消息执行消息处理流程。因此,本申请实施例提供的方法可以避免每次接收消息均执行去重逻辑,避免每次接收消息均访问缓存,达到可以减少对计算资源的占用,降低系统风险的目的。
需要注意的是,本申请实施例所述超时监测子单元311、开关开启子单元312、开关关闭子单元313、去重处理单元340在图3中以虚线绘制,以表示这些单元并不是本申请实施例提供的处理消息的装置的必要单元。
与上述处理消息的方法相对应地,本申请实施例还提供了一种处理消息的系统。例如,参见图4,为本申请实施例提供的一种处理消息的系统结构示意图。如图4所示,该系统可以包括:
消息发送端410,可以用于向消息中间件发送消息。消息中间件420,可以用于将所述消息存放在消息队列中,以及,将所述消息转发给消息接收端,其中,当所述消息满足重复投递的条件时,再次将所述消息转发给消息接收端。消息接收端430,可以用于监测自身的消息处理能力,当所述消息处理能力为第一消息处理能力时,将消息去重逻辑开启,当所述消息处理能力为第二消息处理能力时,将所述消息去重逻辑关闭,其中,所述第一消息处理能力小于所述第二消息处理能力;如果接收到所述消息,判断所述消息去重逻辑是否开启;如果否,针对所述消息执行消息处理流程。
由于消息接收端430通过对自身的消息处理能力进行监测,将消息去重逻辑在开启与关闭之间切换,因此,在消息处理能力正常,消息去重逻辑无用时,可以使消息去重逻辑处于关闭状态,此时,消息接收端430无需对消息中间件420转发的消息执行去重逻辑,而是直接对消息执行消息处理流程。因此,本申请实施例提供的系统可以避免消息接收端430每次接收消息均执行去重逻辑,避免每次接收消息均访问缓存,达到可以减少对计算资源的占用,降低系统风险的目的。
例如,在本申请实施例一些可能的应用场景中,如图5所示,所述处理消息的系统中的消息中间件可以为中间服务器集群,用于转发网站各个应用之间的消息。本申请实施例中的消息发送端可以为网站询盘应用510,网站询盘应用510可以接收用户端针对某指定产品或某指定企业的商品详细信息或价格信息的询问请求,进而根据该询问请求向中间服务器集群520发送对该商品详细信息或价格信息有关的一个或多个第三方业务应用530的调用消息,使中间服务器集群520将调用消息转发第三方业务应用530。本申请实施例中的消息接收端可以为第三方业务应用530。第三方业务应用530例如可以包括:风控逻辑应用、黑名单筛查应用、附件送达确认应用、邮件发送应用、等等。
在该应用场景中,由于第三方业务应用530根据实时监测到的消息处理能力对消息去重逻辑在开启或关闭之间切换,因此,第三方业务应用530在消息处理能力较好时,无需执行消息去重逻辑,可以直接对消息执行消息处理流程,从而减少了对计算资源的占用,降低系统风险。而且,网站询盘应用510可以尽快得到第三方业务应用530处理消息之后的反馈,相应也提高了网站询盘应用的处理效率。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本申请时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例或者实施例的某些部分所述的方法。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
本申请可用于众多通用或专用的计算系统环境或配置中。例如:个人计 算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器系统、基于微处理器的系统、置顶盒、可编程的消费电子设备、网络PC、小型计算机、大型计算机、包括以上任何系统或设备的分布式计算环境等等。
本申请可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本申请,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上所述仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本申请的保护范围内。

Claims (11)

  1. 一种处理消息的方法,其特征在于,包括:
    监测消息接收端的消息处理能力,当所述消息处理能力为第一消息处理能力时,将消息去重逻辑开启,当所述消息处理能力为第二消息处理能力时,将所述消息去重逻辑关闭,其中,所述第一消息处理能力小于所述第二消息处理能力;
    如果消息接收端接收到消息,判断所述消息去重逻辑是否开启;
    如果否,针对所述消息执行消息处理流程。
  2. 根据权利要求1所述的方法,其特征在于,还包括:
    如果所述消息去重逻辑开启,针对所述消息执行所述消息去重逻辑。
  3. 根据权利要求1所述的方法,其特征在于,所述监测消息接收端的消息处理能力包括:
    对消息接收端的消息超时处理数进行监测;
    如果消息接收端的消息超时处理数超过预设阈值,确定消息接收端消息处理能力为第一消息处理能力;
    如果消息接收端的消息超时处理数未超过预设阈值,确定消息接收端消息处理能力为第二消息处理能力。
  4. 根据权利要求3所述的方法,其特征在于,所述对消息接收端的消息超时处理数进行监测包括:在每个时间窗开始时,设置消息超时处理数为初始值;对消息接收端处理每条消息的耗时进行实时监测;针对每条耗时超过预设时长的消息,对消息超时处理数加一;
    所述如果消息接收端的消息超时处理数超过预设阈值,确定消息接收端消息处理能力为第一消息处理能力包括:如果所述消息超时处理数在一个时间窗内超过预设阈值,确定消息接收端消息处理能力为第一消息处理能力;
    所述如果消息接收端的消息超时处理数超过预设阈值,确定消息接收端消息处理能力为第一消息处理能力包括:如果所述消息超时处理数在一个时间窗内未超过预设阈值,确定消息接收端消息处理能力为第二消息处理能力。
  5. 根据权利要求3所述的方法,其特征在于,所述对消息接收端的消息超时处理数进行监测包括:设置消息超时处理数初始值;对消息接收端处理 每条消息的耗时进行实时监测;针对每条耗时超过预设时长的消息,对消息超时处理数加一;如果所述消息超时处理数大于所述初始值,针对每条耗时未超过预设时长的消息,对消息超时处理数减一。
  6. 一种处理消息的装置,其特征在于,包括:
    开关控制单元,用于监测消息接收端的消息处理能力,当所述消息处理能力为第一消息处理能力时,将消息去重逻辑开启,当所述消息处理能力为第二消息处理能力时,将所述消息去重逻辑关闭,其中,所述第一消息处理能力小于所述第二消息处理能力;
    开关判断单元,用于如果消息接收端接收到消息,判断所述消息去重逻辑是否开启;
    消息处理单元,用于如果所述开关判断判定为否,针对所述消息执行消息处理流程。
  7. 根据权利要求6所述的装置,其特征在于,还包括:
    去重处理单元,用于如果所述开关判断判定为是,针对所述消息执行所述消息去重逻辑。
  8. 根据权利要求6所述的装置,其特征在于,所述开关控制单元包括:
    超时监测子单元,用于对消息接收端的消息超时处理数进行监测;
    开关开启子单元,用于如果消息接收端的消息超时处理数超过预设阈值,将消息去重逻辑开启;
    开关关闭子单元,用于如果消息接收端的消息超时处理数未超过预设阈值,将消息去重逻辑关闭。
  9. 根据权利要求8所述的装置,其特征在于,所述超时监测子单元,用于在每个时间窗开始时,设置消息超时处理数为初始值;对消息接收端处理每条消息的耗时进行实时监测;针对每条耗时超过预设时长的消息,对消息超时处理数加一;
    所述开关开启子单元,用于如果所述消息超时处理数在一个时间窗内超过预设阈值,将消息去重逻辑开启;
    所述开关关闭子单元,用于如果消息接收端的消息超时处理数未超过预设阈值,将消息去重逻辑关闭。
  10. 根据权利要求8所述的装置,其特征在于,所述超时监测子单元,用于设置消息超时处理数初始值;对消息接收端处理每条消息的耗时进行实时监测;针对每条耗时超过预设时长的消息,对消息超时处理数加一;如果所述消息超时处理数大于所述初始值,针对每条耗时未超过预设时长的消息,对消息超时处理数减一。
  11. 一种处理消息的系统,其特征在于,包括:
    消息发送端,用于向消息中间件发送消息;
    消息中间件,用于将所述消息存放在消息队列中,以及,将所述消息转发给消息接收端,其中,当所述消息满足重复投递的条件时,再次将所述消息转发给消息接收端;
    消息接收端,用于监测自身的消息处理能力,当所述消息处理能力为第一消息处理能力时,将消息去重逻辑开启,当所述消息处理能力为第二消息处理能力时,将所述消息去重逻辑关闭,其中,所述第一消息处理能力小于所述第二消息处理能力;如果接收到所述消息,判断所述消息去重逻辑是否开启;如果否,针对所述消息执行消息处理流程。
PCT/CN2015/098248 2014-12-29 2015-12-22 一种处理消息的方法、装置及系统 WO2016107456A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410838354.3 2014-12-29
CN201410838354.3A CN105812405B (zh) 2014-12-29 2014-12-29 一种处理消息的方法、装置及系统

Publications (1)

Publication Number Publication Date
WO2016107456A1 true WO2016107456A1 (zh) 2016-07-07

Family

ID=56284234

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/098248 WO2016107456A1 (zh) 2014-12-29 2015-12-22 一种处理消息的方法、装置及系统

Country Status (2)

Country Link
CN (1) CN105812405B (zh)
WO (1) WO2016107456A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112015469A (zh) * 2020-07-14 2020-12-01 北京淇瑀信息科技有限公司 一种系统重构方法、装置和电子设备

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108712494A (zh) * 2018-05-18 2018-10-26 阿里巴巴集团控股有限公司 处理异步消息的方法、装置及设备
CN108984325A (zh) * 2018-07-20 2018-12-11 北京北信源信息安全技术有限公司 消息队列消费方法和装置
CN110225118A (zh) * 2019-06-13 2019-09-10 浪潮软件股份有限公司 实现消息一次送达的消息中间件辅助系统及消息传送系统
CN111464386A (zh) * 2020-03-30 2020-07-28 江苏徐工工程机械研究院有限公司 用于数据传输的通信转换方法和装置、通信系统
CN112463411A (zh) * 2020-12-10 2021-03-09 重庆紫光华山智安科技有限公司 数据处理方法、装置、服务器及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103037344A (zh) * 2012-12-06 2013-04-10 亚信联创科技(中国)有限公司 一种话单去重方法及装置
WO2013130410A1 (en) * 2012-02-29 2013-09-06 Netapp, Inc. Fragmentation control for performing deduplication operations
WO2013187901A2 (en) * 2012-06-14 2013-12-19 Empire Technology Development Llc Data deduplication management

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108541069B (zh) * 2012-02-17 2022-07-12 华为技术有限公司 配置载波的方法及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013130410A1 (en) * 2012-02-29 2013-09-06 Netapp, Inc. Fragmentation control for performing deduplication operations
WO2013187901A2 (en) * 2012-06-14 2013-12-19 Empire Technology Development Llc Data deduplication management
CN103037344A (zh) * 2012-12-06 2013-04-10 亚信联创科技(中国)有限公司 一种话单去重方法及装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112015469A (zh) * 2020-07-14 2020-12-01 北京淇瑀信息科技有限公司 一种系统重构方法、装置和电子设备
CN112015469B (zh) * 2020-07-14 2023-11-14 北京淇瑀信息科技有限公司 一种系统重构方法、装置和电子设备

Also Published As

Publication number Publication date
CN105812405A (zh) 2016-07-27
CN105812405B (zh) 2019-04-09

Similar Documents

Publication Publication Date Title
WO2016107456A1 (zh) 一种处理消息的方法、装置及系统
US9800691B2 (en) Stream processing using a client-server architecture
US11429461B2 (en) Broadcast control method and apparatus, and terminal
US11411990B2 (en) Early detection of potentially-compromised email accounts
US20140344369A1 (en) Electronic mail read receipt processing
US10623343B2 (en) Message processing using deactivation condition and after scheduled end time
US20150120374A1 (en) Automation of customer relationship management (crm) tasks responsive to electronic communications
WO2017004952A1 (zh) 用于检测和阻止恶意点击广告链接的方法和装置
US8880622B2 (en) Message thread management using dynamic pointers
US20140164523A1 (en) Automated enabling of instant messaging communications in a client system
US9450906B2 (en) Managing a messaging queue in an asynchronous messaging system
EP2952037B1 (en) Scheduling data in background services on mobile devices
CN109327453B (zh) 一种特定威胁的识别方法及电子设备
CN111191249A (zh) 用于防护设备的防护方法、防护设备和可读存储介质
WO2018201863A1 (zh) 一种应用程序运维方法、装置、设备以及存储介质
JP2013239939A (ja) メールシステム
EP3032810A1 (en) Method and system for notifying voice mailbox, and computer storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15875134

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15875134

Country of ref document: EP

Kind code of ref document: A1