CN113766437B - Short message sending method and device - Google Patents

Short message sending method and device Download PDF

Info

Publication number
CN113766437B
CN113766437B CN202010900331.6A CN202010900331A CN113766437B CN 113766437 B CN113766437 B CN 113766437B CN 202010900331 A CN202010900331 A CN 202010900331A CN 113766437 B CN113766437 B CN 113766437B
Authority
CN
China
Prior art keywords
short message
processed
delivery state
sending
delivery
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
CN202010900331.6A
Other languages
Chinese (zh)
Other versions
CN113766437A (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 Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Wodong Tianjun Information Technology Co Ltd
Priority to CN202010900331.6A priority Critical patent/CN113766437B/en
Publication of CN113766437A publication Critical patent/CN113766437A/en
Application granted granted Critical
Publication of CN113766437B publication Critical patent/CN113766437B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/12Messaging; Mailboxes; Announcements
    • H04W4/14Short messaging services, e.g. short message services [SMS] or unstructured supplementary service data [USSD]

Abstract

The invention discloses a short message sending method and device, and relates to the technical field of computers. One embodiment of the method comprises: receiving information of short messages to be processed sent by a service system; wherein the information includes: telephone number, short message content and identification content; determining whether the sending sequence of the short message to be processed is the first order according to the identification content, and if not, determining the delivery state of the short message sent before the short message to be processed according to the identification content; determining whether to send the telephone number and the short message content to a short message service platform to which the telephone number belongs according to a delivery state of sending the short message before the short message to be processed; and updating the delivery state of the short message to be processed according to the determination result. The implementation mode can ensure that the delivery sequence of the short messages is consistent with the sending sequence.

Description

Short message sending method and device
Technical Field
The invention relates to the technical field of computers, in particular to a short message sending method and device.
Background
The short message is widely applied to scenes such as notification, marketing and the like as one of modes for triggering the user. In some application scenarios, there is an association relationship between different short messages, and the short messages need to be sent to the user in a certain order.
In the prior art, short message service platforms are called in sequence according to the sending sequence of short messages, and the short messages are sent to users in sequence.
Because the short message service platform processes a large number of short messages, the prior art can ensure that the short messages are sent in sequence according to the sending sequence, but the short messages with the sending sequence arranged in front are difficult to ensure to be sent to the user before the short messages arranged in back.
Disclosure of Invention
In view of this, embodiments of the present invention provide a short message sending method and apparatus, which can ensure that a sending order of short messages is consistent with a sending order.
In a first aspect, an embodiment of the present invention provides a short message sending method, including:
receiving information of short messages to be processed sent by a service system; wherein the information includes: telephone number, short message content and identification content;
determining whether the sending sequence of the short message to be processed is the first order according to the identification content, and if not, determining the delivery state of the short message sent before the short message to be processed according to the identification content;
determining whether to send the telephone number and the short message content to a short message service platform to which the telephone number belongs according to a delivery state of sending the short message before the short message to be processed;
and updating the delivery state of the short message to be processed according to the determination result.
Preferably, the first and second electrodes are formed of a metal,
the identification content comprises: a service identifier to be processed and a sequence number to be processed;
the determining the delivery state of the short message sent before the short message to be processed according to the identification content comprises the following steps:
acquiring a delivery state which has the service identifier to be processed and sends a short message one bit before the short message to be processed from a ZooKeeper according to the service identifier to be processed and the sequence number to be processed; and the first node of the ZooKeeper stores the corresponding relation between the combination of the service identifier and the sequence number and the delivery state of the short message.
Preferably, the first and second electrodes are formed of a metal,
the updating the delivery state of the short message to be processed according to the determination result comprises the following steps:
if the determined result is that the telephone number and the short message content are sent to the short message service platform to which the telephone number belongs, receiving a receipt code of the short message to be processed sent by the short message service platform;
correspondingly storing the receipt code of the short message to be processed, the combination of the service identifier to be processed and the serial number to be processed in a second node of the ZooKeeper;
and updating the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node into the delivery state.
Preferably, the first and second liquid crystal display panels are,
after the updating the delivery status of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node to be in delivery, the method further includes:
receiving the receipt code and the delivery state of the short message to be processed sent by the short message service platform;
determining the combination of the service identification to be processed and the sequence number to be processed corresponding to the receipt code of the short message to be processed according to the corresponding relation between the receipt code of the short message stored in the second node and the combination of the service identification and the sequence number;
determining the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed according to the corresponding relation between the combination of the service identifier and the sequence number stored in the first node and the delivery state of the short message;
and updating the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node from the delivery state to the delivery success or the delivery failure.
Preferably, the first and second electrodes are formed of a metal,
before determining whether the sending sequence of the short message to be processed is the first order according to the identification content, the method further includes:
correspondingly storing the combination of the service identifier to be processed and the sequence number to be processed and the delivery state of the short message to be processed into the first node; wherein, the delivery state of the short message to be processed is to be sent;
the determining whether to send the phone number and the short message content to the short message service platform to which the phone number belongs according to the delivery state of sending the short message before the short message to be processed includes:
if the delivery state of the short message to be processed which is sent one bit before the short message to be processed is to be sent, adding the short message to be processed into a waiting queue; and asynchronously executing the sending state of the short message sent before the short message to be processed according to the identification content aiming at the short message in the waiting queue.
Preferably, the first and second electrodes are formed of a metal,
the determining whether to send the phone number and the short message content to the short message service platform to which the phone number belongs according to the delivery state of sending the short message before the short message to be processed includes:
and if the delivery state of the short message sent one bit before the short message to be processed is successful, determining to send the telephone number and the short message content to a short message service platform to which the telephone number belongs.
Preferably, the first and second electrodes are formed of a metal,
the information further includes: a dependency identification;
the determining whether to send the phone number and the short message content to the short message service platform to which the phone number belongs according to the delivery state of sending the short message before the short message to be processed includes:
if the delivery state of the short message to be processed before the short message to be processed is delivery failure or sending cancellation, determining whether the short message to be processed depends on the short message with the sending sequence arranged at the front position according to the dependence identifier; and when the short message to be processed does not depend on the short message with the sending sequence arranged at the front position, determining to send the telephone number and the short message content to the short message service platform to which the telephone number belongs.
Preferably, the first and second electrodes are formed of a metal,
the information further includes: a dependency identification;
the determining whether to send the phone number and the short message content to the short message service platform to which the phone number belongs according to the delivery state of sending the short message before the short message to be processed includes:
if the delivery state of the short message to be processed before the short message to be processed is delivery failure or sending cancellation, determining whether the short message to be processed depends on the short message with the sending sequence arranged at the front position according to the dependence identifier; when the short message to be processed depends on the short message with the sending sequence arranged at the front position, determining not to send the telephone number and the short message content to the short message service platform to which the telephone number belongs;
the updating the delivery state of the short message to be processed according to the determined result comprises the following steps:
and updating the delivery state of the short message to be processed into the delivery cancellation state.
Preferably, the first and second liquid crystal display panels are,
the information further includes: a timeout wait time;
the method further comprises the following steps:
determining the initial sending time of the short message to be processed;
the determining whether to send the phone number and the short message content to the short message service platform to which the phone number belongs according to the delivery state of sending the short message before the short message to be processed includes:
if the delivery state of the short message to be processed which is sent one bit before the short message to be processed is in sending, adding the short message to be processed into a waiting queue; and asynchronously determining whether the interval between the time to be processed and the initial sending time exceeds the overtime waiting time, if so, determining to send the telephone number and the short message content to a short message service platform to which the telephone number belongs, and otherwise, executing the short message sending state according to the identification content and determining to send the short message before the short message to be processed.
In a second aspect, an embodiment of the present invention provides a short message sending apparatus, including:
the receiving module is configured to receive the information of the short message to be processed sent by the service system; wherein the information includes: telephone number, short message content and identification content;
the determining module is configured to determine whether the sending sequence of the short message to be processed is the first order according to the identification content, and if not, determine the sending state of the short message sent before the short message to be processed according to the identification content; determining whether to send the telephone number and the short message content to a short message service platform to which the telephone number belongs according to a delivery state of sending the short message before the short message to be processed;
and the updating module is configured to update the delivery state of the short message to be processed according to the determination result.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the embodiments described above.
In a fourth aspect, an embodiment of the present invention provides a computer-readable medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method of any one of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: and according to the recorded delivery state of the short messages, ensuring that the short messages with the delivery sequence before the short messages to be processed are delivered before the short messages to be processed, so that the delivery sequence of the short messages is consistent with the delivery sequence.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a flowchart of a method for sending a short message according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a short message sending apparatus according to an embodiment of the present invention;
FIG. 3 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 4 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
As shown in fig. 1, an embodiment of the present invention provides a short message sending method, including:
step 101: receiving information of short messages to be processed sent by a service system; wherein, the information includes: telephone number, short message content and identification content.
The identification content can be used for identifying the group to which the short message to be processed belongs and the sending sequence of the short message to be processed in the group, and if only one group exists, the identification content is only used for identifying the sending sequence of the short message to be processed. The short messages in the same group have a requirement of sending in sequence, for example, the group a includes three short messages, the identification contents of the short messages are respectively A1, A2 and A3, wherein a is used for identifying the group a to which the short message belongs, and the numbers after the group are used for identifying the sequence of the short messages in the group, that is, the sending sequence of the short messages is respectively A1, A2 and A3. The telephone number can be a mobile phone number, a virtual number and the like.
The service system can send information of a plurality of short messages at the same time, and the embodiment of the invention takes only one short message as an example for explanation.
Step 102: and determining whether the sending sequence of the short message to be processed is the first order according to the identification content, if so, executing step 103, otherwise, executing step 104.
The sending sequence refers to the sending sequence of the short messages to be processed in the group to which the short messages belong.
Step 103: and sending the telephone number and the short message content to the short message service platform to which the telephone number belongs, and executing the step 106.
Step 104: and determining the delivery state of the short messages with the delivery sequence before the short messages to be processed according to the identification content.
Step 105: and determining whether to send the telephone number and the short message content to the short message service platform to which the telephone number belongs according to the delivery state of the short messages arranged before the short messages to be processed in the sending sequence, if so, executing step 103, and otherwise, executing step 106.
The short message service platforms of different telecom operators can be called through the telephone number, and the short message service platforms can send short messages to corresponding users through different channels.
Step 106: and updating the delivery state of the short message to be processed.
The embodiment of the invention ensures that the short messages with the sending sequence arranged before the short messages to be processed are sent before the short messages to be processed in the same group according to the recorded sending state of the short messages, so that the sending sequence of the short messages is consistent with the sending sequence.
In one embodiment of the invention, identifying content comprises: a service identifier to be processed and a sequence number to be processed;
according to the identification content, determining the delivery state of the short messages with the delivery sequence arranged before the short messages to be processed, which comprises the following steps:
acquiring a delivery state which has the service identifier to be processed and sends a short message one bit before the short message to be processed from the ZooKeeper according to the service identifier to be processed and the sequence number to be processed; the first node of the ZooKeeper stores the corresponding relation between the combination of the service identifier and the serial number and the delivery state of the short message.
The service identifier to be processed is used for identifying the group to which the short message to be processed belongs, and the sequence number to be processed is used for identifying the sending sequence of the short message to be processed in the group.
The ZooKeeper is an open source code distributed application program coordination service, is an important component of Hadoop and Hbase, and provides functions including: configuration maintenance, domain name service, distributed synchronization, group service, etc.
The embodiment of the invention can determine the group to which the short message to be processed belongs through the service identifier to be processed, determine the sending sequence of the short message to be processed in the group through the sequence number to be processed, and determine the delivery state of the short message to be processed through the combination of the service identifier to be processed and the sequence number to be processed.
The embodiment of the invention marks the delivery state of the short message through the ZooKeeper, and can ensure that the sending sequence of the short message is consistent with the delivery sequence in a distributed architecture.
In an embodiment of the present invention, updating the delivery status of the short message to be processed according to the determination result includes:
if the determined result is that the telephone number and the short message content are sent to the short message service platform to which the telephone number belongs, receiving a receipt code of the short message to be processed sent by the short message service platform;
correspondingly storing the receipt code of the short message to be processed, the combination of the service identifier to be processed and the sequence number to be processed in a second node of the ZooKeeper;
and updating the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node into the delivery state.
And if the delivery state of the short message to be processed corresponding to the combination of the service identifier to be processed and the sequence number to be processed, which is stored in the first node, is to be sent, updating the short message to be sent into the delivery state. And storing the corresponding relation between the receipt code of the short message to be processed and the combination of the service identifier and the sequence number to be processed, so as to update the delivery state of the short message to be processed according to the receipt code of the short message to be processed and the determination result.
In an embodiment of the present invention, after updating the delivery status of the short message corresponding to the combination of the pending service identifier and the pending sequence number in the first node to be in delivery, the method further includes:
receiving a receipt code and a delivery state of a short message to be processed sent by a short message service platform;
determining a combination of the service identification to be processed and the sequence number to be processed corresponding to the receipt code of the short message to be processed according to the corresponding relation between the receipt code of the short message stored in the second node and the combination of the service identification and the sequence number;
determining the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed according to the corresponding relation between the combination of the service identifier and the sequence number stored in the first node and the delivery state of the short message;
and updating the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node from the delivery state to the delivery success or the delivery failure.
The short message service platform feeds back the receipt code of the short message to be processed and the delivery state corresponding to the receipt code after sending the short message, and the delivery state in the first node can be timely and accurately updated through the receipt code of the short message to be processed, so that the consistency of the sending sequence and the delivery sequence of the short message to be processed is ensured.
In an embodiment of the present invention, before determining whether the sending sequence of the short message to be processed is the first bit according to the identification content, the method further includes:
correspondingly storing the combination of the service identifier to be processed and the sequence number to be processed and the delivery state of the short message to be processed into a first node; wherein, the delivery state of the short message to be processed is to be sent;
determining whether to send the telephone number and the short message content to a short message service platform to which the telephone number belongs according to the delivery state of the short messages arranged before the short messages to be processed in the sending sequence, wherein the method comprises the following steps:
if the delivery state of the short message to be sent one bit before the short message to be processed is to be sent, adding the short message to be processed into a waiting queue; and aiming at the short messages in the waiting queue, asynchronously executing to determine the delivery state of the short messages with the delivery sequence before the short messages to be processed according to the identification content.
In the embodiment of the present invention, in consideration of the possibility of receiving information of multiple short messages sent by the service system in a short time, in order to avoid inconsistency between the sending sequence and the delivery sequence of the short messages, the first node may further record the state of the short message to be sent. If the sending state of the short messages of which the sending sequence is arranged in front of the short messages to be processed is to be sent, the short messages to be processed are added into the waiting queue. And the short messages added into the waiting queue are re-executed in an asynchronous mode, and the delivery state of the short messages with the delivery sequence before the short messages to be processed is determined according to the identification content.
In one embodiment of the present invention, determining whether to send the phone number and the short message content to the short message service platform to which the phone number belongs according to the delivery status of the short message ranked before the short message to be processed in the sending sequence includes:
and if the delivery state of the short message sent one bit before the short message to be processed is successful, determining to send the telephone number and the short message content to the short message service platform to which the telephone number belongs.
If the short messages whose sending sequence is arranged in front of the short messages to be processed are all in a state of sending in a long time, in order not to influence the sending of the subsequent short messages, in one embodiment of the invention, the information further comprises: a timeout wait time; the method further comprises the following steps:
determining the initial sending time of the short message to be processed;
if the delivery state of the short message to be sent one bit before the short message to be processed is to be sent, adding the short message to be processed into a waiting queue; and asynchronously determining whether the interval between the time to be processed and the initial sending time exceeds the overtime waiting time, if so, sending the telephone number and the short message content to a short message service platform to which the telephone number belongs, and otherwise, determining the delivery state of the short messages arranged in front of the short messages to be processed in the sending sequence according to the identification content.
The initial sending time of the short message to be processed may be a time point before the first bit of the sending sequence of the short message to be processed is determined after the information of the short message to be processed sent by the service system is received. Of course, in an actual application scenario, the time of the delivery status of the short message with the delivery sequence before the short message to be processed may also be determined as the initial time of sending the short message to be processed.
In an embodiment of the present invention, the information further includes: a dependency identification;
determining whether to send the telephone number and the short message content to a short message service platform to which the telephone number belongs according to the delivery state of the short messages arranged before the short messages to be processed in the sending sequence, wherein the method comprises the following steps:
if the delivery state of sending the short message one bit before the short message to be processed is delivery failure or sending cancellation, determining whether the short message to be processed depends on the short message with the sending sequence arranged on the previous bit according to the dependence identifier; and when the short message to be processed does not depend on the short message with the sending sequence arranged at the previous position, determining to send the telephone number and the short message content to the short message service platform to which the telephone number belongs.
When the short message to be processed depends on the short message with the sending sequence arranged at the front position, determining not to send the telephone number and the short message content to the short message service platform to which the telephone number belongs;
according to the determination result, updating the delivery state of the short message to be processed, comprising the following steps:
and updating the delivery state of the short message to be processed into the cancellation of the delivery.
The dependency identification is used for representing whether the short message to be processed depends on the short message with the sending sequence arranged in front of the short message. For example, the dependency identifier includes M and N, where M is used to represent that the short message to be processed depends on the short message whose sending sequence is arranged one bit before the short message to be processed, that is, the short message to be processed can be sent only if the short message whose sending sequence is arranged one bit before the short message to be processed is successfully sent, and if the short message whose sending sequence is arranged one bit before the short message to be processed is failed to be sent or the sending of the short message to be processed is cancelled, the short message to be processed is cancelled; n is used for representing the short message to be processed which is not dependent on the short message with the sending sequence arranged in front of the short message to be processed, namely, the short message to be processed can be sent even if the short message with the sending sequence arranged in front of the short message to be processed fails to be sent or the sending is cancelled.
In one embodiment of the invention, similar to the delivery status being pending, if the delivery status of the short message to be sent is in process one bit before the short message to be processed, the short message to be processed is added to the waiting queue; and aiming at the short messages in the waiting queue, asynchronously executing to determine the delivery state of the short messages with the delivery sequence before the short messages to be processed according to the identification content. The sending efficiency of the short message is improved in an asynchronous execution mode.
In an embodiment of the present invention, the information further includes: a timeout wait time;
the method further comprises the following steps:
determining the initial sending time of the short message to be processed;
determining whether to send the telephone number and the short message content to a short message service platform to which the telephone number belongs according to the delivery state of the short messages arranged before the short messages to be processed in the sending sequence, wherein the method comprises the following steps:
if the delivery state of the short message sent one bit before the short message to be processed is in sending, adding the short message to be processed into a waiting queue; and asynchronously determining whether the interval between the time to be processed and the initial sending time exceeds the overtime waiting time, if so, determining to send the telephone number and the short message content to the short message service platform to which the telephone number belongs, and otherwise, determining the delivery state of the short messages of which the sending sequence is arranged before the short messages to be processed according to the identification content.
The embodiment of the invention can avoid the influence on the sending of the short message to be processed caused by the long-time sending state of the short message of the previous bit.
The embodiment of the invention provides a short message sending method, which comprises the following steps:
s1: receiving information of short messages to be processed sent by a service system; wherein, the information includes: telephone number, short message content, identification of service to be processed, serial number to be processed, dependency identification and timeout waiting time.
The information includes: the phone number "130" 0110", the short message content" your card is due today and please use it in time ", the pending service identifier" P ", the pending serial number" 2", the dependency identifier" 0", and the timeout wait time" 30s ".
The dependency identification comprises 0 and 1, wherein 0 represents the short message which is not dependent on the sending sequence and is arranged at the front bit, and 1 represents the short message which is dependent on the sending sequence and is arranged at the front bit.
S2: correspondingly storing the combination of the service identifier to be processed and the sequence number to be processed and the delivery state of the short message to be processed into a first node of the ZooKeeper; wherein, the delivery state of the short message to be processed is to be sent.
A combination of "P" and "2" and a delivery status "to be sent" corresponding to the combination are stored in the first node in the form of "/P/2=0". In an actual application scenario, different characters may be used to represent delivery status, for example, 0 represents sending, 1 represents waiting for return of delivery status during sending (for short, sending), 2 represents sending but delivery failure (for short, delivery failure), 3 represents sending and delivery success (for short, delivery success), 4 represents cancellation of sending, and the initial status of the short message is 0.
S3: and determining the initial sending time of the short message to be processed.
And determining the time to be processed as the initial sending time of the short message to be processed. For example, the initial sending time of the short message to be processed is 10.
S4: and determining whether the sending sequence of the short messages to be processed is the first order according to the identification content, if so, executing S9, otherwise, executing S5.
S5: acquiring a delivery state which has the service identifier to be processed and sends a short message one bit before the short message to be processed from a first node of the ZooKeeper according to the service identifier to be processed and the sequence number to be processed; wherein, the first node of the ZooKeeper stores the corresponding relation between the combination of the service identification and the serial number and the delivery state of the short message; if the delivery state of the short message sent one bit before the short message to be processed is to be sent or is being sent, S6 is executed, if the delivery state of the short message sent one bit before the short message to be processed is successful, S9 is executed, and if the delivery state of the short message sent one bit before the short message to be processed is failed or the short message is cancelled, S8 is executed.
A delivery status corresponding to a combination of "P" and "1" is acquired from the first node.
S6: and adding the short messages to be processed to the waiting queue.
S7: and (4) asynchronously determining whether the interval between the time to be processed and the initial sending time of the short message exceeds the overtime waiting time or not aiming at the short message in the waiting queue, if so, executing S9, otherwise, executing S4.
For example, the waiting time is 10. If the waiting time is 10.
S8: and determining whether the short message to be processed depends on the short message with the sending sequence arranged at the front position or not according to the dependency identifier, if so, executing S16, and otherwise, executing S9.
S9: and sending the telephone number and the short message content to the short message service platform to which the telephone number belongs.
S10: and receiving a receipt code of the short message to be processed sent by the short message service platform.
S11: and correspondingly storing the receipt code of the short message to be processed, the combination of the service identifier to be processed and the sequence number to be processed in a second node of the ZooKeeper.
S12: and receiving the receipt code and the delivery state of the short message to be processed sent by the short message service platform.
S13: and determining the combination of the service identification to be processed and the sequence number to be processed corresponding to the receipt code of the short message to be processed according to the corresponding relation between the receipt code of the short message stored in the second node and the combination of the service identification and the sequence number.
S14: and determining the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed according to the corresponding relation between the combination of the service identifier and the sequence number stored in the first node and the delivery state of the short message.
S15: and updating the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node from the delivery to successful delivery or failed delivery, and terminating the process to be processed.
S16: and updating the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node from the short message to be sent to the short message to be cancelled.
The embodiment of the invention maintains the corresponding relation between the combination of the service identification and the serial number and the delivery state of the short message and the corresponding relation between the receipt code of the short message and the combination of the service identification and the serial number through the ZooKeeper, is suitable for scenes with large short message delivery quantity, and can ensure that the sending sequence and the delivery sequence of the short message are consistent.
As shown in fig. 2, an embodiment of the present invention provides a short message sending apparatus, including:
a receiving module 201, configured to receive information of a short message to be processed sent by a service system; wherein, the information includes: telephone number, short message content and identification content.
The determining module 202 is configured to determine whether the sending sequence of the short messages to be processed is the first according to the identification content, and if not, determine the delivery state of the short messages with the sending sequence before the short messages to be processed according to the identification content; determining whether to send the telephone number and the short message content to a short message service platform to which the telephone number belongs according to the delivery state of the short messages arranged in front of the short messages to be processed in the sending sequence;
and the updating module 203 is configured to update the delivery state of the short message to be processed according to the determination result.
In one embodiment of the invention, identifying content comprises: a service identifier to be processed and a sequence number to be processed;
the determining module 202 is configured to obtain, according to the service identifier to be processed and the serial number to be processed, a delivery state that has the service identifier to be processed and sends the short message one bit before the short message to be processed from the ZooKeeper; the first node of the ZooKeeper stores the corresponding relation between the combination of the service identifier and the serial number and the delivery state of the short message.
In an embodiment of the present invention, if the phone number and the short message content are sent to the short message service platform to which the phone number belongs, the updating module 203 is configured to receive the receipt code of the short message to be processed sent by the short message service platform; correspondingly storing the receipt code of the short message to be processed, the combination of the service identifier to be processed and the sequence number to be processed in a second node of the ZooKeeper; and updating the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node into the delivery state.
In an embodiment of the present invention, the updating module 203 is configured to receive a receipt code and a delivery status of a short message to be processed sent by the short message service platform if the determination result is that the telephone number and the short message content are sent to the short message service platform to which the telephone number belongs; determining a combination of the service identification to be processed and the sequence number to be processed corresponding to the receipt code of the short message to be processed according to the corresponding relation between the receipt code of the short message stored in the second node and the combination of the service identification and the sequence number; determining the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed according to the corresponding relation between the combination of the service identifier and the sequence number stored in the first node and the delivery state of the short message; and updating the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node from the delivery state to the delivery success or the delivery failure.
In an embodiment of the present invention, the determining module 202 is configured to correspondingly store a combination of the service identifier to be processed and the sequence number to be processed and a delivery status of the short message to be processed in the first node; wherein, the delivery state of the short message to be processed is to be sent; if the delivery state of the short message to be sent one bit before the short message to be processed is to be sent, adding the short message to be processed into a waiting queue; and aiming at the short messages in the waiting queue, asynchronously executing to determine the delivery state of the short messages with the delivery sequence before the short messages to be processed according to the identification content.
In an embodiment of the present invention, the determining module 202 is configured to determine to send the phone number and the short message content to the short message service platform to which the phone number belongs if the delivery status of the short message sent one bit before the short message to be processed is successful.
In an embodiment of the present invention, the information further includes: a dependency identification;
the determining module 202 is configured to determine whether the short message to be processed depends on the short message with the sending sequence arranged at the previous position according to the dependency identifier if the sending state of the short message sent one position before the short message to be processed is the sending failure or the sending cancellation; and when the short message to be processed does not depend on the short message with the sending sequence arranged in the front, determining to send the telephone number and the short message content to the short message service platform to which the telephone number belongs.
In an embodiment of the present invention, the information further includes: a dependency identification;
the determining module 202 is configured to determine whether the short message to be processed depends on the short message with the sending sequence arranged at the previous position according to the dependency identifier if the sending state of the short message sent one position before the short message to be processed is the sending failure or the sending cancellation; when the short message to be processed depends on the short message with the sending sequence arranged at the front position, determining not to send the telephone number and the short message content to the short message service platform to which the telephone number belongs;
the updating module 203 is configured to update the delivery status of the short message to be processed to cancel the delivery.
In an embodiment of the present invention, the information further includes: a timeout wait time;
the determining module 202 is configured to determine initial sending time of the short message to be processed; if the delivery state of sending the short message one bit before the short message to be processed is in sending, adding the short message to be processed to the waiting queue; and asynchronously determining whether the interval between the time to be processed and the initial sending time exceeds the overtime waiting time, if so, determining to send the telephone number and the short message content to the short message service platform to which the telephone number belongs, and otherwise, determining the delivery state of the short messages of which the sending sequence is arranged before the short messages to be processed according to the identification content.
An embodiment of the present invention provides an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method of any of the embodiments described above.
Fig. 3 shows an exemplary system architecture 300 of a short message sending method or a short message sending apparatus to which an embodiment of the present invention may be applied.
As shown in fig. 3, the system architecture 300 may include terminal devices 301, 302, 303, a network 304, and a server 305. Network 304 is the medium used to provide communication links between terminal devices 301, 302, 303 and server 305. Network 304 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal device 301, 302, 303 to interact with the server 305 via the network 304 to receive or send messages or the like. The terminal devices 301, 302, 303 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 301, 302, 303 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 305 may be a server providing various services, such as a background management server (for example only) providing support for shopping-like websites browsed by users using the terminal devices 301, 302, 303. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the short message sending method provided by the embodiment of the present invention is generally executed by the server 305, and accordingly, the short message sending apparatus is generally disposed in the server 305.
It should be understood that the number of terminal devices, networks, and servers in fig. 3 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 4, a block diagram of a computer system 400 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 4, the computer system 400 includes a Central Processing Unit (CPU) 401 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the system 400 are also stored. The CPU 401, ROM 402, and RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. A drive 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 409, and/or installed from the removable medium 411. The computer program performs the above-described functions defined in the system of the present invention when executed by a Central Processing Unit (CPU) 401.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present invention, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a sending module, an obtaining module, a determining module, and a first processing module. The names of these modules do not form a limitation on the modules themselves in some cases, and for example, the sending module may also be described as a "module sending a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device.
The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: receiving information of short messages to be processed sent by a service system; wherein the information includes: telephone number, short message content and identification content;
determining whether the sending sequence of the short message to be processed is the first order according to the identification content, and if not, determining the delivery state of the short message sent before the short message to be processed according to the identification content;
determining whether to send the telephone number and the short message content to a short message service platform to which the telephone number belongs according to a delivery state of sending the short message before the short message to be processed;
and updating the delivery state of the short message to be processed according to the determination result.
According to the technical scheme of the embodiment of the invention, the short messages with the sending sequence before the short messages to be processed are ensured to be sent before the short messages to be processed according to the recorded sending state of the short messages, so that the sending sequence of the short messages is consistent with the sending sequence.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A short message sending method is characterized by comprising the following steps:
receiving information of short messages to be processed sent by a service system; wherein the information includes: telephone number, short message content and identification content; determining whether the sending sequence of the short message to be processed is the first order according to the identification content, and if not, determining the delivery state of the short message sent before the short message to be processed according to the identification content; the identification content comprises: a service identifier to be processed and a sequence number to be processed; the determining the delivery state of the short message sent before the short message to be processed according to the identification content comprises the following steps: acquiring a delivery state which has the service identifier to be processed and sends a short message one bit before the short message to be processed from a ZooKeeper according to the service identifier to be processed and the sequence number to be processed; wherein, the first node of the ZooKeeper stores the corresponding relation between the combination of the service identification and the serial number and the delivery state of the short message;
determining whether to send the telephone number and the short message content to a short message service platform to which the telephone number belongs according to a delivery state of sending the short message before the short message to be processed;
according to the determined result, updating the delivery state of the short message to be processed, comprising the following steps: if the determined result is that the telephone number and the short message content are sent to the short message service platform to which the telephone number belongs, receiving a receipt code of the short message to be processed sent by the short message service platform; correspondingly storing the receipt code of the short message to be processed, the combination of the service identifier to be processed and the sequence number to be processed in a second node of the ZooKeeper; updating the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node to be in delivery;
and under the condition of subsequently receiving the receipt code and the delivery state of the short message to be processed sent by the short message service platform, continuously updating the delivery state of the short message to be processed in the first node of the ZooKeeper according to the receipt code of the short message to be processed in the second node of the ZooKeeper.
2. The method of claim 1,
after the updating of the delivery status of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node into delivery, the method further includes:
receiving the receipt code and the delivery state of the short message to be processed sent by the short message service platform;
determining a combination of the service identification to be processed and the sequence number to be processed corresponding to the receipt code of the short message to be processed according to the corresponding relation between the receipt code of the short message stored in the second node and the combination of the service identification and the sequence number;
determining the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed according to the corresponding relation between the combination of the service identifier and the sequence number stored in the first node and the delivery state of the short message;
and updating the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node from the delivery state to the delivery success or the delivery failure.
3. The method of claim 1,
before determining whether the sending sequence of the short message to be processed is the first order according to the identification content, the method further includes:
correspondingly storing the combination of the service identifier to be processed and the sequence number to be processed and the delivery state of the short message to be processed into the first node; wherein, the delivery state of the short message to be processed is to be sent;
the determining whether to send the phone number and the short message content to the short message service platform to which the phone number belongs according to the delivery state of sending the short message before the short message to be processed includes:
if the delivery state of the short message to be processed which is sent one bit before the short message to be processed is to be sent, adding the short message to be processed into a waiting queue; and asynchronously executing the short message in the waiting queue according to the identification content, and determining the delivery state of the short message before the short message to be processed is sent.
4. The method of claim 1,
the determining whether to send the phone number and the short message content to the short message service platform to which the phone number belongs according to the delivery state of sending the short message before the short message to be processed includes:
and if the delivery state of the short message sent one bit before the short message to be processed is successful, determining to send the telephone number and the short message content to a short message service platform to which the telephone number belongs.
5. The method of claim 1,
the information further includes: a dependency identification;
the determining whether to send the phone number and the short message content to the short message service platform to which the phone number belongs according to the delivery state of sending the short message before the short message to be processed includes:
if the delivery state of the short message sent one bit before the short message to be processed is delivery failure or sending cancellation, determining whether the short message to be processed depends on the short message with the sending sequence arranged on the previous bit according to the dependence identifier; and when the short message to be processed does not depend on the short message with the sending sequence arranged at the previous position, determining to send the telephone number and the short message content to the short message service platform to which the telephone number belongs.
6. The method of claim 1,
the information further comprises: a dependency identification;
the determining whether to send the phone number and the short message content to the short message service platform to which the phone number belongs according to the delivery state of sending the short message before the short message to be processed includes:
if the delivery state of the short message sent one bit before the short message to be processed is delivery failure or sending cancellation, determining whether the short message to be processed depends on the short message with the sending sequence arranged on the previous bit according to the dependence identifier; when the short message to be processed depends on the short message with the sending sequence arranged at the front position, determining not to send the telephone number and the short message content to the short message service platform to which the telephone number belongs;
the updating the delivery state of the short message to be processed according to the determination result comprises the following steps:
and updating the delivery state of the short message to be processed into the cancellation of delivery.
7. The method of claim 1,
the information further includes: a timeout wait time;
the method further comprises the following steps:
determining the initial sending time of the short message to be processed;
the determining whether to send the phone number and the short message content to the short message service platform to which the phone number belongs according to the delivery state of sending the short message before the short message to be processed includes:
if the delivery state of the short message to be processed which is sent one bit before the short message to be processed is in sending, adding the short message to be processed into a waiting queue; and asynchronously determining whether the interval between the time to be processed and the initial sending time exceeds the overtime waiting time, if so, determining to send the telephone number and the short message content to a short message service platform to which the telephone number belongs, and otherwise, executing the short message sending state according to the identification content and determining to send the short message before the short message to be processed.
8. A short message transmission device, comprising:
the receiving module is configured to receive the information of the short message to be processed sent by the service system; wherein the information includes: telephone number, short message content and identification content; the identification content comprises: a service identifier to be processed and a sequence number to be processed; determining the delivery state of the short message before the short message to be processed according to the identification content, wherein the determination comprises the following steps: acquiring a delivery state which has the service identifier to be processed and sends a short message one bit before the short message to be processed from a ZooKeeper according to the service identifier to be processed and the sequence number to be processed; wherein, the first node of the ZooKeeper stores the corresponding relation between the combination of the service identification and the serial number and the delivery state of the short message;
the determining module is configured to determine whether the sending sequence of the short message to be processed is the first order according to the identification content, and if not, determine the sending state of the short message sent before the short message to be processed according to the identification content; determining whether to send the phone number and the short message content to a short message service platform to which the phone number belongs according to a delivery state of sending the short message before the short message to be processed;
the updating module is configured to update the delivery state of the short message to be processed according to the determination result, and comprises the following steps: if the determined result is that the telephone number and the short message content are sent to the short message service platform to which the telephone number belongs, receiving a receipt code of the short message to be processed sent by the short message service platform; correspondingly storing the receipt code of the short message to be processed, the combination of the service identifier to be processed and the serial number to be processed in a second node of the ZooKeeper; updating the delivery state of the short message corresponding to the combination of the service identifier to be processed and the sequence number to be processed in the first node to be in delivery;
and under the condition of subsequently receiving the receipt code and the delivery state of the short message to be processed sent by the short message service platform, continuously updating the delivery state of the short message to be processed in the first node of the ZooKeeper according to the receipt code of the short message to be processed in the second node of the ZooKeeper.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method recited in any of claims 1-7.
10. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202010900331.6A 2020-08-31 2020-08-31 Short message sending method and device Active CN113766437B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010900331.6A CN113766437B (en) 2020-08-31 2020-08-31 Short message sending method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010900331.6A CN113766437B (en) 2020-08-31 2020-08-31 Short message sending method and device

Publications (2)

Publication Number Publication Date
CN113766437A CN113766437A (en) 2021-12-07
CN113766437B true CN113766437B (en) 2023-04-07

Family

ID=78785751

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010900331.6A Active CN113766437B (en) 2020-08-31 2020-08-31 Short message sending method and device

Country Status (1)

Country Link
CN (1) CN113766437B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013078689A1 (en) * 2011-12-02 2013-06-06 华为技术有限公司 Method and device for realizing message transfer in cloud message service
CN107872473B (en) * 2016-09-23 2021-01-19 阿里巴巴集团控股有限公司 Message processing method, device and system
CN107656825A (en) * 2017-09-01 2018-02-02 上海艾融软件股份有限公司 Message treatment method, apparatus and system
CN113365231A (en) * 2020-03-05 2021-09-07 北京沃东天骏信息技术有限公司 Method and device for sending short message

Also Published As

Publication number Publication date
CN113766437A (en) 2021-12-07

Similar Documents

Publication Publication Date Title
CN109995801B (en) Message transmission method and device
CN109873863B (en) Asynchronous calling method and device of service
CN111478781B (en) Message broadcasting method and device
CN108549586B (en) Information processing method and device
CN113076153A (en) Interface calling method and device
CN108764866B (en) Method and equipment for allocating resources and drawing resources
CN113364664A (en) Instant messaging method and device
CN112948138A (en) Method and device for processing message
CN113766437B (en) Short message sending method and device
CN113127561B (en) Method and device for generating service single number, electronic equipment and storage medium
CN113760487B (en) Service processing method and device
CN112688982B (en) User request processing method and device
CN109087097B (en) Method and device for updating same identifier of chain code
CN112836201A (en) Method, device, equipment and computer readable medium for multi-platform information intercommunication
CN114064803A (en) Data synchronization method and device
CN113742617A (en) Cache updating method and device
CN113556370A (en) Service calling method and device
CN110888770A (en) Method and apparatus for transmitting information
CN113076256A (en) Pressure testing method and device
CN112732417A (en) Method and device for processing application request
CN113556276A (en) Method and device for sending mail
CN113778969A (en) Log processing method and device
CN116010122A (en) Message processing method and device
CN113452739A (en) Message processing method and device
CN113535421A (en) Service message processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant