CN113014672B - Message pushing method and device, electronic equipment and storage medium - Google Patents
Message pushing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113014672B CN113014672B CN202110372993.5A CN202110372993A CN113014672B CN 113014672 B CN113014672 B CN 113014672B CN 202110372993 A CN202110372993 A CN 202110372993A CN 113014672 B CN113014672 B CN 113014672B
- Authority
- CN
- China
- Prior art keywords
- subscription
- agent layer
- channel
- layer
- request
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/55—Push-based network services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/566—Grouping or aggregating service requests, e.g. for unified processing
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention discloses a message pushing method, a message pushing device, electronic equipment and a storage medium, which are used for solving the technical problems that the subscription relationship between a channel and an agent layer is uncontrollable and one channel can be subscribed by a plurality of agent layers in the existing message pushing method. The method comprises the following steps: receiving a first subscription request of a preset client aiming at a preset channel through a preset gateway, and sending the first subscription request to a preset first proxy layer; converting the first subscription request into a second subscription request through the first agent layer, and sending the second subscription request to a preset centralization component; responding to the second subscription request through the centralized component to determine a target agent layer, and judging whether the target agent layer is the same as the first agent layer; if the channel is the same as the target channel, returning a successful subscription message to the client through the first proxy layer, and generating a subscription relation between the target proxy layer and the channel; and when the push request aiming at the channel is received, the push request is sent to the corresponding client based on the subscription relation.
Description
Technical Field
The present invention relates to the field of message pushing technologies, and in particular, to a message pushing method and apparatus, an electronic device, and a storage medium.
Background
In the current instant push system, a client is accessed to a server push system, and is mainly connected with a load balancer through a TCP protocol, and the load balancer then randomly switches the flow to a client proxy layer proxy. In service scenes such as rooms, channels, live broadcast rooms and the like, the subscription relationship has three dimensions, namely, a channel, a client identifier (namely, a user identifier) and a proxy identifier. A message destined for a specific room needs to be routed to proxy first and then to the client.
At present, there are two main feasible ways, one is to broadcast the push message to all proxy regardless of the subscription relationship with the proxy, and the proxy pushes the message or discards the message according to the subscription relationship of the local room and client. This approach simplifies the processing of subscription relationships; however, the messages are broadcasted to all the proxy, most of the messages are invalid for each proxy, namely, the invalid messages are amplified, and a large number of invalid messages cause great waste on network resources and CPU resources; moreover, since the message is broadcast directly to all proxy, when the message volume reaches the single-machine load bottleneck, the horizontal capacity expansion will lose any effect.
The other method is that an upper layer service or a push service entrance processes a subscription relationship, namely, the subscription relationship between a room and a proxy is inquired at the push entrance, then a Message Queue (MQ) routing rule is set, and then the proxy pushes the subscription relationship to a client according to a local subscription relationship.
Disclosure of Invention
The invention provides a message pushing method, a message pushing device, electronic equipment and a storage medium, which are used for solving the technical problems that the subscription relationship between a channel and an agent layer is uncontrollable and one channel can be subscribed by a plurality of agent layers in the existing message pushing method.
The invention provides a message pushing method, which comprises the following steps:
receiving a first subscription request of a preset client aiming at a preset channel through a preset gateway, and sending the first subscription request to a preset first proxy layer;
converting the first subscription request into a second subscription request through the first proxy layer, and sending the second subscription request to a preset centralization component;
responding to the second subscription request through the centralized component to determine a target agent layer, and judging whether the target agent layer is the same as the first agent layer;
if the channel is the same as the target channel, returning a successful subscription message to the client through the first proxy layer, and generating a subscription relation between the target proxy layer and the channel;
and when a push request aiming at the channel is received, sending a push message corresponding to the push request to a corresponding client based on the subscription relation.
Optionally, further comprising;
if the target agent layer is different from the first agent layer, returning an agent layer identifier of the target agent layer to the client through the first agent layer; the proxy layer identification is used for the client to initiate secondary subscription.
Optionally, the step of determining, by the centralized component, a target agent layer in response to the second subscription request includes:
judging whether a subscription relation corresponding to the channel exists or not through the centralized component;
if yes, determining a target agent layer according to the subscription relation;
if not, a second agent layer is distributed for the channel, and the second agent layer is used as a target agent layer of the channel.
Optionally, when receiving a push request for the channel, the step of sending the push request to the client based on the subscription relationship includes:
when a pushing request aiming at the channel is received, acquiring a proxy layer identifier corresponding to the channel based on the subscription relation, and sending the proxy layer identifier to a preset message queue;
sending the push message corresponding to the push request to a target agent layer corresponding to the agent layer identification through the message queue; to send the push message to the client through the target proxy layer.
The invention provides a message pushing device, comprising:
the first subscription request sending module is used for receiving a first subscription request of a preset client terminal for a preset channel through a preset gateway and sending the first subscription request to a preset first proxy layer;
the second subscription request sending module is used for converting the first subscription request into a second subscription request through the first proxy layer and sending the second subscription request to a preset centralized component;
a target agent layer determining module, configured to determine a target agent layer in response to the second subscription request through the centralized component, and determine whether the target agent layer is the same as the first agent layer;
a subscription success message returning module, configured to return a subscription success message to the client through the first proxy layer if the subscription success message is the same as the subscription success message, and generate a subscription relationship between the target proxy layer and the channel;
and the pushing module is used for sending a pushing message corresponding to the pushing request to a corresponding client based on the subscription relation when the pushing request aiming at the channel is received.
Optionally, further comprising;
the proxy layer identifier returning module is used for returning the proxy layer identifier of the target proxy layer to the client through the first proxy layer if the target proxy layer is different from the first proxy layer; the proxy layer identification is used for the client to initiate secondary subscription.
Optionally, the target agent layer determining module includes:
a subscription relation judging submodule, configured to judge whether a subscription relation corresponding to the channel exists through the centralized component;
the first target agent layer determining submodule is used for determining a target agent layer according to the subscription relation if the first target agent layer determining submodule is used for determining the target agent layer according to the subscription relation;
and the second target agent layer determining submodule is used for distributing a second agent layer to the channel if the channel is not distributed, and using the second agent layer as the target agent layer of the channel.
Optionally, the pushing module includes:
the agent layer identifier sending submodule is used for acquiring an agent layer identifier corresponding to the channel based on the subscription relation when a pushing request aiming at the channel is received, and sending the agent layer identifier to a preset message queue;
the pushing sub-module is used for sending the pushing relation corresponding to the pushing request to the target agent layer corresponding to the agent layer identifier through the message queue; to send the push message to the client through the target proxy layer.
The invention also provides an electronic device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the message pushing method according to any one of the above instructions in the program code.
The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium is used for storing program codes, and the program codes are used for executing the message pushing method as described in any one of the above.
According to the technical scheme, the invention has the following advantages: the method comprises the steps that a first subscription request of a preset client for a preset channel is received through a preset gateway, and the first subscription request is sent to a preset first proxy layer; converting the first subscription request into a second subscription request through a first agent layer, and sending the second subscription request to a preset centralization component; responding to the first subscription request through the centralized component to determine a target agent layer, and judging whether the target agent layer is the same as the first agent layer; if the channel is the same as the target channel, returning a successful subscription message to the client through the first proxy layer, and generating a subscription relation between the target proxy layer and the channel; when the push request aiming at the channel is received, the push request is sent to the corresponding client based on the subscription relation. The method solves the technical problems that the subscription relationship between the channels and the agent layers is uncontrollable and one channel can be subscribed by a plurality of agent layers in the existing message pushing method.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without inventive exercise.
Fig. 1 is a flowchart illustrating steps of a message pushing method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating steps of a message pushing method according to another embodiment of the present invention;
fig. 3 is an architecture diagram of a message pushing process according to an embodiment of the present invention;
fig. 4 is a block diagram of a message pushing apparatus according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a message pushing method, a message pushing device, electronic equipment and a storage medium, which are used for solving the technical problems that the subscription relationship between a channel and an agent layer is uncontrollable and one channel can be subscribed by a plurality of agent layers in the existing message pushing method.
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the embodiments described below are only a part of the embodiments of the present invention, 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 invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating a message pushing method according to an embodiment of the present invention.
The embodiment of the invention provides a message pushing method, which specifically comprises the following steps:
the proxy layer proxy mainly provides a plurality of access protocols, maintains the client connection and the subscription relationship between the client and the channel, consumes the messages from the message queue, pushes the messages to the client and establishes long connection with the centralized component controller. The access protocol provided by the proxy layer proxy may be GRPC, WebSocket, or the like. GRPC and WebSocket are both long-connection, can meet the pushing requirement, and are provided with http headers, and the gateways can perform routing through header information.
The centralized component controller component may process, according to the channel number fragment, a subscription request for the channel and perform load scheduling on the channel, and synchronize metadata of a subscription relationship of the channel-proxy with a push-server (push-server). In the embodiment of the present invention, a plurality of stateful controller components may form a cluster to implement control on different channels.
In the embodiment of the invention, when a first subscription request of a preset client for a preset channel is received through a preset gateway, the first subscription request has no header information, so that the first subscription request can be randomly sent to a proxy-n, the proxy-n can change the subscription request of the client for the channel into a second subscription request of the proxy-n for the channel, and the second subscription request is sent to a centralized component for processing.
The first agent layer can be selected according to the actual load condition of each agent layer.
103, responding to the second subscription request through the centralized component to determine a target agent layer, and judging whether the target agent layer is the same as the first agent layer;
in the embodiment of the present invention, when receiving the second subscription request, the centralized component acquires the target proxy layer corresponding to the channel. At this time, it is necessary to determine whether the target proxy layer is the same as the first proxy layer, so as to determine whether the channel subscription is successful.
when the target agent layer is the same as the first agent layer, the subscription is indicated to be successful. At this time, the centralized component may return a subscription success message to the target proxy layer to forward the subscription success message to the client through the target proxy layer. In addition, the centralization component generates and stores the subscription relationship between the channel and the target agent layer, so as to facilitate the subsequent searching of the target agent layer corresponding to the channel based on the subscription relationship.
And 105, when a push request aiming at the channel is received, sending a push message corresponding to the push request to a corresponding client based on the subscription relation.
In the embodiment of the present invention, when a push request for the channel is received, a push message corresponding to the push request may be sent to a corresponding client based on a subscription relationship.
The method comprises the steps that a first subscription request of a preset client for a preset channel is received through a preset gateway, and the first subscription request is sent to a preset first proxy layer; converting the first subscription request into a second subscription request through the first agent layer, and sending the second subscription request to a preset centralization component; responding to the first subscription request through the centralized component to determine a target agent layer, and judging whether the target agent layer is the same as the first agent layer; if the channel is the same as the target channel, returning a successful subscription message to the client through the first proxy layer, and generating a subscription relation between the target proxy layer and the channel; when a push request aiming at a channel is received, a push message corresponding to the push request is sent to a corresponding client based on the subscription relation. The technical problems that the subscription relationship between a channel and an agent layer is uncontrollable and one channel can be subscribed by a plurality of agent layers in the existing message pushing method are solved.
Referring to fig. 2, fig. 2 is a flowchart illustrating a message push method according to another embodiment of the present invention. The method specifically comprises the following steps:
the steps 201-.
in the embodiment of the present invention, when receiving the second subscription request, the centralized component acquires the target proxy layer corresponding to the channel. Wherein the step of determining, by the centralized component, the target agent layer in response to the second subscription request may comprise:
s31, judging whether a subscription relation corresponding to the channel exists through the centralization component;
s32, if yes, determining a target agent layer according to the subscription relationship;
s33, if not, allocating a second proxy layer for the channel, and using the second proxy layer as the target proxy layer of the channel.
In a specific implementation, after receiving the second subscription request, the centralized component first determines whether an agent layer subscribes to the channel, and if so, determines the agent layer where the channel is located as a target agent layer; if not, a second agent layer is dynamically allocated to the channel as a target agent layer, and the subscription relationship is registered in the centralized component cluster.
Then, whether the target agent layer and the first agent layer are the same or not is judged to judge whether the channel subscription is successful or not.
if the first proxy layer is the same as the target proxy layer, a successful subscription message is returned to the target proxy layer, and the target proxy layer can forward the successful subscription message and the identifier of the target proxy layer or the proxy layer logic grouping where the target proxy layer is located to the corresponding client.
if the target agent layer is different from the first agent layer, returning the agent layer identifier of the target agent layer or the identifier of the logic group where the target agent layer is located to the client, and then disconnecting the client; the client may add an identifier (e.g., ID) of the target proxy layer or the logical group in which the target proxy layer is located to the header of the http request, generate a third subscription request, re-initiate the subscription request, and the gateway forwards the subscription request to the specified proxy layer or the logical group in which the proxy layer is located according to the ID in the header, and re-initiate the subscription to the centralized component through the proxy layer. To complete the client's subscription to the channel.
In the embodiment of the invention, the centralization component is connected to a push service (push-server) through long connection, and the centralization component synchronizes the subscription relation in the form of channel-proxy to the push-server in an incremental or full mode. When a channel push request comes, the push-server can query a local subscription relationship to obtain one or more keys, wherein the keys are identifiers of proxy layers or proxy logical groups (groups), such as IDs, the keys are used as routing-keys of message queues to deliver the push request, and further forward the push message to a target proxy layer corresponding to the channel through the message queues, and the target proxy layer sends the push message to a corresponding client according to a connection relationship between the target proxy layer and the client.
It should be noted that the routing-key is used for routing the message queue MQ, the producer specifies the routing-key of the message, and only the user who subscribes to the routing-key can receive the message. In one example, when the routing-key for a message delivery is proxy-1, only the user whose proxy layer is proxy-1 can receive the message, but other users cannot receive the message. If the routing-key is group-1, only users belonging to group-1 can receive the message.
For ease of understanding, the following description is given by way of specific examples.
Referring to fig. 3, fig. 3 is an architecture diagram of a message pushing process according to an embodiment of the present invention.
As shown in fig. 3, the entire architecture may include six parts, including: proxy, controller component, gateway, MQ component (message queue), push-server, and presence component.
The proxy is mainly used for providing various access protocols, maintaining client connection and subscription relation between the client and a channel, consuming and pushing messages from a message queue to the client, establishing long connection with a controller component, reporting a state, and receiving channel subscription behaviors and scheduling instructions.
In specific application, a client is connected to a proxy through a GRPC or WebSocket, a gateway distributes flow to the proxy according to a request header, when the proxy receives a client subscription request, the subscription request is sent to a controller, and then a subscription success message or a redirection response is sent to the client according to the response content of the controller; the client can carry the proxy layer identification/proxy layer logical grouping identification carried in the redirection response to reinitiate the subscription request. The Proxy, upon receiving the message from the MQ, may send the message to the client based on the local subscription relationship. It should be noted that, the proxy subscribes to three routing-keys, namely, proxy ID, group ID and ALL, from the MQ at startup.
And the controller component can be formed into a cluster by a plurality of stateful controller components, and each controller component processes the subscription request of the channel and performs load scheduling according to the channel number slices. And simultaneously, subscribing the metadata of the relation to the push-server synchronous channel-proxy.
In a specific application, the controller component may receive a subscription request from a proxy, select an appropriate proxy according to a load condition, and then reply a subscription success message or reply a redirection response with a proxy ID to the client through the proxy. In addition, subscription relationships and proxy load states may also be synchronized to other controller components.
And (3) MQ component: and the rabbitMQ cluster is responsible for routing the message from the push-server to the proxy.
push-server: and establishing a long connection synchronous channel-proxy subscription relationship with the controller component, receiving the push request, and delivering the push request to the MQ according to the subscription relationship.
In a specific application, the function of the push-server is as follows:
1. synchronizing the subscription relationship of the channels from the controller component through the streaming GRPC, and the policy of channel scheduling.
2. Single pushing: from the presence service query to the proxy ID.
3. Broadcasting: and inquiring proxy ID or group ID from the local channel subscription relationship by using the channel ID, and if the proxy ID or group ID is not found, calculating the proxy ID or group ID by using a scheduling strategy.
4. The message is sent to the MQ with the proxy ID or group ID.
Presence component: the system mainly comprises a single-push component used for storing the user ID-proxy subscription relation.
In the embodiment of the present invention, the frequency channel may also be scheduled. The scheduling process may include capacity expansion, capacity reduction, eviction, and the like.
And (3) an eviction process: the centralized component sends an instruction to the agent layer, the client sides in a certain room are all or in a specified number are expelled, the identification of the agent layer/logic grouping scheduled after the expulsion is carried, the agent layer sends the expelling instruction and the identification of a new agent layer/logic grouping to the corresponding client sides according to the instruction content, the overtime time is set (the overtime time is used for preventing the client sides from not processing, the connection between the client sides can be automatically disconnected after the overtime is finished), the client sides initiate subscription requests again according to the content of the expelling instruction, and the old connection is disconnected after the subscription is successful. It should be noted that the reason for creating a connection and then disconnecting the old connection is to prevent the subscription from failing. The capacity reduction process is similar to the eviction process and is not described in detail herein.
Capacity expansion process: the centralized component judges whether an agent layer or a channel needs capacity expansion according to indexes such as subscription conditions, agent layer load conditions, channel number and the like, if capacity expansion is needed, a new agent layer or agent layer logic grouping is written into a subscription relation, a trigger threshold value is set and synchronized into a centralized component cluster and a push-server, and all new subscriptions are transferred to the new agent layer afterwards. It should be noted that the capacity expansion operation may be triggered automatically when the threshold is reached by setting respective corresponding thresholds of different indexes, or triggered by external manual operation.
Referring to fig. 4, fig. 4 is a block diagram of a message pushing device according to an embodiment of the present invention.
The embodiment of the invention provides a message pushing device, which comprises:
a first subscription request sending module 401, configured to receive, through a preset gateway, a first subscription request for a preset channel from a preset client, and send the first subscription request to a preset first proxy layer;
a second subscription request sending module 402, configured to convert the first subscription request into a second subscription request through the first proxy layer, and send the second subscription request to the preset centralized component;
a target agent layer determining module 403, configured to determine a target agent layer in response to the second subscription request through the centralized component, and determine whether the target agent layer is the same as the first agent layer;
a subscription success message returning module 404, configured to return a subscription success message to the client through the first proxy layer if the subscription success message is the same as the subscription success message, and generate a subscription relationship between the target proxy layer and the channel;
the push module 405 is configured to, when receiving a push request for a channel, send a push message corresponding to the push request to a corresponding client based on a subscription relationship.
In an embodiment of the invention, the apparatus further comprises;
the proxy layer identifier returning module is used for returning the proxy layer identifier of the target proxy layer to the client through the first proxy layer if the target proxy layer is different from the first proxy layer; the proxy layer identification is used for the client to initiate secondary subscription.
In this embodiment of the present invention, the target agent layer determining module 403 includes:
the subscription relation judgment submodule is used for judging whether a subscription relation corresponding to a channel exists or not through the centralized component;
the first target agent layer determining submodule is used for determining the target agent layer according to the subscription relation if the first target agent layer determining submodule is used for determining the target agent layer according to the subscription relation;
and the second target agent layer determining submodule is used for distributing a second agent layer for the channel if the channel is not distributed, and using the second agent layer as the target agent layer of the channel.
In this embodiment of the present invention, the pushing module 405 includes:
the agent layer identifier sending submodule is used for acquiring an agent layer identifier corresponding to a channel based on a subscription relation when a pushing request aiming at the channel is received, and sending the agent layer identifier to a preset message queue;
the pushing sub-module is used for sending a pushing message corresponding to the pushing request to a target agent layer corresponding to the agent layer identifier through a message queue; to send the push message to the client through the target proxy layer.
An embodiment of the present invention further provides an electronic device, where the device includes a processor and a memory:
the memory is used for storing the program codes and transmitting the program codes to the processor;
the processor is used for executing the message pushing method of any embodiment of the invention according to instructions in the program codes.
The embodiment of the invention also provides a computer-readable storage medium, which is used for storing a program code, and the program code is used for executing the message pushing method of any embodiment of the invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, in this document, relational terms such as first and second, and the like are 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 terminal 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 terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A message pushing method, comprising:
receiving a first subscription request of a preset client aiming at a preset channel through a preset gateway, and sending the first subscription request to a preset first proxy layer;
converting the first subscription request into a second subscription request through the first proxy layer, and sending the second subscription request to a preset centralization component;
responding to the second subscription request through the centralized component to determine a target agent layer, and judging whether the target agent layer is the same as the first agent layer;
if the channel is the same as the target channel, returning a successful subscription message to the client through the first proxy layer, and generating a subscription relation between the target proxy layer and the channel;
and when a push request aiming at the channel is received, sending a push message corresponding to the push request to a corresponding client based on the subscription relation.
2. The method of claim 1, further comprising;
if the target agent layer is different from the first agent layer, returning an agent layer identifier of the target agent layer to the client through the first agent layer; the proxy layer identification is used for the client to initiate secondary subscription.
3. The method of claim 2, wherein the step of determining, by the centralized component, a target agent layer in response to the second subscription request comprises:
judging whether a subscription relation corresponding to the channel exists or not through the centralized component;
if yes, determining a target agent layer according to the subscription relation;
if not, a second agent layer is distributed for the channel, and the second agent layer is used as a target agent layer of the channel.
4. The method according to claim 1, wherein the step of sending, when receiving a push request for the channel, a push message corresponding to the push request to the client based on the subscription relationship includes:
when a pushing request aiming at the channel is received, acquiring a proxy layer identifier corresponding to the channel based on the subscription relation, and sending the proxy layer identifier to a preset message queue;
sending the push message corresponding to the push request to a target agent layer corresponding to the agent layer identification through the message queue; to send the push message to the client through the target proxy layer.
5. A message push apparatus, comprising:
the first subscription request sending module is used for receiving a first subscription request of a preset client terminal for a preset channel through a preset gateway and sending the first subscription request to a preset first proxy layer;
the second subscription request sending module is used for converting the first subscription request into a second subscription request through the first proxy layer and sending the second subscription request to a preset centralized component;
a target agent layer determining module, configured to determine a target agent layer in response to the second subscription request through the centralized component, and determine whether the target agent layer is the same as the first agent layer;
a subscription success message returning module, configured to return a subscription success message to the client through the first proxy layer if the subscription success message is the same as the subscription success message, and generate a subscription relationship between the target proxy layer and the channel;
and the pushing module is used for sending a pushing message corresponding to the pushing request to a corresponding client based on the subscription relation when the pushing request aiming at the channel is received.
6. The apparatus of claim 5, further comprising;
the proxy layer identifier returning module is used for returning the proxy layer identifier of the target proxy layer to the client through the first proxy layer if the target proxy layer is different from the first proxy layer; the proxy layer identification is used for the client to initiate secondary subscription.
7. The apparatus of claim 6, wherein the target agent layer determination module comprises:
a subscription relation judging submodule, configured to judge whether a subscription relation corresponding to the channel exists through the centralized component;
the first target agent layer determining submodule is used for determining a target agent layer according to the subscription relation if the first target agent layer determining submodule is used for determining the target agent layer according to the subscription relation;
and the second target agent layer determining submodule is used for distributing a second agent layer to the channel if the channel is not distributed, and using the second agent layer as the target agent layer of the channel.
8. The apparatus of claim 5, wherein the pushing module comprises:
the agent layer identifier sending submodule is used for acquiring an agent layer identifier corresponding to the channel based on the subscription relation when a pushing request aiming at the channel is received, and sending the agent layer identifier to a preset message queue;
the pushing sub-module is used for sending the pushing message corresponding to the pushing request to the target agent layer corresponding to the agent layer identifier through the message queue; to send the push message to the client through the target proxy layer.
9. An electronic device, comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the message pushing method according to any one of claims 1-4 according to instructions in the program code.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium is configured to store a program code for executing the message pushing method of any one of claims 1-4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110372993.5A CN113014672B (en) | 2021-04-07 | 2021-04-07 | Message pushing method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110372993.5A CN113014672B (en) | 2021-04-07 | 2021-04-07 | Message pushing method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113014672A CN113014672A (en) | 2021-06-22 |
CN113014672B true CN113014672B (en) | 2022-05-17 |
Family
ID=76388004
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110372993.5A Active CN113014672B (en) | 2021-04-07 | 2021-04-07 | Message pushing method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113014672B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116112570A (en) * | 2021-11-10 | 2023-05-12 | 青岛海尔科技有限公司 | Message processing method, device, electronic equipment and storage medium |
CN116319650B (en) * | 2023-05-22 | 2024-01-30 | 三一海洋重工有限公司 | Port equipment data distribution method, device and system and container crane |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2622047A1 (en) * | 2007-02-26 | 2008-08-26 | Research In Motion Limited | Method and system for correlation of mobile channel subscription with delivery context |
WO2018013916A1 (en) * | 2016-07-14 | 2018-01-18 | Convida Wireless, Llc | Subscription and notification service |
CN108390933A (en) * | 2018-02-26 | 2018-08-10 | 广州华多网络科技有限公司 | Message distributing method, device, server and storage medium |
CN111163159A (en) * | 2019-12-27 | 2020-05-15 | 中国平安人寿保险股份有限公司 | Message subscription method, device, server and computer readable storage medium |
CN111711663A (en) * | 2020-05-26 | 2020-09-25 | 北京金山云网络技术有限公司 | Processing method and device for publishing and subscribing services and electronic equipment |
CN111770172A (en) * | 2020-06-29 | 2020-10-13 | 深圳前海微众银行股份有限公司 | Message middleware consumption proxy method, device, proxy server and storage medium |
-
2021
- 2021-04-07 CN CN202110372993.5A patent/CN113014672B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2622047A1 (en) * | 2007-02-26 | 2008-08-26 | Research In Motion Limited | Method and system for correlation of mobile channel subscription with delivery context |
WO2018013916A1 (en) * | 2016-07-14 | 2018-01-18 | Convida Wireless, Llc | Subscription and notification service |
CN108390933A (en) * | 2018-02-26 | 2018-08-10 | 广州华多网络科技有限公司 | Message distributing method, device, server and storage medium |
CN111163159A (en) * | 2019-12-27 | 2020-05-15 | 中国平安人寿保险股份有限公司 | Message subscription method, device, server and computer readable storage medium |
CN111711663A (en) * | 2020-05-26 | 2020-09-25 | 北京金山云网络技术有限公司 | Processing method and device for publishing and subscribing services and electronic equipment |
CN111770172A (en) * | 2020-06-29 | 2020-10-13 | 深圳前海微众银行股份有限公司 | Message middleware consumption proxy method, device, proxy server and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113014672A (en) | 2021-06-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3591941B1 (en) | Live video stream guiding method, ccl server and system | |
CN106161593B (en) | Message polling method, server and communication system | |
KR102305064B1 (en) | Video live broadcasting method and device | |
CN110336848B (en) | Scheduling method, scheduling system and scheduling equipment for access request | |
CN113014672B (en) | Message pushing method and device, electronic equipment and storage medium | |
CN112512100B (en) | Slice priority-based AMF (advanced metering framework) redirection method and newly-added management network element | |
CN110311967B (en) | Method, device, equipment and system for pushing data and receiving data | |
EP3709664B1 (en) | Stream pushing method, system and server | |
CN111355798A (en) | Data distribution method and system | |
US11102319B2 (en) | Method, system and server for stream-pushing | |
CN113811013B (en) | Cluster capacity dynamic adjustment method, device, storage medium and communication system | |
CN113747186B (en) | Data processing method, device, terminal and storage medium | |
CN103312593B (en) | A kind of message distributing system and method | |
CN105577561A (en) | Method and system for realizing load balancing between virtualized network elements, and virtualized network element | |
WO2023061060A1 (en) | Audio and video code stream scheduling method, system, medium and electronic apparatus | |
CN114064275A (en) | Data processing method and device | |
CN102333280B (en) | A kind of method, system and the Service Process Server of business cipher key renewal | |
CN115208955B (en) | Method, device, computer equipment and medium for processing resource request | |
US20150074234A1 (en) | Content system and method for chunk-based content delivery | |
CN112423145B (en) | Data processing method, device, system, server and medium | |
CN105634932B (en) | Message pushing method, device, system and computer readable storage medium | |
CN106535112B (en) | Method, device and system for realizing terminal access | |
CN111737029A (en) | Server, data pushing method and data pushing system | |
US20160302055A1 (en) | Information processing system | |
CN110474781B (en) | Method and device for forwarding multicast data |
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 |