CN112751743B - Message sending exception processing method, message sending device and electronic equipment - Google Patents

Message sending exception processing method, message sending device and electronic equipment Download PDF

Info

Publication number
CN112751743B
CN112751743B CN201911046088.XA CN201911046088A CN112751743B CN 112751743 B CN112751743 B CN 112751743B CN 201911046088 A CN201911046088 A CN 201911046088A CN 112751743 B CN112751743 B CN 112751743B
Authority
CN
China
Prior art keywords
target address
message
blacklist
storage time
continuous failure
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
CN201911046088.XA
Other languages
Chinese (zh)
Other versions
CN112751743A (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 CHJ Automotive Information Technology Co Ltd
Original Assignee
Beijing CHJ Automotive 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 CHJ Automotive Information Technology Co Ltd filed Critical Beijing CHJ Automotive Information Technology Co Ltd
Priority to CN201911046088.XA priority Critical patent/CN112751743B/en
Publication of CN112751743A publication Critical patent/CN112751743A/en
Application granted granted Critical
Publication of CN112751743B publication Critical patent/CN112751743B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/212Monitoring or handling of messages using filtering or selective blocking
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/214Monitoring or handling of messages using selective forwarding

Abstract

The invention provides a message sending abnormality processing method, a message sending device and electronic equipment, wherein the method comprises the following steps: sending a first message to a target address; if the first message is failed to be sent, adding the target address into a blacklist; setting a first storage time of the target address in the blacklist; after the first deposit time is reached, the target address is removed from the blacklist. In the invention, after the message is failed to be sent to the target address, the target address is added into a blacklist, the storage time of the target address in the blacklist is set, and the target address is removed from the blacklist after the storage time is reached. In this way, in the case of abnormal message transmission, by setting the storage time of the target address in the blacklist, the number of unnecessary requests sent to the target address by the message transmitting device can be effectively reduced, thereby avoiding resource waste caused by repeated transmission of unnecessary requests.

Description

Message sending exception processing method, message sending device and electronic equipment
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method for processing abnormal message transmission, a message sending device, and an electronic device.
Background
In a messaging event, a receiver may not receive a message due to some reasons, for example, a larger number of transactions to be processed by the receiver, an abnormal receiver interface, an upgrade of a receiver system, a downtime of the receiver system, etc., which may cause timeout or failure of messaging, i.e., abnormal messaging.
When the message transmission is abnormal, the message sender usually tries to send a request to the receiver again, and if the receiver cannot recover to be normal in a short period, the message sender repeatedly sends the request to the receiver, so that more unnecessary requests are generated, and unnecessary resource consumption is caused.
Disclosure of Invention
The embodiment of the invention provides a message sending abnormality processing method, a message sending device and electronic equipment, which aim to solve the problem of resource waste caused by repeated sending requests when the message is sent abnormally.
In a first aspect, an embodiment of the present invention provides a method for processing a message sending exception, where the method includes:
sending a first message to a target address;
if the first message is failed to be sent, adding the target address into a blacklist;
setting a first storage time of the target address in the blacklist;
after the first deposit time is reached, the target address is removed from the blacklist.
In a second aspect, an embodiment of the present invention provides a message sending apparatus, including:
the first sending module is used for sending a first message to the target address;
the first processing module is used for adding the target address into a blacklist if the first message is failed to be sent;
the first setting module is used for setting a first storage time of the target address in the blacklist;
and the second processing module is used for removing the target address from the blacklist after the first storage time is reached.
In a third aspect, an embodiment of the present invention provides an electric vehicle including the message transmitting apparatus in the second aspect.
In a fourth aspect, an embodiment of the present invention provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, which when executed by the processor, implements the steps in the method of handling message sending exceptions in the first aspect.
In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method for handling a message transmission abnormality in the first aspect.
In the embodiment of the invention, after the message is failed to be sent to the target address, the target address is added into the blacklist, the storage time of the target address in the blacklist is set, and the target address is removed from the blacklist after the storage time is reached. In this way, in the case of abnormal message transmission, by setting the storage time of the target address in the blacklist, the number of unnecessary requests sent to the target address by the message transmitting device can be effectively reduced, thereby avoiding resource waste caused by repeated transmission of unnecessary requests.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for handling message sending anomalies provided by an embodiment of the present invention;
fig. 2 is a schematic flow chart of a message sending device sending a message according to an embodiment of the present invention;
fig. 3 is an exemplary diagram of a message transmitted by a message transmitting apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a message sending device according to an embodiment of the present invention;
FIG. 5 is a second schematic diagram of a message sending device according to an embodiment of the present invention;
FIG. 6 is a third schematic diagram of a message sending device according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In a messaging event, the recipient may fail to receive the message for some reason, resulting in a timeout or failure of messaging, i.e., abnormal messaging. When the message transmission is abnormal, the message sender usually tries to send a request to the receiver again, and if the receiver cannot recover to be normal in a short period, the message sender repeatedly sends the request to the receiver, so that more unnecessary requests are generated, and unnecessary resource consumption is caused.
For example, in software system development, system callbacks, merchant notifications, asynchronous reconciliation, etc. are often encountered in business scenarios involving messaging events, which often require access to a target address URL (Uniform Resource Locator, uniform resource locator, i.e., network address) via a public network, which can be understood as a third party interface. Because the public network environment is affected by various factors, such as operator maintenance, third party system upgrades, third party system downtime, etc., service timeouts are becoming very common. Particularly, under the business scenario of asynchronous notification of merchants facing the B end (enterprises), when a large number of B end systems access the URL through the public network, if the URL is abnormal, a large number of messages cannot be normally sent. When a large number of B-side systems repeatedly send requests to the URL, and the URL has not been recovered, more unnecessary requests are generated, which causes unnecessary resource consumption and causes the number of transactions processed per second by the TPS (Transaction processing systems, transaction processing system) to decrease linearly.
In order to avoid more unnecessary requests after serious hysteresis occurs in the system, abnormal URLs can be manually added to the blacklist, and the abnormal URLs need to be manually removed from the blacklist after the URLs are recovered to be normal, however, the method has serious hysteresis and passivity, and the whole process is complicated.
In order to solve the above problem, an embodiment of the present invention provides a method for processing abnormal message transmission, which can be applied to a message sending device, as shown in fig. 1, and includes the following steps:
step 101: a first message is sent to a destination address.
The destination address may be a network address, which may be understood as a network address corresponding to the message receiving device. The first message may be a message to be sent, which is received by the message sending device from an upstream system or other service systems, and the first message may be understood as a new message; the first message may also be a message that has been sent to the destination address before step 101 but has not been successfully sent, which may be understood as a message that currently needs to be retransmitted.
Step 102: and if the first message is failed to be sent, adding the target address into a blacklist.
In the embodiment of the invention, after the target address is added into the blacklist, even if a message needs to be sent to the target address, the message sending device does not send the message to the target address.
Step 103: and setting a first storage time of the target address in the blacklist.
The first depositing time refers to the time when the target address exists in the blacklist, and here, the depositing time of the target address in the blacklist may be counted by setting a timer. Within the first deposit time, i.e. until the first deposit time is reached, the destination address remains on the blacklist and the message sending means stops sending messages to the destination address. The first storage time can be preset time, and the numerical value of the first storage time can be flexibly set by combining various factors such as experience, abnormal reasons, message types and the like.
Optionally, the target address and the storage time of the target address in the blacklist are stored as a first key value pair in a first mapping relation table.
The first mapping table may be represented by a TimeOutMap, where a first key value pair, for example < URL, expirime >, may be stored, where URL represents the target address, and expirime represents the time of storing the target address in the blacklist.
The first mapping table may be maintained by redis, and the storing time of the target address in the blacklist may be set by EXPIRE issue of redis, and when the storing time is reached, the URL may be cleared from the TimeOutMap, where the URL will not exist.
Step 104: after the first deposit time is reached, the target address is removed from the blacklist.
In the embodiment of the invention, before the first storage time is reached, the message sending device stops sending the message to the target address; after the first deposit time is reached, the destination address is removed from the blacklist, and the message sending means may send a message to the destination address when there is a message to be sent to the destination address. In this step, the target address is removed from the blacklist, which can be understood as moving the target address from the blacklist to the whitelist, thereby implementing a full-automatic blacklist mechanism of the target address. By removing the target address from the blacklist, an opportunity for retry may be provided, i.e., an opportunity for retrying sending of the message to the target address. It can be seen that by removing the target address from the blacklist, it is possible to retry the messaging.
As shown in fig. 2, the message sending device in the embodiment of the present invention may mainly include four modules: the system comprises a business message grabbing module, a timing task retry module, an intelligent interception module and a message sending module, wherein the business message grabbing module can be used for receiving messages needing to be notified to the downstream from a business system, the timing task retry module can be used for acquiring messages needing to be sent or retransmitted, more specifically, the timing task retry module is used for timing the storage time of a target address in a blacklist, when the timing reaches the storage time, the messages needing to be sent or retransmitted to the target address can be acquired, the intelligent interception module can be used for judging whether the messages need to be sent or not, and if the intelligent interception module judges that the messages need to be sent, the message sending module can be used for requesting a third party interface.
In the embodiment of the invention, under the condition of abnormal message sending, the target address can be automatically removed from the blacklist by setting the first storage time of the target address in the blacklist, so that possibility is provided for message sending retry; on the other hand, before the first storage time is reached, the message is stopped from being sent to the abnormal target address, so that unnecessary requests can be effectively reduced, unnecessary timeout waiting is reduced, the number of transactions processed per second by TPS is effectively increased, and resource waste caused by repeated sending of the unnecessary requests is avoided. In addition, the manual participation can be effectively reduced, and the problems of hysteresis and passivity existing in the manual participation are solved.
Optionally, if the first message fails to send, adding the target address to a blacklist includes:
if the first message is failed to be sent, the continuous failure times corresponding to the target address are obtained, wherein the continuous failure times corresponding to the target address are accumulated times of continuous failure of sending the message to the target address;
and if the continuous failure times corresponding to the target address are greater than or equal to a first preset value, adding the target address into a blacklist.
In order to better understand the number of consecutive failures corresponding to the target address, the following description will be given. Assume that three consecutive failures of sending a message to a target address have been accumulated in a previous period of time, the number of consecutive failures corresponding to the target address being 3. Currently, a message is sent to the target address again, if the message still fails to be sent, the number of continuous failures corresponding to the current target address is increased by 1, the number of continuous failures corresponding to the current target address is updated from 3 times to 4 times, and at this time, the message sending failure to the target address is continuously accumulated four times, and the number of continuous failures corresponding to the target address is 4 times. If the message is successfully sent, the number of consecutive failures corresponding to the current target address may be set to zero.
In the process of message transmission, besides the target address abnormality, some accidental factors may exist as factors causing message transmission failure due to network instability, network current limitation suddenly appears in message transmission, and the like. In view of this, in order to eliminate abnormal message transmission caused by accidental factors, the embodiment sets a first preset value, and adds the target address to the blacklist only when the number of consecutive failures corresponding to the target address reaches the first preset value.
By the embodiment, the processing mode of abnormal message sending is more reasonable.
Optionally, the target address and the number of consecutive failures corresponding to the target address are stored as a second key value pair in a second mapping relation table.
The second mapping table may be represented by a CountMap, where a second key value pair, for example, < URL, count > may be stored in the CountMap, where URL represents a target address and count represents the number of consecutive failures corresponding to the target address. Every time the number of times of failure of sending the message to the target address increases, the number of continuous failures corresponding to the target address increases by 1.
The second mapping table may be maintained with redis.
Optionally, after removing the target address from the blacklist, the method further includes:
sending a second message to the destination address;
if the second message is failed to be sent, the target address is added into the blacklist;
setting a second storage time of the target address in the blacklist, wherein the second storage time is longer than the first storage time.
The second message may be a message to be sent received by the message sending device from an upstream system or other service systems, where the second message may be understood as a new message; the second message may also be the first message sent to the destination address in step 101 but not successfully sent, which may be understood as the first message that needs to be retransmitted currently.
In this embodiment, when the second message transmission fails, the storage time of the destination address in the blacklist is prolonged, which corresponds to giving a longer recovery time to the destination address, and thus, the waiting time for the message transmission is prolonged, thereby enabling further reduction of unnecessary requests and further reduction of unnecessary timeout waiting.
Optionally, the second storage time is positively correlated with the number of consecutive failures corresponding to the target address.
In this embodiment, the correlation is established between the time of storing the target address in the blacklist and the number of consecutive failures corresponding to the target address, so that the setting of the time of storing the target address in the blacklist is more reasonable, and when the number of consecutive failures corresponding to the target address is larger, a longer recovery time is given to the target address.
Further, if the target address and the storage time of the target address in the blacklist are stored as a first key value pair in the first mapping table, for example, the first mapping table may be represented by a TimeOutMap, the first key value pair may be stored in the TimeOutMap, for example, < URL, n, expireTime >, where URL represents the target address, n represents the number of consecutive failures corresponding to the target address, and expireTime represents the storage time of the target address in the blacklist.
Optionally, the relationship between the second storage time and the number of consecutive failures corresponding to the target address is any one of the following:
the second storage time is in direct proportion to the continuous failure times corresponding to the target address;
the second storage time is in direct proportion to the Nth power of the continuous failure times corresponding to the target address, and N is larger than 1;
the second storage time is in direct proportion to the X power of Y, Y is larger than 1, and the value of X is the continuous failure times corresponding to the target address.
For example, when the first message fails to be sent, the TimeOutMap is triggered to store the URL, and the corresponding storage time is set, for example, 1s, and when the nth message fails to be sent, the storage time corresponding to the URL in the TimeOutMap may be 2 n Second, at 2 n No message will be sent to this URL any more in seconds, at 2 n After seconds, an attempt is made to send a message to the URL again, and if the sending still fails, the storage time corresponding to the URL in the TimeOutMap is 2 n+1 Second.
It should be noted that, in the scheme that the target address is added to the blacklist only when the number of consecutive failures corresponding to the target address is greater than or equal to the first preset value, the second storage time is positively correlated with the number of consecutive failures corresponding to the target address, which can be understood as that the second storage time is positively correlated with (the number of consecutive failures—the first preset value). That is, the second storage time may be proportional to (number of consecutive failures-first preset value), may be proportional to the nth power of (number of consecutive failures-first preset value), where N is greater than 1, and may be proportional to the nth power of Y (number of consecutive failures-first preset value).
Optionally, after sending the second message to the destination address, the method further includes:
and if the second message is successfully sent, setting the continuous failure times corresponding to the target address to be zero.
In this embodiment, once the message is successfully sent to the target address, the number of consecutive failures corresponding to the target address may be set to zero.
Further, if the target address and the number of consecutive failures corresponding to the target address are stored in the second mapping table as the second key value pair and the second message is successfully sent, the target address is deleted from the second mapping table. For example, the second mapping table may be represented by CountMap, and then, when the second message is sent successfully, the corresponding URL may be deleted from CountMap.
Optionally, setting a second storage time of the target address in the blacklist includes:
if the second message is failed to be sent, the continuous failure times corresponding to the target address are obtained;
and if the continuous failure times corresponding to the target address are smaller than or equal to a second preset value, setting a second storage time of the target address in the blacklist.
In order to avoid unlimited retries, in this embodiment, a maximum number of retries, i.e. a second preset value, may be set. And setting the storage time of the target address in the blacklist only when the continuous failure times corresponding to the target address are smaller than or equal to a second preset value. When the number of continuous failures corresponding to the target address exceeds the second preset value, the storage time of the target address in the blacklist is not set any more, and the target address is only triggered to be removed from the blacklist in other ways (e.g. manually), otherwise, the target address is stored in the blacklist all the time for specific illustration:
the message sending device uses redis to maintain two maps, one of which is a CountMap < URL, count >, wherein count is the continuous failure times of the URL, each continuous failure can be increased automatically, when one success occurs, the continuous failure times of the URL are cleared, and the URL does not exist in the Map. Secondly, timeOutMap < URL, n, expieTime >, where n is the number of consecutive failures of the URL, expieTime is the time the URL is deposited in the blacklist, and when the deposited time is reached, the URL will not be present in the Map. Here, n is to calculate the next retry time, so that the time interval for retransmission of the message assumes a stepwise increment, avoiding unnecessary request transmission. In addition, the message sending device also sets a first preset value M, wherein M represents the continuous failure times of the URL, and the URL is automatically added into the blacklist by triggering timeout of the continuous M requests.
When executing, as shown in fig. 3, the message sending device receives a message from the upstream service system, or the timing task obtains a message meeting retransmission, then, the message sending device obtains the continuous failure times count corresponding to the current request URL from the CountMap, judges whether the count is greater than or equal to the M value, if the count is greater than or equal to the M value, adds the URL to the blacklist, at the same time, the continuous failure times n of the corresponding URL in the TimeOutMap are increased, the storage time of the URL in the blacklist is set to be the power of n of 2, the request is not sent to the URL in the storage time, and after the storage time is reached, the request can be sent to the URL again. If the count value is smaller than the M value, the URL is continuously requested, whether the URL is overtime is judged, the corresponding count++ in the countMap is judged if the URL is overtime, and if the count is larger than or equal to the M value, the operation is executed.
In summary, under the condition of abnormal message transmission, by setting the storage time of the target address in the blacklist, not only can the message transmission retry be automatically realized, but also unnecessary requests are reduced to the greatest extent, and unnecessary timeout waiting is reduced. The full-automatic black-and-white list mechanism enables the original lagged black list strategy to be more effective and timely, reduces manual participation, and effectively solves the problem of black list lagging. Therefore, the TPS of the notification system can be effectively improved, and the problem that the performance of the whole notification system is affected due to overtime of an individual third party interface caused by various network conditions is avoided.
As shown in fig. 4, an embodiment of the present invention provides a message sending apparatus 200, including:
a first sending module 201, configured to send a first message to a target address;
a first processing module 202, configured to add the target address to a blacklist if the first message fails to be sent;
a first setting module 203, configured to set a first storage time of the target address in the blacklist;
a second processing module 204 is configured to remove the target address from the blacklist after the first deposit time is reached.
Optionally, the first processing module 202 is specifically configured to:
if the first message is failed to be sent, the continuous failure times corresponding to the target address are obtained, wherein the continuous failure times corresponding to the target address are accumulated times of continuous failure of sending the message to the target address;
and if the continuous failure times corresponding to the target address are greater than or equal to a first preset value, adding the target address into a blacklist.
Optionally, as shown in fig. 5, the message sending apparatus 200 further includes:
a second sending module 205, configured to send a second message to the destination address;
a third processing module 206, configured to add the target address to the blacklist if the second message fails to be sent;
a second setting module 207, configured to set a second storage time of the target address in the blacklist, where the second storage time is greater than the first storage time.
Optionally, as shown in fig. 6, the message sending apparatus 200 further includes:
and a third setting module 208, configured to set the number of consecutive failures corresponding to the target address to zero if the second message is sent successfully.
Optionally, the second storage time is positively correlated with the number of consecutive failures corresponding to the target address.
Optionally, the relationship between the second storage time and the number of consecutive failures corresponding to the target address is any one of the following:
the second storage time is in direct proportion to the continuous failure times corresponding to the target address;
the second storage time is in direct proportion to the Nth power of the continuous failure times corresponding to the target address, and N is larger than 1;
the second storage time is in direct proportion to the X power of Y, Y is larger than 1, and the value of X is the continuous failure times corresponding to the target address.
Optionally, the second setting module 207 includes:
the acquisition sub-module is used for acquiring the continuous failure times corresponding to the target address if the second message is failed to be sent;
and the setting submodule is used for setting a second storage time of the target address in the blacklist if the continuous failure times corresponding to the target address are smaller than or equal to a second preset value.
Optionally, the target address and the storage time of the target address in the blacklist are stored as a first key value pair in a first mapping relation table.
Optionally, the target address and the number of consecutive failures corresponding to the target address are stored as a second key value pair in a second mapping relation table.
It should be noted that any implementation of the method for processing abnormal message sending embodiments may be implemented by the message sending device 200 in the embodiment of the present invention, and achieve the same beneficial effects, so that repetition is avoided and no further description is given here.
Fig. 7 is a block diagram of an electronic device according to an embodiment of the present invention. As shown in fig. 7, the electronic device 500 includes a memory 501, a processor 502, and a computer program stored on the memory 501 and executable on the processor 502; when the processor 502 executes the computer program, the following steps are implemented:
sending a first message to a target address;
if the first message is failed to be sent, adding the target address into a blacklist;
setting a first storage time of the target address in the blacklist;
after the first deposit time is reached, the target address is removed from the blacklist.
In fig. 7, a bus architecture may comprise any number of interconnecting buses and bridges, with one or more processors, represented in particular by processor 502, and various circuits of memory, represented in memory 501, linked together. The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, power management circuits, etc., which are well known in the art and, therefore, will not be described further herein. The bus interface provides an interface. The processor 502 is responsible for managing the bus architecture and general processing, and the memory 501 may store data used by the processor 502 in executing instructions. In an embodiment of the present invention, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted mobile terminal, a wearable device, and the like.
Optionally, when the processor 502 executes the computer program, the following steps are implemented:
if the first message is failed to be sent, the continuous failure times corresponding to the target address are obtained, wherein the continuous failure times corresponding to the target address are accumulated times of continuous failure of sending the message to the target address;
and if the continuous failure times corresponding to the target address are greater than or equal to a first preset value, adding the target address into a blacklist.
Optionally, when the processor 502 executes the computer program, the following steps are also implemented:
sending a second message to the destination address;
if the second message is failed to be sent, the target address is added into the blacklist;
setting a second storage time of the target address in the blacklist, wherein the second storage time is longer than the first storage time.
Optionally, when the processor 502 executes the computer program, the following steps are also implemented:
and if the second message is successfully sent, setting the continuous failure times corresponding to the target address to be zero.
Optionally, the second storage time is positively correlated with the number of consecutive failures corresponding to the target address.
Optionally, the relationship between the second storage time and the number of consecutive failures corresponding to the target address is any one of the following:
the second storage time is in direct proportion to the continuous failure times corresponding to the target address;
the second storage time is in direct proportion to the Nth power of the continuous failure times corresponding to the target address, and N is larger than 1;
the second storage time is in direct proportion to the X power of Y, Y is larger than 1, and the value of X is the continuous failure times corresponding to the target address.
Optionally, when the processor 502 executes the computer program, the following steps are implemented:
if the second message is failed to be sent, the continuous failure times corresponding to the target address are obtained;
and if the continuous failure times corresponding to the target address are smaller than or equal to a second preset value, setting a second storage time of the target address in the blacklist.
Optionally, the target address and the storage time of the target address in the blacklist are stored as a first key value pair in a first mapping relation table.
Optionally, the target address and the number of consecutive failures corresponding to the target address are stored as a second key value pair in a second mapping relation table.
It should be noted that any implementation of the method for processing abnormal message sending embodiment may be implemented by the electronic device 500 in the embodiment of the present invention, and achieve the same beneficial effects, so that repetition is avoided and no further description is given here.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the processes of the network test method embodiment of the whole vehicle rack, and can achieve the same technical effects, and in order to avoid repetition, the description is omitted here. Wherein the computer readable storage medium is selected from Read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk.
In the several embodiments provided in the present application, it should be understood that the disclosed methods and apparatus may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other forms.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may be physically included separately, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in hardware plus software functional units.
The integrated units implemented in the form of software functional units described above may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform part of the steps of the transceiving 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 (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (12)

1. A method for handling message transmission anomalies, the method comprising:
sending a first message to a target address;
if the first message is failed to be sent, adding the target address into a blacklist;
setting a first storage time of the target address in the blacklist;
removing the target address from the blacklist after the first deposit time is reached;
sending a second message to the destination address; if the second message is failed to be sent, the target address is added into the blacklist; setting a second storage time of the target address in the blacklist, wherein the second storage time is longer than the first storage time;
the relationship between the second storage time and the continuous failure times corresponding to the target address is any one of the following:
the second storage time is in direct proportion to the Nth power of the continuous failure times corresponding to the target address, and N is larger than 1;
the second storage time is in direct proportion to the X power of Y, Y is greater than 1, and the value of X is the continuous failure times corresponding to the target address;
maintaining two maps by redis, wherein a second mapping relation table CountMap < URL, count > stores a second key value pair in the CountMap, count is the continuous failure times of the URL, each time of continuous failure can be increased automatically, when success occurs once, the continuous failure times of the URL are cleared, and the URL does not exist in the CountMap;
the first mapping relation table TimeOutMap < URL, n, expireTime >, wherein a first key value pair is stored in TimeOutMap, n is the continuous failure times of the URL, expireTime is the storage time of the URL in a blacklist, when the first message is failed to be sent, the TimeOutMap is triggered to store the URL, the corresponding storage time is set, and when the storage time is reached, the URL does not exist in the TimeOutMap.
2. The method of claim 1, wherein if the first message transmission fails, adding the target address to a blacklist comprises:
if the first message is failed to be sent, the continuous failure times corresponding to the target address are obtained, wherein the continuous failure times corresponding to the target address are accumulated times of continuous failure of sending the message to the target address;
and if the continuous failure times corresponding to the target address are greater than or equal to a first preset value, adding the target address into a blacklist.
3. The method of claim 1, wherein after sending the second message to the destination address, the method further comprises:
and if the second message is successfully sent, setting the continuous failure times corresponding to the target address to be zero.
4. The method of claim 1, wherein the second deposit time is positively correlated with a number of consecutive failures corresponding to the target address.
5. The method of claim 1, wherein setting a second deposit time of the target address in the blacklist comprises:
if the second message is failed to be sent, the continuous failure times corresponding to the target address are obtained;
and if the continuous failure times corresponding to the target address are smaller than or equal to a second preset value, setting a second storage time of the target address in the blacklist.
6. The method of claim 1, wherein the target address and a time of deposit of the target address in the blacklist are stored as a first key-value pair in a first mapping table.
7. The method according to any one of claims 2, 3 to 5, wherein the target address and the number of consecutive failures corresponding to the target address are stored as a second key-value pair in a second mapping table.
8. A message transmission apparatus, comprising:
the first sending module is used for sending a first message to the target address;
the first processing module is used for adding the target address into a blacklist if the first message is failed to be sent;
the first setting module is used for setting a first storage time of the target address in the blacklist;
a second processing module, configured to remove the target address from the blacklist after the first storage time is reached;
the second sending module is used for sending a second message to the target address;
a third processing module, configured to add the target address to the blacklist if the second message fails to be sent;
the second setting module is used for setting a second storage time of the target address in the blacklist, wherein the second storage time is longer than the first storage time;
the relationship between the second storage time and the continuous failure times corresponding to the target address is any one of the following:
the second storage time is in direct proportion to the Nth power of the continuous failure times corresponding to the target address, and N is larger than 1;
the second storage time is in direct proportion to the X power of Y, Y is greater than 1, and the value of X is the continuous failure times corresponding to the target address;
maintaining two maps by redis, wherein a second mapping relation table CountMap < URL, count > stores a second key value pair in the CountMap, count is the continuous failure times of the URL, each time of continuous failure can be increased automatically, when success occurs once, the continuous failure times of the URL are cleared, and the URL does not exist in the Map;
the first mapping relation table TimeOutMap < URL, n, expireTime >, wherein a first key value pair is stored in TimeOutMap, n is the continuous failure times of the URL, expireTime is the storage time of the URL in a blacklist, when the first message is failed to be sent, the TimeOutMap is triggered to store the URL, the corresponding storage time is set, and when the storage time is reached, the URL does not exist in the Map.
9. The apparatus of claim 8, wherein the first processing module comprises:
the acquisition sub-module is used for acquiring the continuous failure times corresponding to the target address if the first message is failed to be sent, wherein the continuous failure times corresponding to the target address are accumulated times of continuous failure of sending the message to the target address;
and the processing sub-module is used for adding the target address into a blacklist if the continuous failure times corresponding to the target address are greater than or equal to a first preset value.
10. The apparatus as recited in claim 8, further comprising:
and the third setting module is used for setting the continuous failure times corresponding to the target address to be zero if the second message is successfully sent.
11. An electronic device, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, which when executed by the processor performs the steps in the method of handling a messaging anomaly as claimed in any one of claims 1 to 7.
12. A computer-readable storage medium having stored thereon a computer program, characterized by: the computer program, when executed by a processor, implements a method of handling a messaging exception as claimed in any one of claims 1 to 7.
CN201911046088.XA 2019-10-30 2019-10-30 Message sending exception processing method, message sending device and electronic equipment Active CN112751743B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911046088.XA CN112751743B (en) 2019-10-30 2019-10-30 Message sending exception processing method, message sending device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911046088.XA CN112751743B (en) 2019-10-30 2019-10-30 Message sending exception processing method, message sending device and electronic equipment

Publications (2)

Publication Number Publication Date
CN112751743A CN112751743A (en) 2021-05-04
CN112751743B true CN112751743B (en) 2023-04-28

Family

ID=75640636

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911046088.XA Active CN112751743B (en) 2019-10-30 2019-10-30 Message sending exception processing method, message sending device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112751743B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11368422B1 (en) * 2021-03-11 2022-06-21 Shopify Inc. Systems and methods for controlling electronic message transmissions
CN114265693A (en) * 2021-12-23 2022-04-01 天翼物联科技有限公司 Data information pushing method, device, equipment and medium based on Internet of things platform

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101771686A (en) * 2009-12-31 2010-07-07 卓望数码技术(深圳)有限公司 Communication method and network adapter
CN105897549A (en) * 2015-12-14 2016-08-24 乐视云计算有限公司 Message sending and receiving methods and message sending and receiving devices
CN107908494A (en) * 2017-11-10 2018-04-13 泰康保险集团股份有限公司 Processing method, device, electronic equipment and the storage medium of anomalous event

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100596049C (en) * 2006-03-30 2010-03-24 阿里巴巴集团控股有限公司 Message repeating method and system
US9148432B2 (en) * 2010-10-12 2015-09-29 Microsoft Technology Licensing, Llc Range weighted internet protocol address blacklist

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101771686A (en) * 2009-12-31 2010-07-07 卓望数码技术(深圳)有限公司 Communication method and network adapter
CN105897549A (en) * 2015-12-14 2016-08-24 乐视云计算有限公司 Message sending and receiving methods and message sending and receiving devices
CN107908494A (en) * 2017-11-10 2018-04-13 泰康保险集团股份有限公司 Processing method, device, electronic equipment and the storage medium of anomalous event

Also Published As

Publication number Publication date
CN112751743A (en) 2021-05-04

Similar Documents

Publication Publication Date Title
CN111371892A (en) High-concurrency distributed message pushing system and method
CN112751743B (en) Message sending exception processing method, message sending device and electronic equipment
CN109992433B (en) Distributed tgt communication optimization method, device, equipment and storage medium
CN111404643A (en) Data receiving and transmitting processing method based on message queue
CN112422684A (en) Target message processing method and device, storage medium and electronic device
CN114500552B (en) Cloud edge message reliability transmission method and device under edge computing scene
CN111124717A (en) Message delivery method, system and computer storage medium
CN111556125A (en) Access request distribution method, load balancing equipment and electronic equipment
CN111200653A (en) Multi-platform communication method, multi-platform communication device and intermediate server
CN108737460B (en) Connection processing method and client
CN111049730A (en) RabbitMQ message retransmission and power of consumption idempotent solution method
CN104734886A (en) Business server management method, device and system
CN112437146B (en) Equipment state synchronization method, device and system
CN111049938B (en) Message notification method and device, electronic equipment and readable storage medium
CN114615284A (en) Method and device for notifying and receiving messages in cluster
CN110971535B (en) Communication congestion control method, device, equipment and storage medium
CN111309744A (en) Object processing method and device, electronic equipment and computer readable storage medium
CN103368754A (en) Service failure detection method, apparatus, system and device
CN109660613B (en) File transmission method and system
CN116347467B (en) Method and system for managing user data by UDR in 5G network
CN117762652A (en) Distributed transaction processing method and device based on message middleware
CN116896592A (en) Service message processing method, device, equipment and medium
CN108184141B (en) Processing method of monitoring video task and server
CN111371573B (en) Message interaction method and device
CN112199212A (en) Asynchronous notification method and system

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