CN115550455A - Method, device, equipment and medium for orderly sending information - Google Patents
Method, device, equipment and medium for orderly sending information Download PDFInfo
- Publication number
- CN115550455A CN115550455A CN202211262498.XA CN202211262498A CN115550455A CN 115550455 A CN115550455 A CN 115550455A CN 202211262498 A CN202211262498 A CN 202211262498A CN 115550455 A CN115550455 A CN 115550455A
- Authority
- CN
- China
- Prior art keywords
- task information
- information
- task
- sending
- generation time
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 238000004590 computer program Methods 0.000 claims description 15
- 230000005540 biological transmission Effects 0.000 claims description 13
- 230000010365 information processing Effects 0.000 claims description 6
- 230000000694 effects Effects 0.000 abstract description 5
- 230000006870 function Effects 0.000 description 6
- 230000008901 benefit Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 238000007726 management method Methods 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 238000005192 partition Methods 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 239000011521 glass Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a method, a device, equipment and a medium for orderly sending information. The method is applied to an information management system established based on Kafka, and comprises the following steps: based on the characteristics of the task request and the task information flow, determining the time interval, the pre-sending sequence and the theme of the task information in the task information flow, wherein the task information comprises initial generation time; if the theme corresponds to a plurality of different theme types, determining target generation time of the task information based on the time interval, the pre-sending sequence and the initial generation time, and writing the task information into an information table to be sent; and determining a sending sequence according to the target generation time, and sending the task information in the information table to be sent according to the sending sequence. The technical scheme of the embodiment of the invention realizes the effect of orderly sending different Topic information when the Producer generates a plurality of different Topic information.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method, an apparatus, a device, and a medium for sequentially sending information.
Background
With the development of technology, a large number of internet related companies use distributed databases and distributed computing clusters to analyze business data and count keywords, and the like. Message systems, particularly distributed message systems, have come into play because a large amount of data stored in a database consumes a large amount of memory, and direct storage of a large amount of data in a hard disk can reduce the work efficiency. .
At present, kafka is a distributed message system developed by LinkedIn, used to construct real-time data pipes and streaming applications, and is used by many companies due to its high-level expansion and high throughput. The Producer (information Producer) in the Kafka architecture is responsible for sending messages to the Topic, the Consumer (information Consumer) can obtain historical messages through an offset, and the ordering of the messages in the Topic can be guaranteed through Partition.
However, the ordering of messages within the same Topic can be guaranteed by specifying partitions, etc., but when the Producer generates a plurality of different Topic messages, the ordering between different topics cannot be guaranteed.
Disclosure of Invention
The invention provides a method, a device, equipment and a medium for transmitting information in order, which are used for realizing the orderliness of transmitting different Topic messages.
In a first aspect, an embodiment of the present invention provides a method for sending information in order, where the method is applied to an information management system established based on Kafka, and the method includes:
determining a time interval, a pre-sending sequence and a theme of task information in a task information stream based on characteristics of a task request and the task information stream, wherein the task information comprises initial generation time;
if the theme corresponds to a plurality of different theme types, determining target generation time of the task information based on the time interval, the pre-sending sequence and the initial generation time, and writing the task information into an information table to be sent;
and determining a sending sequence according to the target generation time, and sending the task information in the information table to be sent according to the sending sequence.
In a second aspect, an embodiment of the present invention provides an apparatus for orderly sending information, configured in an information management system established based on Kafka, where the apparatus includes:
the system comprises a theme determining module, a task information processing module and a task information processing module, wherein the theme determining module is used for determining the time interval, the pre-sending sequence and the theme of task information in a task information stream based on the characteristics of a task request and the task information stream, and the task information comprises initial generation time;
an information writing module, configured to determine target generation time of the task information based on the time interval, the pre-sending sequence, and the initial generation time if the topic corresponds to multiple different topic types, and write the task information into an information table to be sent;
and the information sending module is used for determining a sending sequence according to the target generation time and sending the task information in the information table to be sent according to the sending sequence.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
at least one processor;
and a memory communicatively coupled to the at least one processor;
wherein the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the method of the first aspect for ordered delivery of information.
In a fourth aspect, the present invention provides a computer-readable storage medium, which stores computer instructions for causing a processor to implement the method for orderly sending information according to the first aspect when executed.
The scheme for orderly sending information, provided by the embodiment of the invention, determines a time interval, a pre-sending sequence and a theme of task information in a task information stream based on a task request and characteristics of the task information stream, wherein the task information comprises initial generation time, and if the theme corresponds to a plurality of different theme types, the task information is determined to have target generation time based on the time interval, the pre-sending sequence and the initial generation time, and is written into an information table to be sent, the sending sequence is determined according to the target generation time, and the task information in the information table to be sent is sent according to the sending sequence. By adopting the technical scheme, the time interval, the pre-sending sequence and the theme of the task information are determined according to the characteristics of the task request and the task information flow, then the target generation time of the task information of various different theme types is determined, the task information is stored in the information table to be sent, and finally the task information in the information table to be sent is sent according to the sequence of the target generation time, so that the effect of orderly sending different Topic information is realized when the Producer generates a plurality of different Topic messages.
It should be understood that the statements in this section are not intended to identify key or critical features of the embodiments of the present invention, nor are they intended to limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a method for orderly transmitting information according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for orderly transmitting information according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for orderly transmitting information according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. In the description of the present invention, "a plurality" means two or more unless otherwise specified. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1 is a flowchart of a method for sending information in order according to an embodiment of the present invention, where this embodiment is applicable to a case where different topoc messages are sent in order, and the method may be executed by an apparatus for sending information in order, where the apparatus for sending information in order may be implemented in a form of hardware and/or software, and the apparatus for sending information in order may be configured in an information management system established based on Kafka, where the information management system may be run in an electronic device, and the electronic device may be formed by two or more physical entities or may be formed by one physical entity.
As shown in fig. 1, a method for sending information in order provided in an embodiment of the present invention specifically includes the following steps:
s101, determining time intervals, pre-sending sequences and topics of task information in task information streams based on characteristics of task requests and task information streams.
Wherein, the task information comprises the initial generation time.
In this embodiment, in the Kafka system, task information may be generated according to each task request, a time for generating the task information is an initial generation time, and it is determined according to the task request that a plurality of pieces of task information need to be generated, then interval time, that is, time intervals, and a transmission sequence, that is, a pre-transmission sequence, when the plurality of pieces of task information are transmitted, may be configured in advance, for example, an interval 1s between a piece of task information and a piece of task information b is transmitted, and when a plurality of pieces of task information are generated, a corresponding information stream may be formed, and a topic of the task information may be determined according to characteristics of the task information in the information stream, characteristics of the task information may be specific functions of the task information, and the like, for example, the task information for changing a database table belongs to topic a, and the task information for deleting a database table belongs to topic b, and the task request may be determined according to a specific request or need of a Consumer, and the task information may include contents of initial generation time, a key value, a main body of the task information, and the task information of the same task information, and whether topics included in the information stream may be the same, and whether characteristics of the task information may be determined by a key value, and a relationship of the characteristics of the task information corresponding to the task information may be the corresponding relationship of the task.
S102, if the theme corresponds to a plurality of different theme types, determining target generation time of the task information based on the time interval, the pre-sending sequence and the initial generation time, and writing the task information into an information table to be sent.
In this embodiment, when the topics of a plurality of task information included in an information stream are different, that is, the topic types are different, the initial generation time of all the task information may be changed, or the initial generation time of a part of the task information in the task information may be changed according to a time interval, a pre-transmission sequence and an initial generation time to obtain a target generation time, so that the generation time of task information ranked later in the pre-transmission sequence is later, for example, a task information in the pre-transmission sequence is prior to b task information, the initial generation time of a is not changed, but the target generation time of b is determined to be the initial generation time later than a, and then all the task information is written into an information table to be transmitted, where when the initial generation times of a plurality of task information are the same, the gap between the initial generation time and the target generation time may be the same as the value of the time interval, when the initial generation times of a plurality of task information are different, the gap between different target generation times may be the same as the value of the time interval, and the presentation form of the initial transmission time may be a few types of the information set to be transmitted, and the information set to be transmitted.
S103, determining a sending sequence according to the target generation time, and sending the task information in the information table to be sent according to the sending sequence.
In this embodiment, in the Kafka system, task information of an earlier generation time is to be preferentially sent, and the task information in the information table to be sent may be sent according to a target generation time and/or an initial generation time in the information table to be sent, and a corresponding order.
The method for orderly sending information, provided by the embodiment of the invention, determines the pre-sending time of the task information and the theme of the task information in the task information stream based on the characteristics of the task request and the task information stream, wherein the task information comprises the theme and the initial generation time of the task information, the pre-sending time is determined based on the initial generation time of the task information and the time interval, the time interval is used for determining the time interval for sending the task information, if the theme corresponds to a plurality of different theme types, the task information corresponding to the theme is written into an information table to be sent, and if the pre-sending time is different, the task information in the information table to be sent is sent based on the sequence of the pre-sending time. According to the technical scheme of the embodiment of the invention, the time interval, the pre-sending sequence and the theme of the task information are determined according to the characteristics of the task request and the task information flow, then the target generation time of the task information of various different theme types is determined, the task information is stored in the information table to be sent, and finally the task information in the information table to be sent is sent according to the sequence of the target generation time, so that the effect of orderly sending different Topic information is realized when the Producer generates a plurality of different Topic information.
Example two
Fig. 2 is a flowchart of a method for sending information in order according to a second embodiment of the present invention, where the technical solution of the second embodiment of the present invention is further optimized based on the foregoing optional technical solutions, and a manner for sending different Topic messages in order is given.
Optionally, the determining a sending sequence according to the target generation time includes: and determining the scanning interval time of the information table to be sent, and scanning the information table to be sent once every time the scanning interval time passes to determine the sending sequence of the task information in the information table to be sent, wherein the scanning interval time is less than or equal to the time interval. The advantage of this arrangement is that by setting a reasonable scanning time, the task information in the information table to be sent can be guaranteed to be sent on time.
Optionally, the determining, based on the characteristics of the task request and the task information flow, a time interval, a pre-sending sequence, and a topic of the task information in the task information flow includes: according to a task request, determining initial generation time, interval time and a pre-sending sequence of each task information in a task information stream, wherein the task information stream comprises a plurality of task information; and determining the theme of each task information in the task information flow according to the characteristics of each task information in the task information flow. The advantage of this arrangement is that by determining the initial generation time, time interval, subject and pre-transmission sequence of each task information, it provides assurance that the task information will be transmitted accurately.
Optionally, if the theme corresponds to multiple different theme types, determining target generation time of the task information based on the time interval, the pre-sending sequence, and the initial generation time, and writing the task information into an information table to be sent, including: if the theme corresponds to multiple different theme types and the time interval is greater than zero, determining first task information in the task information according to the time interval of the task information and the pre-sending sequence; adjusting the initial generation time of the first task information based on the time interval to obtain target generation time; and writing the first task information and the second task information into an information table to be sent, wherein the task information comprises the first task information and the second task information, and the second task information is corresponding to the generation time which is not adjusted. This arrangement is advantageous in that since task information of earlier generation time is to be transmitted preferentially in the Kafka system, the transmission order of task information can be set by changing the initial generation time.
Optionally, after the sending of the task information in the information table to be sent, the method further includes: and generating actual sending time of the task information, deleting the task information from the information table to be sent, and adding the actual sending time and the task information into a sent history table. The advantage of setting up like this is, according to comparing the time of sending in advance of the task information with actual sending time, can check whether the sending sequence of the task information satisfies the corresponding sending sequence in the time of sending in advance.
As shown in fig. 2, a method for sending information in order provided in the second embodiment of the present invention specifically includes the following steps:
s201, according to the task request, determining the initial generation time, the time interval and the pre-sending sequence of each task information in the task information flow.
The task information flow comprises a plurality of task information.
Specifically, the initial generation time, the time interval, the pre-transmission order, the key value, the information body, and the like of the task information may be configured according to the service requirement or the task request of the concumer.
S202, determining the theme of each piece of task information in the task information flow according to the characteristics of each piece of task information in the task information flow.
For example, if the task information is characterized by modifying an a database table of a certain storage area in the Kafka cluster, the task information may be determined as a topic a, and if the task information is characterized by modifying a B database table of a certain storage area in the Kafka cluster, the task information may be determined as a topic B.
S203, if the theme corresponds to multiple different theme types and the time interval is greater than zero, determining first task information in the task information according to the time interval of the task information and the pre-sending sequence.
Specifically, the first task information may be task information that is subsequent to the task information that is ranked first in the pre-transmission order, i.e., is transmitted first.
For example, if the time interval is one minute, the topic types of the topic a and the topic B are different, the initial generation time of the task information of the topic a is 8 am, the initial generation time of the task information of the topic B is also 8 am, and the pre-transmission order is that a precedes B, the task information of the topic B may be determined as the first task information.
S204, adjusting the initial generation time of the first task information based on the time interval to obtain target generation time.
Specifically, the target generation time of the first task information may be determined as a time corresponding to a time interval later than the initial generation time of the theme a.
Optionally, the adjusting the initial generation time of the first task information based on the time interval to obtain a target generation time includes: and when the initial generation time of the plurality of task information is the same, calculating the sum of the initial generation time of the first task information and the interval time to obtain target generation time.
Illustratively, as described in the above example, the initial time of the task information of the topic B may be adjusted to 8 am 1 minute.
Optionally, the adjusting the initial generation time of the first task information based on the time interval to obtain a target generation time includes: when the initial generation times of the plurality of pieces of task information are different, the sum of the initial generation time of the second piece of task information and the interval time in the plurality of pieces of task information can be calculated to obtain a target generation time.
For example, if the time interval is 5 minutes, the initial generation time of the task information of the topic a is 8 am, the initial generation time of the task information of the topic B is 8 am 1 min, the initial generation time of the task information of the topic C is 8 am 2 min, the pre-transmission sequence is that a precedes B and B precedes C, the task information of the topic B and the topic C may be determined as the first task information, the task information of the topic a is determined as the second task information, and the target generation times of the task information of the topic B and the topic C are both 8 am 5 min.
S205, writing the first task information and the second task information into an information table to be sent.
The task information comprises the first task information and the second task information, and the second task information is corresponding to the production time which is not adjusted.
Illustratively, as described in the above example, the task information of the subject a, the subject B, and the subject C may be written in the to-be-transmitted information table.
Optionally, if the theme corresponds to multiple different theme types and the time interval is equal to zero, storing the task information of the theme in an information table to be sent; and when the initial generation time of the task information is the same, simultaneously sending the task information in the information table to be sent.
For example, if the time interval is zero, the task information of the topic a and the topic B may be directly written into the information table to be sent, and if the initial generation time of the topic a and the initial generation time of the topic B are the same, the task information of the topic a and the task information of the topic B may be sent at the same time.
S206, determining the scanning interval time of the information table to be sent, and scanning the information table to be sent once every time the scanning interval time passes so as to determine the sending sequence of the task information in the information table to be sent.
Wherein the scan interval time is less than or equal to the time interval.
For example, as described in the above example, if the time interval is 5 minutes, and the information table to be sent only includes the task information of the topic a, the topic B, and the topic C, the scanning interval time may be set to 5 minutes, that is, the information table to be sent is scanned every 5 minutes, and since the initial generation time of the topic a is prior to the target generation time of the topic B and the topic C, it may be determined that the sending sequence of the task information in the information table to be sent is that the task information of the topic a is sent first, and the task information of the topic B and the task information of the topic C are sent again when the next scanning is performed, that is, after 5 minutes.
And S207, sending the task information in the information table to be sent according to the sending sequence.
S208, generating the actual sending time of the task information, deleting the task information from the information table to be sent, and adding the actual sending time and the task information into a sent history table.
For example, as described in the above example, after the task information of the topic a is sent, the time corresponding to the current sending is determined as the actual sending time of the task information, the task information of the topic a is deleted from the to-be-sent information table, and the actual sending time of the task information of the topic a and the task information are added to the sent history table.
The method for orderly sending the information determines the pre-sending sequence, the initial generating time, the time interval, the theme and the like of the task information according to the characteristics of the task request and the task information flow, then updates the target generating time and the second task information of the first task information in the task information according to the pre-sending sequence and the time interval, stores the first task information and the second task information into an information table to be sent, determines the scanning time interval of the information table to be sent, finally sends the task information in the information table to be sent according to the target generating time and/or the sequence of the initial generating time in the information table to be sent, reasonably determines the sending sequence of the task information with different themes according to the pre-sending sequence and the time interval of the task information, and pointedly increases the initial generating time of the task information needing to be sent later based on the principle of sending data by a Kafka system, thereby realizing the effect of sending different Topic information when a Producer generates a plurality of orderly Topic messages with different Topic.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an apparatus for orderly sending information according to a third embodiment of the present invention, where the apparatus may be configured in an information management system established based on Kafka. As shown in fig. 3, the apparatus includes: a theme determining module 301, an information writing module 302, and an information sending module 303, wherein:
the system comprises a theme determining module, a task information processing module and a task information processing module, wherein the theme determining module is used for determining the time interval, the pre-sending sequence and the theme of task information in a task information stream based on the characteristics of a task request and the task information stream, and the task information comprises initial generation time;
an information writing module, configured to determine target generation time of the task information based on the time interval, the pre-sending sequence, and the initial generation time if the theme corresponds to multiple different theme types, and write the task information into an information table to be sent;
and the information sending module is used for determining a sending sequence according to the target generation time and sending the task information in the information table to be sent according to the sending sequence.
The device for orderly sending the information determines the time interval, the pre-sending sequence and the theme of the task information according to the characteristics of the task request and the task information flow, then determines the target generation time of the task information with various different theme types, stores the task information into the information table to be sent, and finally sends the task information in the information table to be sent according to the sequence of the target generation time, thereby realizing the effect of orderly sending different Topic information when a Producer generates a plurality of different Topic messages.
Optionally, the information sending module includes:
and the scanning unit is used for determining the scanning interval time of the information table to be sent and scanning the information table to be sent once every time the scanning interval time passes so as to determine the sending sequence of the task information in the information table to be sent, wherein the scanning interval time is less than or equal to the time interval.
Optionally, the theme determination module includes:
the time determining unit is used for determining the initial generation time, the interval time and the pre-sending sequence of each task information in a task information stream according to the task request, wherein the task information stream comprises a plurality of task information;
and the theme determining unit is used for determining the theme of each piece of task information in the task information flow according to the characteristics of each piece of task information in the task information flow.
Optionally, the information writing module includes:
a first task information determining unit, configured to determine, if the theme corresponds to multiple different theme types and the time interval is greater than zero, first task information in the multiple task information according to the time interval of the task information and the pre-sending order;
a target generation time determining unit, configured to adjust an initial generation time of the first task information based on the time interval, so as to obtain a target generation time;
and an information writing unit, configured to write the first task information and the second task information into an information table to be sent, where the task information includes the first task information and the second task information, and the second task information is task information corresponding to generation time that has not been adjusted.
Optionally, the information writing module further includes:
the information storage unit is used for storing the task information of the theme into an information table to be sent if the theme corresponds to a plurality of different theme types and the time interval is equal to zero;
and the information sending unit is used for simultaneously sending the task information in the information table to be sent when the initial generation time of the task information is the same.
Optionally, the apparatus further comprises:
and the sent history table updating module is used for generating actual sending time of the task information after the task information in the information table to be sent is sent, deleting the task information from the information table to be sent, and adding the actual sending time and the task information into the sent history table.
Adjusting the initial generation time of the first task information based on the time interval to obtain a target generation time, including: and when the initial generation time of the plurality of task information is the same, calculating the sum of the initial generation time of the first task information and the interval time to obtain target generation time.
The device for orderly sending the information can execute the method for orderly sending the information provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Example four
FIG. 4 shows a schematic block diagram of an electronic device 40 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 40 includes at least one processor 41, and a memory communicatively connected to the at least one processor 41, such as a Read Only Memory (ROM) 42, a Random Access Memory (RAM) 43, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 41 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 42 or the computer program loaded from a storage unit 48 into the Random Access Memory (RAM) 43. In the RAM 43, various programs and data necessary for the operation of the electronic apparatus 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other via a bus 44. An input/output (I/O) interface 45 is also connected to bus 44.
A number of components in the electronic device 40 are connected to the I/O interface 45, including: an input unit 46 such as a keyboard, a mouse, or the like; an output unit 47 such as various types of displays, speakers, and the like; a storage unit 48 such as a magnetic disk, an optical disk, or the like; and a communication unit 49 such as a network card, modem, wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
In some embodiments, the method of sequentially transmitting information may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 40 via the ROM 42 and/or the communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the above-described method of sequentially transmitting information may be performed. Alternatively, in other embodiments, processor 41 may be configured by any other suitable means (e.g., by way of firmware) to perform the method of sending information in order.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
The computer device provided above can be used to execute the method for sending information in order provided in any of the above embodiments, and has corresponding functions and advantages.
EXAMPLE five
In the context of the present invention, a computer-readable storage medium may be a tangible medium, which when executed by a computer processor, performs a method of transmitting information in order, the method comprising:
based on the characteristics of a task request and a task information stream, determining the time interval, the pre-sending sequence and the theme of the task information in the task information stream, wherein the task information comprises initial generation time;
if the theme corresponds to a plurality of different theme types, determining target generation time of the task information based on the time interval, the pre-sending sequence and the initial generation time, and writing the task information into an information table to be sent;
and determining a sending sequence according to the target generation time, and sending the task information in the information table to be sent according to the sending sequence.
In the context of the present invention, a computer readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer device provided above can be used to execute the method for sending information in order provided in any of the above embodiments, and has corresponding functions and advantages.
It should be noted that, in the embodiment of the apparatus for sending information in order, each unit and each module included in the apparatus are only divided according to functional logic, but are not limited to the above division, as long as the corresponding function can be implemented; in addition, the specific names of the functional units are only for the convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will appreciate that the present invention is not limited to the particular embodiments described herein, and that various obvious changes, rearrangements and substitutions will now be apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims (10)
1. A method for orderly sending information is applied to an information management system established based on Kafka, and the method comprises the following steps:
based on the characteristics of a task request and a task information stream, determining the time interval, the pre-sending sequence and the theme of the task information in the task information stream, wherein the task information comprises initial generation time;
if the theme corresponds to a plurality of different theme types, determining target generation time of the task information based on the time interval, the pre-sending sequence and the initial generation time, and writing the task information into an information table to be sent;
and determining a sending sequence according to the target generation time, and sending the task information in the information table to be sent according to the sending sequence.
2. The method of claim 1, wherein determining the transmission order based on the target generation time comprises:
and determining a scanning time interval of the information table to be sent, and scanning the information table to be sent once every time the scanning time interval passes to determine a sending sequence of task information in the information table to be sent, wherein the scanning time interval is less than or equal to the time interval.
3. The method of claim 1, wherein determining the time interval, the pre-sending order and the subject of the task information in the task information flow based on the task request and the characteristics of the task information flow comprises:
according to a task request, determining initial generation time, time interval and pre-sending sequence of each task information in a task information stream, wherein the task information stream comprises a plurality of task information;
and determining the theme of each task information in the task information flow according to the characteristics of each task information in the task information flow.
4. The method according to claim 3, wherein if the topic corresponds to a plurality of different topic types, determining a target generation time of the task information based on the time interval, the pre-sending sequence and the initial generation time, and writing the task information into an information table to be sent comprises:
if the theme corresponds to multiple different theme types and the time interval is greater than zero, determining first task information in the task information according to the time interval of the task information and the pre-sending sequence;
adjusting the initial generation time of the first task information based on the time interval to obtain target generation time;
and writing the first task information and the second task information into an information table to be sent, wherein the task information comprises the first task information and the second task information, and the second task information is corresponding to the generation time which is not adjusted.
5. The method of claim 4, further comprising:
if the theme corresponds to a plurality of different theme types and the time interval is equal to zero, storing the task information of the theme into an information table to be sent;
and when the initial generation time of the task information is the same, simultaneously sending the task information in the information table to be sent.
6. The method according to claim 1, further comprising, after said sending task information in the to-be-sent information table, the step of:
and generating actual sending time of the task information, deleting the task information from the information table to be sent, and adding the actual sending time and the task information into a sent history table.
7. The method of claim 4, wherein said adjusting an initial generation time of the first task information based on the time interval to obtain a target generation time comprises:
and when the initial generation time of the plurality of task information is the same, calculating the sum of the initial generation time of the first task information and the time interval to obtain target generation time.
8. An apparatus for orderly transmitting information, configured in an information management system established based on Kafka, the apparatus comprising:
the system comprises a theme determining module, a task information processing module and a task information processing module, wherein the theme determining module is used for determining the time interval, the pre-sending sequence and the theme of task information in a task information stream based on the characteristics of a task request and the task information stream, and the task information comprises initial generation time;
an information writing module, configured to determine target generation time of the task information based on the time interval, the pre-sending sequence, and the initial generation time if the topic corresponds to multiple different topic types, and write the task information into an information table to be sent;
and the information sending module is used for determining a sending sequence according to the target generation time and sending the task information in the information table to be sent according to the sending sequence.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of sending information in order of any one of claims 1-7.
10. A computer-readable storage medium storing computer instructions for causing a processor to perform the method of transmitting information in order of any one of claims 1-7 when executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211262498.XA CN115550455A (en) | 2022-10-14 | 2022-10-14 | Method, device, equipment and medium for orderly sending information |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211262498.XA CN115550455A (en) | 2022-10-14 | 2022-10-14 | Method, device, equipment and medium for orderly sending information |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115550455A true CN115550455A (en) | 2022-12-30 |
Family
ID=84734805
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211262498.XA Pending CN115550455A (en) | 2022-10-14 | 2022-10-14 | Method, device, equipment and medium for orderly sending information |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115550455A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140297769A1 (en) * | 2013-03-29 | 2014-10-02 | International Business Machines Corporation | Retrieving messages in order in a distributed publish/subscribe system |
CN109788026A (en) * | 2018-12-13 | 2019-05-21 | 新华三大数据技术有限公司 | Message treatment method and device |
CN111031135A (en) * | 2019-12-17 | 2020-04-17 | 金瓜子科技发展(北京)有限公司 | Message transmission method and device and electronic equipment |
-
2022
- 2022-10-14 CN CN202211262498.XA patent/CN115550455A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140297769A1 (en) * | 2013-03-29 | 2014-10-02 | International Business Machines Corporation | Retrieving messages in order in a distributed publish/subscribe system |
CN109788026A (en) * | 2018-12-13 | 2019-05-21 | 新华三大数据技术有限公司 | Message treatment method and device |
CN111031135A (en) * | 2019-12-17 | 2020-04-17 | 金瓜子科技发展(北京)有限公司 | Message transmission method and device and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113254445B (en) | Real-time data storage method, device, computer equipment and storage medium | |
CN113760498A (en) | Message consumption method, device, electronic equipment and computer readable medium | |
CN111461583B (en) | Inventory checking method and device | |
CN109858285B (en) | Block chain data processing method, device, equipment and medium | |
CN116991562B (en) | Data processing method and device, electronic equipment and storage medium | |
CN118113766A (en) | Batch data processing method, device, equipment and medium | |
CN117950850A (en) | Data transmission method, device, electronic equipment and computer readable medium | |
CN109947736B (en) | Method and system for real-time computing | |
CN115550455A (en) | Method, device, equipment and medium for orderly sending information | |
CN116185578A (en) | Scheduling method of computing task and executing method of computing task | |
CN115525659A (en) | Data query method and device, electronic equipment and storage medium | |
CN113760570A (en) | Data processing method, device, electronic equipment, system and storage medium | |
CN112968876A (en) | Content sharing method and device, electronic equipment and storage medium | |
US8554757B2 (en) | Determining a score for a product based on a location of the product | |
CN116756460B (en) | Combined data acquisition method and device and related equipment | |
CN115484149B (en) | Network switching method, network switching device, electronic equipment and storage medium | |
CN110262756B (en) | Method and device for caching data | |
CN112948206B (en) | Time sequence log management system based on cloud computing and electronic equipment comprising same | |
CN112783904B (en) | Method and device for updating index data | |
CN116431928A (en) | Time sequence data pushing method, device, equipment and storage medium | |
CN114090585A (en) | Batch data processing method and device, computer equipment and storage medium | |
CN116701384A (en) | Method, device and storage medium for storing database and table aiming at vehicle condition data | |
CN116318999A (en) | Data processing method and device, electronic equipment and storage medium | |
CN115168896A (en) | Data processing method and device, electronic equipment and storage medium | |
CN116467146A (en) | Log processing method and application server |
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 |