Message replication method, device, equipment and computer readable medium

By selecting target messages that conform to the configuration information and copying them according to the message pull time interval, the problems of high system pressure and data inconsistency in the existing technology are solved, and efficient and flexible message storage is achieved.

CN113176951BActive Publication Date: 2024-10-18JINGDONG TECH HLDG CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202110425821.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-20
Publication Date
2024-10-18
Estimated Expiration
2041-04-20

AI Technical Summary

Technical Problem

When existing message replication technology obtains online traffic from asynchronous messages, there are problems such as excessive system pressure and data inconsistency. In particular, frequent configuration reads caused by the monitoring method put pressure on the database, and the message reception process cannot be freely controlled. .

Method used

The configuration information is obtained according to the message pull time interval, and target messages that meet the remaining storage message capacity and filtering conditions are selected for replication, thereby reducing real-time monitoring and database reading operations, and ensuring data consistency through timers and configuration information update mechanisms.

Benefits of technology

It reduces system pressure, improves the efficiency, flexibility and accuracy of message storage, and avoids the problems of excessive database pressure and data inconsistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113176951B_ABST
    Figure CN113176951B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of software engineering technology, and in particular to a message replication method, device, equipment and computer-readable medium. The method is used to replicate messages from a message source to a replication database according to a message pull time interval, including: obtaining configuration information of the message pull time interval, the configuration information at least including remaining storage message capacity information; selecting target messages to be replicated to the replication database from the messages pulled within the message pull time interval according to the acquired remaining storage message capacity information; and sending the selected target messages to the replication database. The method of the embodiment of the present invention greatly reduces the pressure on the system caused by the huge online traffic, and improves the storage efficiency, flexibility and accuracy of the message replication process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software engineering, and in particular to a message replication method, device, equipment and computer-readable medium. Background Art

[0002] The main functions of the message replication platform include traffic storage process and playback process. Traffic storage has different operation modes for different data sources (such as databases, logs, asynchronous messages, etc.).

[0003] In the process of implementing the present invention, the inventors found that the method of obtaining online traffic from asynchronous messages has problems such as excessive online traffic, excessive system pressure, and inability to freely control the message receiving process because it uses a monitoring method to receive messages. Moreover, the data volume switch configuration is read from the database. When the monitoring method is used, the configuration will be read once for each message, which puts a lot of pressure on the database. However, reading the switch configuration into the memory and periodically synchronizing the configuration information in the database and the memory cache will cause data inconsistency.

[0004] There is currently no effective solution to the above problems, and a new message replication method is urgently needed to solve the above problems. Summary of the invention

[0005] In view of this, in order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present invention provide a message replication method, apparatus, device and computer-readable medium.

[0006] In a first aspect, an embodiment of the present invention provides a message replication method for replicating messages from a message source to a replication database according to a message pull time interval, comprising:

[0007] Acquire configuration information of the message pulling time interval, wherein the configuration information at least includes remaining storage message capacity information;

[0008] Selecting target messages to be copied to the replication database from the messages pulled within the message pulling time interval according to the acquired remaining storage message capacity information;

[0009] The selected target message is sent to the replicated database.

[0010] Optionally, sending the selected target message to the replicated database comprises:

[0011] The configuration information in the replicated database is updated to obtain updated configuration information, and the updated configuration information is used as configuration information for the next message pulling time interval.

[0012] Optionally, the acquiring the configuration information of the message pulling time interval includes:

[0013] Sending a configuration information request to the replicated database;

[0014] The configuration information returned from the replication database is received.

[0015] Optionally, the configuration information also includes a filtering condition.

[0016] The selecting, from the messages pulled within the message pulling time interval, target messages to be copied to the copy database according to the acquired remaining storage message capacity information, comprises:

[0017] From the messages pulled within the message pulling time interval, messages that meet the filtering condition and whose number does not exceed the remaining storage message capacity information are selected as target messages to be copied to the replication database.

[0018] Optionally, the filtering condition is a specified keyword.

[0019] Optionally, selecting, from the messages pulled within the message pulling time interval, messages that meet the filtering condition and whose number does not exceed the remaining storage message capacity information as target messages to be copied to the replication database includes:

[0020] Selecting messages that meet the filtering condition from the messages pulled within the message pulling time interval;

[0021] If the number of messages meeting the filtering condition is greater than the number indicated by the remaining storage message capacity information, the number of messages indicated by the remaining storage message capacity information is retained from the messages meeting the filtering condition as target messages to be copied to the copy database.

[0022] Optionally, selecting, from the messages pulled within the message pulling time interval, messages that meet the filtering condition and whose number does not exceed the number indicated by the remaining storage message capacity information as target messages to be copied to the replication database includes:

[0023] Setting an initial value of the counter equal to the number indicated by the remaining storage message capacity information;

[0024] Determine a message among the messages pulled within the message pulling time interval. If the message meets the filtering condition, use the message as the target message to be copied to the replication database, reduce the value of the counter by 1, and then determine whether the next message among the messages pulled within the message pulling time interval meets the filtering condition.

[0025] Optionally, the configuration information includes a message source identifier.

[0026] The selecting, from the messages pulled from the message source within the message pulling time interval, target messages to be copied to the copy database according to the acquired remaining storage message capacity information, comprises:

[0027] Pulling messages from a message source corresponding to the message source identifier within the message pulling time interval;

[0028] From the messages pulled from the message source corresponding to the message source identifier, a target message to be copied to the copy database is selected according to the acquired remaining storage message capacity information.

[0029] Optionally, the pulling of messages from a message source corresponding to the message source identifier within the message pulling time interval includes:

[0030] Determine a pulling method corresponding to the message source identifier;

[0031] Pull the message from the message source corresponding to the message source identifier according to the determined pulling method.

[0032] Optionally, the message pulling time interval is set by at least one of the following methods:

[0033] Set to a fixed time interval;

[0034] Setting the message pulling time interval according to a predetermined time function;

[0035] Setting the message pulling time interval based on the number of messages pulled from the message source in the last pulling time interval;

[0036] The message pulling time interval is set based on the number of messages indicated by the remaining storage message capacity information in the previous pulling time interval.

[0037] In a second aspect, an embodiment of the present invention provides a message replication device, which is used to replicate messages from a message source to a replication database according to a message pull time interval, including:

[0038] A configuration information acquisition unit, which acquires configuration information of the message pulling time interval, wherein the configuration information at least includes remaining storage message capacity information;

[0039] a target message selection unit, which selects target messages to be copied to a replication database from the messages pulled within the message pulling time interval according to the acquired remaining storage message capacity information;

[0040] The target message sending unit sends the selected target message to the replication database.

[0041] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, a communication interface and a communication bus, wherein the memory stores a computer program that can be run on the processor, the memory and the processor communicate through the communication bus and the communication interface, and the processor implements the steps of the method of any embodiment of the present invention when executing the computer program.

[0042] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium storing a non-volatile program code executable by a processor, wherein the program code enables the processor to execute a method according to any embodiment of the present invention.

[0043] The technical solution provided by the embodiment of the present invention has the following beneficial effects: by copying messages from a message source to a replication database according to a message pulling time interval, it is no longer necessary to monitor in real time and read the configuration frequently during the message replication process. Therefore, it will not cause problems such as excessive database pressure and data inconsistency caused by message replication in the previous monitoring mode, which greatly reduces the pressure on the system caused by huge online traffic and improves the efficiency, flexibility and accuracy of message storage. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0046] Figure 1 A schematic diagram of a hardware environment of an optional message replication method provided according to an embodiment of the present invention;

[0047] Figure 2 A flowchart of an optional message copying method provided according to an embodiment of the present invention;

[0048] Figure 3 A structural diagram of an optional message replication system provided according to an embodiment of the present invention;

[0049] Figure 4 A block diagram of an optional message copying device provided according to an embodiment of the present invention;

[0050] Figure 5 A schematic diagram of the structure of an optional electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0052] In the following description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present invention, and have no specific meanings. Therefore, "module" and "component" can be used interchangeably.

[0053] To facilitate understanding of the embodiments of the present invention, the system architecture involved in the embodiments of the present invention is first described below with reference to the accompanying drawings.

[0054] See also Figure 1 , is a schematic diagram of the hardware environment of an optional message replication method provided according to an embodiment of the present invention.

[0055] The above message replication method can be applied to Figure 1 In the hardware environment composed of the terminal 101 and the server 103 shown in FIG. 1 , the traffic playback system can be installed in the terminal or in the server. Figure 1 As shown, the server 103 is connected to the terminal 101 via a network, and can be used to provide services for the terminal or a client installed on the terminal. A database 105 can be set on the server or independently of the server to provide data storage services for the server 103. The above-mentioned network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the terminal 101 includes but is not limited to a PC, a mobile phone, a tablet computer, etc.

[0056] The message replication method in the embodiment of the present invention may be executed by the server 103 , or may be executed jointly by the server 103 and the terminal 101 .

[0057] like Figure 2 As shown, the message replication method of the embodiment of the present invention, in order to avoid the problem of high database pressure caused by performing reading judgment under judgment conditions and storing in the database every time a message is monitored in the previous monitoring method, copies the message from the message source to the replication database according to the message pulling time interval, including the following steps:

[0058] Step S202, obtaining configuration information of the message pulling time interval, wherein the configuration information at least includes remaining storage message capacity information;

[0059] Step S204, selecting target messages to be copied to the replication database from the messages pulled within the message pulling time interval according to the acquired remaining storage message capacity information;

[0060] Step S206: Send the selected target message to the replication database.

[0061] The above steps are described in detail below.

[0062] Specifically, the message can be the traffic data of the platform. Alternatively, for example, the message can be order information, such as at least one of the order number, recipient, product number, recipient address, mobile phone number, etc. Usually, the sender of the message is the producer, and the receiver is the consumer, and the two are associated through the message subject. The data format of the message is customized by the producer, and the intermediate platform that transmits the message sends the message according to the specified template format. Among them, these fields can be arranged in different orders.

[0063] Optionally, the configuration information is stored in a database, for example, configured in a MySQL database, for the configuration information acquisition unit to read and call through a reading device.

[0064] Optionally, the message pulling time interval for pulling messages can be set to a fixed time interval of 1 second, 5 seconds, 1 minute, etc. according to the platform processing requirements, or can be set to a dynamic time interval that changes dynamically over time. In addition, the message pulling time interval can also be set according to the platform processing capacity or platform processing requirements of the message replication platform.

[0065] In the prior art, the synchronization time difference may cause the actual amount of stored data to be greater than the configured threshold switch value, and the judgment on whether to store is made by reading from the cache, and the cache at the time of reading is not the latest configuration, so the actual number of dropped data may be greater than the configured number, and the number is uncontrollable. The embodiment of the present invention effectively solves the above problem by copying the messages from the message source to the replication database according to the message pull time interval.

[0066] Specifically, when the server of the message replication platform is started, the task is executed by setting an appropriate timing through the timer, and the traffic pulling operation is performed at regular intervals. Therefore, there is no need to read the configuration every time a message is consumed, which can ensure the consistency of the data volume and the switch configuration, greatly reduce the number of database operations, speed up the reading of memory cache, improve the data storage efficiency of the message replication platform, and realize the controllability of the platform processing capacity, and avoid uncontrollable situations such as platform replication overload.

[0067] In addition, preferably, in the method described in the embodiment of the present invention, the template format of the message can be set by the above-mentioned message replication platform, and the method of pulling the message can be different or the same according to the different traffic sources.

[0068] According to the message replication method of an embodiment of the present invention, the above step S206 further includes: step S206A, updating the configuration information in the replication database to obtain updated configuration information, and using the updated configuration information as the configuration information of the next message pulling time interval.

[0069] Therefore, by setting the configuration information of the next message pulling time interval in response to the configuration information in the updated database, the platform's traffic replication process can be controlled in a timely manner, so as to make timely adjustments according to the platform's processing capacity and processing tasks, thereby ensuring the improvement of the platform's overall processing efficiency.

[0070] According to the message replication method of an embodiment of the present invention, the above step S204 includes: step S204A, sending a configuration information request to the replication database; step S204B, receiving the configuration information returned from the replication database.

[0071] Since the replication database is set to feedback the corresponding configuration information in response to the configuration information request, if no configuration information request is received, there is no need to provide configuration information feedback. Compared with the real-time answering method in the prior art, the embodiment of the present invention does not need to read the configuration information from the database uninterruptedly, thereby greatly reducing the processing pressure of the replication platform and further improving the overall replication capability of the platform.

[0072] According to a message replication method according to an embodiment of the present invention, the configuration information also includes a filtering condition, wherein step S204 also includes: step S204C, selecting, from the messages pulled within the message pulling time interval, messages that meet the filtering condition and whose quantity does not exceed the remaining storage message capacity information as target messages to be copied to the replication database.

[0073] According to the message copying method of an embodiment of the present invention, the filtering condition is a specified keyword. If the pulled message contains the keyword specified in the configuration information and the number does not exceed the remaining storage message capacity information, the message is copied as the target message.

[0074] The embodiment of the present invention can directly remove other unnecessary data other than the target message by selecting messages that meet the filtering conditions from the pulled messages and whose number does not exceed the remaining storage message capacity information, thereby greatly reducing the amount of data copied by the platform as a whole, and thus enabling the replication platform to have greater message replication capabilities and have the spare capacity to copy more data that needs to be copied.

[0075] According to a message replication method according to an embodiment of the present invention, step S204C includes: step S204Ca, selecting messages that meet the filtering conditions from the messages pulled within the message pulling time interval; step S204Cb, if the number of messages that meet the filtering conditions is greater than the number indicated by the remaining storage message capacity information, retaining the number of messages indicated by the remaining storage message capacity information from the messages that meet the filtering conditions as target messages to be copied to the replication database.

[0076] In the embodiment of the present invention, if the number of messages that meet the filtering condition is less than or equal to the number indicated by the remaining storage message capacity information, it goes without saying that all messages that meet the filtering condition can be stored in the database as target messages. However, once the number of messages that meet the filtering condition is greater than the number indicated by the remaining storage message capacity information, the copying action is often no longer performed. In this case, the embodiment of the present invention is set to retain the number of messages indicated by the remaining storage message capacity information from the messages that meet the filtering condition, thereby effectively avoiding the situation where the remaining storage message capacity is wasted, thereby fully improving the overall copying capability and processing efficiency of the platform.

[0077] According to a message replication method according to an embodiment of the present invention, step S204C includes: step S204Cc, setting the initial value of the counter equal to the number indicated by the remaining storage message capacity information; step S204Cd, determining a message among the messages pulled within the message pulling time interval, and if the message meets the filtering condition, using the message as the target message to be copied to the replication database, reducing the value of the counter by 1, and then determining whether the next message among the messages pulled within the message pulling time interval meets the filtering condition.

[0078] In this way, the embodiment of the present invention can set the number of messages pulled within the same pulling time interval according to the remaining storage message capacity information, and then check whether this batch of messages meets the filtering conditions one by one. If they meet the filtering conditions, they will be copied; if they do not meet the filtering conditions, they will be directly removed, further effectively and orderly utilizing the overall storage capacity of the replication platform and improving the processing capacity of the replication platform.

[0079] According to a message replication method according to an embodiment of the present invention, wherein the configuration information includes a message source identifier, step S204 includes: step S204D, pulling messages from a message source corresponding to the message source identifier within the message pulling time interval; step S204E, selecting target messages to be copied to a replication database from the messages pulled from the message source corresponding to the message source identifier according to the acquired remaining storage message capacity information.

[0080] Therefore, by setting the message source identifier in the configuration information to clearly indicate which message source each pulled message comes from, the messages can be regrouped according to the different message sources, and after copying, it can still be clear which message source the copied message originally came from.

[0081] According to a message replication method according to an embodiment of the present invention, step S204D includes: step S204Da, determining a pulling method corresponding to the message source identifier; step S204Db, pulling messages from a message source corresponding to the message source identifier according to the determined pulling method.

[0082] In this way, the embodiment of the present invention can adopt different pulling methods for messages from different message sources, thereby avoiding low processing efficiency and production capacity caused by adopting the same pulling method for all messages.

[0083] According to a message replication method according to an embodiment of the present invention, the message pulling time interval is set by at least one of the following methods: setting it to a fixed time interval; setting the message pulling time interval according to a predetermined time function; setting the message pulling time interval based on the number of messages pulled from the message source in the previous pulling time interval; setting the message pulling time interval based on the number of messages indicated by the remaining storage message capacity information in the previous pulling time interval.

[0084] Since the embodiments of the present invention can flexibly set the message pulling time interval to be fixed or timely variable according to the actual needs of the platform or the dynamic processing conditions of the platform, the processing of the message replication platform can be adjusted in time according to the current task volume and the saturation state of processing capacity, thereby comprehensively improving the processing efficiency and production capacity of the replication platform in the entire replication process.

[0085] In addition, if Figure 3 FIG. 1 is a structure of an optional message replication system provided according to an embodiment of the present invention.

[0086] like Figure 3As shown, it is the structure of the message replication system according to an embodiment of the present invention. In this embodiment, the message replication system includes: a reading device 310, a buffer device 320, a timer device 330 and a copy writing device 340. The business server includes an interface 350 for consumers to input message replication requests. The reading device 310 is mainly used to receive message replication requests from the interface 350, and initialize reading and timing reading. The buffer device 320 is mainly used to store configuration information and data quantity as a cache during the message replication process. The timer device 330 is mainly used to set the message pull cycle to regularly pull messages for message replication. The copy writing device 340 is mainly used to judge and filter the data that needs to be copied and stored in the library in each message pull cycle, and after filtering, the data that needs to be copied and stored in the library is copied as the replication target data to the database, thereby completing the message replication of the platform. The interface 350 is mainly used to receive business requests, that is, message replication requests. The message replication request comes from the client or other servers connected to the business server.

[0087] According to another aspect of the embodiment of the present invention, Figure 4 As shown, a message replication device is provided, which is used to replicate messages from a message source to a replication database according to a message pulling time interval, including:

[0088] A configuration information acquisition unit 401 is configured to acquire configuration information of the message pulling time interval, wherein the configuration information at least includes information on the remaining storage message capacity;

[0089] The target message selection unit 403 selects the target message to be copied to the copy database from the messages pulled within the message pulling time interval according to the acquired remaining storage message capacity information;

[0090] The target message sending unit 405 sends the selected target message to the replication database.

[0091] It should be noted that the configuration information acquisition unit 401 in this embodiment can be used to execute step S202 in the embodiment of the present invention, the target message selection unit 403 in this embodiment can be used to execute step S204 in the embodiment of the present invention, and the target message sending unit 405 in this embodiment can be used to execute step S206 in the embodiment of the present invention.

[0092] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware.

[0093] According to another aspect of the embodiments of the present invention, the present invention provides an electronic device, such as Figure 5 As shown, it includes: a memory 501, a processor 503, a communication interface 505 and a communication bus 507. The memory 501 stores a computer program that can be run on the processor 503. The memory 501 and the processor 503 communicate through the communication interface 505 and the communication bus 507. When the processor 503 executes the computer program, the steps of the above method are implemented.

[0094] The memory and processor in the above electronic device communicate via a communication bus and a communication interface. The communication bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc.

[0095] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Alternatively, the memory may also be at least one storage device located away from the aforementioned processor.

[0096] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0097] According to another aspect of the embodiments of the present invention, a computer-readable medium having a non-volatile program code executable by a processor is provided.

[0098] Optionally, in an embodiment of the present invention, the computer-readable medium is configured to store program codes for the processor to perform the following steps:

[0099] Step S202, obtaining configuration information of the message pulling time interval, wherein the configuration information at least includes remaining storage message capacity information;

[0100] Step S204, selecting target messages to be copied to the replication database from the messages pulled within the message pulling time interval according to the acquired remaining storage message capacity information;

[0101] Step S206: Send the selected target message to the replication database.

[0102] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0103] The embodiments of the present invention may refer to the above embodiments when being specifically implemented, and have corresponding technical effects.

[0104] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present invention, or a combination thereof.

[0105] For software implementation, the technology described herein can be implemented by a unit that performs the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0106] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0107] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0108] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0109] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0110] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0111] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk. It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "includes", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also includes elements inherent to such a process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.

[0112] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A message replication method, for replicating messages from a message source to a replication database at a message pulling time interval, comprising: Acquire configuration information of the message pulling time interval, wherein the configuration information at least includes remaining storage message capacity information; Selecting target messages to be copied to the replication database from the messages pulled within the message pulling time interval according to the acquired remaining storage message capacity information; sending the selected target message to the replicated database; The sending the selected target message to the replicated database comprises: The configuration information in the replicated database is updated to obtain updated configuration information, and the updated configuration information is used as configuration information for the next message pulling time interval.

2. The message copying method according to claim 1, wherein: The obtaining of the configuration information of the message pulling time interval includes: Sending a configuration information request to the replicated database; The configuration information returned from the replication database is received.

3. The message copying method according to claim 1, wherein: The configuration information also includes filtering conditions. The selecting, from the messages pulled within the message pulling time interval, target messages to be copied to the copy database according to the acquired remaining storage message capacity information, comprises: From the messages pulled within the message pulling time interval, messages that meet the filtering condition and whose number does not exceed the remaining storage message capacity information are selected as target messages to be copied to the replication database.

4. The message copying method according to claim 3, wherein: The filtering condition is a specified keyword.

5. The message copying method according to claim 3, wherein: The selecting, from the messages pulled within the message pulling time interval, messages that meet the filtering condition and whose number does not exceed the remaining storage message capacity information as target messages to be copied to the replication database comprises: Selecting messages that meet the filtering condition from the messages pulled within the message pulling time interval; If the number of messages meeting the filtering condition is greater than the number indicated by the remaining storage message capacity information, the number of messages indicated by the remaining storage message capacity information is retained from the messages meeting the filtering condition as target messages to be copied to the copy database.

6. The message copying method according to claim 3, wherein: The selecting, from the messages pulled within the message pulling time interval, messages that meet the filtering condition and whose number does not exceed the number indicated by the remaining storage message capacity information as target messages to be copied to the replication database comprises: Setting an initial value of the counter equal to the number indicated by the remaining storage message capacity information; Determine a message among the messages pulled within the message pulling time interval. If the message meets the filtering condition, use the message as the target message to be copied to the replication database, reduce the value of the counter by 1, and then determine whether the next message among the messages pulled within the message pulling time interval meets the filtering condition.

7. The message copying method according to claim 1, wherein: The configuration information includes a message source identifier, The selecting, from the messages pulled from the message source within the message pulling time interval, target messages to be copied to the copy database according to the acquired remaining storage message capacity information, comprises: Pulling messages from a message source corresponding to the message source identifier within the message pulling time interval; From the messages pulled from the message source corresponding to the message source identifier, a target message to be copied to the copy database is selected according to the acquired remaining storage message capacity information.

8. The message copying method according to claim 7, wherein: Pulling the message from the message source corresponding to the message source identifier within the message pulling time interval includes: Determine a pulling method corresponding to the message source identifier; Pull the message from the message source corresponding to the message source identifier according to the determined pulling method.

9. The message copying method according to claim 1, wherein: The message pulling time interval is set by at least one of the following methods: Set to a fixed time interval; Setting the message pulling time interval according to a predetermined time function; Setting the message pulling time interval based on the number of messages pulled from the message source in the last pulling time interval; The message pulling time interval is set based on the number of messages indicated by the remaining storage message capacity information in the previous pulling time interval.

10. A message replication device, used to replicate messages from a message source to a replication database according to a message pulling time interval, comprising: A configuration information acquisition unit, which acquires configuration information of the message pulling time interval, wherein the configuration information at least includes remaining storage message capacity information; a target message selection unit, which selects target messages to be copied to a replication database from the messages pulled within the message pulling time interval according to the acquired remaining storage message capacity information; a target message sending unit, which sends the selected target message to the replication database; The sending the selected target message to the replicated database comprises: The configuration information in the replicated database is updated to obtain updated configuration information, and the updated configuration information is used as configuration information for the next message pulling time interval.

11. An electronic device, comprising a memory, a processor, a communication interface and a communication bus, wherein the memory stores a computer program that can be run on the processor, and the memory and the processor communicate through the communication bus and the communication interface, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.

12. A computer-readable medium storing a non-volatile program code executable by a processor, wherein: The program code causes the processor to execute the method of any one of claims 1 to 9.

Citation Information

Patent Citations

  • System and method for copying data among heterogeneous databases

    CN102004743A

  • Information processing method and server

    CN107454144A

  • Push information storage method and device, server and computer readable memory medium

    CN108881354A

  • Keyword-based reply method, device, computer device and storage medium

    CN109067643A