CN110908810A - Message transmission method and device - Google Patents

Message transmission method and device Download PDF

Info

Publication number
CN110908810A
CN110908810A CN201911044154.XA CN201911044154A CN110908810A CN 110908810 A CN110908810 A CN 110908810A CN 201911044154 A CN201911044154 A CN 201911044154A CN 110908810 A CN110908810 A CN 110908810A
Authority
CN
China
Prior art keywords
message
message queue
queue
label
marked
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911044154.XA
Other languages
Chinese (zh)
Inventor
张�杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Taikang Insurance Group Co Ltd
Original Assignee
Taikang Insurance Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Taikang Insurance Group Co Ltd filed Critical Taikang Insurance Group Co Ltd
Priority to CN201911044154.XA priority Critical patent/CN110908810A/en
Publication of CN110908810A publication Critical patent/CN110908810A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/08Insurance

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Development Economics (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a message transmission method and a message transmission device, and relates to the technical field of computers. One embodiment of the method comprises: receiving a message, and acquiring a label in the message; wherein, different labels are marked according to different types of the messages; searching the message queue marked with the label to distribute the message according to the preset weight of the searched message queue; and sending the message based on the allocated message queue for transmission to the corresponding message consumption interface. Therefore, the implementation mode of the invention can solve the problems that the message queue in the prior art can not meet the service requirement and has low utilization rate.

Description

Message transmission method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for transmitting a message.
Background
Currently, message queues are used for transmitting data in many scenes such as claim bill transmission, insurance scanning piece transmission, insured person certificate information transmission, insurance detail information transmission and the like. Each message queue has a special use scene, the use scenes do not influence each other, and the pressure of different services on the system is different in different time periods. For example, the time of the door opening red flushing service is 1 month to 4 months, and the pressure ratio of the system is higher in the time period. Many people apply for bill settlement and claim preservation in the end of the year, and the system preservation and claim settlement pressure is relatively large. Most systems are configured such that only some of the pressures are relatively large and other pressures are relatively small for a fixed period of time.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
if the bearing capacity of a certain current message queue is exceeded at one stage, the message queue needs to be reapplied to relieve the system pressure, but the new application queue needs to be recreated, the adjustment code needs to be matched with the new queue, and the new program needs to be retested, and other existing message queues are not fully utilized.
Disclosure of Invention
In view of this, embodiments of the present invention provide a message transmission method and apparatus, which can solve the problems in the prior art that a message queue cannot meet a service requirement and a utilization rate is low.
In order to achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a message transmission method, including receiving a message, and acquiring a tag in the message; wherein, different labels are marked according to different types of the messages; searching the message queue marked with the label to distribute the message according to the preset weight of the searched message queue; and sending the message based on the allocated message queue for transmission to the corresponding message consumption interface.
Optionally, the distributing the message according to the found preset weight of the message queue includes:
acquiring a preset weight of the message queue marked with the label;
taking the preset weight of each message queue marked with the label as an initial value of the loadable weight of each message queue;
calculating the ratio of the current loadable weight of each message queue to the sum of the current loadable weights of the message queues, and distributing the current message to the message queue with the maximum ratio until all the remaining messages are distributed; and subtracting 1 from the assigned message queue loadable weight when one remaining message is assigned, and restoring the loadable weight of each message queue marked with the label to a preset weight when the loadable weight of each message queue is 0.
Optionally, the distributing the message according to the found preset weight of the message queue includes:
acquiring a preset weight of the message queue marked with the label;
distributing the first N messages according to the preset weight of the message queue; wherein N is equal to the sum of preset weights of all message queues marked with the labels;
based on the remaining unallocated messages, taking the preset weight of each message queue marked with the label as an initial value of the loadable weight of each message queue;
calculating the ratio of the current loadable weight of each message queue to the sum of the current loadable weights of the message queues, and distributing the current message to the message queue with the maximum ratio until all the remaining messages are distributed; and subtracting 1 from the assigned message queue loadable weight when one remaining message is assigned, and restoring the loadable weight of each message queue marked with the label to a preset weight when the loadable weight of each message queue is 0.
Optionally, sending the message based on the allocated message queue for transmission to a corresponding message consumption interface includes:
and sending the message based on the distributed message queue, and further transmitting the message to a message consumption interface according to the message consumption interface corresponding to the label in the message.
Optionally, the method further comprises:
monitoring the number and the type of the messages sent by each message queue to count the load data of the message queues;
and modifying the label marked by the message queue according to the load data.
Optionally, modifying the tag marked by the message queue according to the load data includes:
and modifying the data in the label configuration table so as to modify the label marked by the message queue.
Optionally, the method further comprises:
and monitoring the processing time of each message queue, retrying overtime on the overtime message processing event, and storing the overtime message processing event in a preset table.
In addition, according to an aspect of the embodiments of the present invention, there is provided a message transmission apparatus, including a tag parsing module, configured to receive a message and obtain a tag in the message; wherein, different labels are marked according to different types of the messages; the queue load module is used for searching the message queue marked with the label so as to distribute the message according to the preset weight of the searched message queue; and the message analysis module is used for sending the message based on the distributed message queue so as to transmit the message to the corresponding message consumption interface.
Optionally, the allocating, by the queue load module, the message according to the found preset weight of the message queue includes:
acquiring a preset weight of the message queue marked with the label;
taking the preset weight of each message queue marked with the label as an initial value of the loadable weight of each message queue;
calculating the ratio of the current loadable weight of each message queue to the sum of the current loadable weights of the message queues, and distributing the current message to the message queue with the maximum ratio until all the remaining messages are distributed; and subtracting 1 from the assigned message queue loadable weight when one remaining message is assigned, and restoring the loadable weight of each message queue marked with the label to a preset weight when the loadable weight of each message queue is 0.
Optionally, the allocating, by the queue load module, the message according to the found preset weight of the message queue includes:
acquiring a preset weight of the message queue marked with the label;
distributing the first N messages according to the preset weight of the message queue; wherein N is equal to the sum of preset weights of all message queues marked with the labels;
based on the remaining unallocated messages, taking the preset weight of each message queue marked with the label as an initial value of the loadable weight of each message queue;
calculating the ratio of the current loadable weight of each message queue to the sum of the current loadable weights of the message queues, and distributing the current message to the message queue with the maximum ratio until all the remaining messages are distributed; and subtracting 1 from the assigned message queue loadable weight when one remaining message is assigned, and restoring the loadable weight of each message queue marked with the label to a preset weight when the loadable weight of each message queue is 0.
Optionally, the sending, by the message parsing module, the message based on the allocated message queue for transmission to the corresponding message consuming interface includes:
and sending the message based on the distributed message queue, and further transmitting the message to a message consumption interface according to the message consumption interface corresponding to the label in the message.
Optionally, the method further comprises:
the monitoring module is used for monitoring the number and the type of the messages sent by each message queue so as to count the load data of the message queues; and modifying the label marked by the message queue according to the load data.
Optionally, the modifying, by the monitoring module, the tag marked by the message queue according to the load data includes:
and modifying the data in the label configuration table so as to modify the label marked by the message queue.
Optionally, the monitoring module is further configured to:
and monitoring the processing time of each message queue, retrying overtime on the overtime message processing event, and storing the overtime message processing event in a preset table.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the message transmission embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method according to any of the above-mentioned message transmission-based embodiments.
One embodiment of the above invention has the following advantages or benefits: the invention obtains the label in the message by receiving the message; searching the message queue marked with the label to distribute the message according to the preset weight of the searched message queue; and sending the message based on the allocated message queue for transmission to the corresponding message consumption interface. Therefore, the invention can realize the effect of distributing the message queue in real time according to the service pressure.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of a main flow of a message transmission method according to a first embodiment of the present invention;
fig. 2 is a schematic diagram of a main flow of a message transmission method according to a second embodiment of the present invention;
fig. 3 is a schematic diagram of a main flow of a message transmission method according to a third embodiment of the present invention;
FIG. 4 is a schematic diagram of a message transmission apparatus according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a message transmission apparatus according to another embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a message transmission method according to a first embodiment of the present invention, where the message transmission method may include:
step S101, receiving a message and acquiring a label in the message.
In an embodiment, different tags are tagged according to different types of messages. In addition, the message queue is also provided with a label, and the label data is stored in the database. Preferably, multiple tags may be created for a message queue (e.g., there are 3 tags for message queue 1, respectively, "underwriting", "image", "secure"). The system selects different message queues to transmit data, i.e., messages, by different tags.
And step S102, searching the message queue marked with the label, and distributing the message according to the preset weight of the searched message queue.
In an embodiment, each message queue may be load balanced, with message load for each type of message.
Preferably, a specific implementation process of distributing the message according to the found preset weight of the message queue may use the preset weight of each message queue marked with the tag as an initial value of the loadable weight of each message queue. Then, calculating the ratio of the current loadable weight of each message queue to the sum of the current loadable weights of the message queues, and distributing the current message to the message queue with the maximum ratio until all the remaining messages are distributed; and subtracting 1 from the assigned message queue loadable weight when one remaining message is assigned, and restoring the loadable weight of each message queue marked with the label to a preset weight when the loadable weight of each message queue is 0.
Further, if there are more messages waiting to be allocated, a preset weight of the message queue marked with the tag may be obtained. And then distributing the first N messages according to the preset weight of the message queue. Wherein the N is equal to the sum of the preset weights of all the message queues marked with the labels.
And based on the remaining unallocated messages, taking the preset weight of each message queue marked with the label as an initial value of the loadable weight of each message queue. Then, calculating the ratio of the current loadable weight of each message queue to the sum of the current loadable weights of the message queues, and distributing the current message to the message queue with the maximum ratio until all the remaining messages are distributed.
Wherein the assigned message queue loadable weight is decremented by 1 per assignment of one remaining message. And in addition, when the loadable weight of each message queue marked with the label is 0, the loadable weight of each message queue is restored to the preset weight.
And step S103, sending the message based on the distributed message queue to transmit the message to a corresponding message consumption interface.
Preferably, the message is sent based on the allocated message queue, and then the message can be transmitted to the message consumption interface according to the message consumption interface corresponding to the tag in the message.
Fig. 2 is a schematic diagram of a main flow of a message transmission method according to a second embodiment of the present invention, where the message transmission method may include:
step S201, receiving a message, and acquiring a label in the message.
Wherein different tags are marked according to different types of messages.
Step S202, searching the message queue marked with the label, and acquiring the preset weight of the message queue.
And step S203, distributing the first N messages according to the preset weight of the message queue.
Wherein the N is equal to the sum of the preset weights of all the message queues marked with the labels.
Step S204, determining whether there is a remaining unallocated message, if yes, performing step S205, otherwise, directly performing step S210.
Step S205, using the preset weight of each message queue marked with the label as an initial value of the loadable weight of each message queue.
Step S206, calculating the ratio of the current loadable weight of each message queue to the sum of the current loadable weights of the message queues, and distributing the current message to the message queue with the maximum ratio.
Preferably, if there are two message queues with the largest ratio, one message queue may be randomly selected.
Step S207, determining whether all the remaining messages are completely distributed, if yes, performing step S211, otherwise, performing step S208.
In step S208, the assigned message queue loadable weight is decremented by 1.
Step S209 determines whether the loadable weights of the message queues marked with the tags are all 0, if yes, step S210 is performed, otherwise, step S206 is returned to.
And step S210, restoring the loadable weight of each message queue to a preset weight, and returning to the step S206.
And step S211, sending the message based on the distributed message queue to transmit the message to a corresponding message consumption interface.
For example, in fig. 2, the message allocation process: when 10 security messages are transmitted, the corresponding queue code is, for example, 3, 7, 9. The corresponding authorities are respectively: 1. 2 and 3. The first 6 pieces of data of the transmission data are respectively 1, 2 and 3 pieces of data according to weight distribution, when the 7 th piece of data is transmitted, the weight of the queue code 9 is the highest 3/(1+2+3), and the queue code 9 is distributed to the queue. When the 8 th piece of security data is transmitted, the queue weights of the queue codes 7 and 9 are both 2/(1+2+2), and the queue codes can be randomly allocated to the queue of the queue code 7 or the queue code 9. Suppose that the 8 th secured data is sent using a queue encoded as 9. When the 9 th data is transmitted, the queue weight of the queue code 7 is 2/(1+2+1), i.e. the highest, the queue 7 is used for transmission. When the 10 th data is sent, the weights of the three queues are all 1/(1+1+1), and the data can be sent through one queue randomly.
Fig. 3 is a schematic diagram of a main flow of a message transmission method according to a third embodiment of the present invention, where the message transmission method may include:
step S301, receiving a message, and acquiring a tag in the message.
Wherein different tags are marked according to different types of messages.
Step S302, searching the message queue marked with the label, and distributing the message according to the preset weight of the searched message queue.
Step S303, sending the message based on the allocated message queue to transmit to a corresponding message consuming interface.
Step S304, the number and the type of the messages sent by each message queue are monitored, so as to count the load data of the message queues.
Step S305, modifying the label marked by the message queue according to the load data.
Preferably, the data in the tag configuration table can be modified in real time, so that the message queue tag and the responsible balancing mode can be modified in real time. Preferably, the modified data can synchronously modify the cache data in the item, so as to achieve the purpose of real-time loading.
In an embodiment, the processing time of the message in the queue may also be monitored, the processing start time for saving the message may be called when the message is sent to the message queue, the end time of the record may be updated again when the message consumption is completed, and the processing time of the message may be obtained by the difference between the two times.
Further, the overtime message is subjected to overtime retry and error recording, and can be stored in a preset table corresponding to the system, so that abnormal data can be monitored. That is, the processing time of each message queue is monitored, and a timeout retry is performed for a message processing event that is timed out, and saved into a preset table.
As an example, if RabbitMQ is based in a shard insurance system, there is underwriting data and policy image files that need to be transmitted through message queues. There are five message queue channels in the system to deliver messages. The tag configuration in the system is as follows:
numbering Queue coding Queue name Label coding Note name Load mode Weighted value
1 DQ1 Queue 1 CB Underwriting and protecting Weight 5
2 DQ2 Queue 2 CB Underwriting and protecting Weight 5
3 DQ3 Queue 3 YX Image forming method Weight 1
4 DQ4 Queue 4 CB Underwriting and protecting Weight 2
5 DQ4 Queue 4 YX Image forming method Weight 1
6 DQ5 Queue 5 CB Underwriting and protecting Weight 3
7 DQ5 Queue 5 YX Image forming method Weight 1
As shown in the above table: the names of 5 channels are as follows: DQ1, DQ2, DQ3, DQ4, DQ 5. Queue 1, queue 2 this channel is responsible for underwriting messaging only. Queue 3 is responsible for messaging of images only. Queue 4 and queue 5 are responsible for the delivery of both underwriting messages and video messages.
It should be noted that the above configuration is a weighting method, but it is needless to say that an averaging method may be adopted, and if the averaging method is adopted, the queue equally divides all the traffic. Preferably, the configuration information is loaded into the service system at the time of system startup.
For example: there are 15 underwriting messages and 9 shadow messages to be delivered through the message queue. The queues that may deliver underwriting messages are DQ1, DQ2, DQ4, DQ 5. The weights for these four channels are 5/5/2/3, respectively. This sends the messages to 5 queues according to weight, respectively. DQ1 received 5 messages, DQ2 received 5 messages, DQ3 received 2 messages, and DQ4 received 3 messages. Similarly, DQ3, DQ4, and DQ5 receive 3 video messages, respectively.
It is worth noting that in the transmitted message, a field is added to the body of the underwriting and imaging messages. The field is MQTYPE, which is useful in the tag parsing and message parsing modules. In the tag analysis, the value transmitted by MQTYPE is CB representing underwriting, and the value transmitted by MQTYPE is YX representing image. From which it can be determined to send the message to the corresponding message channel. The type of the message is obtained through the field during message parsing, and then the message is transmitted to different core systems for consumption.
In addition, message monitoring can be performed for the entire life cycle. Specifically, the number and the type of messages in each message queue may be counted, and each message queue needs to record passing messages when processing messages, and the recording format is as follows: a total of 24 strips.
Figure BDA0002253678460000101
Figure BDA0002253678460000111
The processing time of the message in the queue can be monitored, the processing start time for storing the message is called when the message is sent to the message queue, the recorded end time is updated when the message consumption is completed, and the processing time of the message is obtained through the difference value of the two times. Further, a timeout retry and an error log are performed for the message that times out. In this embodiment, the default number of timeout retries in the system is 3.
Meanwhile, the data in the tag configuration table is modified in real time, so that the message queue tag can be modified in real time and the message queue tag is responsible for a balancing mode. The modified data can synchronously modify the cache data in the project, so that the purpose of real-time loading is achieved.
In summary, the message transmission method of the present invention can make full use of the existing message queue of the system, and greatly improve the utilization rate. And the message queue pressure can be configured in real time according to the system pressure, namely, the invention realizes the load balance of the queue according to the label and equally divides the system pressure.
Fig. 4 is a message transmission apparatus according to an embodiment of the present invention, and as shown in fig. 4, the message transmission apparatus 400 includes a tag resolution module 401, a queue load module 402, and a message resolution module 403. The tag analysis module 401 is configured to receive a message and obtain a tag in the message; wherein different tags are marked according to different types of messages. The queue load module 402 is configured to search the message queue marked with the tag, so as to distribute the message according to the preset weight of the searched message queue. The message parsing module 403 is configured to send the message based on the allocated message queue for transmission to the corresponding message consuming interface.
Preferably, when the queue load module 402 allocates the message according to the found preset weight of the message queue, the specific real-time process includes:
acquiring a preset weight of the message queue marked with the label;
and taking the preset weight of each message queue marked with the label as an initial value of the loadable weight of each message queue.
And calculating the ratio of the current loadable weight of each message queue to the sum of the current loadable weights of the message queues, and distributing the current message to the message queue with the maximum ratio until all the rest messages are distributed. Wherein the assigned message queue loadable weight is decremented by 1 per assignment of one remaining message. And in addition, when the loadable weight of each message queue marked with the label is 0, the loadable weight of each message queue is restored to the preset weight.
Further, if more messages to be distributed exist, acquiring the preset weight of the message queue marked with the label, and distributing the first N messages according to the preset weight of the message queue. Wherein the N is equal to the sum of the preset weights of all the message queues marked with the labels.
And on the basis of the unallocated messages, taking the preset weight of each message queue marked with the label as an initial value of the loadable weight of each message queue.
And calculating the ratio of the current loadable weight of each message queue to the sum of the current loadable weights of the message queues, and distributing the current message to the message queue with the maximum ratio until all the rest messages are distributed. Wherein the assigned message queue loadable weight is decremented by 1 per assignment of one remaining message. And in addition, when the loadable weight of each message queue marked with the label is 0, the loadable weight of each message queue is restored to the preset weight.
It should be further noted that the message parsing module 403 may send the message based on the allocated message queue, and further transmit the message to the message consuming interface according to the message consuming interface corresponding to the tag in the message.
Fig. 5 is a message transmission apparatus according to another embodiment of the present invention, and as shown in fig. 5, the message transmission apparatus 500 includes a tag resolution module 501, a queue load module 502, a message resolution module 503, and a monitoring module 504. The tag analysis module 501 is configured to receive a message and obtain a tag in the message; wherein different tags are marked according to different types of messages. The queue load module 502 is configured to search the message queue marked with the tag, so as to distribute the message according to the preset weight of the searched message queue. The message parsing module 503 is configured to send the message based on the allocated message queue for transmission to the corresponding message consuming interface. The monitoring module 504 is configured to monitor the number and types of messages sent by each message queue to count load data of the message queue; and modifying the label marked by the message queue according to the load data.
Preferably, the monitoring module 504 modifies the tag marked by the message queue according to the load data, including:
and modifying the data in the label configuration table so as to modify the label marked by the message queue.
It is further worth mentioning that the monitoring module 504 is further configured to:
and monitoring the processing time of each message queue, retrying overtime on the overtime message processing event, and storing the overtime message processing event in a preset table.
It should be noted that, the message transmission method and the message transmission apparatus of the present invention have corresponding relation in the specific implementation content, so the repeated content is not described again.
Fig. 6 shows an exemplary system architecture 600 to which the message transmission method or the message transmission apparatus of the embodiments of the present invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. The terminal devices 601, 602, 603 may have installed thereon various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 601, 602, 603. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the message transmission method provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the message transmission apparatus is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 1208 into a Random Access Memory (RAM) 703. In the RAM703, various programs and data necessary for the operation of the system 700 are also stored. The CPU1201, the ROM1202, and the RAM703 are connected to each other by a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a tag resolution module, a queue load module, and a message resolution module. Wherein the names of the modules do not in some cases constitute a limitation of the module itself.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: receiving a message, and acquiring a label in the message; wherein, different labels are marked according to different types of the messages; searching the message queue marked with the label to distribute the message according to the preset weight of the searched message queue; and sending the message based on the allocated message queue for transmission to the corresponding message consumption interface.
According to the technical scheme of the embodiment of the invention, the problems that the message queue cannot meet the service requirement and the utilization rate is low in the prior art can be solved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for message transmission, comprising:
receiving a message, and acquiring a label in the message; wherein, different labels are marked according to different types of the messages;
searching the message queue marked with the label to distribute the message according to the preset weight of the searched message queue;
and sending the message based on the allocated message queue for transmission to the corresponding message consumption interface.
2. The method according to claim 1, wherein distributing the message according to the found preset weight of the message queue comprises:
acquiring a preset weight of the message queue marked with the label;
taking the preset weight of each message queue marked with the label as an initial value of the loadable weight of each message queue;
calculating the ratio of the current loadable weight of each message queue to the sum of the current loadable weights of the message queues, and distributing the current message to the message queue with the maximum ratio until all the remaining messages are distributed; and subtracting 1 from the assigned message queue loadable weight when one remaining message is assigned, and restoring the loadable weight of each message queue marked with the label to a preset weight when the loadable weight of each message queue is 0.
3. The method according to claim 2, wherein distributing the message according to the found preset weight of the message queue comprises:
acquiring a preset weight of the message queue marked with the label;
distributing the first N messages according to the preset weight of the message queue; wherein N is equal to the sum of preset weights of all message queues marked with the labels;
based on the remaining unallocated messages, taking the preset weight of each message queue marked with the label as an initial value of the loadable weight of each message queue;
calculating the ratio of the current loadable weight of each message queue to the sum of the current loadable weights of the message queues, and distributing the current message to the message queue with the maximum ratio until all the remaining messages are distributed; and subtracting 1 from the assigned message queue loadable weight when one remaining message is assigned, and restoring the loadable weight of each message queue marked with the label to a preset weight when the loadable weight of each message queue is 0.
4. The method of claim 1, wherein sending the message for transmission to a corresponding message consumption interface based on the assigned message queue comprises:
and sending the message based on the distributed message queue, and further transmitting the message to a message consumption interface according to the message consumption interface corresponding to the label in the message.
5. The method of any of claims 1-4, further comprising:
monitoring the number and the type of the messages sent by each message queue to count the load data of the message queues;
and modifying the label marked by the message queue according to the load data.
6. The method of claim 5, wherein modifying the tag marked by the message queue based on the load data comprises:
and modifying the data in the label configuration table so as to modify the label marked by the message queue.
7. The method of claim 1, further comprising:
and monitoring the processing time of each message queue, retrying overtime on the overtime message processing event, and storing the overtime message processing event in a preset table.
8. A message transmission apparatus, comprising:
the label analysis module is used for receiving the message and acquiring the label in the message; wherein, different labels are marked according to different types of the messages;
the queue load module is used for searching the message queue marked with the label so as to distribute the message according to the preset weight of the searched message queue;
and the message analysis module is used for sending the message based on the distributed message queue so as to transmit the message to the corresponding message consumption interface.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN201911044154.XA 2019-10-30 2019-10-30 Message transmission method and device Pending CN110908810A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911044154.XA CN110908810A (en) 2019-10-30 2019-10-30 Message transmission method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911044154.XA CN110908810A (en) 2019-10-30 2019-10-30 Message transmission method and device

Publications (1)

Publication Number Publication Date
CN110908810A true CN110908810A (en) 2020-03-24

Family

ID=69815908

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911044154.XA Pending CN110908810A (en) 2019-10-30 2019-10-30 Message transmission method and device

Country Status (1)

Country Link
CN (1) CN110908810A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113259266A (en) * 2021-05-28 2021-08-13 北京达佳互联信息技术有限公司 Message pushing method and device of message queue, server and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104750545A (en) * 2013-12-27 2015-07-01 乐视网信息技术(北京)股份有限公司 Process scheduling method and device
CN105763595A (en) * 2015-12-23 2016-07-13 杭州赫智电子科技有限公司 Method of improving data processing efficiency and server
CN106302647A (en) * 2016-07-29 2017-01-04 深圳前海微众银行股份有限公司 message distributing method and server
CN107094171A (en) * 2017-03-30 2017-08-25 聚好看科技股份有限公司 Load-balancing method and device
CN108009028A (en) * 2017-11-29 2018-05-08 中国平安人寿保险股份有限公司 Message treatment method, device, equipment and computer-readable recording medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104750545A (en) * 2013-12-27 2015-07-01 乐视网信息技术(北京)股份有限公司 Process scheduling method and device
CN105763595A (en) * 2015-12-23 2016-07-13 杭州赫智电子科技有限公司 Method of improving data processing efficiency and server
CN106302647A (en) * 2016-07-29 2017-01-04 深圳前海微众银行股份有限公司 message distributing method and server
CN107094171A (en) * 2017-03-30 2017-08-25 聚好看科技股份有限公司 Load-balancing method and device
CN108009028A (en) * 2017-11-29 2018-05-08 中国平安人寿保险股份有限公司 Message treatment method, device, equipment and computer-readable recording medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王攀攀: "HustBackup备份***中负载均衡算法的研究", 《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113259266A (en) * 2021-05-28 2021-08-13 北京达佳互联信息技术有限公司 Message pushing method and device of message queue, server and storage medium

Similar Documents

Publication Publication Date Title
JP7127010B2 (en) Resource allocation methods, apparatus, electronic equipment, computer readable media and computer programs
US20160259802A1 (en) Adaptive data striping and replication across multiple storage clouds for high availability and performance
CN110008050B (en) Method and device for processing information
CN110706093A (en) Accounting processing method and device
US20200364143A1 (en) Externalized configurations and caching solution
CN110738436A (en) method and device for determining available stock
CN112861529A (en) Method and device for managing error codes
CN107426336B (en) Method and device for adjusting push message opening rate
CN109428926B (en) Method and device for scheduling task nodes
CN112686528A (en) Method, apparatus, server and medium for allocating customer service resources
CN112381453A (en) Information processing method, information processing apparatus, electronic device, and medium
CN111881329A (en) Account balance management method and system
CN113535726A (en) Database capacity expansion method and device
CN110908810A (en) Message transmission method and device
CN107045452B (en) Virtual machine scheduling method and device
CN115103015B (en) Data pushing method and device, electronic equipment and computer readable medium
CN111062572A (en) Task allocation method and device
CN111010453A (en) Service request processing method, system, electronic device and computer readable medium
US11711274B2 (en) Request response based on a performance value of a server
CN113127561B (en) Method and device for generating service single number, electronic equipment and storage medium
CN113918282A (en) Database access method and device, electronic equipment and computer readable medium
CN113434754A (en) Method and device for determining recommended API (application program interface) service, electronic equipment and storage medium
CN113282455A (en) Monitoring processing method and device
CN112632074A (en) Inventory allocation method and device for database, electronic equipment and medium
CN111127077A (en) Recommendation method and device based on stream computing

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200324

RJ01 Rejection of invention patent application after publication