CN112380266A - Message data processing method, device, equipment and storage medium - Google Patents

Message data processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN112380266A
CN112380266A CN202011112173.4A CN202011112173A CN112380266A CN 112380266 A CN112380266 A CN 112380266A CN 202011112173 A CN202011112173 A CN 202011112173A CN 112380266 A CN112380266 A CN 112380266A
Authority
CN
China
Prior art keywords
message
update
user
data
updating
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
CN202011112173.4A
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.)
Guangzhou Baiguoyuan Network Technology Co Ltd
Original Assignee
Guangzhou Baiguoyuan Network Technology 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 Guangzhou Baiguoyuan Network Technology Co Ltd filed Critical Guangzhou Baiguoyuan Network Technology Co Ltd
Priority to CN202011112173.4A priority Critical patent/CN112380266A/en
Publication of CN112380266A publication Critical patent/CN112380266A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2477Temporal data queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Computational Linguistics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention discloses a message data processing method, a device, equipment and a storage medium, wherein the method comprises the following steps: step 1, obtaining an updating message recorded in a first message queue; step 2, determining a subscription user corresponding to the data source; step 3, obtaining a current time stamp and a historical time stamp when the subscriber inquires the update message last time; step 4, screening the subscribing users according to the relation between the current timestamp and the historical timestamp; step 5, updating the screened updating list of the subscription users according to the updating content; and 6, acquiring another updating message in the first message queue, and repeating the steps 2 to 5. The scheme can improve the response speed to the user query, save the storage space and optimize the resource allocation.

Description

Message data processing method, device, equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of data processing, in particular to a message data processing method, a message data processing device, message data processing equipment and a storage medium.
Background
Message data is a data format for providing frequently updated contents to a user, and feed stream data, for example, is a typical message data. The user can be provided with subscription and update through the feed stream mechanism, namely, the user can subscribe to certain data sources and receive continuous update of the data sources.
The existing feed stream mechanism is mainly divided into a pull model and a push model, in the pull model, when a user views the feed stream, a system acquires data of a subscription data source to construct feed stream data, and feeds the constructed feed stream data back to the user. In the push model, a system maintains a feed list for each user, and when a data source issues an update message, data is updated to the feed lists of all subscribed users to be fed back to the user. The pull model has the defect that when the number of the subscription data sources of the user is large, the constructing of feed stream data requires accessing a large number of the subscription data sources, and the query request of the user cannot be responded in time. The push model has the defects that when a large number of subscribing users exist in a certain data source, the time consumption for maintaining the feed list of the subscribing users is high, and the subscribing users can inquire the data to be updated in a long time; when a data source writes data into a database, the data source occupies a large amount of database resources due to the large number of subscribing users, and the database resources cannot be reasonably used for the data source with the small number of subscribing users; in addition, the push model stores feed lists of all the subscribing users, and occupies a large storage space.
Disclosure of Invention
Embodiments of the present invention provide a message data processing method, apparatus, device, and storage medium, so that when a user queries an update message, the user does not access a large number of data sources, can obtain a response in time, and has a stronger maintenance pertinence to an update list, thereby reducing data writing and saving a storage space. Meanwhile, the resource allocation of the database is optimized, so that the data sources with few subscribing users can be reasonably allocated to the database resources, and the problem of delayed release of some data sources is avoided when the update message is released.
In a first aspect, an embodiment of the present invention provides a message data processing method, where the method includes:
step 1, obtaining an update message recorded in a first message queue, wherein the update message comprises a data source and associated update content;
step 2, determining a subscription user corresponding to the data source;
step 3, obtaining a current time stamp and a historical time stamp when the subscriber inquires the update message last time;
step 4, screening the subscribing users according to the relation between the current timestamp and the historical timestamp;
step 5, updating the screened updating list of the subscription users according to the updating content;
and 6, acquiring another updating message in the first message queue, and repeating the steps 2 to 5 until the updating message recorded in the first message queue is processed.
In a second aspect, an embodiment of the present invention further provides a message data processing method, where the method includes:
when a user inquires an update message is detected, acquiring a current timestamp and a historical timestamp of the user when the user inquires the update message last time;
if the relation between the current timestamp and the historical timestamp meets a first preset condition, determining a subscription data source corresponding to the user, and acquiring an update message of the subscription data source for data feedback;
and if the relation between the current timestamp and the historical timestamp meets a second preset condition, reading an update list corresponding to the user for data feedback.
In a third aspect, an embodiment of the present invention further provides a message data processing apparatus, where the apparatus includes:
the message acquisition module is used for acquiring an update message recorded in the first message queue, wherein the update message comprises a data source and associated update content;
the user determining module is used for determining a subscription user corresponding to the data source;
the time stamp recording module is used for acquiring a current time stamp and a historical time stamp when the subscriber inquires the update message last time;
the user screening module is used for screening the subscribed users according to the relation between the current timestamp and the historical timestamp;
and the message updating module is used for updating the screened updating list of the subscription user according to the updating content.
In a fourth aspect, an embodiment of the present invention further provides another message data processing apparatus, where the apparatus includes:
the time stamp recording module is used for acquiring a current time stamp and a historical time stamp when the user inquires the update message last time when the user inquires the update message is detected;
the first message query module is used for determining a subscription data source corresponding to the user and acquiring an update message of the subscription data source for data feedback if the relationship between the current timestamp and the historical timestamp meets a first preset condition;
and the second message query module is used for reading the update list corresponding to the user for data feedback if the relationship between the current timestamp and the historical timestamp meets a second preset condition.
In a fifth aspect, an embodiment of the present invention further provides a message data processing apparatus, where the apparatus includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the message data processing method according to the embodiment of the present invention.
In a sixth aspect, the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform the message data processing method according to the present invention.
In the embodiment of the invention, when the update message issued by a data source is processed, an update message recorded in a first message queue is acquired, a subscriber corresponding to the data source is determined, a current timestamp and a historical timestamp of the subscriber when the subscriber inquires the update message last time are acquired, the subscriber is screened according to the relationship between the current timestamp and the historical timestamp, an update list of the screened subscriber is updated according to the update content, when the update message is processed, another update message recorded in the first message queue is processed, and so on. When a user inquires an update message, acquiring a current timestamp and a historical timestamp of the user when the user inquires the update message last time, if the relationship between the current timestamp and the historical timestamp meets a first preset condition, determining a subscription data source corresponding to the user, acquiring the update message of the subscription data source for data feedback, and if the relationship between the current timestamp and the historical timestamp meets a second preset condition, reading an update list corresponding to the user for data feedback. According to the scheme, when the user inquires the updating message, a large number of data sources cannot be accessed, the response can be obtained in time, the maintenance pertinence to the updating list is stronger, the data writing is reduced, and the storage space is saved. Meanwhile, the resource allocation of the database is optimized, so that the data sources with few subscribing users can be reasonably allocated to the database resources, and the problem of delayed release of some data sources is avoided when the update message is released.
Drawings
Fig. 1 is a flowchart of a message data processing method according to an embodiment of the present invention;
fig. 1a is a schematic diagram of a first message queue structure according to an embodiment of the present invention;
fig. 1b is a schematic diagram of a corresponding relationship between a data source and a subscriber according to an embodiment of the present invention;
fig. 2 is a flowchart of another message data processing method according to an embodiment of the present invention;
fig. 2a is a schematic diagram of a subscribed user list according to an embodiment of the present invention;
fig. 2b is a schematic diagram of a message queue according to an embodiment of the present invention;
fig. 3 is a flowchart of another message data processing method according to an embodiment of the present invention;
fig. 4 is a flowchart of another message data processing method according to an embodiment of the present invention;
FIG. 4a is a flowchart of determining a header data source list and updating the list accordingly according to an embodiment of the present invention;
fig. 5 is a block diagram of a message data processing apparatus according to an embodiment of the present invention;
fig. 6 is a block diagram of another message data processing apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a message data processing apparatus according to an embodiment of the present invention.
Detailed Description
The embodiments of the present invention will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of and not restrictive on the broad invention. It should be further noted that, for convenience of description, only some structures, not all structures, relating to the embodiments of the present invention are shown in the drawings.
Fig. 1 is a flowchart of a message data processing method according to an embodiment of the present invention, where this embodiment may be applicable to processing feed stream data to provide a subscription and data update to a user, and the method may be executed by a message data processing device, such as a server, and specifically includes the following steps:
step S101, an update message recorded in a first message queue is obtained, wherein the update message comprises a data source and associated update content.
In one embodiment, when a data source publishes an update message, rather than directly updating the list of subscribers, the update message is stored in a queue, illustratively referred to herein as the first message queue, as opposed to directly processing the update message as is known in the art. The queue is used as a special linear table, a deletion operation is performed at the front end of the table, an insertion operation is performed at the back end of the table, and optionally, the first message queue can be a first-in first-out queue. I.e. when an update message is generated, it is inserted at the end of the first message queue and so on.
In a user subscription update mechanism, there may be multiple data sources, each of which may be subscribed to by multiple users. For example, taking microblog as an example, each person may perform one registration to become a data source, and may also subscribe to other data sources, for example, a large number of subscribing users may exist in zhang san (as a data source) of a writer, and when zhang san publishes an update message, all the corresponding subscribing users may inquire the update message.
In one embodiment, the update message stored in the first message queue includes a data source and associated update content, the data source may be characterized in the form of an ID, and each data source is assigned with a unique ID in the background of the system for marking and confirming the data source. The updated content can be any multimedia information such as text, voice, picture, video and so on. Specifically, when it is detected that the data source issues an update message, a message body is constructed, such as: the update message 1 (data source 1, update content 1) is stored in the first message queue. And constructing another message body aiming at another updating message issued by the data source, such as: update message 2 (data source 2, update content 2), update message 2 is also inserted into the queue. As shown in fig. 1a, fig. 1a is a schematic diagram of a first message queue structure according to an embodiment of the present invention, where W update messages including update message 1 to update message W are stored in the first message queue.
When the update message in the first message queue is processed, an update message recorded in the first message queue is acquired. Illustratively, the update message recorded in the first message queue may be obtained for subsequent processing by maintaining a system processing process. Specifically, the update information in the first message queue may be sequentially acquired, and after an update message is processed, the update message stored after the update message is acquired according to a first-in first-out queue mechanism to be processed.
By introducing a queue mechanism, the update messages published by the data source are stored in the queue, rather than being directly processed when the update messages published by the data source are detected, because when one data source has a large number of subscribers, the update messages of the data source are processed, which easily causes blockage, and the subsequent update messages cannot be timely responded.
And S102, determining a subscription user corresponding to the data source.
As can be seen from the foregoing, one data source may correspond to multiple subscribers, and when one update message in the queue is acquired and processed, the corresponding subscriber is determined according to the data source recorded in the update message. In one embodiment, a user list is maintained for each data source, and all the subscribed users subscribed to the data source are recorded in the user list, for example, the subscribed users may be characterized in an ID form, that is, each subscribed user corresponds to a unique ID, which may be a corresponding ID generated during registration. When a data source is identified, each subscribing user to the data source can be identified by querying the user list for the data source. As shown in fig. 1b, fig. 1b is a schematic diagram of a corresponding relationship between a data source and a subscriber, where the data source 1 corresponds to a user list 1, the data source 2 corresponds to a user list 2, and the data source Z corresponds to a user list Z, where the user list 1 records corresponding subscribers 11 to 1a, the user list 2 records corresponding subscribers 21 to 2b, and the user list Z records corresponding subscribers Z1 to Zc.
Step S103, obtaining the current time stamp and the historical time stamp when the subscriber inquires the update message last time.
In one embodiment, the time when each user inquires the update message last time is recorded, that is, the time is a historical time stamp, and the current time stamp is the acquired time when the system is currently located. For example, a timestamp may be maintained for each user, and after a user queries an update message once, the historical timestamp of the corresponding record is updated. In this step, a new parameter, i.e., a concept of a timestamp, is introduced when message data processing is performed.
And step S104, screening the subscribing users according to the relation between the current time stamp and the historical time stamp.
In one embodiment, after the subscribing users corresponding to the data source are determined, the subscribing users are screened according to the obtained relationship between the historical timestamp and the current timestamp of each subscribing user. Optionally, a preset time T may be set, and a subscriber whose difference between the current timestamp and the historical timestamp is smaller than the preset time T, that is, a subscriber who has not queried the update message for a long time is filtered out, where the preset time T may be 30 minutes, 2 hours, and the like, and may be adaptively adjusted according to actual needs. Optionally, the corresponding preset time T may be determined according to the current timestamp, and the preset time T is associated with the current timestamp, for example, in a range from 0:00 to 8:00, the value of the corresponding preset time T is 3 hours, and in a range from 8:00 to 0:00, the value of the corresponding preset time T is 30 minutes.
In this step, the subscribing users are screened by comparing the timestamps, rather than all subscribing users are processed in batch, so that the subsequent processing for the subscribing users has stronger pertinence.
And step S105, updating the screened updating list of the subscription users according to the updating content.
Each subscriber correspondingly maintains an update list, and the update list records the update messages issued by the subscription data source. In one embodiment, the screened update list of the subscribing users is updated according to the update content recorded in the update message, and the update list of the subscribing users discarded in the screening process is not updated, so that the data writing amount is remarkably reduced.
Step S106, acquiring another update message in the first message queue, and repeating steps S102 to S105 until the update message recorded in the first message queue is processed.
After the step S105 is completed, another update message is taken out from the first message queue, and the steps S102 to S105 are repeatedly executed until the update message recorded in the first message queue is processed, and the corresponding processed update message is removed from the queue. In one embodiment, in order to increase the data processing speed, a plurality of processes can be simultaneously operated, and each process correspondingly processes the update messages in one queue, so as to further increase the data processing speed and the throughput.
According to the scheme, through the setting of the message queue and the screening of the subscribing users, the blocking phenomenon when the data source publishes the update message is avoided, and meanwhile, the data writing amount is obviously reduced.
Fig. 2 is a flowchart of another message data processing method according to an embodiment of the present invention, which provides an optimized processing mechanism for a subscriber. As shown in fig. 2, the technical solution is as follows:
step S201, when it is detected that the data source issues an update message, adding the update message to the first message queue.
Step S202, obtaining an update message recorded in the first message queue, where the update message includes a data source and associated update content.
And step S203, determining a subscription user list corresponding to the data source.
And step S204, determining the first N subscribed users recorded in the subscribed user list.
The subscription user list can contain a plurality of subscription users, the number of the subscription users of some popular data sources is very large, and some data sources reach millions or even tens of millions of subscription users. In one embodiment, after acquiring the subscribed user list, the first N subscribed users recorded in the subscribed user list are determined, where N may be 500, 1000, 1 ten thousand, or 10 ten thousand, and may be set according to actual requirements. In this step, since the number of the subscribing users is partially intercepted (the first N subscribing users), rather than performing one-time processing on all the subscribing users, the problem that other data sources cannot obtain database resources due to resource occupation of data sources with excessive number of subscribing users all the time when the update message is issued is avoided.
Step S205, obtaining the current time stamp and the historical time stamp when the former N subscribing users query the update message last time.
Correspondingly, after the first N subscribed users of the user list are determined, the historical time stamps of the first N subscribed users are obtained for further screening subsequently. Illustratively, if the number of the subscribed users in the subscribed user list is less than N, the historical timestamp of each user in the subscribed user list is obtained.
And S206, screening the subscribing users according to the relation between the current time stamp and the historical time stamp.
And step S207, updating the screened updating list of the subscription users according to the updating content.
Step S208, determining whether the number of users recorded in the subscribed user list is greater than N, if so, performing step S209, otherwise, performing step S210.
In an embodiment, it is determined whether the number of users recorded in the subscribed user list is greater than N, and if so, recording a part of the obtained first N subscribed users after the first N subscribed users into another message queue for processing, as shown in fig. 2a, fig. 2a is a schematic diagram of a subscribed user list provided in an embodiment of the present invention, where K subscribed users are recorded in the subscribed user list in total, and in the K subscribed users, the first N subscribed users perform an update process in a first message queue processing process, and the subscribed users after the first N subscribed users are exemplarily recorded into a second message queue, where an exemplary processing manner is shown in step S209.
Step S209, add the update message and the corresponding processing identifier to the second message queue.
Wherein the second message queue is another queue structure distinct from the first message queue, which may likewise be a first-in-first-out queue. And processing the subscribed users after the N in the queue.
In one embodiment, the update messages retrieved in the message queue and the corresponding process identification may be added to the second message queue, and the process identification may be understood as a flag for determining unprocessed subscribing users. Specifically, during enqueuing, a message body can be constructed, such as: update message 1 (data source 1, update content 1, S), where S is the process identifier. Taking the previous example that N subscribing users are processed in the foregoing step, S here may be N +1, i.e. from N +1 to K subscribing users are recorded to the second message queue to be processed.
The processing mode of the update message in the second message queue is basically consistent with that of the first message queue, the list of the subscription users is determined through the acquisition of the update message, and the subscription users are screened and then updated. In the batch processing process of the subscribing users, only N subscribing users are screened out, and for the part of the subscribing users exceeding N, the part of the subscribing users is reinserted into the second message queue or recorded into the third message queue for processing, and so on.
Step S210, obtaining another update message in the first message queue, and repeating steps S203 to S209 until the update message recorded in the first message queue is processed.
According to the above solution, the subscribing users are processed in batches by setting a double queue, as shown in fig. 2b for example, fig. 2b is a message queue diagram provided in the embodiment of the present invention, and as can be seen from the diagram, a first message queue records update messages 1 to update messages W, when processing the update message 1, the first N subscribing users are screened, and the subscribing users exceeding N record to a second message queue; in the first message queue, after the first N subscribed users are processed, acquiring an update message 2 for processing, and at this time, assuming that the number of the subscribed users corresponding to the data source in the update message 2 does not exceed N, screening the timestamp relations of all the subscribed users; when the update message 3 is processed in the first message queue, the total number of the subscribed users corresponding to the update message 3 is X, and if X is larger than N and smaller than 2N, the subscribed users in the update message 3 are recorded to the second message queue from the part N +1 to the part X for processing, and the update message 4 is processed in the same way; in the second message queue processing process, assuming that when processing the subscribed users of the N +1 to K parts in the update message 1, determining that K is greater than 2N, recording 2N +1 to K to the second message queue, where the first message queue is already processing the update message 3 and has not yet processed the update message 4, so that a data schematic form of the message queue in the example diagram is formed. Through a batch processing mechanism adopted for subscription data, when a data source issues an update message, each data source competes for database resources simultaneously, and the update delay of the data source is reduced.
Fig. 3 is a flowchart of another message data processing method provided in an embodiment of the present invention, where this embodiment may be applicable to processing feed stream data to provide a subscription and data update to a user, and the method may be executed by a message data processing device, such as a server, and specifically includes the following steps:
step S301, when detecting that a user inquires an update message, acquiring a current time stamp and a historical time stamp of the user when inquiring the update message last time.
In the feed stream data implementation mechanism, a user can initiate a query request at any time to query for update messages. Different from the existing implementation mechanism, in this step, when the user is detected to inquire the update message, the current timestamp and the historical timestamp of the user when inquiring the update message last time are obtained. The explanation of the current timestamp and the historical timestamp is partially referred to step S103, and will not be described here.
Step S302, if the relation between the current time stamp and the historical time stamp meets a first preset condition, determining a subscription data source corresponding to the user, and acquiring an update message of the subscription data source for data feedback.
The first preset condition may be that a difference between the current timestamp and the historical timestamp is greater than a preset time T, and the preset time T may be 30 minutes, 2 hours, and the like, which may be adaptively adjusted according to actual needs. Optionally, the corresponding preset time T may be determined according to the current timestamp, and the preset time T is associated with the current timestamp, for example, in a range from 0:00 to 8:00, the value of the corresponding preset time T is 3 hours, and in a range from 8:00 to 0:00, the value of the corresponding preset time T is 30 minutes.
And if the difference value between the current time stamp and the historical time stamp is greater than the preset time T, determining the subscription data source corresponding to the user, and acquiring the updating message of the subscription data source for data feedback. Specifically, after the subscription data source corresponding to the user is determined, the update message of each subscription data source is taken out from the database and added to the update list of the user, and the content of the update list is fed back to the user.
And step S303, if the relation between the current timestamp and the historical timestamp meets a second preset condition, reading an update list corresponding to the user for data feedback.
The second preset condition may be that a difference between the current timestamp and the historical timestamp is not greater than the preset time T, and the preset time T may be 30 minutes, 2 hours, and the like, which may be adaptively adjusted according to actual needs. Optionally, the corresponding preset time T may be determined according to the current timestamp, and the preset time T is associated with the current timestamp, for example, in a range from 0:00 to 8:00, the value of the corresponding preset time T is 3 hours, and in a range from 8:00 to 0:00, the value of the corresponding preset time T is 30 minutes.
And if the difference value between the current timestamp and the historical timestamp is not more than the preset time T, reading an updating list corresponding to the user for data feedback.
According to the scheme, when the user inquires the update message, the current timestamp and the historical timestamp of the user when the update message is inquired for the last time are obtained, data feedback is carried out in different modes through comparison of the current timestamp and the historical timestamp, the inquiry mechanism of the update message is optimized, data feedback is carried out in a mode of reading an update list under the condition that the inquiry time interval is short, data feedback is carried out in a mode of reading the subscription data source update message under the condition that the inquiry time interval is long, and the method is superior to the existing mechanism of independently adopting a pull model or a push model to carry out update message feedback.
Correspondingly, on the basis of the technical scheme, in the process of responding to the query request of the user, the method further comprises the step of updating the historical timestamp of the user, namely updating the current timestamp to the historical timestamp corresponding to the user.
Fig. 4 is a flowchart of another message data processing method according to an embodiment of the present invention, further optimizing a mechanism for responding to a query request of a user. As shown in fig. 4, the technical solution is as follows:
step S401, when detecting that the user inquires the update message, acquiring a current timestamp and a historical timestamp of the user when the user inquires the update message last time.
Step S402, judging whether the difference value between the current time stamp and the historical time stamp is larger than the preset time T, if so, executing step S403, otherwise, executing step S404.
Step S403, determining a subscription data source corresponding to the user, acquiring a preset number of update messages in the subscription data source, and adding the update messages to an update list corresponding to the user for data feedback.
In an embodiment, after the subscription data source of the user is determined, a preset number (for example, 3, 5, or 10, etc.) of update messages in the subscription data source are taken, and the update messages are added to an update list corresponding to the user for data feedback. The preset number of update messages may be determined according to the update time of the update messages, for example, 5 update messages with the latest update time in each subscription data source are selected.
Step S404, reading the updating list corresponding to the user, updating the data of the subscription data source which meets the updating condition in the updating list, and feeding back the updated updating list.
In the update list corresponding to each user, the recorded content illustratively includes the subscription data sources and corresponding update data, for example, user 1 corresponds to an update list 1, and the subscription data sources 1 to P are recorded in the update list 1, and each subscription data source records corresponding update data in association.
In response to the query request of the user, unlike the conventional updating method of the update list, in this step, data update is performed on the subscription data sources in the update list that meet the update condition. The update condition may be, for example, to update the update data of the important subscription data source, or to update the update data of the subscription data source with high activity.
And step S405, updating the current time stamp to the historical time stamp corresponding to the user.
According to the scheme, when the update messages of the subscription data source are added, the preset number of update messages are added instead of adding all the update messages of the subscription data source, so that the access amount of data resources is reduced, and the response speed of the user query request is improved. Meanwhile, when the update list is updated, the data of the subscription data source which meets the update condition in the update list is updated, so that data writing is reduced, and the storage space is saved.
In another embodiment, the specific flow of step S404 is further defined, as shown in fig. 4a, fig. 4a is a flowchart for determining a header data source list and updating the list accordingly according to an embodiment of the present invention, and the specific flow is as follows:
step S4041, determining the data updating amount and the number of subscribed users corresponding to each data source.
And S4042, generating a head data source list according to the data updating amount and/or the data amount of the subscribed user, and updating periodically.
Illustratively, for each subscription data source, the data update amount in a period of time t (t may be 1 day, 3 days, one week, or the like) is recorded as tn, the number of subscribed users is recorded as u, a header data source list is generated according to the data update amount and the data amount of the subscribed users, each subscription data source is counted to obtain a statistical value tsum, and the calculation manner of tsum may be tsum ═ tn ═ u; after tsum is obtained, sequencing each subscription data source according to the size of the tsum value, and determining the top v subscription data sources in the sequencing result as head data sources to form a head data source list.
In another embodiment, the manner of determining the header data source list may also be: determining the activity tq of each subscription data source, wherein the determination mode of the activity tp can be determined according to the increment of the number of the subscription users and the comment forwarding number, exemplarily, the increment of the number of the subscription users is denoted as tg, the comment forwarding number is denoted as tr, and the activity tp is denoted as tg × tr.
Step S4043, comparing the subscription data source in the update list with the header data source recorded by the system, and obtaining the update message of the subscription data source with consistent comparison to update data.
In one embodiment, by using the generated and regularly maintained header data source list, when the update list is updated, data update is performed on the data source recorded in the update list and having the subscription data source and the header data source consistent, so that occupation of data writing and storage space is reduced, and update messages of the header data source can also be viewed in real time.
On the basis of the technical scheme, the method further comprises the following steps: and if the relation between the current timestamp and the historical timestamp is regularly detected to meet a third preset condition, clearing the data record in the update list. The third preset condition may be that a difference between the current timestamp and the historical timestamp is greater than a preset time D, the preset time D may be, for example, 3 days, one week, or two weeks, and the periodic time period may be 5 days, two weeks, or one month. Thus, the data records exceeding a certain time are deleted, and the storage space is further released.
Fig. 5 is a block diagram of a message data processing apparatus according to an embodiment of the present invention, where the apparatus is configured to execute the message data processing method according to some embodiments, and has functional modules and beneficial effects corresponding to the execution method. As shown in fig. 5, the apparatus specifically includes: a message acquisition module 101, a user determination module 102, a time stamp recording module 103, a user screening module 104 and a message update module 105, wherein,
a message obtaining module 101, configured to obtain an update message recorded in a first message queue, where the update message includes a data source and associated update content;
a user determining module 102, configured to determine a subscribing user corresponding to the data source;
a timestamp recording module 103, configured to obtain a current timestamp and a historical timestamp of the subscriber when the subscriber inquires an update message last time;
the user screening module 104 is used for screening the subscribed users according to the relation between the current timestamp and the historical timestamp;
and the message updating module 105 is configured to update the screened update list of the subscribing user according to the update content.
According to the scheme, when the user inquires the update message, the user does not access a large number of data sources, can timely obtain response, has stronger pertinence to maintenance of the update list, reduces data writing, and saves storage space. Meanwhile, the resource allocation of the database is optimized, so that the data sources with few subscribing users can be reasonably allocated to the database resources, and the problem of delayed release of some data sources is avoided when the update message is released.
In one possible embodiment, the apparatus further comprises: the message inserting module 106 is configured to, before acquiring an update message recorded in the first message queue, add the update message to the first message queue when it is detected that the data source issues the update message.
In a possible embodiment, the user determination module 102 is specifically configured to:
determining a subscription user list corresponding to the data source;
the timestamp recording module 103 is specifically configured to:
determining the first N subscribed users recorded in the subscribed user list, wherein N is an integer greater than 0;
and acquiring a current timestamp and historical timestamps of the last time when the former N subscribing users query the update messages.
In one possible embodiment, the message insertion module 106 is further configured to:
after determining the first N subscribed users recorded in the subscribed user list, adding the update message and the corresponding processing identifier to a second message queue.
Fig. 6 is a block diagram of another message data processing apparatus according to an embodiment of the present invention, where the apparatus is configured to execute the message data processing method according to some embodiments, and has functional modules and beneficial effects corresponding to the execution method. As shown in fig. 6, the apparatus specifically includes: a timestamp recording module 201, a first message query module 202, and a second message query module 203, wherein,
a timestamp recording module 201, configured to, when a user query update message is detected, obtain a current timestamp and a historical timestamp of the user when the user last queried the update message;
a first message query module 202, configured to determine a subscription data source corresponding to the user if a relationship between the current timestamp and the historical timestamp meets a first preset condition, and obtain an update message of the subscription data source for data feedback;
and the second message query module 203 is configured to, if the relationship between the current timestamp and the historical timestamp meets a second preset condition, read an update list corresponding to the user and perform data feedback.
According to the scheme, when the user inquires the update message, the user does not access a large number of data sources, can timely obtain response, has stronger pertinence to maintenance of the update list, reduces data writing, and saves storage space. Meanwhile, the resource allocation of the database is optimized, so that the data sources with few subscribing users can be reasonably allocated to the database resources, and the problem of delayed release of some data sources is avoided when the update message is released.
In a possible embodiment, the first message query module 202 is specifically configured to:
acquiring a preset number of update messages in the subscription data source;
and adding the update message to an update list corresponding to the user for data feedback.
In a possible embodiment, the second message query module 203 is specifically configured to:
reading an update list corresponding to the user;
updating data of the subscription data sources meeting the updating conditions in the updating list;
and feeding back the updated update list.
In a possible embodiment, the second message query module 203 is specifically configured to:
comparing the subscription data source in the updating list with the head data source recorded by the system;
and acquiring the update message of the compared and consistent subscription data source to update data.
In a possible embodiment, the apparatus further includes a header data source generating module 204, specifically configured to:
determining the data updating amount and the number of subscribed users corresponding to each data source;
and generating a head data source list according to the data updating amount and/or the data amount of the subscribed users, and updating periodically.
In one possible embodiment, the first preset condition includes: the difference value between the current timestamp and the historical timestamp is greater than a preset time T;
the second preset condition includes:
and the difference value between the current timestamp and the historical timestamp is not more than the preset time T.
In one possible embodiment, the apparatus further comprises: the data cleaning module 205 is specifically configured to:
and if the relation between the current timestamp and the historical timestamp is regularly detected to meet a third preset condition, clearing the data record in the update list.
Fig. 7 is a schematic structural diagram of a message data processing apparatus according to an embodiment of the present invention, as shown in fig. 7, the apparatus includes a processor 301, a memory 302, an input device 303, and an output device 304; the number of the processors 301 in the device may be one or more, and one processor 301 is taken as an example in fig. 7; the processor 301, the memory 302, the input means 303 and the output means 304 in the device may be connected by a bus or other means, as exemplified by a bus connection in fig. 7. The memory 302 is a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the message data processing method in the embodiment of the present invention. The processor 301 executes various functional applications of the device and data processing by executing software programs, instructions, and modules stored in the memory 302, that is, implements the message data processing method described above. The input device 303 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the apparatus. The output means 304 may comprise a display device such as a display screen.
Embodiments of the present invention also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a message data processing method, the method comprising:
acquiring an update message recorded in a first message queue, wherein the update message comprises a data source and associated update content;
determining a subscription user corresponding to the data source;
acquiring a current timestamp and a historical timestamp of the subscriber when the subscriber inquires an update message last time;
screening the subscribing users according to the relation between the current timestamp and the historical timestamp;
updating the screened updating list of the subscription users according to the updating content;
acquiring another updating message in the first message queue, and repeating the processing steps until the updating message recorded in the first message queue is processed;
when a user inquires an update message is detected, acquiring a current timestamp and a historical timestamp of the user when the user inquires the update message last time;
if the relation between the current timestamp and the historical timestamp meets a first preset condition, determining a subscription data source corresponding to the user, and acquiring an update message of the subscription data source for data feedback;
and if the relation between the current timestamp and the historical timestamp meets a second preset condition, reading an update list corresponding to the user for data feedback.
From the above description of the embodiments, it is obvious for those skilled in the art that the embodiments of the present invention can be implemented by software and necessary general hardware, and certainly can be implemented by hardware, but the former is a better implementation in many cases. Based on such understanding, the technical solutions of the embodiments of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions to make a computer device (which may be a personal computer, a server, or a network device) perform the methods described in the embodiments of the present invention.
It should be noted that, in the embodiment of the message data processing apparatus, the included units and modules are only divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the embodiment of the invention.
It should be noted that the foregoing is only a preferred embodiment of the present invention and the technical principles applied. Those skilled in the art will appreciate that the embodiments of the present invention are not limited to the specific embodiments described herein, and that various obvious changes, adaptations, and substitutions are possible, without departing from the scope of the embodiments of the present invention. Therefore, although the embodiments of the present invention have been described in more detail through the above embodiments, the embodiments of the present invention are not limited to the above embodiments, and many other equivalent embodiments may be included without departing from the concept of the embodiments of the present invention, and the scope of the embodiments of the present invention is determined by the scope of the appended claims.

Claims (15)

1. The message data processing method is characterized by comprising the following steps:
step 1, obtaining an update message recorded in a first message queue, wherein the update message comprises a data source and associated update content;
step 2, determining a subscription user corresponding to the data source;
step 3, obtaining a current time stamp and a historical time stamp when the subscriber inquires the update message last time;
step 4, screening the subscribing users according to the relation between the current timestamp and the historical timestamp;
step 5, updating the screened updating list of the subscription users according to the updating content;
and 6, acquiring another updating message in the first message queue, and repeating the steps 2 to 5 until the updating message recorded in the first message queue is processed.
2. The method of claim 1, further comprising, prior to retrieving an update message recorded in the first message queue:
when a data source is detected to issue an update message, adding the update message to the first message queue.
3. The method according to claim 1 or 2, wherein the determining the subscribed user corresponding to the data source comprises:
determining a subscription user list corresponding to the data source;
correspondingly, the obtaining the current timestamp and the historical timestamp of the subscriber when the subscriber last inquired about the update message includes:
determining the first N subscribed users recorded in the subscribed user list, wherein N is an integer greater than 0;
and acquiring a current timestamp and historical timestamps of the last time when the former N subscribing users query the update messages.
4. The method of claim 3, wherein after determining the first N subscribed users recorded in the subscribed user list, further comprising:
and adding the update message and the corresponding processing identifier in the step 1 to a second message queue for updating an update list, wherein the processing identifier is used for marking the subscribed users which are not updated in the subscribed user list.
5. The message data processing method is characterized by comprising the following steps:
when a user inquires an update message is detected, acquiring a current timestamp and a historical timestamp of the user when the user inquires the update message last time;
if the relation between the current timestamp and the historical timestamp meets a first preset condition, determining a subscription data source corresponding to the user, and acquiring an update message of the subscription data source for data feedback;
and if the relation between the current timestamp and the historical timestamp meets a second preset condition, reading an update list corresponding to the user for data feedback.
6. The method of claim 5, wherein obtaining the update message of the subscription data source for data feedback comprises:
acquiring a preset number of update messages in the subscription data source;
and adding the update message to an update list corresponding to the user for data feedback.
7. The method according to claim 5, wherein the reading the update list corresponding to the user for data feedback comprises:
reading an update list corresponding to the user;
updating data of the subscription data sources meeting the updating conditions in the updating list;
and feeding back the updated update list.
8. The method of claim 7, wherein updating the data of the subscribed data sources in the update list that satisfy the update condition comprises:
comparing the subscription data source in the updating list with the head data source recorded by the system;
and acquiring the update message of the compared and consistent subscription data source to update data.
9. The method of claim 8, further comprising:
determining the data updating amount and the number of subscribed users corresponding to each data source;
and generating a head data source list according to the data updating amount and/or the data amount of the subscribed users, and updating periodically.
10. The method according to any one of claims 5 to 9, wherein the first preset condition comprises:
the difference value between the current timestamp and the historical timestamp is greater than a preset time T;
the second preset condition includes:
and the difference value between the current timestamp and the historical timestamp is not more than the preset time T.
11. The method according to any one of claims 5-9, further comprising:
and if the relation between the current timestamp and the historical timestamp is regularly detected to meet a third preset condition, clearing the data record in the update list.
12. A message data processing apparatus, comprising:
the message acquisition module is used for acquiring an update message recorded in the first message queue, wherein the update message comprises a data source and associated update content;
the user determining module is used for determining a subscription user corresponding to the data source;
the time stamp recording module is used for acquiring a current time stamp and a historical time stamp when the subscriber inquires the update message last time;
the user screening module is used for screening the subscribed users according to the relation between the current timestamp and the historical timestamp;
and the message updating module is used for updating the screened updating list of the subscription user according to the updating content.
13. A message data processing apparatus, comprising:
the time stamp recording module is used for acquiring a current time stamp and a historical time stamp when the user inquires the update message last time when the user inquires the update message is detected;
the first message query module is used for determining a subscription data source corresponding to the user and acquiring an update message of the subscription data source for data feedback if the relationship between the current timestamp and the historical timestamp meets a first preset condition;
and the second message query module is used for reading the update list corresponding to the user for data feedback if the relationship between the current timestamp and the historical timestamp meets a second preset condition.
14. A message data processing apparatus, the apparatus comprising: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out a message data processing method according to any one of claims 1-11.
15. A storage medium containing computer-executable instructions for performing the message data processing method of any one of claims 1-11 when executed by a computer processor.
CN202011112173.4A 2020-10-16 2020-10-16 Message data processing method, device, equipment and storage medium Pending CN112380266A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011112173.4A CN112380266A (en) 2020-10-16 2020-10-16 Message data processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011112173.4A CN112380266A (en) 2020-10-16 2020-10-16 Message data processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112380266A true CN112380266A (en) 2021-02-19

Family

ID=74580061

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011112173.4A Pending CN112380266A (en) 2020-10-16 2020-10-16 Message data processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112380266A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112883316A (en) * 2021-03-02 2021-06-01 广州市百果园信息技术有限公司 Data processing method and device, electronic equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140075454A1 (en) * 2012-09-13 2014-03-13 International Business Machines Corporation Efficient dynamic subscription updates in a content management system
CN105847447A (en) * 2016-06-01 2016-08-10 腾讯科技(深圳)有限公司 Message push method and device
CN107733968A (en) * 2017-07-24 2018-02-23 上海壹账通金融科技有限公司 Application message method for pushing, device, computer equipment and storage medium
US20180167475A1 (en) * 2016-12-08 2018-06-14 International Business Machines Corporation Dynamic distribution of persistent data
CN109818851A (en) * 2019-01-23 2019-05-28 北京奇艺世纪科技有限公司 A kind of information persistence method, device and electronic equipment
CN110166788A (en) * 2018-08-02 2019-08-23 腾讯科技(深圳)有限公司 Synchronizing information playback method, device and storage medium
CN110209734A (en) * 2019-05-05 2019-09-06 深圳市腾讯计算机系统有限公司 Data copy method, device, computer equipment and storage medium
US20190305935A1 (en) * 2018-04-03 2019-10-03 Alibaba Group Holding Limited Cross-blockchain interaction method, apparatus, system, and electronic device
CN110720096A (en) * 2019-07-03 2020-01-21 深圳市速腾聚创科技有限公司 Multi-sensor state estimation method and device and terminal equipment
US20200250188A1 (en) * 2019-02-01 2020-08-06 Zenoss, Inc. Systems, methods and data structures for efficient indexing and retrieval of temporal data, including temporal data representing a computing infrastructure

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140075454A1 (en) * 2012-09-13 2014-03-13 International Business Machines Corporation Efficient dynamic subscription updates in a content management system
CN105847447A (en) * 2016-06-01 2016-08-10 腾讯科技(深圳)有限公司 Message push method and device
US20180167475A1 (en) * 2016-12-08 2018-06-14 International Business Machines Corporation Dynamic distribution of persistent data
CN107733968A (en) * 2017-07-24 2018-02-23 上海壹账通金融科技有限公司 Application message method for pushing, device, computer equipment and storage medium
US20190305935A1 (en) * 2018-04-03 2019-10-03 Alibaba Group Holding Limited Cross-blockchain interaction method, apparatus, system, and electronic device
CN110166788A (en) * 2018-08-02 2019-08-23 腾讯科技(深圳)有限公司 Synchronizing information playback method, device and storage medium
CN109818851A (en) * 2019-01-23 2019-05-28 北京奇艺世纪科技有限公司 A kind of information persistence method, device and electronic equipment
US20200250188A1 (en) * 2019-02-01 2020-08-06 Zenoss, Inc. Systems, methods and data structures for efficient indexing and retrieval of temporal data, including temporal data representing a computing infrastructure
CN110209734A (en) * 2019-05-05 2019-09-06 深圳市腾讯计算机系统有限公司 Data copy method, device, computer equipment and storage medium
CN110720096A (en) * 2019-07-03 2020-01-21 深圳市速腾聚创科技有限公司 Multi-sensor state estimation method and device and terminal equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
胡正华 等: "面向GIS增量数据的订阅与发布机制研究", 测绘通报, no. 01 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112883316A (en) * 2021-03-02 2021-06-01 广州市百果园信息技术有限公司 Data processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US8195757B2 (en) Method, apparatus and computer program for controlling retention of publications
CN109063196B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN111597257A (en) Database synchronization method and device, storage medium and terminal
JP2015005308A (en) Providing link to portion of media object in real time in social networking update
CN111125260A (en) Data synchronization method and system based on SQL Server
CN109558065B (en) Data deleting method and distributed storage system
CN112445863A (en) Real-time data synchronization method and system
CN107038218B (en) Report processing method and system
US11080115B2 (en) Sampling management of application programming interface (API) requests
CN111177254B (en) Method and device for data synchronization between heterogeneous relational databases
CN110995566A (en) Message data pushing method, system and device
CN113242174B (en) Mail synchronization method and device, computer equipment and storage medium
CN112380266A (en) Message data processing method, device, equipment and storage medium
CN112231344B (en) Real-time stream data query method and device
JP2000357117A (en) Device and method for information processing, and computer-readable recording medium where program allowing computer to implement the method is recorded
CN110990476A (en) Data importing method, device, server and storage medium
CN115623071A (en) Method and system for distributing publish-subscribe messages of single machine and multiple clients
CN112818166B (en) Video information query method and device, electronic equipment and storage medium
CN113940086B (en) Content modification system with broadcast schedule utilization feature
CN114816778A (en) Time delay control method, system and related equipment
CN114416717A (en) Data processing method and architecture
JPH11177616A (en) System raving delivery option for deleting/replacing message
CN112764988A (en) Data segmentation acquisition method and device
CN111563123A (en) Live warehouse metadata real-time synchronization method
JP4835612B2 (en) Electronic document conversion server, control method thereof, and program

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