Disclosure of Invention
In view of the above problems, the present invention has been made to provide a message push platform and a message push method that overcome the above problems or at least partially solve the above problems.
According to an aspect of the embodiments of the present invention, there is provided a message push platform, including: the system comprises a front-end unit, a routing unit, a database and a back-end unit;
the front-end unit is composed of one or more front-end nodes and is suitable for establishing connection with the client by the front-end node corresponding to the connection request when the connection request of the client is received, and registering the connection information to the routing unit;
the routing unit is suitable for recording the connection information between the front-end node and the client;
the database is suitable for storing the corresponding relation between the message to be pushed and the identifier of the message to be pushed; and
the back-end unit is suitable for receiving a message pushing command from a pushing end, analyzing the message pushing command to obtain an identifier of a message to be pushed, searching a corresponding message to be pushed from the database according to the identifier of the message to be pushed, determining at least one client and at least one front-end node to be pushed according to the message pushing command and the connection information recorded by the routing unit, and sending the message to be pushed to the at least one front-end node to be pushed, so that the at least one front-end node to be pushed pushes the message to be pushed to the at least one client.
Optionally, the back-end unit is further adapted to:
and determining the at least one client to be pushed according to the message pushing command, and searching the front end node connected with the at least one client to be pushed from the connection information recorded by the routing unit to serve as the at least one front end node to be pushed.
Optionally, the back-end unit is further adapted to:
analyzing the message pushing command to obtain the at least one client to be pushed; or
And analyzing the message pushing command to obtain the relevant conditions of the client to be pushed, and searching the client matched with the relevant conditions in a pre-constructed client list to serve as the at least one client to be pushed.
Optionally, the relevant conditions include at least one of:
area information, type of network accessed, and current state of the terminal.
Optionally, the back-end unit is further adapted to:
and analyzing the message pushing command to obtain the at least one front-end node to be pushed, and searching the client connected with the at least one front-end node to be pushed from the connection information recorded by the routing unit to serve as the at least one client to be pushed.
Optionally, each front-end node in the front-end units records connection information between itself and the client.
Optionally, the back-end unit is further adapted to:
and analyzing the message pushing command to obtain the at least one front-end node to be pushed, and sending the message to be pushed to the at least one front-end node to be pushed, so that the at least one front-end node to be pushed sends the message to be pushed to a client recorded by the at least one front-end node to be pushed.
Optionally, the plurality of front-end nodes are distributed across one or more clusters of servers.
Optionally, the message push platform further includes:
and the database agent is suitable for receiving a search request for searching the corresponding message to be pushed from the database by the back-end unit according to the identifier of the message to be pushed, searching the corresponding message to be pushed in the database according to the search request, and sending the message to the back-end unit.
Optionally, the database proxy is further adapted to:
after searching for the corresponding message to be pushed in the database according to the search request, caching the message to be pushed so that when the back-end unit sends the search request for searching for the message to be pushed next time, whether the message to be pushed exists is searched in the cached message or not, and if the message to be pushed exists, the cached message to be pushed is directly sent to the back-end unit; and if not, searching the corresponding message to be pushed in the database according to the search request, and sending the message to be pushed to the back-end unit.
Optionally, the front-end unit is further adapted to:
and when the connection with the client meets the disconnection condition, the connection information with the client is logged out from the routing unit, so that the routing unit deletes the connection information between the front-end node and the client.
Optionally, the disconnect condition comprises at least one of:
receiving a request for disconnecting sent by a client;
the client heartbeat times out.
Optionally, the back-end unit is further adapted to:
after the at least one client to be pushed is determined according to the message pushing command, if one or more connected front-end nodes in the at least one client to be pushed are not found in the connection information recorded in the routing unit, it is determined that the one or more clients to be pushed are in an offline state, so that when the one or more clients to be pushed are online again, the front-end nodes connected with the one or more clients to be pushed are searched in the connection information recorded in the routing unit, and the found front-end nodes push the messages to be pushed to the one or more clients to be pushed, wherein the offline state refers to disconnection between the front-end nodes and the clients.
Optionally, the back-end unit is further adapted to:
when the one or more to-be-pushed clients are determined to be in an offline state, establishing an offline message list between each to-be-pushed client in the one or more to-be-pushed clients and the to-be-pushed message;
and when the one or more clients to be pushed are online again, searching the messages to be pushed from the offline message list.
Optionally, the back-end unit is further adapted to:
before the found front-end node pushes the message to be pushed to the one or more clients to be pushed, judging whether the message to be pushed is overdue or not, and if not, executing pushing operation; and if the time is expired, not executing the pushing operation.
Optionally, the back-end unit is further adapted to:
when the one or more to-be-pushed clients are determined to be in an offline state, correspondingly storing the to-be-pushed messages and expiration time, so that before the searched front-end nodes push the to-be-pushed messages to the one or more to-be-pushed clients, the stored expiration time is compared with the current time, and whether the to-be-pushed messages are expired is judged.
According to another aspect of the embodiments of the present invention, there is also provided a message pushing method applied to a front-end unit on a message pushing platform, where the front-end unit is composed of one or more front-end nodes, and includes:
when a connection request of a client is received, a front-end node corresponding to the connection request establishes connection with the client, and registers connection information to a routing unit on the message pushing platform; and
and when receiving a message to be pushed sent by a back end unit on the message pushing platform, pushing the message to be pushed to a corresponding client.
Optionally, each front-end node in the front-end units records connection information between itself and the client.
Optionally, the plurality of front-end nodes are distributed across one or more clusters of servers.
Optionally, the message pushing method further includes:
and when the connection with the client meets the disconnection condition, the connection information with the client is logged out from the routing unit, so that the routing unit deletes the connection information between the front-end node and the client.
Optionally, the disconnect condition comprises at least one of:
receiving a request for disconnecting sent by a client;
the client heartbeat times out.
According to another aspect of the embodiments of the present invention, there is also provided a message pushing method applied to a backend unit on a message pushing platform, including:
receiving a message pushing command from a pushing end, and analyzing the message pushing command to obtain an identifier of a message to be pushed;
searching a corresponding message to be pushed from a database on the message pushing platform according to the identifier of the message to be pushed, wherein the database stores the corresponding relation between the message to be pushed and the identifier thereof;
determining at least one client to be pushed and at least one front-end node to be pushed according to the message pushing command and the connection information recorded by a routing unit on the message pushing platform, wherein the connection information between the front-end node and the client is recorded by the routing unit; and
sending the message to be pushed to the at least one front end node to be pushed, so that the message to be pushed is pushed to the at least one client to be pushed by the at least one front end node to be pushed.
Optionally, the step of determining at least one client to be pushed and at least one front-end node to be pushed according to the message pushing command and the connection information recorded by the routing unit on the message pushing platform further includes:
and determining the at least one client to be pushed according to the message pushing command, and searching the front end node connected with the at least one client to be pushed from the connection information recorded by the routing unit to serve as the at least one front end node to be pushed.
Optionally, the step of determining the at least one client to be pushed according to the message push command further includes:
analyzing the message pushing command to obtain the at least one client to be pushed; or
And analyzing the message pushing command to obtain the relevant conditions of the client to be pushed, and searching the client matched with the relevant conditions in a pre-constructed client list to serve as the at least one client to be pushed.
Optionally, the relevant conditions include at least one of:
area information, type of network accessed, and current state of the terminal.
Optionally, the step of determining at least one client to be pushed and at least one front-end node to be pushed according to the message pushing command and the connection information recorded by the routing unit on the message pushing platform further includes:
and analyzing the message pushing command to obtain the at least one front-end node to be pushed, and searching the client connected with the at least one front-end node to be pushed from the connection information recorded by the routing unit to serve as the at least one client to be pushed.
Optionally, each front-end node in the front-end unit records connection information between itself and a client, and the step of determining at least one client to be pushed and at least one front-end node to be pushed according to the message pushing command and the connection information recorded by the routing unit on the message pushing platform further includes:
and analyzing the message pushing command to obtain the at least one front-end node to be pushed, and sending the message to be pushed to the at least one front-end node to be pushed, so that the at least one front-end node to be pushed sends the message to be pushed to a client recorded by the at least one front-end node to be pushed.
Optionally, the step of searching for the corresponding message to be pushed from the database on the message pushing platform according to the identifier of the message to be pushed further includes:
sending a search request for searching the corresponding message to be pushed from the database according to the identifier of the message to be pushed to a database agent on the message pushing platform;
and receiving the message to be pushed returned by the database agent.
Optionally, after searching for the corresponding message to be pushed in the database according to the search request, the database proxy caches the message to be pushed, so that when the back-end unit sends the search request for searching for the message to be pushed next time, whether the message to be pushed exists in the cached message is searched for first, and if the message to be pushed exists, the cached message to be pushed is directly sent to the back-end unit; and if not, searching the corresponding message to be pushed in the database according to the search request, and sending the message to be pushed to the back-end unit.
Optionally, the message pushing method further includes:
after the at least one client to be pushed is determined according to the message pushing command, if one or more connected front-end nodes in the at least one client to be pushed are not found in the connection information recorded in the routing unit, it is determined that the one or more clients to be pushed are in an offline state, so that when the one or more clients to be pushed are online again, the front-end nodes connected with the one or more clients to be pushed are searched in the connection information recorded in the routing unit, and the found front-end nodes push the messages to be pushed to the one or more clients to be pushed, wherein the offline state refers to disconnection between the front-end nodes and the clients.
Optionally, the message pushing method further includes:
when the one or more to-be-pushed clients are determined to be in an offline state, establishing an offline message list between each to-be-pushed client in the one or more to-be-pushed clients and the to-be-pushed message;
and when the one or more clients to be pushed are online again, searching the messages to be pushed from the offline message list.
Optionally, the message pushing method further includes:
before the found front-end node pushes the message to be pushed to the one or more clients to be pushed, judging whether the message to be pushed is overdue or not, and if not, executing pushing operation; and if the time is expired, not executing the pushing operation.
Optionally, the message pushing method further includes:
when the one or more to-be-pushed clients are determined to be in an offline state, correspondingly storing the to-be-pushed messages and expiration time, so that before the searched front-end nodes push the to-be-pushed messages to the one or more to-be-pushed clients, the stored expiration time is compared with the current time, and whether the to-be-pushed messages are expired is judged.
The message pushing platform provided by the embodiment of the invention comprises a front-end unit, a routing unit, a database and a back-end unit, wherein the front-end unit is composed of one or more front-end nodes and is suitable for establishing connection between the front-end node corresponding to a connection request and a client and registering the connection information to the routing unit when the connection request of the client is received; the routing unit is suitable for recording the connection information between the front-end node and the client; the database is suitable for storing the corresponding relation between the message to be pushed and the identifier of the message to be pushed; and the back-end unit is suitable for receiving a message pushing command from the pushing end, analyzing the message pushing command to obtain an identifier of a message to be pushed, searching a corresponding message to be pushed from the database according to the identifier of the message to be pushed, determining at least one client and at least one front-end node to be pushed according to the message pushing command and the connection information recorded by the routing unit, and sending the message to be pushed to the at least one front-end node to be pushed, so that the at least one front-end node to be pushed pushes the message to be pushed to the at least one client to be pushed. Therefore, the message pushing platform provided by the embodiment of the invention pushes the messages through mutual cooperation among the front-end unit, the routing unit, the database and the rear-end unit, has clear role division, is easy to realize operation and maintenance capacity expansion, and can improve the efficiency and accuracy of message pushing. In addition, the embodiment of the invention extracts the dynamic connection information between the front-end node and the client from the front-end unit, the database and the back-end unit, and records the dynamic connection information in real time by the routing unit, thereby effectively reducing the access pressure of the database and the loads of the front-end unit and the back-end unit.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
The above and other objects, advantages and features of the present invention will become more apparent to those skilled in the art from the following detailed description of specific embodiments thereof, taken in conjunction with the accompanying drawings.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
In order to solve the above technical problem, an embodiment of the present invention provides a message push platform. Fig. 1 shows a schematic structural diagram of a message push platform according to an embodiment of the present invention. As shown in fig. 1, the message push platform 100 may include a front-end unit 110, arouting unit 120, adatabase 130, and a back-end unit 140, specifically:
a front-end unit 110, which is composed of one or more front-end nodes and is adapted to, upon receiving a connection request from a client, establish a connection with the client by the front-end node corresponding to the connection request and register the connection information to therouting unit 120;
arouting unit 120 adapted to record connection information between the front-end node and the client;
adatabase 130 adapted to store correspondence between messages to be pushed and their identities; and
thebackend unit 140 is adapted to receive a message push command from the push end, parse the message push command to obtain an identifier of the message to be pushed, search a corresponding message to be pushed from thedatabase 130 according to the identifier of the message to be pushed, determine at least one client and at least one front-end node to be pushed according to the message push command and the connection information recorded by therouting unit 120, and send the message to be pushed to the at least one front-end node to be pushed, so that the at least one front-end node to be pushed pushes the message to be pushed to the at least one client.
The message push platform 100 provided by the embodiment of the present invention pushes messages through mutual cooperation among the front-end unit 110, therouting unit 120, thedatabase 130, and the back-end unit 140, has clear role division, is easy to implement, and is capable of expanding capacity of operation and maintenance, and improving efficiency and accuracy of message push. In addition, in the embodiment of the present invention, dynamic connection information between the front-end node and the client is extracted from the front-end unit 110, thedatabase 130, and the back-end unit 140, and is recorded in real time by therouting unit 120, so that the access pressure of thedatabase 130 and the loads of the front-end unit 110 and the back-end unit 140 can be effectively reduced.
In alternative embodiments of the present invention, the plurality of front-end nodes in the front-end unit 110 may be distributed among one or more server clusters. For example, the plurality of front-end nodes in the front-end unit 110 are grouped into clusters P1, P2, P3, etc. by different products, P1 includes front-end nodes a1, a2, A3, a4, a5, etc., P2 includes front-end nodes B1, B2, B3, B4, B5, etc., and so on, i.e.:
p1 (front end node A1, A2, A3, A4, A5 … …)
P2 (front end nodes B1, B2, B3, B4, B5 … …)
P3 (front end nodes C1, C2, C3, C4, C5 … …)
……
Assuming that the client a is connected to the front-end node a1, the connection information is recorded on the front-end node a1 and registered to therouting unit 120; the same may be true for clients b, c, d, etc. It should be noted that the examples are merely illustrative and do not limit the embodiments of the present invention.
In an alternative embodiment of the present invention, when determining at least one client to be pushed and at least one front-end node to be pushed according to the message push command and the connection information recorded by therouting unit 120, the back-end unit 140 may specifically implement two ways, which will be described in detail below.
In a first manner, the back-end unit 140 determines at least one client to be pushed according to the message pushing command, and searches the connection information recorded in therouting unit 120 for a front-end node to which the at least one client to be pushed is connected, as the at least one front-end node to be pushed.
In the first mode, the back-end unit 140 may obtain at least one to-be-pushed client by parsing the message push command; or
The back-end unit 140 may obtain the relevant conditions of the clients to be pushed by parsing from the message pushing command, and search a client matching the relevant conditions in a pre-constructed client list to serve as at least one client to be pushed. The relevant condition may be area information, a type of an access network, a current state of a terminal, and the like, and the embodiment of the present invention is not limited thereto.
For example, if the message pushing command is "send message 123 to the beijing sun-facing area user", where "beijing sun-facing area" is the area information, the back-end unit 140 may search the client matching the "beijing sun-facing area" in the client list as at least one client to be pushed. For another example, if the message pushing command is "push video to a user currently in wifi state", where the "wifi state" is an access network type, thebackend unit 140 may search a client matching the "wifi state" in the client list to serve as at least one client to be pushed.
In a second manner, the back-end unit 140 may obtain at least one to-be-pushed front-end node by analyzing the message pushing command, and search, from the connection information recorded by therouting unit 120, a client that is connected to the at least one to-be-pushed front-end node, as the at least one to-be-pushed client.
In the second manner, for example, the message push command is "push message 234 to clients connected to front-end nodes a1, a2, A3, a4, a5, etc. of the cluster P1", thebackend unit 140 may parse the message push command to obtain that at least one front-end node to be pushed is "front-end node a1, a2, A3, a4, a5, etc", and then search clients connected to the at least one front-end node to be pushed from the connection information recorded by therouting unit 120, as the at least one client to be pushed.
In an optional embodiment of the present invention, each front-end node in the front-end unit 110 records connection information between itself and the client, and then the back-end unit 140 may further obtain at least one front-end node to be pushed by parsing from the message push command, and directly send the message to be pushed to the at least one front-end node to be pushed, so that the at least one front-end node to be pushed sends the message to be pushed to the client recorded by itself.
In an optional embodiment of the present invention, as shown in fig. 2, the message push platform 100 shown in fig. 1 above may further include adatabase proxy 210, where thedatabase proxy 210 is adapted to receive a search request for thebackend unit 140 to search for a corresponding message to be pushed from thedatabase 130 according to the identifier of the message to be pushed, search for a corresponding message to be pushed in thedatabase 130 according to the search request, and send the corresponding message to be pushed to thebackend unit 140.
Further, thedatabase proxy 210 is further adapted to cache the message to be pushed after searching the corresponding message to be pushed in thedatabase 130 according to the search request, so that when thebackend unit 140 sends the search request for searching the message to be pushed next time, it searches whether the message to be pushed exists in the cached message first, and if so, it directly sends the cached message to be pushed to thebackend unit 140; if the message to be pushed does not exist, the corresponding message to be pushed is searched in thedatabase 130 according to the search request, and is sent to the back-end unit 140. In this way, the efficiency of message reading can be improved by means of caching, and the access pressure of thedatabase 130 can be relieved.
In an alternative embodiment of the present invention, the front-end unit 110 is further adapted to log out the connection information with the client from therouting unit 120 when the connection with the client satisfies the disconnection condition, so that therouting unit 120 deletes the connection information between the front-end node and the client. The disconnection condition here may be that a request for disconnection sent by the client is received, or that the client has a heartbeat timeout, that is, for the client that is online, if the message push platform does not receive any message from the client within a specified time, the client is considered to have dropped. In this way, therouting unit 120 can record the connection information updated in real time, and can improve the accuracy of message pushing.
In an optional embodiment of the present invention, the back-end unit 140 is further adapted to, after determining at least one to-be-pushed client according to the message pushing command, determine that the one or more to-be-pushed clients are in an offline state if one or more connected front-end nodes of the at least one to-be-pushed client are not found in the connection information recorded in therouting unit 120, so that, after the one or more to-be-pushed clients are on line again, the front-end nodes respectively connected to the one or more to-be-pushed clients are found in the connection information recorded in therouting unit 120, and the found front-end nodes push the to-be-pushed message to the one or more to-be-pushed clients, where the offline state refers to disconnection between the front-end nodes and the clients. Here, whether one or more clients to be pushed come online again may be monitored by the front-end unit 110, and the back-end unit 140 is notified when the front-end unit 110 monitors that one or more clients to be pushed come online again. Therefore, the embodiment of the invention can still realize the message pushing when the client is off-line and on-line again.
In an optional embodiment of the present invention, the back-end unit 140 is further adapted to, when it is determined that one or more to-be-pushed clients are in an offline state, establish an offline message list between each to-be-pushed client in the one or more to-be-pushed clients and a to-be-pushed message, and then, when the one or more to-be-pushed clients are online again, find the to-be-pushed message from the offline message list.
In an optional embodiment of the present invention, some expired messages may also be filtered, so that the pushed messages meet timeliness, that is, the back-end unit 140 is further adapted to determine whether the messages to be pushed are expired before the found front-end node pushes the messages to be pushed to one or more clients to be pushed, and if not, execute a pushing operation; and if the time is expired, not executing the pushing operation.
In an optional embodiment of the present invention, when determining whether the message to be pushed is expired, specifically, when determining that one or more clients to be pushed are in an offline state, the back-end unit 140 stores the message to be pushed and the expiration time correspondingly, so that before the found front-end node pushes the message to be pushed to the one or more clients to be pushed, the stored expiration time is compared with the current time to determine whether the message to be pushed is expired. If the comparison result is that the stored expiration time exceeds the current time, determining that the message to be pushed is expired; and if the comparison result is that the stored expiration time does not exceed the current time, determining that the message to be pushed is not expired.
It should be noted that, in practical applications, all the above optional embodiments may be combined in a combined manner at will to form an optional embodiment of the present invention, and details are not described here any more.
Based on the same inventive concept, the embodiment of the invention also provides a message pushing method. Fig. 3 shows a flow chart of a message pushing method applied to a front end unit on a message pushing platform according to an embodiment of the invention. As shown in fig. 3, the method may include the following steps S302 and S304.
Step S302, when receiving the connection request of the client, the front end node corresponding to the connection request establishes connection with the client, and registers the connection information to the routing unit on the message pushing platform.
Step S304, when receiving the message to be pushed sent by the back-end unit on the message pushing platform, pushing the message to be pushed to the corresponding client.
In an embodiment of the invention, the front-end unit may be constituted by one or more front-end nodes. In alternative embodiments, multiple front-end nodes may be distributed across one or more server clusters. For example, the plurality of front-end nodes in the front-end unit are divided into clusters P1, P2, P3, etc. by different products, P1 includes front-end nodes a1, a2, A3, a4, a5, etc., P2 includes front-end nodes B1, B2, B3, B4, B5, etc., and so on, i.e.:
p1 (front end node A1, A2, A3, A4, A5 … …)
P2 (front end nodes B1, B2, B3, B4, B5 … …)
P3 (front end nodes C1, C2, C3, C4, C5 … …)
……
Assuming that the client a is connected with the front-end node A1, recording the connection information on the front-end node A1, and registering the connection information to a routing unit on the message push platform; the same may be true for clients b, c, d, etc. It should be noted that the examples are merely illustrative and do not limit the embodiments of the present invention.
In an alternative embodiment of the present invention, each front-end node in the front-end unit may record connection information between itself and the client, and then register the connection information with the routing unit on the message push platform.
In an optional embodiment of the present invention, when the connection with the client satisfies the disconnection condition, the front-end unit may log out the connection information with the client from the routing unit, so that the routing unit deletes the connection information between the front-end node and the client. The disconnection condition here may be that a request for disconnection sent by the client is received, or that the client has a heartbeat timeout, that is, for the client that is online, if the message push platform does not receive any message from the client within a specified time, the client is considered to have dropped. Therefore, the routing unit can record the connection information updated in real time, and the accuracy of message pushing can be improved.
Fig. 4 shows a flowchart of a message pushing method applied to a backend unit on a message pushing platform according to an embodiment of the present invention. As shown in fig. 4, the method may include the following steps S402, S404, S406, and S408.
Step S402, receiving a message pushing command from a pushing end, and analyzing the message pushing command to obtain an identifier of the message to be pushed.
Step S404, searching a corresponding message to be pushed from a database on the message pushing platform according to the identifier of the message to be pushed, wherein the database stores the corresponding relationship between the message to be pushed and the identifier thereof.
Step S406, determining at least one client to be pushed and at least one front-end node to be pushed according to the message pushing command and the connection information recorded by the routing unit on the message pushing platform, wherein the connection information between the front-end node and the client is recorded by the routing unit.
Step S408, sending the message to be pushed to at least one front-end node to be pushed, so that the message to be pushed is pushed to at least one client to be pushed by the at least one front-end node to be pushed.
The push terminal mentioned in the above step S402 may be an operator such as a service, an administrator, and the like, and the message push command may be for a single user, a batch user, or all users of a product, and the like.
In an alternative embodiment of the present invention, the message push command is directed to different objects, and the manner of determining at least one client to be pushed and at least one front-end node to be pushed according to the message push command and the connection information recorded by the routing unit on the message push platform in step S406 is also different, which will be described in detail below.
In a case that the message pushing command is directed to a single user or a batch of users, step S406 may further be to determine at least one client to be pushed according to the message pushing command, and search, from the connection information recorded in the routing unit, a front-end node to which the at least one client to be pushed is connected, as the at least one front-end node to be pushed.
In an optional embodiment, when at least one client to be pushed is determined according to the message pushing command, the at least one client to be pushed may be obtained by parsing the message pushing command, or the relevant conditions of the client to be pushed may be obtained by parsing the message pushing command, and a client matched with the relevant conditions is searched in a pre-constructed client list to serve as the at least one client to be pushed. The relevant condition may be area information, a type of an access network, a current state of a terminal, and the like, and the embodiment of the present invention is not limited thereto.
For example, if the message push command is "send message 123 to the beijing sun-facing region user", where "beijing sun-facing region" is the region information, a client matching the "beijing sun-facing region" may be searched in the client list as at least one client to be pushed. For another example, if the message push command is "push video to a user currently in a wifi state", where the "wifi state" is an access network type, a client matching the "wifi state" may be searched in the client list as at least one client to be pushed.
In case two, when the message pushing command is directed to all users of the product, step S406 may further be to obtain at least one to-be-pushed front-end node by parsing the message pushing command, and search, from the connection information recorded in the routing unit, a client connected to each of the at least one to-be-pushed front-end node as the at least one to-be-pushed client.
For example, if the message push command is "push message 234 to clients connected to front-end nodes a1, a2, A3, a4, a5, etc. of the cluster P1", at least one front-end node to be pushed is "front-end node a1, a2, A3, a4, a5, etc" may be obtained by parsing from the message push command, and then the client to be connected to each of the at least one front-end node to be pushed is searched from the connection information recorded by the routing unit, and is used as the at least one client to be pushed.
In an optional embodiment of the present invention, each front-end node in the front-end unit records connection information between itself and the client, then step S406 may further be to obtain at least one front-end node to be pushed by parsing from the message pushing command, and directly send the message to be pushed to the at least one front-end node to be pushed, so that the at least one front-end node to be pushed sends the message to be pushed to the client recorded by itself.
In the step S404, the corresponding message to be pushed is searched from the database on the message pushing platform according to the identifier of the message to be pushed, and an optional scheme is provided in the embodiment of the present invention.
Further, after searching the corresponding message to be pushed in the database according to the search request, the database agent caches the message to be pushed, so that when the back-end unit sends the search request for searching the message to be pushed next time, whether the message to be pushed exists in the cached message is searched first, and if the message to be pushed exists, the cached message to be pushed is directly sent to the back-end unit; if not, searching the corresponding message to be pushed in the database according to the searching request, and sending the message to the back-end unit. Therefore, the efficiency of reading the message can be improved in a caching mode, and the access pressure of the database can be relieved.
In an optional embodiment of the present invention, the message pushing when the client goes online again after going offline can also be implemented. Specifically, after at least one to-be-pushed client is determined according to the message pushing command, if one or more connected front-end nodes in the at least one to-be-pushed client are not found in the connection information recorded in the routing unit, it is determined that the one or more to-be-pushed clients are in an offline state, so that after the one or more to-be-pushed clients are on line again, the front-end nodes connected with the one or more to-be-pushed clients are found in the connection information recorded in the routing unit, and the found front-end nodes push the to-be-pushed messages to the one or more to-be-pushed clients, where the offline state refers to disconnection between the front-end nodes and the clients.
In an optional embodiment of the present invention, when it is determined that one or more to-be-pushed clients are in an offline state, an offline message list between each to-be-pushed client in the one or more to-be-pushed clients and a to-be-pushed message may be established, and then, after the one or more to-be-pushed clients are online again, the to-be-pushed message is searched from the offline message list.
In an optional embodiment of the present invention, some expired messages may also be filtered, so that the pushed messages meet timeliness, specifically, before the found front-end node pushes the to-be-pushed message to one or more to-be-pushed clients, it is determined whether the to-be-pushed message is expired, and if not, a pushing operation is performed; and if the time is expired, not executing the pushing operation.
In an optional embodiment of the present invention, when determining whether the message to be pushed is expired, specifically, when determining that one or more clients to be pushed are in an offline state, the message to be pushed and the expiration time are correspondingly stored, so that before the found front-end node pushes the message to be pushed to the one or more clients to be pushed, the stored expiration time and the current time are compared, and whether the message to be pushed is expired is determined. If the comparison result is that the stored expiration time exceeds the current time, determining that the message to be pushed is expired; and if the comparison result is that the stored expiration time does not exceed the current time, determining that the message to be pushed is not expired.
According to any one or a combination of multiple optional embodiments, the embodiment of the present invention can achieve the following advantages:
the message pushing platform provided by the embodiment of the invention comprises a front-end unit, a routing unit, a database and a back-end unit, wherein the front-end unit is composed of one or more front-end nodes and is suitable for establishing connection between the front-end node corresponding to a connection request and a client and registering the connection information to the routing unit when the connection request of the client is received; the routing unit is suitable for recording the connection information between the front-end node and the client; the database is suitable for storing the corresponding relation between the message to be pushed and the identifier of the message to be pushed; and the back-end unit is suitable for receiving a message pushing command from the pushing end, analyzing the message pushing command to obtain an identifier of a message to be pushed, searching a corresponding message to be pushed from the database according to the identifier of the message to be pushed, determining at least one client and at least one front-end node to be pushed according to the message pushing command and the connection information recorded by the routing unit, and sending the message to be pushed to the at least one front-end node to be pushed, so that the at least one front-end node to be pushed pushes the message to be pushed to the at least one client to be pushed. Therefore, the message pushing platform provided by the embodiment of the invention pushes the messages through mutual cooperation among the front-end unit, the routing unit, the database and the rear-end unit, has clear role division, is easy to realize operation and maintenance capacity expansion, and can improve the efficiency and accuracy of message pushing. In addition, the embodiment of the invention extracts the dynamic connection information between the front-end node and the client from the front-end unit, the database and the back-end unit, and records the dynamic connection information in real time by the routing unit, thereby effectively reducing the access pressure of the database and the loads of the front-end unit and the back-end unit.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in a message push platform according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
Thus, it should be appreciated by those skilled in the art that while a number of exemplary embodiments of the invention have been illustrated and described in detail herein, many other variations or modifications consistent with the principles of the invention may be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the invention. Accordingly, the scope of the invention should be understood and interpreted to cover all such other variations or modifications.