CN112202914B - Message pushing method and device - Google Patents

Message pushing method and device Download PDF

Info

Publication number
CN112202914B
CN112202914B CN202011091034.8A CN202011091034A CN112202914B CN 112202914 B CN112202914 B CN 112202914B CN 202011091034 A CN202011091034 A CN 202011091034A CN 112202914 B CN112202914 B CN 112202914B
Authority
CN
China
Prior art keywords
push
terminal
message
pushing
subtask
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011091034.8A
Other languages
Chinese (zh)
Other versions
CN112202914A (en
Inventor
刘梓强
田魁
刘芸江
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Happly Sunshine Interactive Entertainment Media Co Ltd
Original Assignee
Hunan Happly Sunshine Interactive Entertainment Media Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Happly Sunshine Interactive Entertainment Media Co Ltd filed Critical Hunan Happly Sunshine Interactive Entertainment Media Co Ltd
Priority to CN202011091034.8A priority Critical patent/CN112202914B/en
Publication of CN112202914A publication Critical patent/CN112202914A/en
Application granted granted Critical
Publication of CN112202914B publication Critical patent/CN112202914B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/214Monitoring or handling of messages using selective forwarding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/12Messaging; Mailboxes; Announcements

Abstract

The application provides a message pushing method and a device, wherein after a task to be pushed is obtained, a pushing channel is selected for a terminal for each terminal based on information of the terminal, and for each terminal, pushing subtasks are sent to a message aggregator uniquely corresponding to the pushing channel of the terminal, the message aggregator aggregates the received pushing subtasks into a target task, so that the pushing subtasks belonging to the same task to be pushed and corresponding to the same pushing channel are aggregated into the target task, on the basis, the target task is sent to a target pushing service provider, the terminal information belonging to the same task to be pushed and corresponding to the same pushing channel and the information to be pushed are submitted to the target pushing service provider at one time, the number of information submission and the data amount are reduced, the submission efficiency is improved, the overall pushing efficiency is improved, and the real-time performance is improved.

Description

Message pushing method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for pushing a message.
Background
With the development of mobile internet and intelligent terminals, the message push technology is widely applied.
Currently, the message pushing technology generally comprises: and selecting a push service provider for each target terminal, independently submitting the message to be pushed to the push service provider corresponding to each target terminal, and distributing and pushing the message to be pushed to the target terminal by the push service provider.
However, this method needs to submit the message to be pushed for multiple times, and has the problem of low submission efficiency, which results in low overall pushing efficiency and poor message pushing real-time performance.
Disclosure of Invention
In order to solve the foregoing technical problems, embodiments of the present application provide a method and an apparatus for pushing a message, so as to achieve the purposes of improving pushing efficiency and improving the real-time property of a pushed message, and the technical scheme is as follows:
a message push method, comprising:
when a task to be pushed is obtained, analyzing a message to be pushed, a target terminal list and a message unique identifier from the task to be pushed, wherein the target terminal list comprises terminal information of each terminal for receiving the message to be pushed;
for each terminal, selecting a push channel for the terminal based on the terminal information;
for each terminal, packaging terminal information of the terminal, the message to be pushed and the unique message identifier into a pushing subtask, and sending the pushing subtask to a message aggregator uniquely corresponding to a pushing channel of the terminal;
for each message aggregator, aggregating the received push subtasks into a target task by the message aggregator, wherein the target task comprises the message to be pushed and the terminal information in each received push subtask;
and sending the target task to a target push service provider to enable the target push service provider to carry out message push based on the target task, wherein the target push service provider is a push service provider corresponding to a push channel corresponding to a terminal to which terminal information in the target task belongs.
The selecting a push channel for the terminal based on the information of the terminal includes:
determining a push channel supported by the terminal based on the information of the terminal;
and if a plurality of push channels supported by the terminal exist and a terminal manufacturer push service push channel exists in the plurality of push channels, taking the terminal manufacturer push service push channel as the push channel of the terminal.
The message aggregator aggregates the received push subtasks into a target task, including:
when the message aggregator receives a push subtask, inquiring a corresponding push subtask list in the memory cache according to the message unique identifier;
if the sub task to be pushed is not inquired, writing the sub task to be pushed into a memory cache, and waiting for the next sub task to be pushed;
if the query is received, adding the current pushing subtask into the pushing subtask list;
judging whether the number of the push subtask lists in the memory cache exceeds a set threshold value or not;
if the current push subtask list does not exceed the set threshold, updating the current push subtask list to a memory cache, and waiting for the next push subtask;
and if the current task exceeds the set threshold value, packaging the push subtask list data in the memory cache into a target task.
The updating the current push subtask list to the memory cache, and after waiting for the next push subtask, the method further includes:
the message aggregator scans and queries all push subtask lists to be sent in the memory cache once every set time;
and if so, packaging each push subtask list to be sent in the memory cache into a target task.
After the target task is sent to the target push service provider, the method further includes:
and deleting the target task sent in the memory cache.
A message pushing apparatus, comprising:
the system comprises an analysis module, a sending module and a processing module, wherein the analysis module is used for analyzing a message to be pushed, a target terminal list and a message unique identifier from the task to be pushed when each task to be pushed is obtained, and the target terminal list comprises terminal information of each terminal for receiving the message to be pushed;
the selection module is used for selecting a push channel for each terminal based on the terminal information;
the routing module is used for packaging terminal information of the terminal, the message to be pushed and the unique message identifier into a pushing subtask for each terminal and sending the pushing subtask to a message aggregation module which is uniquely corresponding to a pushing channel of the terminal;
each message aggregation module is used for aggregating the received push subtasks into a target task, and the target task comprises the message to be pushed and the terminal information in each received push subtask;
and the pushing module is used for sending the target task to a target pushing service provider so as to enable the target pushing service provider to push messages based on the target task, wherein the target pushing service provider is a pushing service provider corresponding to a pushing channel corresponding to a terminal to which the terminal information in the target task belongs.
The selection module is specifically configured to:
determining a push channel supported by the terminal based on the information of the terminal;
and if a plurality of push channels supported by the terminal exist and a terminal manufacturer push service push channel exists in the plurality of push channels, taking the terminal manufacturer push service push channel as the push channel of the terminal.
The message aggregation module is specifically configured to:
when a push subtask is received, inquiring a corresponding push subtask list in the memory cache according to the message unique identifier;
if the sub task to be pushed is not inquired, writing the sub task to be pushed into a memory cache, and waiting for the next sub task to be pushed;
if the query is received, adding the current pushing subtask into the pushing subtask list;
judging whether the quantity of the push subtask lists in the memory cache exceeds a set threshold value or not;
if the current push subtask list does not exceed the set threshold, updating the current push subtask list to a memory cache, and waiting for the next push subtask;
and if the current task exceeds the set threshold value, packaging the push subtask list data in the memory cache into a target task.
The message aggregation module is further configured to:
updating the current push subtask list to a memory cache, and scanning and inquiring all push subtask lists to be sent in the memory cache once every set time after waiting for the next push subtask;
and if so, packaging each push subtask list to be sent in the memory cache into a target task.
The device further comprises:
and the deleting module is used for deleting the target task which is sent in the memory cache after the target task is sent to a target push service provider.
Compared with the prior art, the beneficial effect of this application is:
in the application, after the tasks to be pushed are obtained, a pushing channel is selected for each terminal based on information of the terminal, the pushing subtasks are sent to the message aggregator uniquely corresponding to the pushing channel of the terminal for each terminal, the message aggregator aggregates the received pushing subtasks into one target task, the pushing subtasks belonging to the same task to be pushed and corresponding to the same pushing channel are aggregated into one target task, on the basis, the target task is sent to the target pushing service provider, the terminal information belonging to the same task to be pushed and corresponding to the same pushing channel and the information to be pushed are submitted to the target pushing service provider at one time, the number of information submission and the data quantity are reduced, the submission efficiency is improved, the overall pushing efficiency is improved, and the real-time performance is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
Fig. 1 is a flowchart of a message push method provided in embodiment 1 of the present application;
fig. 2 is a flowchart of a message pushing method provided in embodiment 2 of the present application;
fig. 3 is a flowchart of a message pushing method provided in embodiment 3 of the present application;
fig. 4 is a flowchart of a message pushing method provided in embodiment 4 of the present application;
fig. 5 is a schematic logical structure diagram of a message pushing apparatus provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Referring to fig. 1, a flowchart of a message pushing method provided in embodiment 1 of the present application is shown, and as shown in fig. 1, the method may include, but is not limited to, the following steps:
step S11, when a task to be pushed is obtained, a message to be pushed, a target terminal list and a message unique identifier are analyzed from the task to be pushed, wherein the target terminal list comprises terminal information of each terminal for receiving the message to be pushed.
The message unique identifier can uniquely represent the task to be pushed and the message to be pushed in the task to be pushed. For example, the message unique identifier in the task 1 to be pushed is a1, the message unique identifier in the task 2 to be pushed is a2, the message unique identifier in the task 3 to be pushed is a3, and a1, a2, and a3 are different from each other.
The terminal information may include, but is not limited to: the terminal comprises a terminal identification, a terminal mobile phone manufacturer, a terminal device model and a terminal push channel number list. Wherein, the terminal push channel number list includes: number of push channels supported by the terminal.
Push channels, which can be understood as: a third party push service or a long connection message push channel between a terminal (e.g., a cell phone) vendor push service and the terminal. Wherein each push channel has a respective number.
In this embodiment, the correspondence between the push channels and the push services may be, but is not limited to, refer to table 1.
Figure BDA0002722126330000051
Figure BDA0002722126330000061
In this embodiment, a corresponding message aggregator is set in advance for each push channel. Each push channel uniquely corresponds to one message aggregator. For example, push channel 1 corresponds to only message aggregator 1, push channel 2 corresponds to only message aggregator 2, push channel 3 corresponds to only message aggregator 3, push channels 1, 2, and 3 are different push channels, and message aggregators 1, 2, and 3 are different message aggregators.
And S12, selecting a push channel for each terminal based on the terminal information.
Because the terminal information includes the terminal push channel number list, the push channel supported by the terminal can be determined based on the terminal push channel number list in the terminal information. After determining the push channels supported by the terminal, a push channel may be selected for the terminal from among the push channels supported by the terminal.
Specifically, based on the terminal information, selecting a push channel for the terminal may include, but is not limited to:
s121, determining a push channel supported by the terminal based on the information of the terminal.
And S122, if a plurality of push channels supported by the terminal exist and a terminal manufacturer push service push channel exists in the plurality of push channels, taking the terminal manufacturer push service push channel as the push channel of the terminal.
And S123, if only one push channel supported by the terminal exists, using the push channel supported by the terminal as the push channel of the terminal.
And S13, for each terminal, packaging the terminal information of the terminal, the message to be pushed and the unique message identifier into a pushing subtask, and sending the pushing subtask to a message aggregator uniquely corresponding to a pushing channel of the terminal.
It can be understood that each terminal corresponds to one push subtask, and each push subtask is different.
In this embodiment, if the push channels of different terminals are the same, the push subtasks corresponding to the terminals are sent to the same message aggregator. For example, a target terminal list analyzed from the task 1 to be pushed includes terminal information of 4 terminals, the 4 terminals are respectively a terminal 1, a terminal 2, a terminal 3, and a terminal 4, a push channel selected for the terminal 1 is a push channel 1, a push channel selected for the terminal 2 is a push channel 1, a push channel selected for the terminal 3 is a push channel 2, a push channel selected for the terminal 4 is a push channel 2, the push channel 1 corresponds to the message aggregator 1, the push channel 2 corresponds to the message aggregator 2, a push subtask 1 of the terminal 1 is obtained by encapsulation, a push subtask 2 of the terminal 2 is obtained by encapsulation, a push subtask 3 of the terminal 3 is obtained by encapsulation, a push subtask 4 of the terminal 4 is obtained by encapsulation, the push subtasks 1 and 2 are respectively sent to the message aggregator 1, and the push subtasks 3 and 4 are respectively sent to the message aggregator 2.
And S14, for each message aggregator, aggregating the received push subtasks into a target task, wherein the target task comprises the message to be pushed and the terminal information in each received push subtask.
It can be understood that, since the push subtasks received by the message aggregator are push subtasks obtained by encapsulating terminals belonging to the task to be pushed, the push subtasks received by the message aggregator belong to the same task to be pushed.
In this embodiment, the message aggregator may receive the push subtask using a golang language cache channel and a channel multiplexing asynchronous communication mechanism, which may avoid a problem of blocking the push subtask due to too many receive-push subtasks or a problem of memory overflow due to too many cache data of a memory cache module in the message aggregator.
And step S15, sending the target task to a target pushing service provider to enable the target pushing service provider to carry out message pushing based on the target task, wherein the target pushing service provider is a pushing service provider corresponding to a pushing channel corresponding to a terminal to which terminal information in the target task belongs.
In this embodiment, sending the target task to the target push service provider may include: and packaging the target task into information in accordance with a push protocol format agreed by the target push service provider, and sending the packaged information to the target push service provider.
The target task is packaged into the information which accords with the push protocol format agreed by the target push service provider, so that the analysis time of the target push service provider can be shortened, and the push efficiency is improved.
Specifically, the target task may be sent to the target push service provider by an HTTP (HyperText Transfer Protocol) request.
The target push service provider performs message pushing based on the target task, which can be understood as follows: and the target push service provider analyzes the message to be pushed and the information of each terminal from the target task, and pushes the message to be pushed to each terminal through a push channel corresponding to the information of each terminal.
In the application, after the tasks to be pushed are obtained, a pushing channel is selected for each terminal based on information of the terminal, the pushing subtasks are sent to the message aggregator uniquely corresponding to the pushing channel of the terminal for each terminal, the message aggregator aggregates the received pushing subtasks into one target task, the pushing subtasks belonging to the same task to be pushed and corresponding to the same pushing channel are aggregated into one target task, on the basis, the target task is sent to the target pushing service provider, the terminal information belonging to the same task to be pushed and corresponding to the same pushing channel and the information to be pushed are submitted to the target pushing service provider at one time, the number of information submission and the data quantity are reduced, the submission efficiency is improved, the overall pushing efficiency is improved, and the real-time performance is improved.
Moreover, the information is submitted to the target push service provider at one time, so that the network bandwidth and the server resource consumption can be effectively reduced, and the information push cost is reduced.
As another alternative embodiment of the present application, referring to fig. 2, a flowchart of an embodiment 2 of a message pushing method provided by the present application is provided, where this embodiment mainly relates to a refinement scheme of the message pushing method described in the foregoing embodiment 1, as shown in fig. 2, the method may include, but is not limited to, the following steps:
step S21, when a task to be pushed is obtained, a message to be pushed, a target terminal list and a message unique identifier are analyzed from the task to be pushed, wherein the target terminal list comprises terminal information of each terminal for receiving the message to be pushed;
s22, selecting a push channel for each terminal based on the terminal information;
and S23, for each terminal, packaging the terminal information of the terminal, the message to be pushed and the unique message identifier into a pushing subtask, and sending the pushing subtask to a message aggregator uniquely corresponding to a pushing channel of the terminal.
The detailed processes of steps S21 to S23 can be referred to the related descriptions of steps S11 to S13 in embodiment 1, and are not described herein again.
And step S24, for each message aggregator, querying a corresponding push subtask list in the memory cache according to the message unique identifier when the message aggregator receives one push subtask.
If not, executing step S25; if yes, go to step S26.
And S25, writing the subtask to be pushed into a memory cache, and waiting for the next pushing subtask.
Step S26, determining whether the number of the push subtask lists in the memory cache exceeds a set threshold.
When the corresponding push subtask list is queried in the memory cache, the push subtask does not need to be written into the memory cache again, so that the workload is reduced, and the efficiency is improved.
If the number does not exceed the set number threshold, executing step S27; if the threshold value is exceeded, step S28 is executed.
In this embodiment, the set number threshold may be set as needed, and is not limited in this application.
And step S27, updating the current push subtask list to a memory cache, and waiting for the next push subtask.
And step S28, packaging the push subtask list data in the memory cache into a target task.
After the push subtask list data in the memory cache is encapsulated as the target task, the target task may be stored in the memory cache.
And the target task comprises the message to be pushed and the received terminal information in each pushing subtask.
Steps S24 to S28 are a specific implementation of step S14 in example 1.
Step S29, sending the target task to a target pushing service provider to enable the target pushing service provider to carry out message pushing based on the target task, wherein the target pushing service provider is a pushing service provider corresponding to a pushing channel corresponding to a terminal to which terminal information in the target task belongs.
In this embodiment, sending the target task to the target push service may include:
and S291, judging whether the unsent target task exists in the memory cache once every set time.
If yes, go to step S292.
And S292, sending the target tasks which are not sent in the memory cache to a target service provider.
In this embodiment, whether an unsent target task exists in the memory cache is determined once every set time, so that it is possible to avoid that the message aggregator waits for the time when the number of push subtasks reaches the preset threshold value to be too long and the target tasks in the memory cache are too many.
As another optional embodiment of the present application, referring to fig. 3, which is a flowchart of embodiment 3 of a message pushing method provided in the present application, this embodiment is mainly an extension scheme of the message pushing method described in the foregoing embodiment 2, and as shown in fig. 3, the method may include, but is not limited to, the following steps:
step S31, when each task to be pushed is obtained, analyzing a message to be pushed, a target terminal list and a message unique identifier from the task to be pushed, wherein the target terminal list comprises terminal information of each terminal for receiving the message to be pushed;
step S32, for each terminal, selecting a push channel for the terminal based on the terminal information;
and S33, for each terminal, packaging the terminal information of the terminal, the message to be pushed and the message unique identifier into a pushing subtask, and sending the pushing subtask to a message aggregator uniquely corresponding to a pushing channel of the terminal.
And step S34, for each message aggregator, querying a corresponding push subtask list in the memory cache according to the message unique identifier when the message aggregator receives one push subtask.
If not, executing step S35; if yes, go to step S36.
And step S35, writing the subtask to be pushed into a memory cache, and waiting for the next pushing subtask.
And step S36, judging whether the quantity of the push subtask lists in the memory cache exceeds a set threshold value.
When the corresponding push subtask list is inquired in the memory cache, the push subtask does not need to be written into the memory cache again, so that the workload is reduced, and the efficiency is improved.
If not, executing step S37; if the threshold value is exceeded, step S310 is executed.
In this embodiment, the set number threshold may be set as needed, and is not limited in this application.
And step S37, updating the current push subtask list to a memory cache, and waiting for the next push subtask.
The detailed procedures of steps S31 to S37 can be referred to the related descriptions of steps S21 to S27 in embodiment 2, and are not described herein again.
And step S38, the message aggregator scans and queries all push subtask lists to be sent in the memory cache once every set time.
If there is a push subtask list to be sent, step S39 is executed.
In this embodiment, the setting time may be set as needed, and is not limited in this application.
And step S39, packaging each push subtask list to be sent in the memory cache into a target task.
Step S310, encapsulating the push subtask list data in the memory cache into a target task.
After the push subtask list data in the memory cache is encapsulated as the target task, the target task may be stored in the memory cache.
And the target task comprises the message to be pushed and the received terminal information in each pushing subtask.
Step S311, sending the target task to a target push service provider, so that the target push service provider performs message pushing based on the target task, where the target push service provider is a push service provider corresponding to a push channel and a terminal to which terminal information in the target task belongs.
In this embodiment, under the condition that the number of the push subtask lists in the memory cache does not exceed the set threshold, the push subtask list to be sent in the memory cache may be scanned and queried once every set time, and the queried push subtask list to be sent is encapsulated into the target task, so that the push task is prevented from being not pushed for a long time, and the push task is ensured to be sent to the target push service provider in time.
As another alternative embodiment of the present application, referring to fig. 4, a flowchart of an embodiment 4 of a message pushing method provided by the present application is provided, where this embodiment is mainly an extension of the message pushing method described in the foregoing embodiment 2, and as shown in fig. 4, the method may include, but is not limited to, the following steps:
step S41, when a task to be pushed is obtained, a message to be pushed, a target terminal list and a message unique identifier are analyzed from the task to be pushed, wherein the target terminal list comprises terminal information of each terminal for receiving the message to be pushed.
And S42, selecting a push channel for each terminal based on the terminal information.
And S43, for each terminal, packaging the terminal information of the terminal, the message to be pushed and the unique message identifier into a pushing subtask, and sending the pushing subtask to a message aggregator uniquely corresponding to a pushing channel of the terminal.
And step S44, for each message aggregator, querying a corresponding push subtask list in the memory cache according to the message unique identifier when the message aggregator receives one push subtask.
If not, executing step S45; if yes, go to step S46.
And step S45, writing the subtask to be pushed into a memory cache, and waiting for the next subtask to be pushed.
Step S46, determining whether the number of the push subtask lists in the memory cache exceeds a set threshold.
When the corresponding push subtask list is queried in the memory cache, the push subtask does not need to be written into the memory cache again, so that the workload is reduced, and the efficiency is improved.
If the number does not exceed the set number threshold, executing step S47; if the threshold value is exceeded, step S48 is executed.
In this embodiment, the set number threshold may be set as needed, and is not limited in this application.
And S47, updating the current push subtask list to a memory cache, and waiting for the next push subtask.
And step S48, packaging the push subtask list data in the memory cache into a target task.
And step S49, sending the target task to a target pushing service provider to enable the target pushing service provider to carry out message pushing based on the target task, wherein the target pushing service provider is a pushing service provider corresponding to a pushing channel corresponding to a terminal to which terminal information in the target task belongs.
The detailed procedures of steps S41 to S49 can be referred to the related descriptions of steps S21 to S29 in embodiment 2, and are not described herein again.
Step S410, deleting the target task that has been sent in the memory cache.
In this embodiment, after the target task is sent to the target push service, the sent target task in the memory cache is deleted, so that the space of the memory cache is saved.
Next, a message pushing apparatus provided in the present application is described, and the message pushing apparatus described below and the message pushing method described above may be referred to correspondingly.
Referring to fig. 5, the message pushing apparatus includes: the message aggregation module comprises a parsing module 100, a selection module 200, a routing module 300, a message aggregation module 400 and a push module 500.
The system comprises an analysis module 100, a service module and a service module, wherein the analysis module 100 is used for analyzing a message to be pushed, a target terminal list and a message unique identifier from the task to be pushed when each task to be pushed is obtained, and the target terminal list comprises terminal information of each terminal for receiving the message to be pushed;
a selecting module 200, configured to select, for each terminal, a push channel for the terminal based on the terminal information;
the routing module 300 is configured to encapsulate, for each terminal, terminal information of the terminal, the message to be pushed, and the unique message identifier as a push subtask, and send the push subtask to a message aggregation module uniquely corresponding to a push channel of the terminal;
each message aggregation module 400 is configured to aggregate the received push subtasks into one target task, where the target task includes the message to be pushed and the terminal information in each received push subtask.
The pushing module 500 is configured to send the target task to a target pushing facilitator, so that the target pushing facilitator performs message pushing based on the target task, where the target pushing facilitator is a pushing facilitator corresponding to a pushing channel to which the terminal information in the target task belongs.
In this embodiment, the message sending unit and the push sub-module corresponding to the push module in each message aggregation module 400 use a middleware MQ to perform data communication; the message sending unit is a middleware MQ message producer, the pushing module corresponding to the pushing submodule is a middleware MQ message consumer, the message sending unit and the pushing submodule are mapped through a middleware MQ corresponding Theme (TOPIC), namely, a target task after the same pushing channel is aggregated is sent to the same Theme (TOPIC) of the middleware MQ by the message sending unit, and the corresponding pushing submodule receives the Theme (TOPIC) message corresponding to the middleware MQ and consumes; the message aggregation module and the pushing module can effectively avoid the problem that the message aggregation module is blocked due to the fact that an external network environment or too many pushing tasks are caused by the aid of the middleware MQ asynchronous consumption module, and message aggregation and distribution speed is effectively improved.
The middleware MQ may be understood as: message queues are a kind of "first-in first-out" data mechanism in the basic data structure. Data (messages) to be transmitted are placed in a queue, message transmission is realized by using a queue mechanism, a producer generates messages and places the messages in the queue, and then the messages are processed by a consumer, and the problems of application decoupling, asynchronous messages, traffic cut and the like are generally solved.
In this embodiment, the selecting module 200 may be specifically configured to:
determining a push channel supported by the terminal based on the information of the terminal;
and if a plurality of push channels supported by the terminal exist and a terminal manufacturer push service push channel exists in the plurality of push channels, taking the terminal manufacturer push service push channel as the push channel of the terminal.
In this embodiment, the message aggregation module 400 may be specifically configured to:
when a push subtask is received, inquiring the message to be pushed in a memory cache according to the unique message identifier;
if not, writing the message to be pushed into the memory cache, and judging whether the number of the received push subtasks exceeds a set number threshold value;
if the number exceeds the set number threshold, aggregating the received push subtasks into a target task, and storing the target task in the memory cache;
and if yes, executing the step of judging whether the number of the received push subtasks exceeds a set number threshold value.
In this embodiment, the pushing module 500 may be specifically configured to:
judging whether unsent target tasks exist in the memory cache once every set time;
and if so, sending the target tasks which are not sent in the memory cache to a target service provider.
In this embodiment, the message pushing apparatus may further include:
and the deleting module is used for deleting the target task sent in the memory cache after the target task is sent to a target push service provider.
It should be noted that each embodiment is mainly described as a difference from the other embodiments, and the same and similar parts between the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
For convenience of description, the above devices are described as being divided into various units by function, respectively. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application or portions thereof that contribute to the prior art may be embodied in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, or the like, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute the method according to the embodiments or some portions of the embodiments of the present application.
The defense method and device for cross-site scripting attack provided by the application are introduced in detail, specific examples are applied in the description to explain the principle and implementation mode of the application, and the description of the above embodiments is only used for helping to understand the method and core idea of the application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A message pushing method is characterized by comprising the following steps:
when a task to be pushed is obtained, analyzing a message to be pushed, a target terminal list and a message unique identifier from the task to be pushed, wherein the target terminal list comprises terminal information of each terminal for receiving the message to be pushed;
for each terminal, selecting a push channel for the terminal based on the terminal information;
for each terminal, packaging terminal information of the terminal, the message to be pushed and the message unique identifier into a pushing subtask, sending the pushing subtask to a message aggregator uniquely corresponding to a pushing channel of the terminal, and sending the pushing subtask corresponding to the terminal to the same message aggregator if the pushing channels of different terminals are the same;
for each message aggregator, aggregating the received push subtasks into a target task by the message aggregator, wherein the target task comprises the message to be pushed and the terminal information in each received push subtask;
and sending the target task to a target push service provider to enable the target push service provider to carry out message push based on the target task, wherein the target push service provider is a push service provider corresponding to a push channel corresponding to a terminal to which terminal information in the target task belongs.
2. The method according to claim 1, wherein the selecting a push channel for the terminal based on the information of the terminal comprises:
determining a push channel supported by the terminal based on the information of the terminal;
and if a plurality of push channels supported by the terminal exist and a terminal manufacturer push service push channel exists in the plurality of push channels, taking the terminal manufacturer push service push channel as the push channel of the terminal.
3. The method of claim 1, wherein the message aggregator aggregates the received push subtasks into one target task, comprising:
when the message aggregator receives a push subtask, inquiring a corresponding push subtask list in the memory cache according to the message unique identifier;
if the sub-tasks are not inquired, writing the sub-tasks to be pushed into a memory cache, and waiting for the next sub-task to be pushed;
if the query is received, adding the current pushing subtask into the pushing subtask list;
judging whether the number of the push subtask lists in the memory cache exceeds a set threshold value or not;
if the current push subtask list does not exceed the set threshold, updating the current push subtask list to a memory cache, and waiting for the next push subtask;
and if the current task exceeds the set threshold, packaging the data of the push subtask list in the memory cache into the target task.
4. The method of claim 3, wherein the updating the current push subtask list to the memory cache after waiting for the next push subtask list further comprises:
the message aggregator scans and queries all push subtask lists to be sent in the memory cache once every set time;
and if so, packaging each push subtask list to be sent in the memory cache into a target task.
5. The method of claim 3, wherein after sending the target task to the target push service, further comprising:
and deleting the target task sent in the memory cache.
6. A message push apparatus, comprising:
the system comprises an analyzing module, a sending module and a receiving module, wherein the analyzing module is used for analyzing a message to be pushed, a target terminal list and a message unique identifier from a task to be pushed when each task to be pushed is obtained, and the target terminal list comprises terminal information of each terminal for receiving the message to be pushed;
the selection module is used for selecting a push channel for each terminal based on the terminal information;
the routing module is used for packaging terminal information of each terminal, the message to be pushed and the unique message identifier into pushing subtasks, sending the pushing subtasks to a message aggregation module uniquely corresponding to a pushing channel of the terminal, and sending the pushing subtasks corresponding to the terminal to the same message aggregation module if the pushing channels of different terminals are the same;
each message aggregation module is used for aggregating the received push subtasks into a target task, and the target task comprises the message to be pushed and the received terminal information in each push subtask;
and the pushing module is used for sending the target task to a target pushing service provider so as to enable the target pushing service provider to push messages based on the target task, wherein the target pushing service provider is a pushing service provider corresponding to a pushing channel corresponding to a terminal to which the terminal information in the target task belongs.
7. The apparatus of claim 6, wherein the selection module is specifically configured to:
determining a push channel supported by the terminal based on the information of the terminal;
and if a plurality of push channels supported by the terminal exist and a terminal manufacturer push service push channel exists in the plurality of push channels, taking the terminal manufacturer push service push channel as the push channel of the terminal.
8. The apparatus of claim 6, wherein the message aggregation module is specifically configured to:
when a push subtask is received, inquiring a corresponding push subtask list in the memory cache according to the message unique identifier;
if the sub-tasks are not inquired, writing the sub-tasks to be pushed into a memory cache, and waiting for the next sub-task to be pushed;
if the query is received, adding the current pushing subtask into the pushing subtask list;
judging whether the quantity of the push subtask lists in the memory cache exceeds a set threshold value or not;
if the current push subtask list does not exceed the set threshold, updating the current push subtask list to a memory cache, and waiting for the next push subtask;
and if the current task exceeds the set threshold, packaging the data of the push subtask list in the memory cache into the target task.
9. The apparatus of claim 8, wherein the message aggregation module is further configured to:
updating the current push subtask list to a memory cache, and scanning and inquiring all push subtask lists to be sent in the memory cache once every set time after waiting for the next push subtask;
and if so, packaging each push subtask list to be sent in the memory cache into a target task.
10. The apparatus of claim 8, further comprising:
and the deleting module is used for deleting the target task which is sent in the memory cache after the target task is sent to a target push service provider.
CN202011091034.8A 2020-10-13 2020-10-13 Message pushing method and device Active CN112202914B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011091034.8A CN112202914B (en) 2020-10-13 2020-10-13 Message pushing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011091034.8A CN112202914B (en) 2020-10-13 2020-10-13 Message pushing method and device

Publications (2)

Publication Number Publication Date
CN112202914A CN112202914A (en) 2021-01-08
CN112202914B true CN112202914B (en) 2023-02-24

Family

ID=74008952

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011091034.8A Active CN112202914B (en) 2020-10-13 2020-10-13 Message pushing method and device

Country Status (1)

Country Link
CN (1) CN112202914B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112866414B (en) * 2021-02-20 2022-08-05 每日互动股份有限公司 Data information pushing method and device, computer equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105472400A (en) * 2015-12-24 2016-04-06 Tcl集团股份有限公司 Message pushing method and system
CN107911484A (en) * 2017-12-13 2018-04-13 浪潮软件股份有限公司 A kind of method and device of Message Processing
CN108063724A (en) * 2018-01-12 2018-05-22 吉浦斯信息咨询(深圳)有限公司 Information push method and its system based on Android platform
CN109450805A (en) * 2018-10-31 2019-03-08 百度在线网络技术(北京)有限公司 Information push method, device and system
CN109698799A (en) * 2019-01-14 2019-04-30 广州荔支网络技术有限公司 A kind of information push method, device and mobile terminal
CN111259246A (en) * 2020-01-17 2020-06-09 北京达佳互联信息技术有限公司 Information pushing method and device, electronic equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180248977A1 (en) * 2017-02-24 2018-08-30 Satori Worldwide, Llc Selective distribution of messages in a publish-subscribe system
CN110300032A (en) * 2019-07-31 2019-10-01 凌云天博光电科技股份有限公司 Message pushes storm suppressing method
CN111371672B (en) * 2020-02-14 2022-04-08 贝壳技术有限公司 Message pushing method and device
CN111464618B (en) * 2020-03-30 2023-07-04 广州市百果园信息技术有限公司 Message pushing method, device, equipment and storage medium
CN111741058A (en) * 2020-05-07 2020-10-02 北京五八信息技术有限公司 Message pushing method and device, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105472400A (en) * 2015-12-24 2016-04-06 Tcl集团股份有限公司 Message pushing method and system
CN107911484A (en) * 2017-12-13 2018-04-13 浪潮软件股份有限公司 A kind of method and device of Message Processing
CN108063724A (en) * 2018-01-12 2018-05-22 吉浦斯信息咨询(深圳)有限公司 Information push method and its system based on Android platform
CN109450805A (en) * 2018-10-31 2019-03-08 百度在线网络技术(北京)有限公司 Information push method, device and system
CN109698799A (en) * 2019-01-14 2019-04-30 广州荔支网络技术有限公司 A kind of information push method, device and mobile terminal
CN111259246A (en) * 2020-01-17 2020-06-09 北京达佳互联信息技术有限公司 Information pushing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112202914A (en) 2021-01-08

Similar Documents

Publication Publication Date Title
CN110958281B (en) Data transmission method and communication device based on Internet of things
US20060036764A1 (en) Priority control device
US8825797B2 (en) Method and system for providing user service data
CN113132489A (en) Method, device, computing equipment and medium for downloading file
KR20110076954A (en) Optimized polling in low resource devices
US20100115031A1 (en) System and Method For Enabling P2P Applications in a Wireless Mobile Network
CN103179217A (en) Load balancing method and device applicable to WEB application server group
CN109039817B (en) Information processing method, device, equipment and medium for flow monitoring
CN110753129A (en) Message transmission method, system, device, equipment and computer readable storage medium
CN113259415B (en) Network message processing method and device and network server
CN113064742A (en) Message processing method, device, equipment and storage medium
CN113296976A (en) Message processing method, message processing device, electronic equipment, storage medium and program product
CN112202914B (en) Message pushing method and device
CN110519388B (en) Processing method and device for block chain request, electronic equipment and readable storage medium
CN112104679B (en) Method, apparatus, device and medium for processing hypertext transfer protocol request
CN109510850B (en) Method, device and system for processing browsing request
CN116684468B (en) Data processing method, device, equipment and storage medium
CN112769671B (en) Message processing method, device and system
CN109271259B (en) Enterprise service bus system, data processing method, terminal and storage medium
CN114048059A (en) Method and device for adjusting timeout time of interface, computer equipment and storage medium
CN116074784A (en) Vehicle-mounted data transmission method and device and storage medium
CN109600452B (en) Server cluster, message pushing method and related server
CN112905273A (en) Service calling method and device
CN112165529A (en) Method, device, equipment and medium for low-cost cross-network data exchange
CN108737525A (en) A kind of Web service system based on REST frameworks

Legal Events

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