CN117155998A - Message pushing method, system, medium and electronic equipment - Google Patents

Message pushing method, system, medium and electronic equipment Download PDF

Info

Publication number
CN117155998A
CN117155998A CN202311175666.6A CN202311175666A CN117155998A CN 117155998 A CN117155998 A CN 117155998A CN 202311175666 A CN202311175666 A CN 202311175666A CN 117155998 A CN117155998 A CN 117155998A
Authority
CN
China
Prior art keywords
target
message
subscription server
subscriber terminal
service
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.)
Pending
Application number
CN202311175666.6A
Other languages
Chinese (zh)
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.)
Douyin Vision Co Ltd
Original Assignee
Douyin Vision 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 Douyin Vision Co Ltd filed Critical Douyin Vision Co Ltd
Priority to CN202311175666.6A priority Critical patent/CN117155998A/en
Publication of CN117155998A publication Critical patent/CN117155998A/en
Pending legal-status Critical Current

Links

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
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Abstract

The method comprises the steps of obtaining target information, writing the target information into first target service of a subscription server, and then pushing the target information to a subscriber terminal subscribing the first target service through the first target service, so that the subscriber terminal can be ensured to receive the information in time under the condition that the subscriber terminal does not need to constantly poll the subscription server. And, since the target message is written into the first target service for caching, rather than being written into the database, the pressure for storing the message can be reduced.

Description

Message pushing method, system, medium and electronic equipment
Technical Field
The disclosure relates to the technical field of communication, and in particular relates to a message pushing method, a system, a medium and electronic equipment.
Background
In the related art, a message server pushes a message to a client, the message server needs to write the message into a database, and the client periodically queries the message server to obtain the message stored on the message server. However, because the number of clients facing the message service end is extremely large, the frequency of the message service end for processing the query is extremely high, which results in that the message service end needs to consume extremely much resources, and the message can not be guaranteed to be sent to the clients in time.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, the present disclosure provides a message pushing method, performed by a subscription server, the method comprising:
acquiring a target message;
writing the target message into a first target service of the subscription server, wherein the first target service is a service which runs in the subscription server and matches the target message;
and pushing the target message to a subscriber terminal subscribed to the first target service through the first target service.
In a second aspect, the present disclosure provides a message pushing method performed by a subscriber terminal, the method comprising:
receiving a target message sent by a first target service subscribed by the subscriber terminal;
the first target service is a service which runs in a subscription server and is matched with the target message, and the target message is written into the first target service by the subscription server and is sent to a subscriber terminal subscribed to the first target service through the first target service.
In a third aspect, the present disclosure provides a message pushing system, comprising:
a subscription server configured to obtain a target message, and write the target message into a first target service of the subscription server, wherein the first target service is a service running in the subscription server and matching the target message;
the subscription server is configured to push the target message to a subscriber terminal subscribing to the first target service through the first target service;
the subscriber terminal is configured to receive the target message sent by the subscription server.
In a fourth aspect, the present disclosure provides a computer readable medium having stored thereon a computer program which, when executed by a processing device, implements the steps of the method of the first aspect, or implements the steps of the method of the second aspect.
In a fifth aspect, the present disclosure provides an electronic device comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method according to the first aspect or to carry out the steps of the method according to the second aspect.
Based on the technical scheme, the target message is acquired and written into the first target service of the subscription server, and then the target message is pushed to the subscriber terminal subscribing to the first target service through the first target service, so that the subscriber terminal can be ensured to receive the message in time without continuously polling the subscription server by the subscriber terminal. And, since the target message is written into the first target service for caching, rather than being written into the database, the pressure for storing the message can be reduced.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale. In the drawings:
fig. 1 is a block diagram of a message pushing system, according to an example embodiment.
Fig. 2 is a flow chart illustrating a message pushing method according to an exemplary embodiment.
FIG. 3 is a flow chart illustrating a service transfer according to an exemplary embodiment.
Fig. 4 is a flow chart illustrating a message pushing method according to yet another exemplary embodiment.
Fig. 5 is a flow chart illustrating a message pushing method according to another exemplary embodiment.
Fig. 6 is a schematic diagram illustrating a modular connection of a message pushing device according to an exemplary embodiment.
Fig. 7 is a schematic diagram illustrating a modular connection of a message pushing device according to another exemplary embodiment.
Fig. 8 is a schematic diagram of a structure of an electronic device according to an exemplary embodiment.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Fig. 1 is a block diagram of a message pushing system, according to an example embodiment. As shown in fig. 1, the message pushing method provided by the embodiment of the present disclosure is applicable to the system shown in fig. 1, and the system may include at least one subscription server 101 and a subscriber terminal 102. The subscription server 101 and the subscriber terminal 102 may perform data interaction through wired connection or wireless connection.
The subscription server 101 obtains the target message and writes the target message to the first target service of the subscription server 101. The first target service is a service that runs in the subscription server 101 that matches the target message. The subscription server 101 pushes a target message to a subscriber terminal 102 subscribed to a first target service through the first target service. The subscriber terminal 102 receives a target message sent by a first target service running on the subscription server 101, to which the subscriber terminal 102 subscribes.
Of course, the message pushing system may further include a message distribution server 103, where the message distribution server 103 writes the target message into a message queue corresponding to the service identifier according to the service identifier of the first target service corresponding to the target message, and the subscription server 101 acquires the target message in the message queue.
In this way, the subscriber terminal 102 does not need to query the subscription server 101 for new messages at regular time, but waits for the subscription server 101 to send the target message to the subscriber terminal 102 through the first target service subscribed by the subscriber terminal 102, so that the message can be guaranteed to be sent to the subscriber terminal 102 in time, and resources of the subscription server 101 can be saved. In addition, through the message pushing system provided by the embodiment of the disclosure, the message distribution of the subscriber terminals in the billion level can be processed.
Fig. 2 is a flow chart illustrating a message pushing method according to an exemplary embodiment. As shown in fig. 2, an embodiment of the present disclosure provides a message pushing method, which may be performed by the subscription server shown in fig. 1, and in particular, may be performed by a message pushing device, which may be implemented by software and/or hardware, and configured in the subscription server. As shown in fig. 2, the method may include the following steps.
In step 210, a target message is acquired.
Here, the target message may refer to a message transmitted to a subscriber terminal of the target. The subscription server may receive the target message sent by the message distribution server, e.g., the message distribution server needs to push the target message to the subscriber terminal, and the message distribution server sends the target message to the subscription server. Of course, the subscription server may also obtain the target message through other means.
In step 220, the target message is written to a first target service of the subscription server.
Here, after the subscription server acquires the target message, the target message is written into the first target service of the subscription server. Wherein the first target service is a service running in the subscription server that matches the target message. For example, the target message is a message sent to a particular subscriber terminal, and the first target service is a service running in a subscription server for sending messages to the particular subscriber terminal.
It should be noted that a plurality of services for transmitting messages to subscriber terminals subscribing to the service may be run in the subscription server. For example, service a, service B, and service C may run in a subscription server. And the subscription server receives the target message and writes the target message into the service where the receiver information is located according to the receiver information of the target message. Wherein the recipient information of the target message may be an identifier to which the target message belongs. In a message push system, each service may have a globally unique identifier. For example, assuming that the receiver information representation of the target message is that the target information is sent to the subscriber terminal D, if the subscriber terminal D subscribes to the service a in the subscription server, the service a is the first target service corresponding to the target message, the identifier carried in the target message is the identifier of the service a, and the subscription server writes the target message into the service a.
It should be understood that a service running in a subscription server may be understood as a mailbox. The mailbox is used for sending a message written in the mailbox to a subscriber terminal subscribed to the mailbox.
In addition, writing the target message into the first target service of the subscription server can be understood as that the subscription server caches the target message, and the target message is not written into the database any more, so that the storage resource of the subscription server is saved.
In step 230, the targeted message is pushed through the first targeted service to a subscriber terminal subscribed to the first targeted service.
Here, the subscription server may push the new message to the subscriber terminal subscribed to the first target service through the first target service in case that the first target service has the new message, thereby enabling the subscriber terminal to receive the new message in real time. And the subscription server writes the target message into the first target service, so that the first target service has new message, and pushes the target message to a subscriber terminal subscribing to the first target service through the first target service.
It should be appreciated that a first targeted service may be subscribed to by one or more subscriber terminals, and when a new message exists for the first targeted service, the subscription server sends the new message to all subscriber terminals subscribed to the first targeted service via the first targeted service.
For example, a service running in a subscription server may be understood as a mailbox. When a new message exists in the mailbox of the subscription server, the mailbox sends the new message to all subscriber terminals subscribing to the mailbox.
Therefore, the target message is acquired and written into the first target service of the subscription server, and then the target message is pushed to the subscriber terminal subscribing to the first target service through the first target service, so that the subscriber terminal can be ensured to receive the message in time under the condition that the subscriber terminal does not need to constantly poll the subscription server. And, since the target message is written into the first target service for caching, rather than being written into the database, the pressure for storing the message can be reduced.
In some implementations, the subscription server may also send metadata to a subscriber terminal associated with a first target service running in the subscription server to cause the subscriber terminal to subscribe to the first target service running in the subscription server according to the received metadata.
Here, the metadata is used to cause the subscriber terminal to subscribe to a first target service corresponding to the metadata according to the metadata. The metadata transmitted from the subscription server to the subscriber terminal may include first address information of the subscription server and second address information of the first target service. The subscriber terminal receives and caches the metadata, subscribes and accesses a subscription server corresponding to the first address information according to the first address information and the second address information carried in the metadata, and subscribes a first target service corresponding to the second address information running in the subscription server.
It should be understood that metadata is used for resource searching by the subscriber terminal, through which the subscriber terminal can subscribe to a service running in the subscription server of the target corresponding to the metadata. For example, a service a, a service B, and a service C may be run in the subscription server, and assuming that the service a is used to push a message to the subscriber terminal D, the service B is used to push a message to the subscriber terminal E, and the service C is used to push a message to the subscriber terminal F, the subscription server sends first metadata for subscribing to the service a to the subscriber terminal D, the subscription server sends second metadata for subscribing to the service B to the subscriber terminal E, and the subscription server sends third metadata for subscribing to the service C to the subscriber terminal F.
It should be noted that, the subscription server may write the metadata into the consistency hash table for storage, and the subscriber terminal combines the consistency hash table according to the received metadata to find the service corresponding to the metadata, thereby subscribing the service.
Thus, by transmitting metadata to the subscriber terminal associated with the first target service running in the subscription server, the subscriber terminal can be made to subscribe to the first target service corresponding to the metadata according to the metadata, and, by the metadata, the subscriber terminal can maintain less information of the subscription server.
In some implementations, in step 210, the subscription server may obtain the target message from the message queue corresponding to the subscription server in sequence.
Here, each subscription server may have a corresponding message queue for sequentially writing messages to services running in the subscription server.
The target message in the message queue is that the message distribution server writes the target message into the message queue corresponding to the service identifier according to the service identifier of the first target service corresponding to the target message.
The service identification of the first target service corresponding to the target message may refer to an identifier of a service for transmitting the target message. In a message push system, each service may have a globally unique identifier to distinguish between the individual services in the message push system.
And the message distribution server writes the message into a message queue of a subscription server corresponding to the service identifier carried by the message according to the service identifier carried by each message. And then, the subscription server sequentially takes out the messages from the message queue according to the sequence of writing the messages into the message queue, and writes the messages into the service corresponding to the subscription server.
It should be noted that, the subscription server may obtain the target message from the message queue corresponding to the subscription server in sequence through a single thread.
Thus, by sequentially fetching the messages from the message queue, the messages can be ensured to be orderly written into the service of the subscription server.
In some implementations, in step 220, a message identification of the target message may be generated based on the optimistic lock mechanism and the target message written to the first target service of the subscription server based on the message identification.
Here, after the subscription server sequentially fetches the target message from the message queue corresponding to the subscription server, the subscription server generates the message identifier of the target message based on the optimistic lock mechanism. Wherein the message identification of the target message may be generated by the optimistic lock mechanism and the message sequence number of the target message in the message queue, and accordingly the generated message identification corresponds to a sequential message sequence number that is capable of using the optimistic lock mechanism.
It should be noted that, the optimistic lock mechanism is to assume that data will not cause a conflict in a general case, so that when the data is submitted to update, whether the data is in conflict or not is detected formally. Thus, by optimistically locked message identification, a conflict check is performed when writing the target message to the first target service of the subscription server to ensure that the target message is uniquely assigned to one service.
It should be appreciated that write events of the message queue may be handled by a single thread. That is, the subscription server sequentially fetches the target message from the message queue through a single thread, and then writes the target message into the corresponding first target service, again based on the single thread. Because the write-in event of the same message queue is processed through a single thread, the write-in sequence and the processing sequence of the messages are consistent, the generated optimistically-locked message identification can be ensured not to conflict, and meanwhile, the message write-in service is also sequentially carried out, so that the messages can be quickly written in the cache of the service, and the storage pressure of a database is reduced.
Thus, by the optimistically locked message identification, it is ensured that the message is uniquely assigned to a service, thereby ensuring ordered writing of the message, and improving the speed of writing the message into the service due to the optimistically locked mechanism.
FIG. 3 is a flow chart illustrating a service transfer according to an exemplary embodiment. In some implementations, as shown in fig. 3, the services run by one subscription server may be transferred to another server by the following steps.
In step 310, a second target service running on the other subscription server is transferred to the present subscription server in response to the service transfer request.
Here, the service transfer request may be sent by the management end to a target subscription server in the message push system, where the service transfer request is used to instruct the target subscription server to connect to a second target service running in another subscription server. Other subscription servers may refer to subscription servers that are down or down in the message push system.
The management end can determine state information corresponding to each subscription server in the message pushing system, and determine a target subscription server in all subscription servers of the message pushing system according to the state information.
The state information corresponding to the subscription server may refer to a message load of the subscription server. For example, the status information may refer to the number of subscriber terminals for which the subscription server is responsible for notification. Accordingly, the target subscription server may be a node server with the least message load in the message pushing system.
After the subscription server receives the service transfer request, a second target service running on other subscription servers is created in the subscription server in response to the service transfer request, so that the second target service running on the other subscription servers is transferred to the subscription server. The subscription server refers to a subscription server for receiving the second target service to be transferred. It should be appreciated that in a message push system, each of the subscription servers that are functioning properly may become a subscription server that receives the second target service that needs to be diverted.
It is worth noting that the second target service transferred to the subscription server has the authority which is consistent with the authority of the service originally running in the subscription server. The second target service transferred to the present subscription server may share the message queue of the present subscription server.
In step 320, according to the second target service, the metadata corresponding to the second target service is updated, and updated metadata is obtained.
Here, the original metadata of the second target service running on the other subscription server is directed to the second target service of the other subscription server. After the second target service is transferred to the subscription server, the subscription server needs to update metadata of the transferred second target service, and the updated metadata is used for describing address information of the second target service in the subscription server.
It should be noted that, the updated metadata may be written into the consistent hash table for storage. Subsequently, the subscriber terminal corresponding to the metadata can find the corresponding second target service in the subscription server according to the updated metadata.
In step 330, the updated metadata is sent to the subscriber terminal associated with the second target service.
Here, the present subscription server transmits the updated metadata to the subscriber terminal associated with the second target service, so that the subscriber terminal subscribes to the second target service running in the present subscription server again according to the updated metadata.
The updated metadata is used for enabling the subscriber terminal to subscribe to a second target service corresponding to the updated metadata according to the updated metadata.
It should be appreciated that sending updated metadata to subscriber terminals associated with the second target service may be sending updated metadata to all subscriber terminals that need to be pushed messages by the second target service.
Therefore, when other subscription servers have problems, the second target service of the other subscription servers can be transferred to the subscription server which operates normally, so that the subscriber terminal notified by the second target service can receive new messages in time. And by transferring the second target service to the subscription server which normally operates, the subscription servers of the message pushing system can be shared, and the stability of message notification is ensured.
In some implementations, the subscription server may send the target message to the subscriber terminal via the first target service based on a short connection channel between the subscription server and the subscriber terminal.
Here, the short connection channel is established by the subscriber terminal initiating a request for establishing the short connection channel to the subscription server in the case that the subscriber terminal fails to establish the long connection channel with the corresponding subscription server.
The short connection channel is established by the subscriber terminal initiating a request for establishing the short connection channel to a corresponding subscription server in case the subscriber terminal fails to establish the long connection channel with the subscription server.
The long connection is that the subscriber terminal and the subscription server are not disconnected after the connection is established, and then the long connection channel is continuously used when the subscriber terminal accesses the content on the subscription server again. The short connection means that the subscriber terminal and the subscription server are connected, and the subscriber terminal and the subscription server are disconnected immediately after the data are sent. Illustratively, the long connection channel may be a long connection channel established through WebSocket, a protocol that performs full duplex communications over a single TCP connection. The short connection channel may be a short connection channel established via HTTP (a stateless connection-oriented protocol).
The subscriber terminal can initiate a request for establishing a long connection channel to a corresponding subscription server, and under the condition that the subscriber terminal fails to establish the long connection channel with the corresponding subscription server, the subscriber terminal initiates a request for establishing a short connection channel between the subscriber terminal and the subscription server to the subscription server, and under the condition that the short connection channel is successfully established, the subscription server pushes a target message to the subscriber terminal through a first target service based on the short connection channel.
It is worth noting that the target message sent by the subscription server to the subscriber terminal may include all broadcast messages that the subscriber terminal has not yet received but should receive.
Taking an HTTP request as an example, the subscriber terminal may carry the maximum sequence number of the broadcast message historically received by the subscriber terminal in the HTTP request, after the subscription server receives the HTTP request, establish a short connection channel between the subscriber terminal and the subscription server, and send all the messages stored in the first target service and greater than the maximum sequence number to the subscriber terminal through the first target service and the short connection channel based on the maximum sequence number. For example, if the sequence numbers of the messages received locally by the subscriber terminal are 1, 2, 3, 4, and 5, the HTTP request carries the maximum sequence number of 5. And the serial numbers of the messages stored in the subscription server are respectively 1, 2, 3, 4, 5, 6, 7 and 8, and the subscription server sends the messages with the serial numbers of 6, 7 and 8 to the subscriber terminal through the first target service and the short connection channel.
Therefore, when the establishment of the long connection channel between the subscriber terminal and the subscription server fails, the message is sent to the subscriber terminal through the short connection channel between the subscriber terminal and the subscription server, so that the message can be ensured to be sent to the subscriber terminal in time.
In other embodiments, in case the long connection channel between the subscription server and the subscriber terminal is established successfully, the subscription server may send all messages to the subscriber terminal that the subscriber terminal has not yet received but should receive, based on the long connection channel, through the first target service.
In addition, the subscriber terminal can periodically detect the connection state of the long connection channel, and switch to communicate with the subscription server through the short connection channel under the condition that the connection state represents the failure of establishing the long connection channel, so as to ensure that the message in the subscription server can be timely sent to the subscriber terminal.
Fig. 4 is a flow chart illustrating a message pushing method according to yet another exemplary embodiment. As shown in fig. 4, an embodiment of the present disclosure provides a message pushing method, which may be performed by the subscriber terminal shown in fig. 1, and in particular, may be performed by a message pushing device, which may be implemented by software and/or hardware, and configured in the subscriber terminal. As shown in fig. 4, the method may include the following steps.
In step 410, a target message sent by a first target service subscribed to by a subscriber terminal is received.
Here, the first target service is a service that runs in the subscription server and matches a target message that the subscription server writes the target message into the first target service and transmits to a subscriber terminal subscribed to the first target service through the first target service.
It should be noted that, for the detailed description of step 410, reference may be made to the related description of the above embodiment, which is not repeated here.
Therefore, the subscriber terminal can be ensured to receive the message in time without continuously polling the subscription server by the subscriber terminal. And, since the target message is written into the first target service for caching, rather than being written into the database, the pressure for storing the message can be reduced.
In some implementations, the subscriber terminal may receive and cache metadata sent by the subscription server, and then send a subscription request to the subscription server corresponding to the metadata according to the metadata.
Here, the metadata includes first address information of the subscription server and second address information of the first target service associated with the subscriber terminal. The subscription request is used for enabling the subscription server to allow the subscriber terminal to subscribe to the first target service corresponding to the metadata in response to the subscription request.
The subscriber terminal receives and caches the metadata, subscribes and accesses a subscription server corresponding to the first address information according to the first address information and the second address information carried in the metadata, and subscribes a first target service corresponding to the second address information running in the subscription server.
It should be noted that, for how the subscriber terminal subscribes to the first target service according to the metadata, reference may be made to the related description of the above embodiments, which is not repeated herein.
It should be understood that the metadata received and cached by the subscriber terminal may also be the updated metadata described above, and the principle is consistent and will not be described in detail herein.
Thus, the subscriber terminal can be made to subscribe to the first target service corresponding to the metadata according to the metadata, and through the metadata, the subscriber terminal can maintain less information of the subscription server.
In some implementations, in step 410, the subscriber terminal may send a request to the subscription server for establishing a short connection channel between the subscriber terminal and the subscription server in the event that the subscriber terminal fails to establish a long connection channel with the corresponding subscription server, and receive, in response to establishing the short connection channel, a target message sent by a first target service subscribed to by the subscriber terminal through the short connection channel.
Here, the detailed description of the long connection channel and the short connection channel may be referred to the above embodiments, and will not be repeated here.
It should be noted that, the subscriber terminal sends a request for establishing a short connection channel between the subscriber terminal and the subscription server to the subscription server, and the subscription server responds to the request to establish the short connection channel between the subscriber terminal and the subscription server, so that the subscriber terminal and the subscription server can communicate through the short connection channel. Accordingly, the subscription server pushes the target message to the subscriber terminal over the short connection channel through the first target service.
Therefore, under the condition that the establishment of the long connection channel between the subscriber terminal and the subscription server fails, the subscriber terminal can be ensured to receive the message in time by establishing the short connection channel.
Fig. 5 is a flow chart illustrating a message pushing method according to another exemplary embodiment. As shown in fig. 5, the message pushing method may include the following steps.
S501, a subscription server sends metadata to a subscriber terminal;
s502, receiving and caching metadata by a subscriber terminal;
s503, the subscriber terminal sends a request for subscribing to a first target service according to the metadata;
S504, allowing the subscriber terminal to subscribe to a first target service by the subscription server in response to the request;
s505, the subscription server acquires the target message;
s506, the subscription server writes the target message into the first target service;
s507, the subscription server pushes a target message to the subscriber terminal through the first target service;
s508, the subscriber terminal receives the target message.
It should be noted that, the detailed descriptions of the above steps S501 to S508 can be referred to the related descriptions of the above embodiments, and are not repeated here.
Fig. 6 is a schematic diagram illustrating a modular connection of a message pushing device according to an exemplary embodiment. As shown in fig. 6, an embodiment of the present disclosure provides a message pushing device 600, where the message pushing device 600 is configured on a subscription server, and the message pushing device 600 may include:
an acquisition module 601 configured to acquire a target message;
a writing module 602 configured to write the target message into a first target service of the subscription server, wherein the first target service is a service running in the subscription server that matches the target message;
a pushing module 603 is configured to push the target message to a subscriber terminal subscribing to the first target service through the first target service.
Optionally, the message pushing device 600 further includes:
and the first sending module is configured to send metadata to a subscriber terminal associated with a first target service running in the subscription server, wherein the metadata comprises first address information of the subscription server and second address information of the first target service, and the metadata is used for enabling the subscriber terminal to subscribe to the first target service corresponding to the metadata according to the metadata.
Optionally, the obtaining module 601 is specifically configured to:
and acquiring target messages from message queues corresponding to the subscription servers in sequence, wherein the target messages are written into the message queues corresponding to the service identifiers by the message distribution server according to the service identifiers of the first target service corresponding to the target messages.
Optionally, the writing module 602 is specifically configured to:
generating a message identification of the target message based on an optimistic lock mechanism;
and writing the target message into a first target service of the subscription server based on the message identification.
Optionally, the message pushing device 600 further includes:
A transfer module configured to transfer a second target service running on the other subscription server to the present subscription server in response to the service transfer request;
the updating module is configured to update the metadata corresponding to the second target service according to the second target service to obtain updated metadata;
and the second sending module is configured to send the updated metadata to the subscriber terminal associated with the second target service, wherein the updated metadata is used for enabling the subscriber terminal to subscribe to the second target service corresponding to the updated metadata according to the updated metadata.
Optionally, the pushing module 603 is specifically configured to:
and sending, by the first target service, the target message to the subscriber terminal based on a short connection channel between the subscription server and the subscriber terminal, wherein the short connection channel is established by the subscriber terminal initiating, to the subscription server, a request for establishing the short connection channel in the event that the subscriber terminal fails to establish a long connection channel with a corresponding subscription server.
The logic of the method executed by each functional module in the message pushing apparatus 600 may refer to the part of the method related to the foregoing embodiment, which is not described herein.
Fig. 7 is a schematic diagram illustrating a modular connection of a message pushing device according to another exemplary embodiment. As shown in fig. 7, an embodiment of the present disclosure provides a message pushing apparatus 700, where the message pushing apparatus 700 is configured at a subscriber terminal, and the message pushing apparatus 700 may include:
a receiving module 701, configured to receive a target message sent by a first target service subscribed by the subscriber terminal;
the first target service is a service which runs in a subscription server and is matched with the target message, and the target message is written into the first target service by the subscription server and is sent to a subscriber terminal subscribed to the first target service through the first target service.
Optionally, the message pushing device 700 further includes:
a caching module configured to receive and cache metadata sent by the subscription server, wherein the metadata comprises first address information of the subscription server and second address information of a first target service associated with the subscriber terminal;
And the subscription module is configured to send a subscription request to a subscription server corresponding to the metadata according to the metadata, wherein the subscription request is used for enabling the subscription server to allow the subscriber terminal to subscribe to a first target service corresponding to the metadata in response to the subscription request.
Optionally, the receiving module 701 is specifically configured to:
sending a request for establishing a short connection channel between the subscriber terminal and a corresponding subscription server to the subscription server under the condition that the subscriber terminal fails to establish the long connection channel with the subscription server;
and receiving a target message sent by a first target service subscribed by the subscriber terminal through the short connection channel in response to the establishment of the short connection channel.
The logic of the method executed by each functional module in the message pushing apparatus 700 may refer to the part of the method related to the foregoing embodiment, which is not described herein.
As shown in fig. 1, the embodiment of the present disclosure further provides a message pushing system, which may include a subscription server and a subscriber terminal.
The subscription server is configured to acquire a target message, and write the target message into a first target service of the subscription server, wherein the first target service is a service which is operated in the subscription server and matched with the target message;
The subscription server is configured to push the target message to a subscriber terminal subscribing to the first target service through the first target service;
the subscriber terminal is configured to receive the target message sent by the subscription server.
Optionally, the subscription server is further configured to send metadata to a subscriber terminal associated with a first target service running in the subscription server, wherein the metadata comprises first address information of the subscription server and second address information of the first target service;
the subscriber terminal is further configured to receive and cache metadata sent by the subscription server, and send a subscription request to the subscription server corresponding to the metadata according to the metadata, wherein the subscription request is used for enabling the subscription server to allow the subscriber terminal to subscribe to a first target service corresponding to the metadata in response to the subscription request.
Optionally, the subscription server is specifically configured to:
and acquiring target messages from message queues corresponding to the subscription servers in sequence, wherein the target messages are written into the message queues corresponding to the service identifiers by the message distribution server according to the service identifiers of the first target service corresponding to the target messages.
Optionally, the subscription server is specifically configured to:
generating a message identification of the target message based on an optimistic lock mechanism;
and writing the target message into a first target service of the subscription server based on the message identification.
Optionally, the subscription server is further configured to:
responding to the service transfer request, and transferring a second target service running on other subscription servers to the subscription server;
updating metadata corresponding to the second target service according to the second target service to obtain updated metadata;
and sending the updated metadata to the subscriber terminal associated with the second target service, wherein the updated metadata is used for enabling the subscriber terminal to subscribe to the second target service corresponding to the updated metadata according to the updated metadata.
Optionally, the subscriber terminal is specifically configured to:
sending a request for establishing a short connection channel between the subscriber terminal and a corresponding subscription server to the subscription server under the condition that the subscriber terminal fails to establish the long connection channel with the subscription server;
The subscription server is specifically configured to:
and responding to the request, establishing the short connection channel, and sending the target message to the subscriber terminal through the first target service based on the short connection channel.
Referring now to fig. 8, a schematic diagram of an architecture of an electronic device (e.g., subscriber terminal or subscription server in fig. 1) 800 suitable for use in implementing embodiments of the present disclosure is shown. Subscriber terminals in embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), car terminals (e.g., car navigation terminals), and the like, as well as stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 8 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 8, the electronic device 800 may include a processing means (e.g., a central processor, a graphics processor, etc.) 801, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
In general, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, etc.; storage 808 including, for example, magnetic tape, hard disk, etc.; communication means 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 8 shows an electronic device 800 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 809, or installed from storage device 808, or installed from ROM 802. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 801.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the subscriber terminal and subscription server may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a target message; writing the target message into a first target service of the subscription server, wherein the first target service is a service which runs in the subscription server and matches the target message; and pushing the target message to a subscriber terminal subscribed to the first target service through the first target service.
Alternatively, the computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: receiving a target message sent by a first target service subscribed by the subscriber terminal; the first target service is a service which runs in a subscription server and is matched with the target message, and the target message is written into the first target service by the subscription server and is sent to a subscriber terminal subscribed to the first target service through the first target service.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented in software or hardware. The name of a module does not in some cases define the module itself.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims. The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.

Claims (12)

1. A message pushing method, performed by a subscription server, the method comprising:
acquiring a target message;
writing the target message into a first target service of the subscription server, wherein the first target service is a service which runs in the subscription server and matches the target message;
and pushing the target message to a subscriber terminal subscribed to the first target service through the first target service.
2. The method according to claim 1, wherein the method further comprises:
and sending metadata to a subscriber terminal associated with a first target service running in the subscription server, wherein the metadata comprises first address information of the subscription server and second address information of the first target service, and the metadata is used for enabling the subscriber terminal to subscribe to the first target service corresponding to the metadata according to the metadata.
3. The method of claim 1, wherein the obtaining the target message comprises:
and acquiring target messages from message queues corresponding to the subscription servers in sequence, wherein the target messages are written into the message queues corresponding to the service identifiers by the message distribution server according to the service identifiers of the first target service corresponding to the target messages.
4. A method according to claim 3, wherein said writing said target message into a first target service of said subscription server comprises:
generating a message identification of the target message based on an optimistic lock mechanism;
and writing the target message into a first target service of the subscription server based on the message identification.
5. The method according to any one of claims 1 to 4, further comprising:
responding to the service transfer request, and transferring a second target service running on other subscription servers to the subscription server;
updating metadata corresponding to the second target service according to the second target service to obtain updated metadata;
and sending the updated metadata to the subscriber terminal associated with the second target service, wherein the updated metadata is used for enabling the subscriber terminal to subscribe to the second target service corresponding to the updated metadata according to the updated metadata.
6. The method of claim 1, wherein pushing the targeted message through the first targeted service to a subscriber terminal subscribed to the first targeted service comprises:
and sending, by the first target service, the target message to the subscriber terminal based on a short connection channel between the subscription server and the subscriber terminal, wherein the short connection channel is established by the subscriber terminal initiating, to the subscription server, a request for establishing the short connection channel in the event that the subscriber terminal fails to establish a long connection channel with a corresponding subscription server.
7. A message pushing method, performed by a subscriber terminal, the method comprising:
receiving a target message sent by a first target service subscribed by the subscriber terminal;
the first target service is a service which runs in a subscription server and is matched with the target message, and the target message is written into the first target service by the subscription server and is sent to a subscriber terminal subscribed to the first target service through the first target service.
8. The method of claim 7, wherein prior to receiving the target message sent by the first target service subscribed to by the subscriber terminal, the method further comprises:
receiving and caching metadata sent by the subscription server, wherein the metadata comprises first address information of the subscription server and second address information of a first target service associated with the subscriber terminal;
and sending a subscription request to a subscription server corresponding to the metadata according to the metadata, wherein the subscription request is used for enabling the subscription server to allow the subscriber terminal to subscribe to a first target service corresponding to the metadata in response to the subscription request.
9. The method of claim 7, wherein receiving the target message sent by the first target service subscribed to by the subscriber terminal comprises:
sending a request for establishing a short connection channel between the subscriber terminal and a corresponding subscription server to the subscription server under the condition that the subscriber terminal fails to establish the long connection channel with the subscription server;
and receiving a target message sent by a first target service subscribed by the subscriber terminal through the short connection channel in response to the establishment of the short connection channel.
10. A message pushing system, comprising:
a subscription server configured to obtain a target message, and write the target message into a first target service of the subscription server, wherein the first target service is a service running in the subscription server and matching the target message;
the subscription server is configured to push the target message to a subscriber terminal subscribing to the first target service through the first target service;
the subscriber terminal is configured to receive the target message sent by the subscription server.
11. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processing device, implements the steps of the method of any one of claims 1 to 6 or the steps of the method of any one of claims 7 to 9.
12. An electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method of any one of claims 1 to 6 or to carry out the steps of the method of any one of claims 7 to 9.
CN202311175666.6A 2023-09-12 2023-09-12 Message pushing method, system, medium and electronic equipment Pending CN117155998A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311175666.6A CN117155998A (en) 2023-09-12 2023-09-12 Message pushing method, system, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311175666.6A CN117155998A (en) 2023-09-12 2023-09-12 Message pushing method, system, medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117155998A true CN117155998A (en) 2023-12-01

Family

ID=88909917

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311175666.6A Pending CN117155998A (en) 2023-09-12 2023-09-12 Message pushing method, system, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117155998A (en)

Similar Documents

Publication Publication Date Title
CN110311983B (en) Service request processing method, device and system, electronic equipment and storage medium
CN110909521B (en) Online document information synchronous processing method and device and electronic equipment
CN112383787B (en) Live broadcast room creating method and device, electronic equipment and storage medium
CN111432001B (en) Method, apparatus, electronic device and computer readable medium for jumping scenes
CN112637287A (en) Load balancing method and equipment
CN112256733A (en) Data caching method and device, electronic equipment and computer readable storage medium
CN112035529A (en) Caching method and device, electronic equipment and computer readable storage medium
CN111596992B (en) Navigation bar display method and device and electronic equipment
CN111309366B (en) Method, device, medium and electronic equipment for managing registration core
CN111262907B (en) Service instance access method and device and electronic equipment
CN113420400B (en) Routing relation establishment method, request processing method, device and equipment
CN111444457B (en) Data release method and device, storage medium and electronic equipment
CN117155998A (en) Message pushing method, system, medium and electronic equipment
CN113824675B (en) Method and device for managing login state
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN111212296B (en) Live broadcast room gift list configuration method, device, medium and electronic equipment
CN110941683B (en) Method, device, medium and electronic equipment for acquiring object attribute information in space
CN111694679B (en) Message processing method and device and electronic equipment
CN112948108B (en) Request processing method and device and electronic equipment
CN110633324B (en) Method, apparatus, electronic device and computer readable medium for synchronizing data
CN113157365B (en) Program running method, program running device, electronic equipment and computer readable medium
CN115348260B (en) Information processing method, device, equipment and medium based on campus information security
CN117155723A (en) Message broadcasting method, medium and electronic equipment
CN114785794A (en) Resource allocation method, device, equipment, medium, program product and system
CN115543347A (en) Application deployment method and device, electronic equipment and computer readable medium

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