Short message sending method and device

文档序号:1941984 发布日期:2021-12-07 浏览:24次 中文

阅读说明:本技术 一种短信发送方法和装置 (Short message sending method and device ) 是由 叶强 于 2020-08-31 设计创作,主要内容包括:本发明公开了一种短信发送方法和装置,涉及计算机技术领域。该方法的一具体实施方式包括:接收业务系统发送的待处理短信的信息;其中,所述信息中包括:电话号码、短信内容和标识内容;根据所述标识内容,确定所述待处理短信的发送顺序是否为第一位,如果否,则根据所述标识内容,确定在所述待处理短信之前发送短信的送达状态;根据在所述待处理短信之前发送短信的送达状态,确定是否向所述电话号码所属的短信服务平台发送所述电话号码和所述短信内容;根据确定结果,更新所述待处理短信的送达状态。该实施方式能够确保短信的送达顺序与发送顺序一致。(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.)

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;

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.

2. The method of claim 1,

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.

3. The method of claim 2,

the updating the delivery state of the short message to be processed according to the determined 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 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.

4. The method of claim 3,

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.

5. The method of claim 2,

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.

6. 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.

7. 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.

8. 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; 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 cancellation of delivery.

9. 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.

10. A short message transmission device, comprising:

the receiving module is configured to receive the information of the short message to be processed, which is 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.

11. An electronic device, comprising:

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 one of claims 1-9.

12. 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-9.

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 determined 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 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.

Preferably, the first and second electrodes are formed of a metal,

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 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.

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 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 determined result comprises the following steps:

and updating the delivery state of the short message to be processed into the cancellation of delivery.

Preferably, the first and second electrodes are formed of a metal,

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, which is 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 employed;

fig. 4 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the 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, and the identification contents of the short messages are a1, a2 and A3, respectively, where a is used to identify the group a to which the short message belongs, and the numbers after the group are used to identify the sequence of the short messages in the group, that is, the sending sequence of the short messages is a1, a2 and A3, respectively. 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 messages 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 serial 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 serial number to be processed, so as to update the delivery state of the short message to be processed according to the determination result and the receipt code of the short message to be processed.

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 a plurality of short messages sent by a 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 arranged 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 a phone number and a short message content to a short message service platform to which the phone number belongs according to a delivery status of short messages arranged in a sending sequence before short messages 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 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 messages with the delivery sequence before the short message to be processed may also be determined as the initial sending time of 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 the short message sent one bit before the short message to be processed is delivery failure or transmission cancellation, determining whether the short message to be processed depends on the short message with the transmission sequence arranged on the previous bit according to the dependency identification; 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 determined 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 of which the sending sequence is not dependent on the short message of which the sending sequence is 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 of which the sending sequence is 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 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 identifier includes 0 and 1, where 0 represents a short message that is not dependent on the transmission sequence and is arranged in the previous order, and 1 represents a short message that is dependent on the transmission sequence and is arranged in the previous order.

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.

The combination of "P" and "2" and the delivery status "pending delivery" corresponding to the combination are stored in the first node, and the storage form may be "/P/2 ═ 0". In an actual application scenario, different characters may be used to represent a delivery status, for example, 0 represents to-be-sent, 1 represents to-be-returned delivery status during sending (for short, during sending), 2 represents to-be-sent but failed to be delivered (for short, failed to be delivered), 3 represents to-be-sent and successfully delivered (for short, successful to be delivered), 4 represents to cancel 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:00: 00.

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 status of the short message sent one bit before the short message to be processed is to be sent or is being sent, executing S6, if the delivery status of the short message sent one bit before the short message to be processed is successful, executing S9, and if the delivery status of the short message sent one bit before the short message to be processed is failed to be sent or the short message is cancelled to be sent, executing S8.

The delivery status corresponding to the 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 asynchronously determining whether the interval between the time to be processed and the initial sending time of the short message exceeds the timeout waiting time or not for the short message in the waiting queue, if so, executing S9, otherwise, executing S4.

For example, the time to be processed is 10:00:20, the initial sending time of the short message is 10:00:00, the time interval between the two is 20S, and the timeout waiting time is not exceeded, so S4 is executed. If the pending time is 10:00:59, the time interval is 59S, and the timeout waiting time is exceeded, the process proceeds to S9.

S8: and determining whether the short message to be processed depends on the short message with the transmission sequence arranged at the front position according to the dependency identification, if so, executing S16, 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 state to the delivery success state or the delivery failure state, and terminating the flow 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 order according to the identification content, and if not, determine 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; 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 phone number and the short message content are sent to the short message service platform to which the phone 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 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 correspondingly; 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 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.

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 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.

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 can 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. The network 304 serves as a medium for providing communication links between the terminal devices 301, 302, 303 and the 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 driver 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 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 the present invention, however, 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 also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.

The 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 arranged 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. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can 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.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:针对启用eDRX的移动终端的MT SM传送的增强

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类