Scheduling method and device based on multi-channel message system and electronic equipment
By using multi-dimensional weighted calculation and token bucket algorithm to dynamically select the target channel, the problem of slow channel switching and fault response in existing technologies is solved, and efficient and intelligent message transmission and resource utilization are achieved.
Patent Information
- Application Number
- CN202511390671.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-26
- Publication Date
- 2025-12-05
AI Technical Summary
In existing technologies, message middleware relies on pre-bound fixed channels for data transmission, which leads to code refactoring required when switching channels, slow response to channel failures, static weight configuration, unbalanced channel utilization, and inability to dynamically adapt and recover quickly from failures.
Message weights are determined by multi-dimensional coefficient weighting calculations, target channels are dynamically selected, and channel load is monitored using the token bucket algorithm to achieve dynamic switching and resource allocation. This is combined with prioritizing the transmission of high-weight messages and switching low-weight messages to low-cost channels.
It improved the message success rate, reduced the latency of critical messages, increased the utilization of channel resources, and reduced the overall message transmission cost and fault recovery time.
Smart Images

Figure CN121077979A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of information processing, and in particular to a scheduling method and device based on a multi-channel message system and electronic equipment. BACKGROUND With the vigorous development of the Internet, especially the development of mobile Internet, the frequency of user-oriented message notification is increasing, and the notification channels are becoming more and more diversified. Users receive various messages, such as IM instant messaging messages, email messages, and short messages. The common message notification channels on the market are very scattered and have no unified specifications and standards.
[0002] In related technologies, message middleware relies on pre-bound fixed channels for data transmission. However, the above communication method has the following defects: first, the business code needs to specify the specific channel API (application programming interface), and the channel needs to be reconstructed when switching, which requires high coupling of the channel and cannot be dynamically adapted; second, when the channel fails, it relies on manual switching, and the average response time is greater than 30 minutes, causing slow fault recovery and insufficient fault tolerance; third, the weight configuration is static and cannot be dynamically adjusted according to real-time success rate and delay, resulting in unbalanced utilization of high-cost channels and rigid traffic allocation. Therefore, there is an urgent need for a multi-channel message system scheduling scheme that can dynamically adapt, has high channel utilization, and quickly recovers from faults. SUMMARY
[0003] The present application provides a scheduling method and device based on a multi-channel message system and electronic equipment to solve the problem of low efficiency and poor accuracy of test cases generated by large models in the prior art.
[0004] The scheduling method provided by the present application based on a multi-channel message system comprises: obtaining message data to be transmitted, the message data being stored in a message cache queue; performing weighted calculation on the message weight of the message data according to a preset multi-dimensional coefficient to determine the weight coefficient; the preset multi-dimensional coefficient includes at least two of the number of similar messages, the quality of service coefficient, the channel success rate, the channel cost, and the channel delay; matching a first target channel for data transmission according to the weight coefficient of the message data in multiple channels, and determining the remaining token number of the first target channel within a preset time limit, the multiple channels including at least three of short message, email, telephone, and instant messaging; if it is identified that the remaining token number of the first target channel is less than or equal to a preset threshold, the weight of the first target channel is reduced, and the message data is transmitted to a second target channel, the priority of the second target channel being only lower than that of the first target channel.
[0005] In some embodiments of the present application, if the number of remaining tokens of the first target channel is greater than a preset threshold, the data transmission is continued until a feedback result is generated after the message data transmission is completed; if the feedback result is success, the channel success rate of the first target channel is increased, if the feedback result is failure, the channel success rate of the first target channel is decreased, and the third target channel is switched to retransmit the message data, and the priority of the third target channel is only lower than that of the second target channel.
[0006] In some embodiments of the present application, the message weight of the message data is weighted and calculated according to a preset multi-dimensional coefficient, and a weight coefficient is determined, including: determining a first adjustment coefficient of a success rate proportion, a second adjustment coefficient of a channel delay proportion, and a third adjustment coefficient of a channel cost proportion; according to the difference between the channel success rate and the service quality coefficient, the difference is multiplied by the first adjustment coefficient to determine the first weight value, wherein the service quality coefficient is the SLA coefficient; the channel delay rate is determined based on the ratio of the channel delay, and the second weight value is determined by multiplying the channel delay rate, the second adjustment coefficient and the service quality coefficient; the third weight value is determined by multiplying the third adjustment coefficient, the channel cost and the reciprocal of the number of the same type of message; and the weight coefficient of the message data is determined according to the sum of the first weight value, the second weight value and the third weight value.
[0007] In some embodiments of the present application, the success rate model is constructed based on the expression of the first weight value, when the channel success rate is greater than the service quality coefficient, and the coefficient representing the success rate model is positive, the weight coefficient is higher; when the channel success rate is lower than the service quality coefficient, and the coefficient representing the success rate model is negative, the weight coefficient is lower; in the expression corresponding to the second weight value, when the service quality coefficient is higher and the channel delay is lower, the weight coefficient is higher; the cost model is constructed based on the expression of the third weight value, when the number of message data sent at a time is greater, the channel cost is higher, and the coefficient representing the cost model is lower, the weight coefficient is lower.
[0008] In some embodiments of the present application, according to the weight coefficient of the message data, the first target channel is matched in the plurality of channels for data transmission, and the channel throughput coefficient of each type of channel is determined based on the number of the same type of message sent in a preset period; if there are multiple channels of the same type, and the weight coefficient, the priority and the channel success rate of each channel are the same, the channel with the maximum channel throughput coefficient is selected as the first target channel according to the channel throughput coefficient of each channel.
[0009] In some embodiments of the present application, before determining the remaining tokens of the first target channel within the preset time limit, further comprising: configuring a token bucket for each channel according to the bandwidth requirement of each channel, the token bucket comprising a token quantity and a token generation rate; defining a mapping relationship between tokens and transmission data volume, and if multiple channels simultaneously initiate transmission requests, then allocating transmission rights according to the weight coefficient of the channel.
[0010] In some embodiments of the present application, further comprising: after receiving the message data, converting various message data into a unified message in a preset format, and broadcasting the unified message using a preset response mode.
[0011] In some embodiments of the present application, before obtaining the message data to be transmitted, further comprising: receiving a business system message, encapsulating the business system message into a file data in a preset format, the file data comprising message content and priority identifier; integrating an application programming interface of a third-party channel, calling the application programming interface to dynamically switch between channels; and storing each message data in a queue according to the priority identifier of the file data, and preferentially storing the message cache queue of high priority when consuming.
[0012] The present application also provides a scheduling system based on a multi-channel message system, comprising: an obtaining module for obtaining message data to be transmitted, the message data being stored in a message cache queue; a weight calculation block for performing weighted calculation on the message weight of the message data according to a preset multi-dimensional coefficient to determine a weight coefficient; the preset multi-dimensional coefficient comprising at least two of the number of similar messages, the quality of service coefficient, the channel success rate, the channel cost, and the channel delay; a token determination module for matching a first target channel for data transmission among multiple channels according to the weight coefficient of the message data, and determining the remaining tokens of the first target channel within a preset time limit, the multiple channels comprising at least three of short message, email, telephone, and instant messaging; and a flow control scheduling module for reducing the weight of the first target channel and switching to a second target channel to transmit the message data if it is identified that the remaining tokens of the first target channel are less than or equal to a preset threshold, the priority of the second target channel being only lower than that of the first target channel.
[0013] The present application also provides an electronic device comprising a processor, a memory, and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to realize the scheduling system based on the multi-channel message system of any one of the above.
[0014] The beneficial effects of the present application: the scheduling method, device and electronic equipment based on the multi-channel message system provided by the present application, the message weight of the message data is weighted calculated according to the preset multi-dimensional coefficient, and the weight coefficient is determined; the first target channel is matched for data transmission according to the weight coefficient of the message data in the plurality of channels, and the remaining token number of the first target channel within the preset time limit is determined; if it is identified that the remaining token number of the first target channel is less than or equal to the preset threshold, the weight of the first target channel is reduced, and the second target channel is switched to transmit the message data. Through multi-dimensional weighted calculation of the message weight, the target channel is matched in combination with the channel performance index, the blindness of the traditional scheme is avoided, the high priority message is given priority, the message successful transmission rate is improved, and the key message delay is reduced; based on the token bucket algorithm and dynamic weight adjustment, the channel load is monitored in real time, when the channel is close to saturation, the matching probability is automatically reduced and the channel is switched, the system failure caused by single channel congestion is avoided, and the channel resource utilization rate is improved; through the resource allocation strategy of high weight message using high weight channel and low weight message using low cost channel, in combination with the channel switching mechanism, invalid transmission is reduced, and the overall message transmission cost is reduced. BRIEF DESCRIPTION OF DRAWINGS
[0015] The drawings incorporated into the specification and constituting a part of the specification show embodiments consistent with the present application and, together with the specification, serve to explain the principles of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained from these drawings without creative labor for those skilled in the art.
[0016] In the drawings: Figure 1 The scheduling method flow chart based on the multi-channel message system provided by an embodiment of the present application; Figure 2 The complete flowchart of the scheduling method based on the multi-channel message system provided by an embodiment of the present application; Figure 3 The architecture diagram of the scheduling system based on the multi-channel message system provided by an embodiment of the present application; Figure 4 The dynamic weight engine diagram in the scheduling method based on the multi-channel message system provided by an embodiment of the present application; Figure 5 The channel switching flowchart in the scheduling method based on the multi-channel message system provided by an embodiment of the present application; Figure 6 The structure block diagram of the scheduling system based on the multi-channel message system provided by an embodiment of the present application; Figure 7 The structure diagram of the electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0017] The above objects and advantages of the present application will become more apparent by describing in detail the preferred embodiment thereof with reference to the accompanying drawings, in which:
[0018] It is to be understood that the above-mentioned arrangements are merely illustrative for the principles of the present application and that numerous modifications and adaptions thereof can be effected without departing from the spirit and scope of the application as set forth in the appended claims.
[0019] In the following description, numerous specific details are discussed in order to provide a thorough understanding of the embodiments of the present application. However, those of ordinary skill in the art will realize that the embodiments of the present application can be practiced without many of these details. In other instances, well-known structures and devices are not described in order to avoid obscuring the embodiments of the present application.
[0020] The related art lacks intelligent basis in selecting a message transmission channel. Traditional solutions mostly rely on single-dimensional selection of a channel, for example, on cost or delay, and cannot comprehensively consider the importance of a message and the actual performance of a channel, which easily leads to delay or failure of transmission of a high-priority message. Meanwhile, when the number of remaining tokens of a single channel reaches a preset threshold, there is no dynamic switching mechanism, which leads to a lack of channel load control and easily causes channel congestion, reducing the overall message transmission efficiency. In addition, the dimension of message weight evaluation is single, and similar message size, quality of service requirements and other factors cannot be combined to accurately determine the priority of a message, which leads to unreasonable allocation of resources and affects the timeliness of transmission of critical messages.
[0021] To solve the above problems, the present application provides a scheduling method, device and electronic equipment based on a multi-channel message system. Please refer to Figure 1 , Figure 1 The flowchart of the scheduling method based on a multi-channel message system provided by an embodiment of the present application includes the following steps: Step S110, obtaining message data to be transmitted, the message data being stored in a message cache queue; Step S120, the message weight of the message data is weighted and calculated according to a preset multi-dimension coefficient to determine a weight coefficient; the preset multi-dimension coefficient includes at least two of the same kind of message quantity, service quality coefficient, channel success rate, channel cost and channel delay; Step S130, the weight coefficient of the message data is used to match a first target channel in a plurality of channels for data transmission, and the remaining token number of the first target channel within a preset time limit is determined, the plurality of channels including at least three of short message, email, telephone and instant messaging; Step S140, if the remaining token number of the first target channel is less than or equal to a preset threshold, the weight of the first target channel is reduced, and the message data is transmitted to a second target channel, and the priority of the second target channel is only lower than that of the first target channel.
[0022] Exemplarily, based on the first-in-first-out characteristics of the queue, the message data is cached and managed in order, the data security is guaranteed through the persistent configuration of the queue, and the message loss caused by system failure is prevented; based on the multi-dimension comprehensive evaluation model, the importance of the message and the performance index of the channel are converted into comparable weight coefficients through quantification and weighted calculation, and the one-sidedness of single-dimension evaluation is avoided. Based on the priority and channel matching logic, the high weight message is distributed to the channel with better performance, and the transmission effect of the key message is guaranteed; at the same time, the channel flow control is realized through the token bucket algorithm, the token generation rate corresponds to the maximum processing capacity of the channel, and the remaining token number reflects the current available load of the channel, which avoids the overload of the channel caused by too much message, realizes the on-demand allocation of channel resources and dynamic control of flow; based on the load sensing and dynamic switching mechanism, when the channel is close to saturation, i.e. the remaining token number reaches the preset threshold, the new message is reduced, and the channel congestion is avoided; at the same time, the sub-priority channel is switched to, and the message transmission is not interrupted.
[0023] Specifically, the data collection interface is used to obtain the message data to be transmitted from a business system, such as an e-commerce order system or a social platform message system, and the message data is stored in the message cache queue according to the generation time sequence or the preliminary classification rule, the queue is set with a message expiration time and a retry mechanism to avoid data loss.
[0024] For example, by defining the quantization standard of each dimension coefficient, such as the number of similar messages is quantized by the number of messages of the same type within 5 minutes (value range 0-100), the service quality coefficient is quantized by the message transmission reliability requirement (value range 1-5, 1 for ordinary reliability, and 5 for extremely high reliability), the channel success rate is quantized by the proportion of successful message transmission of the channel within 24 hours (value range 0-1), the channel cost is quantized by the transmission cost of a single message (value range 0.01-5 yuan), and the channel delay is quantized by the average transmission delay of the channel within 24 hours (value range 0.1-10 seconds); the weight proportion of each dimension coefficient is allocated, such as the service quality coefficient accounts for 40%, the channel success rate accounts for 30%, and the channel delay accounts for 30%, and the weight proportion can be dynamically adjusted according to business needs; the maximum weight coefficient is calculated by the formula, and the value range is 0-100, and the higher the value represents the higher the message priority.
[0025] For another example, a matching rule of channel and weight coefficient is established, such as weight coefficient 80-100 matches telephone channel, representing high timeliness and high reliability; weight coefficient 50-79 matches short message channel, representing medium timeliness and medium reliability; weight coefficient 20-49 matches instant messaging channel, representing low timeliness and low cost; weight coefficient 0-19 matches mail channel, representing extremely low timeliness and extremely low cost; the first target channel is determined according to the message weight coefficient and the matching rule.
[0026] Based on the token bucket algorithm, the preset time limit and the token generation rate of the first target channel are set, the remaining token number is the total token number generated within the preset time limit minus the consumed token number, and a single message transmission consumes one token. When the remaining token number is greater than 1, the message is allowed to pass through the channel for transmission. The token preset threshold of the first target channel is set; the token number of the first target channel is obtained through real-time monitoring of the interface, and when the remaining token number is less than or equal to the preset threshold, i.e. the preset threshold is 1, the weight adjustment mechanism is triggered, and the matching weight coefficient threshold of the channel is increased by 20%-50%, and the probability of being matched is reduced. Query the channel priority list, such as priority order: telephone > short message > instant messaging > mail, determine the second target channel, such as the first target channel is telephone, the second target channel is short message, switch the to-be-transmitted message data to the second target channel, and update the remaining token number of the second target channel, i.e. consume one token.
[0027] By the above manner, by multi-dimension weighted calculation of message weight, target channel is matched in combination with channel performance index, blindness of traditional scheme is avoided, high priority message is given priority, transmission through high reliability and high timeliness channel is realized, message successful transmission rate is improved, key message delay is reduced, message transmission intelligence and precision are improved, based on token bucket algorithm and dynamic weight adjustment, channel load is monitored in real time, when channel is close to saturation, matching probability is automatically reduced and channel is switched, system failure caused by single channel congestion is avoided, channel resource utilization rate is improved, through resource allocation strategy of high weight message using high channel and low weight message using low cost channel, in combination with channel switching mechanism, invalid transmission is reduced, overall message transmission cost is reduced.
[0028] In an embodiment, further comprising: if the remaining token number of the first target channel is greater than the preset threshold, continuing to maintain data transmission until a feedback result is generated after message data transmission is completed; if the feedback result is success, the channel success rate of the first target channel is increased, if the feedback result is failure, the channel success rate of the first target channel is decreased, and the third target channel is switched to retransmit message data, the priority of the third target channel is only lower than that of the second target channel.
[0029] Exemplarily, the remaining token number of the first target channel is collected in real time and compared with the preset threshold; if the remaining token number is greater than the preset threshold, it is determined that the channel load is sufficient, a continue transmission instruction is triggered, and the transmission process of the message data in the first target channel is maintained; after the message data is completely transmitted, the feedback result contains two states of success or failure, and the failure reason such as network interruption or receiver interface exception is attached. The success state identifier is extracted from the feedback result, and the channel success rate adjustment mechanism is triggered; the current channel success rate of the first target channel is obtained, and the adjustment amplitude is set; the new success rate is calculated by adding the adjustment amplitude to the current success rate, and the statistical period data of the channel success rate is updated.
[0030] The failure state identifier and the failure reason in the feedback result are extracted, the success rate adjustment and channel switching dual mechanisms are triggered; the channel success rate is adjusted, the current success rate of the first target channel is obtained, the single failure adjustment amplitude is set, the new success rate is calculated, the statistical data is updated and synchronized to the database; the third target channel is switched, the preset channel priority list such as priority order, phone>message>instant messaging>mail is queried, the second target channel is message, and the third target channel is instant messaging; the remaining token number of the third target channel is verified, which needs to satisfy that the remaining token number is greater than the preset threshold to ensure sufficient load; the message data which is not successfully transmitted is re-injected into the third target channel, the transmission process is started, and the transmission, feedback and adjustment mechanism is repeated until the message transmission is successful or the maximum retry number is triggered.
[0031] By the above manner, the channel success rate is dynamically adjusted through a single transmission result, the real-time performance and the accuracy of the channel performance evaluation are improved, when the transmission fails, the limitation of the traditional single reset mechanism is avoided through the ladder type standby channel switching, the reliability and continuity of the message transmission are strengthened, the real-time adjustment of the channel success rate enables the high-performance channel to obtain more matching opportunities if it succeeds for many times, and the low-performance channel is reasonably limited if it fails for many times, the channel resource utilization rate is improved, and the dynamic configuration efficiency of the channel resource is optimized.
[0032] Optionally, in an embodiment, the message weight of the message data is weighted and calculated according to a preset multi-dimensional coefficient, and a weight coefficient is determined, including: determining a first adjustment coefficient of a success rate proportion, a second adjustment coefficient of a channel delay proportion, and a third adjustment coefficient of a channel cost proportion; multiplying the difference value and the first adjustment coefficient to determine a first weight value according to the difference value between the channel success rate and a service quality coefficient, wherein the service quality coefficient is an SLA coefficient; determining a channel non-delay rate based on the ratio of the channel delay, and multiplying the channel non-delay rate, the second adjustment coefficient, and the service quality coefficient to determine a second weight value; multiplying the third adjustment coefficient, the channel cost, and the reciprocal of the number of similar messages to determine a third weight value; determining the weight coefficient of the message data according to the sum of the first weight value, the second weight value, and the third weight value.
[0033] By the above manner, by splitting the three core dimensions of success rate, channel delay, and channel cost, a multi-factor calculation model is constructed in combination with the adjustment coefficient and the business association parameter such as the service quality coefficient and the number of similar messages, the one-sidedness of the traditional single dimension or simple weighted calculation is effectively avoided. On the one hand, the first weight value calculation links the channel success rate with the SLA (service quality agreement) coefficient, and through the product of the difference value and the first adjustment coefficient, the matching degree of the actual performance of the channel and the business requirement is accurately quantified. When the channel success rate is greater than the SLA coefficient, the difference value is positive, the first weight value is positively improved, and the channel performance exceeds the business demand is intuitively reflected; when the channel success rate is lower than the SLA coefficient, the difference value is negative, the first weight value is inversely reduced, and the channel performance is not up to standard is exposed in time, and the misjudgment caused by relying only on the absolute value of the success rate is avoided.
[0034] On the other hand, the second weight value converts the channel delay from absolute value comparison to relative performance evaluation by multiplying the channel non-delay rate, the second adjustment coefficient and the quality of service coefficient. For example, in a high quality of service demand scenario, even if the absolute value of the channel delay is slightly high, the non-delay rate meets the standard, and the adaptability can be reflected by the second weight value, so that the evaluation of the delay dimension is more in line with the actual business demand. In addition, the third weight value introduces the reciprocal of the number of similar messages. When the number of similar messages increases, the reciprocal decreases, which can weaken the proportion of channel cost in weight calculation, so as to avoid ignoring performance due to excessive attention to cost when similar messages are concentrated in transmission. Conversely, the cost weight proportion is enhanced, and dynamic adaptation of cost and business size is realized. Overall, the weight coefficient is no longer the superposition of a single parameter, but a comprehensive evaluation result of multi-dimensional and business correlation, which reduces the weight calculation error.
[0035] In some embodiments, according to the weight coefficient of the message data, the data is transmitted in a first target channel matched from a plurality of channels, further comprising: Based on the number of similar messages sent in a preset period, the channel throughput coefficient of each type of channel is determined; If there are multiple channels of the same type, and the weight coefficient, priority and channel success rate of each channel are the same, the channel with the maximum channel throughput coefficient is selected as the first target channel according to the channel throughput coefficient of each channel.
[0036] In the above manner, on the one hand, the channel throughput coefficient of each type of channel is determined based on the number of similar messages sent in a preset period, and the carrying capacity of the channel is converted from a vague concept to a quantifiable specific index, effectively filling the gap in the traditional scheme that the channel selection only depends on the weight coefficient, priority, success rate and other dimensions. On the other hand, through the selection strategy of the maximum throughput coefficient priority, the message is guided to the channel with high carrying capacity, while avoiding excessive load of the channel with low carrying capacity, and realizing dynamic load balancing among channels.
[0037] In some embodiments, before determining the remaining token number of the first target channel within a preset time limit, further comprising: According to the bandwidth demand of each channel, a token bucket is configured for each channel, and the token bucket includes the number of tokens and the token generation rate; Defining the mapping relationship between tokens and transmission data volume, if multiple channels simultaneously initiate transmission requests, the transmission right is allocated according to the weight coefficient of the channel.
[0038] By the above manner, the token bucket is configured according to the bandwidth requirement of each channel, for example, the token quantity and the token generation rate, the channel bandwidth requirement is converted into quantifiable and controllable token parameters, and the resource imbalance problem caused by the extensive allocation in the traditional bandwidth management is effectively solved; by defining the mapping relationship between the token and the transmission data quantity, the abstract token parameters are bound with the concrete transmission data quantity, an explicit quantitative control standard is provided for data transmission, and the insufficient control precision problem caused by the fuzzy association between the token and the data quantity in the traditional token bucket mechanism is solved. By allocating the transmission right according to the weight coefficient of the channel, the right allocation is directly associated with the importance of the channel, the high-weight channel is ensured to obtain the transmission resource preferentially, and the imbalance problem of the right allocation in the concurrent scene is solved. By the double mechanism of the token bucket control and the weight allocation, the concurrent pressure is effectively dispersed, and the concurrent bearing capacity of the system is enhanced; on the one hand, the token quantity and the generation rate of the token bucket are configured, the independent bandwidth safety valve is set for each channel, and the system is prevented from being overloaded as a whole due to the excessive occupation of the bandwidth by a single channel; on the other hand, the weight coefficient allocation mechanism enables the concurrent requests to be processed in order according to the priority, and the congestion storm caused by the resource contention of multiple channels at the same time is avoided.
[0039] In some embodiments, further comprising: after receiving the message data, converting the various types of message data into a unified message in a preset format, and playing the unified message using a preset response mode.
[0040] By the above manner, the different types of message data are converted into a unified message in a unified preset format, for example, all messages are converted into voice playing, or all messages are played in the form of text, or all information is output externally in the form of text.
[0041] In some embodiments, before obtaining the message data to be transmitted, further comprising: Receiving a business system message, encapsulating the business system message into file data in a preset format, the file data including message content and priority identification; Integrating an application programming interface of a third-party channel, and calling the application programming interface to dynamically switch the channels; Storing each message data in a queue according to the priority identification of the file data, and preferentially storing the message cache queue of high priority when consuming.
[0042] By the above manner, by encapsulating the business system message as file data in a preset format, the problems of loose data structure and no clear priority identification of traditional business message are solved; the application programming interface of the integrated third-party channel is called to dynamically switch the design of each channel, breaking through the limitation of traditional channel and system strong coupling and switching relying on hard coding; each message data is stored in a queue according to the priority identification of the file data, and the strategy of storing the message cache queue of high priority first is used in consumption, solving the problem of high priority message being blocked caused by traditional single queue storage and FIFO consumption. The standardized encapsulated file data contains complete fields, so even if a link fails, the message source can be traced based on these fields, and the processing can be re-initiated, avoiding the message from being unable to recover due to missing fields, and improving the traceability of the message. The dynamic switching capability of the third-party channel can quickly switch to the standby channel when the current channel fails, avoiding the message transmission interruption caused by single channel failure, and reducing the business interruption rate caused by channel failure. Through the priority identification queue storage, the high priority message is independently stored and consumed first, so even if the low priority queue is abnormal, it will not affect the normal processing of the high priority queue, and the influence range of the queue failure is reduced.
[0043] As shown in Figure 2 , an architecture schematic diagram of a scheduling system based on a multi-channel message system is provided for the embodiment of the present application, which is described in detail as follows: The message receiving layer is used for receiving business system messages and encapsulating them into a unified JSON format (including message content and priority identification); The channel abstraction layer is configured to integrate third-party channel APIs and provide standardized calling interfaces, including email, SMS, telephone and instant messaging, including but not limited to QQ, Dingding, WeChat, Feishu, etc. The channel abstraction layer decouples the message content and the physical channel, and supports seamless access of heterogeneous channels such as SMS, email and telephone.
[0044] The message cache queue is used for caching messages, and whether to send immediately or wait for more similar messages is determined according to the flag of whether to collect and send the cached messages; The dynamic weight engine is a core component, including a weight calculation module, which includes a dynamic weight engine, an initial weight configuration and real-time index monitoring. The weight calculation module outputs a weight distribution instruction to the flow control scheduler, and the specific implementation process of the weight calculation module is shown in Figure 3 . For example, the initial weight includes but is not limited to channel cost coefficient and SLA coefficient; the dynamic adjustment automatically corrects the weight according to the similar message accumulation coefficient, channel success rate, delay and channel throughput coefficient.
[0045] The flow control scheduler is configured to allocate sending quota according to the token bucket by weight, wherein the low-cost channel token generation rate is faster; on the one hand, when there is no token, the control channel abstraction layer switches the channel; on the other hand, the message sending result is generated, and whether the data sending is successful and the sending time consumption are monitored through indicators; finally, the weight coefficient is dynamically adjusted.
[0046] Specifically, the token bucket algorithm is used to allocate message quota by weight, the weight queue is used, and high-weight messages are sent preferentially; when the specified channel has no token, the weight is recalculated and the channel throughput coefficient is reduced.
[0047] In the above manner, the problem of static configuration rigidity in the traditional manner is solved, the corresponding channel can be selected according to the cross-channel dynamic weight, the channel utilization rate is greatly improved, and the cost is reduced; at the same time, the weight coefficient of the channel can be automatically reduced to form a feedback closed-loop control system, thereby avoiding fault recovery delay, reducing the switching time to millimeter level, and improving the system availability; in addition, the problem of uneven resource allocation in the prior art is solved, and the blocking rate of high-priority message channels is avoided through token bucket weight flow control.
[0048] Please refer to Figure 4 The dynamic weight engine schematic diagram of the scheduling method based on a multi-channel message system provided by an embodiment of the present application comprises: receiving input information; The input information includes the number of similar messages C, the SLA coefficient (service quality coefficient), the channel cost T, the channel success rate S (for example, within 3 minutes), and the channel delay D (unit: millisecond); determining the first adjustment coefficient SP of the success rate proportion, the second adjustment coefficient DP of the channel delay proportion, and the third adjustment coefficient TP of the channel cost proportion; for example, through the above coefficient adjustment, the message strategy of cost priority, speed priority, and success priority can be switched; according to the weight calculation formula, the success rate naturally has a higher proportion in the weight than other coefficients, and needs to be switched to the cost priority strategy, and the value of the success rate adjustment coefficient is set to be smaller.
[0049] W=T·TP·(1 / C)+(S-SLA)·SP·10+SLA·(1-D / 1000)·DP formula (1) Wherein, the first adjustment coefficient SP is 0.6, the second adjustment coefficient DP is 0.2, and the third adjustment coefficient TP is 0.2; C is the number of similar messages, SLA is the SLA coefficient, T is the channel cost, S is the channel success rate, D is the channel delay, and W is the weight coefficient.
[0050] Based on the expression of the first weight value (S-SLA)·SP·10, a success rate model is constructed. When the channel success rate is greater than the service quality coefficient, and the coefficient representing the success rate model is positive, the higher the weight coefficient is; when the channel success rate is lower than the service quality coefficient, and the coefficient representing the success rate model is negative, the lower the weight coefficient is. In the expression of the second weight value corresponding to SLA·(1-D / 1000)·DP, when the service quality coefficient is higher and the channel delay is lower, the weight coefficient is higher. Based on the expression of the third weight value T·TP·(1 / C), a cost model is constructed. When the number of message data sent at one time is more, the channel cost is higher, and the coefficient representing the cost model is lower, the weight coefficient is lower.
[0051] In the above manner, based on the token bucket algorithm and dynamic weight adjustment, the channel load is monitored in real time, the matching probability is automatically reduced and the channel is switched when the channel is close to saturation, system failure caused by single channel congestion is avoided, and the channel resource utilization is improved.
[0052] Please refer to Figure 5 The channel switching process schematic diagram in the scheduling method based on the multi-channel message system provided by an embodiment of the present application is described in detail as follows: When the message data arrives, the channel with the highest weight is selected, such as channel A. It is checked whether the remaining tokens of the token bucket channel A are equal to zero. If yes, the weight is automatically reduced, and the secondary channel B is switched to, which is only lower than channel A. If no, the message is sent, and the feedback result is fed back after the sending is completed. If the feedback result is successful, the channel success rate index S is updated, that is, the success rate is represented to be increased. If the feedback result fails, the weight is triggered to be reduced, the channel success rate index S is updated, and the channel C is switched on, that is, the success rate is represented to be decreased.
[0053] For example, when the weight is reduced, the threshold is 3 times of failure or the delay is greater than 1 second, and the weight is automatically reduced. When the success rate of the fault channel rises to 95%, the weight is gradually restored.
[0054] For example, an e-commerce promotion notice, high-concurrency message. When the channel is selected, the channel configuration information is as follows: short message, initial weight is 5, cost is 0.1 yuan per message, SLA is 0.8; email, initial weight is 7, cost is 0.01 yuan per message, SLA is 0.7; telephone, initial weight is 3, cost is 0.5 yuan per message, SLA is 0.9.
[0055] According to the channel configuration information, formula (1) is called. It can be obtained that: when the peak period short message delay is greater than 800 ms, the delay coefficient weight is reduced to 0.32, and the email weight is increased to the highest weight; the telephone channel success rate is 99%, the success rate coefficient weight is increased to 0.54, and it is dedicated to high-priority messages.
[0056] In the above manner, the dispatch system based on the multi-channel message system greatly reduces the cost and improves the message arrival rate.
[0057] Please refer to Figure 6 The embodiment of the present application also provides a structural block diagram of a dispatch system based on a multi-channel message system, which comprises: The acquisition module 610 is configured to acquire message data to be transmitted, and the message data is stored in a message cache queue. The weight calculation block 620 is configured to perform weighted calculation on the message weight of the message data according to a preset multi-dimensional coefficient, to determine a weight coefficient; the preset multi-dimensional coefficient comprises at least two of the following: the number of messages of the same type, the quality of service coefficient, the channel success rate, the channel cost, and the channel delay. The token determination module 630 is configured to match a first target channel for data transmission according to the weight coefficient of the message data in a plurality of channels, and determine the remaining token number of the first target channel within a preset time limit, wherein the plurality of channels comprise at least three of the following: short message, email, telephone, and instant messaging. The flow control scheduling module 640 is configured to reduce the weight of the first target channel and switch to a second target channel to transmit the message data if it is identified that the remaining token number of the first target channel is less than or equal to a preset threshold, wherein the priority of the second target channel is only lower than that of the first target channel.
[0058] It should be noted that the dispatch system based on the multi-channel message system provided in the above embodiment and the dispatch method based on the multi-channel message system belong to the same concept, wherein the specific manner in which each module performs operations has been described in detail in the method embodiment, which will not be repeated here. The dispatch method based on the multi-channel message system provided in the above embodiment can allocate the above functions to different functional modules to complete in actual application, that is, the internal structure of the system is divided into different functional modules to complete all or part of the above described functions, and this is not limited herein.
[0059] By the above manner, the message weight of the message data is weighted and calculated according to the preset multi-dimension coefficient, and the weight coefficient is determined; the first target channel is matched in the plurality of channels for data transmission according to the weight coefficient of the message data, and the remaining token number of the first target channel within the preset time limit is determined; if it is identified that the remaining token number of the first target channel is less than or equal to the preset threshold, the weight of the first target channel is reduced, and the second target channel is switched to transmit the message data. By multi-dimension weighted calculation of the message weight, the target channel is matched in combination with the channel performance index, the blindness of the traditional scheme is avoided, the high-priority message is given priority, the message successful transmission rate is improved, and the key message delay is reduced; based on the token bucket algorithm and the dynamic weight adjustment, the channel load is monitored in real time, when the channel approaches saturation, the matching probability is automatically reduced and the channel is switched, the system failure caused by single channel congestion is avoided, and the channel resource utilization rate is improved; by the resource allocation strategy of using high-weight messages to high-weight channels and low-weight messages to low-cost channels, in combination with the channel switching mechanism, invalid transmission is reduced, and the overall message transmission cost is reduced.
[0060] In some embodiments, an electronic device is also provided, which can be a server, and an internal structure diagram thereof is as shown in Figure 7 The electronic device includes a processor, a memory, a network interface and a database connected through a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes non-volatile and / or volatile storage media, internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The network interface of the electronic device is used to communicate with the external client through the network connection. The computer program is executed by the processor to realize the functions or steps of the server side of the above-mentioned method.
[0061] In some embodiments, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor executes the computer program to realize the following steps: Obtaining message data to be transmitted, the message data being stored in a message cache queue; performing weighted calculation on message weights of the message data according to preset multi-dimension coefficients to determine weight coefficients; the preset multi-dimension coefficients include at least two of a same message quantity, a service quality coefficient, a channel success rate, a channel cost, and a channel delay; matching a first target channel in a plurality of channels for data transmission according to the weight coefficients of the message data, the plurality of channels including at least three of a short message, an email, a telephone, and instant messaging; and determining a remaining token number of the first target channel within a preset time limit; if it is identified that the remaining token number of the first target channel is less than or equal to a preset threshold, reducing the weight of the first target channel, and switching to a second target channel to transmit the message data, the priority of the second target channel being only lower than that of the first target channel.
[0062] In some embodiments, a computer readable storage medium is provided, and the computer readable storage medium has stored thereon a computer program, and the computer program is executed by a processor to implement the following steps: Obtaining message data to be transmitted, the message data being stored in a message cache queue; performing weighted calculation on message weights of the message data according to preset multi-dimension coefficients to determine weight coefficients; the preset multi-dimension coefficients include at least two of a same message quantity, a service quality coefficient, a channel success rate, a channel cost, and a channel delay; matching a first target channel in a plurality of channels for data transmission according to the weight coefficients of the message data, the plurality of channels including at least three of a short message, an email, a telephone, and instant messaging; and determining a remaining token number of the first target channel within a preset time limit; if it is identified that the remaining token number of the first target channel is less than or equal to a preset threshold, reducing the weight of the first target channel, and switching to a second target channel to transmit the message data, the priority of the second target channel being only lower than that of the first target channel.
[0063] It should be noted that the functions or steps that the computer readable storage medium or the electronic device can implement are described above with reference to the method embodiments, and the related descriptions of the server side and the client side are not repeated here.
[0064] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0065] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. A dispatching method based on a multi-channel message system, characterized in that, The method comprises the following steps: acquiring message data to be transmitted, the message data being stored in a message cache queue; weighting the message weight of the message data according to preset multi-dimensional coefficients to determine a weight coefficient; the preset multi-dimensional coefficients include at least two of the number of same type messages, a quality of service coefficient, a channel success rate, a channel cost, and a channel delay; matching a first target channel in multiple channels according to the weight coefficient of the message data for data transmission, and determining the remaining token number of the first target channel within a preset time limit; the multiple channels include at least three of short message, email, telephone, and instant messaging; if it is identified that the remaining token number of the first target channel is less than or equal to a preset threshold, the weight of the first target channel is reduced, and the message data is transmitted to a second target channel, the priority of the second target channel being only lower than that of the first target channel.
2. The dispatch method based on a multi-channel message system of claim 1, wherein, Further comprising: if it is identified that the remaining token number of the first target channel is greater than the preset threshold, the data transmission is continuously maintained until a feedback result is generated after the message data is transmitted; if the feedback result is success, the channel success rate of the first target channel is increased, if the feedback result is failure, the channel success rate of the first target channel is decreased, and the message data is retransmitted to a third target channel, the priority of the third target channel being only lower than that of the second target channel.
3. The dispatch method based on a multi-channel message system of claim 1, wherein, Weighting the message weight of the message data according to preset multi-dimensional coefficients to determine a weight coefficient, comprising: determining a first adjustment coefficient of a success rate proportion, a second adjustment coefficient of a channel delay proportion, and a third adjustment coefficient of a channel cost proportion; multiplying the difference between the channel success rate and the quality of service coefficient by the first adjustment coefficient to determine a first weight value, wherein the quality of service coefficient is an SLA coefficient; determining a channel non-delay rate based on the ratio of the channel delay, and multiplying the channel non-delay rate, the second adjustment coefficient, and the quality of service coefficient to determine a second weight value; multiplying the third adjustment coefficient, the channel cost, and the inverse of the number of same type messages to determine a third weight value; determining the weight coefficient of the message data according to the sum of the first weight value, the second weight value, and the third weight value.
4. The dispatch method based on a multi-channel message system of claim 3, wherein, Further comprising: constructing a success rate model based on the expression of the first weight value, when the channel success rate is greater than the quality of service coefficient, and the coefficient representing the success rate model is positive, the weight coefficient is higher; when the channel success rate is lower than the quality of service coefficient, and the coefficient representing the success rate model is negative, the weight coefficient is lower; in the expression corresponding to the second weight value, when the quality of service coefficient is higher and the channel delay is lower, the weight coefficient is higher; constructing a cost model based on the expression of the third weight value, when the number of message data transmitted at a time is greater, the channel cost is higher, and the coefficient representing the cost model is lower, the weight coefficient is lower.
5. The dispatch method based on a multi-channel message system according to any one of claims 1 to 4, characterized in that, According to the weight coefficient of the message data, a first target channel is matched in multiple channels for data transmission, and the method further comprises: Based on the number of the same type of messages sent within a preset period, the channel throughput coefficient of each type of channel is determined; If there are multiple channels of the same type, and the weight coefficient, priority and success rate of each channel are the same, then according to the channel throughput coefficient of each channel, the channel with the largest channel throughput coefficient is selected as the first target channel.
6. The dispatch method based on a multi-channel message system according to any one of claims 1 to 4, characterized in that, Before determining the remaining tokens of the first target channel within a preset time limit, the method further comprises: According to the bandwidth requirement of each channel, a token bucket is configured for each channel, and the token bucket comprises the number of tokens and the token generation rate; A mapping relationship between the tokens and the amount of transmitted data is defined, and if multiple channels simultaneously initiate a transmission request, then according to the weight coefficient of the channel, the transmission right is allocated.
7. The dispatch method based on a multi-channel message system according to any one of claims 1 to 4, characterized in that, The method further comprises: After receiving the message data, each type of message data is converted into a unified message in a preset format, and the unified message is broadcasted using a preset response mode.
8. The dispatch method based on a multi-channel message system according to any one of claims 1 to 4, characterized in that, Before obtaining the message data to be transmitted, the method further comprises: Receiving a business system message, and encapsulating the business system message into a file data in a preset format, wherein the file data comprises message content and priority identifier; Integrating an application programming interface of a third-party channel, and calling the application programming interface to dynamically switch each channel; According to the priority identifier of the file data, each message data is stored in a queue, and when consumed, the message cache queue with high priority is stored preferentially.
9. A dispatch system based on a multi-channel messaging system, characterized in that, The method comprises: An acquisition module is configured to obtain message data to be transmitted, wherein the message data is stored in a message cache queue; A weight calculation block is configured to perform weight calculation on the message weight of the message data according to a preset multi-dimensional coefficient, and determine a weight coefficient; the preset multi-dimensional coefficient comprises at least two of the number of same type of messages, the quality of service coefficient, the channel success rate, the channel cost and the channel delay; A token determination module is configured to match a first target channel in multiple channels for data transmission according to the weight coefficient of the message data, and determine the remaining tokens of the first target channel within a preset time limit, wherein the multiple channels comprise at least three of short message, email, telephone and instant messaging; A flow control scheduling module is configured to, if it is identified that the remaining tokens of the first target channel are less than or equal to a preset threshold, reduce the weight of the first target channel, and switch to a second target channel to transmit the message data, wherein the priority of the second target channel is only lower than that of the first target channel.
10. An electronic device, comprising: The device comprises a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute the computer program stored in the memory, so as to realize the scheduling method based on the multi-channel message system according to any one of claims 1 to 8.