CN112822648A - Short message channel routing method based on random weight algorithm and strategy mode - Google Patents

Short message channel routing method based on random weight algorithm and strategy mode Download PDF

Info

Publication number
CN112822648A
CN112822648A CN202110009565.6A CN202110009565A CN112822648A CN 112822648 A CN112822648 A CN 112822648A CN 202110009565 A CN202110009565 A CN 202110009565A CN 112822648 A CN112822648 A CN 112822648A
Authority
CN
China
Prior art keywords
short message
channel
message channel
redis
service
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
CN202110009565.6A
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.)
Yinsheng Payment Service Co Ltd
Original Assignee
Yinsheng Payment Service 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 Yinsheng Payment Service Co Ltd filed Critical Yinsheng Payment Service Co Ltd
Priority to CN202110009565.6A priority Critical patent/CN112822648A/en
Publication of CN112822648A publication Critical patent/CN112822648A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/12Messaging; Mailboxes; Announcements
    • H04W4/14Short messaging services, e.g. short message services [SMS] or unstructured supplementary service data [USSD]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W40/00Communication routing or communication path finding
    • H04W40/02Communication route or path selection, e.g. power-based or shortest path routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W40/00Communication routing or communication path finding
    • H04W40/34Modification of an existing route
    • H04W40/36Modification of an existing route due to handover

Abstract

The invention discloses a short message channel routing method based on a random weight algorithm and a strategy mode, which relates to the technical field of short messages and comprises the steps of establishing a short message channel environment in a mysql database, introducing redis distributed cache, loading the established short message channel environment into redis, developing a short message channel background configuration page, realizing configuration modification in the database and the redis cache, developing short message channel routing service, acquiring a random number according to an appointed range, circularly traversing and accumulating the weight configured by the available short message channel, appointing the current short message channel as the short message service channel when the accumulation result is larger than the random number acquired previously, realizing the name of a bean similar to the short message service in spring according to the short message service configured in the channel, acquiring the corresponding bean from the spring, and sending the short message, and can realize the flexible switching of the short message channel, after the short message channel of the provider breaks down, the short message channel can be quickly switched to other available short message channels, and the short message sending failure rate is reduced.

Description

Short message channel routing method based on random weight algorithm and strategy mode
Technical Field
The invention relates to the technical field of short messages, in particular to a short message channel routing method based on a random weight algorithm and a strategy mode.
Background
Based on a plurality of short message operators which are in butt joint with the current products, the problem that which short message provider is adopted for sending short messages cannot be flexibly adjusted is solved. When a short message channel of a supplier fails, the short message channel cannot be quickly switched to other available short message channels, so that the short message transmission fails, and the short message transmission rate is high, so that a receiver cannot receive the short message in time, and the life and work of other people are seriously influenced.
Disclosure of Invention
In order to overcome the defects of the prior art, the short message channel routing method based on the random weight algorithm and the strategy mode can realize flexible switching of the short message channel.
The technical scheme adopted by the invention for solving the technical problems is as follows: a short message channel routing method based on random weight algorithm and strategy mode is improved in that a short message channel environment is created in a mysql database, redis distributed cache is introduced, the created short message channel environment is loaded into redis, a short message channel background configuration page is developed, and configuration modification in the database and the redis cache is realized;
developing a short message channel routing service, acquiring a random number according to an appointed range, circularly traversing and accumulating the weight configured by the available short message channel, when the accumulation result is larger than the random number acquired previously, appointing the current short message channel as the short message service channel, acquiring a corresponding bean from the spring context according to the bean name of the short message service implementation class configured in the channel, and sending the short message.
As a further improvement of the above technical solution, the short message request that fails to be sent is put into the message queue again to wait for the next channel routing and then sent again.
As a further improvement of the technical scheme, the establishment of the short message channel environment in the mysql database comprises the establishment of a short message channel configuration table.
As a further improvement of the above technical solution, after the redis distributed cache is introduced, when the application service is started, the configuration table in the database is loaded into the redis.
As a further improvement of the technical scheme, after a current short message service channel is specified, an interface class IsmsService is created, and a method for sending short messages is defined.
As a further improvement of the technical scheme, each short message service channel independently realizes IsmsService.
As a further improvement of the above technical solution, when the configuration page of the short message channel configuration is modified, the configuration of the short message channel cached in the redis is refreshed.
As a further improvement of the technical scheme, before the short message channel environment is created, each application system sends the corresponding short message requirement to the short message service system through http, after the short message service system receives the request, the request data is stored in a database, then the request data is sent to different RabbitMq message queues according to the type of the short message of the request, and then a request receiving success response is returned to the application system.
As a further improvement of the above technical solution, after a response of successful request reception is returned to the application system, the message listener of the short message service system receives the short message request message, parses the short message request, and obtains an available short message channel set from the redis cache according to an application name in the short message request.
The invention has the beneficial effects that: the short message channel switching method and the short message channel switching device can be configured on a background page, the switching of the short message channel can be flexibly realized, and after a short message channel of a certain supplier breaks down, the short message channel can be quickly switched to other available short message channels, so that the short message sending failure rate is reduced.
Detailed Description
The present invention will be further described with reference to the following examples.
The conception, the specific structure, and the technical effects produced by the present invention will be clearly and completely described in conjunction with the embodiments below, so that the objects, the features, and the effects of the present invention can be fully understood. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments, and those skilled in the art can obtain other embodiments without inventive effort based on the embodiments of the present invention, and all embodiments are within the protection scope of the present invention. In addition, all the connection/connection relations referred to in the patent do not mean that the components are directly connected, but mean that a better connection structure can be formed by adding or reducing connection auxiliary components according to specific implementation conditions. All technical characteristics in the invention can be interactively combined on the premise of not conflicting with each other.
The invention discloses a short message channel routing method based on a random weight algorithm and a strategy mode, which comprises the steps of establishing a short message channel environment in a mysql database, establishing the short message channel environment, including establishing a short message channel configuration table, introducing a redis distributed cache, loading the configuration table in the database into the redis when an application service is started, loading the established short message channel environment into the redis, developing a short message channel background configuration page, and realizing configuration modification in the database and the redis cache. Developing a short message channel routing service, acquiring a random number according to an appointed range, circularly traversing and accumulating the weight configured by the available short message channel, when the accumulation result is larger than the random number acquired previously, appointing the current short message channel as the short message service channel, acquiring a corresponding bean from the spring context according to the bean name of the short message service implementation class configured in the channel, and sending the short message.
The short message request which is failed to be sent is put into the message queue again to wait for channel routing again next time and then is sent. After a current short message service channel is appointed, an interface class IsmsService is established, and a method for sending a short message is defined. Each short message service channel independently realizes IsmsService. The problem of simplification of the short message channel can be solved, and the failure rate of sending the short message is reduced.
The invention discloses a short message channel routing method based on a random weight algorithm and a strategy mode, which is implemented concretely, each application system sends corresponding short message requirements to a short message service system through http, the short message service system stores request data to a database after receiving the request, then the request data are sent to different RabbitMq message queues according to the type of the requested short message, then a request receiving success response is returned to the application system, a short message service system message monitor receives a short message request message, analyzes the short message request, and obtains an available short message channel set from a redis cache according to an application name in the short message request.
Executing the short message channel routing method, and generating a random number NUM1 in an appointed range by using a random function; traversing available short message channels, and accumulating the weight values; and if the accumulation result is less than NUM1, continuing to circularly accumulate until the accumulation result is more than NUM1, stopping accumulation, and sending the short message by adopting the currently traversed short message channel.
And acquiring the bean name configured by the short message channel of the route, and acquiring the object of the short message service of the channel in the system according to the bean name. And calling a short message sending method of the short message service object to send the short message.
When the short message is failed to be sent, the failure rate of the short message of the channel which is sent for the last 100 times is counted, whether the number of the available channels is more than 1 is judged, and if the number of the available channels is less than 1, a mail and a short message are sent to inform a system principal. If the channel weight value is greater than 1, judging the failure rate, and if the failure rate is greater than 25%, modifying the channel weight value to the original weight value (1-failure rate). The invention only modifies the execution weight value, and does not modify the original manually set weight value. When the failure rate of the last 100 times of transmission is less than 10%, the execution weight value is restored to the original manually set weight value. The execution weight values in the database and the redis cache are updated asynchronously.
The short message request which is failed to be sent is put into the message queue again to wait for channel routing again next time and then is sent. And when the short message channel configuration page modifies the configuration, refreshing the short message channel configuration cached in the redis.
After the short message is successfully sent, the short message task in the database is deleted, and the data is cleared, so that the system load can be reduced.
The invention has the beneficial effects that: the short message channel switching method and the short message channel switching device can be configured on a background page, the switching of the short message channel can be flexibly realized, and after a short message channel of a certain supplier breaks down, the short message channel can be quickly switched to other available short message channels, so that the short message sending failure rate is reduced.
While the preferred embodiments of the present invention have been illustrated and described, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (9)

1. A short message channel routing method based on a random weight algorithm and a strategy mode is characterized by comprising the steps of establishing a short message channel environment in a mysql database, introducing a redis distributed cache, loading the established short message channel environment into the redis, developing a short message channel background configuration page, and realizing configuration modification in the database and the redis cache;
developing a short message channel routing service, acquiring a random number according to an appointed range, circularly traversing and accumulating the weight configured by the available short message channel, when the accumulation result is larger than the random number acquired previously, appointing the current short message channel as the short message service channel, acquiring a corresponding bean from the spring context according to the bean name of the short message service implementation class configured in the channel, and sending the short message.
2. The method as claimed in claim 1, wherein the SMS request that fails to be sent is re-placed in the message queue to wait for the next re-channel routing and then sent.
3. The method as claimed in claim 1, wherein the creating of the short message channel environment in the mysql database comprises creating a short message channel configuration table.
4. The short message channel routing method based on the random weight algorithm and the policy mode as claimed in claim 1, wherein after introducing a redis distributed cache, when the application service is started, the configuration table in the database is loaded into the redis.
5. The SMS channel routing method based on stochastic weight algorithm and strategy mode of claim 1, wherein after the current SMS service channel is designated, an interface class IsmsService is created to define the method for sending SMS.
6. The SMS channel routing method based on stochastic weight algorithm and strategy mode of claim 5, wherein each SMS service channel realizes IsmsService independently.
7. The short message channel routing method based on the random weight algorithm and the strategy mode as claimed in claim 1, wherein the short message channel configuration cached in redis is refreshed when the short message channel configuration page modifies the configuration.
8. The short message channel routing method based on the random weight algorithm and the strategy mode as claimed in claim 1, wherein before creating the short message channel environment, each application system sends the corresponding short message requirement to the short message service system through http, after the short message service system receives the request, the request data is stored in the database, then the request data is sent to different RabbitMq message queues according to the type of the requested short message, and then the request receiving success response is returned to the application system.
9. The short message channel routing method based on the random weight algorithm and the policy mode as claimed in claim 8, wherein after a response of successful request reception is returned to the application system, the message listener of the short message service system receives the short message request message, parses the short message request, and obtains an available short message channel set from the redis cache according to an application name in the short message request.
CN202110009565.6A 2021-01-05 2021-01-05 Short message channel routing method based on random weight algorithm and strategy mode Pending CN112822648A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110009565.6A CN112822648A (en) 2021-01-05 2021-01-05 Short message channel routing method based on random weight algorithm and strategy mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110009565.6A CN112822648A (en) 2021-01-05 2021-01-05 Short message channel routing method based on random weight algorithm and strategy mode

Publications (1)

Publication Number Publication Date
CN112822648A true CN112822648A (en) 2021-05-18

Family

ID=75857522

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110009565.6A Pending CN112822648A (en) 2021-01-05 2021-01-05 Short message channel routing method based on random weight algorithm and strategy mode

Country Status (1)

Country Link
CN (1) CN112822648A (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8208914B1 (en) * 2005-11-30 2012-06-26 Kyocera Corporation System and method for transparent communication over a wireless communication network
CN110213728A (en) * 2018-02-28 2019-09-06 腾讯科技(深圳)有限公司 The method of adjustment and device of port weight
CN110413681A (en) * 2019-08-01 2019-11-05 上海胜泰信息技术有限公司 A Web end group is in the visualized data processing method of big data technology
CN110428253A (en) * 2019-06-19 2019-11-08 平安银行股份有限公司 Trading channel control method, device, computer equipment and storage medium
CN110430173A (en) * 2019-07-19 2019-11-08 河南工程学院 A kind of cloud platform based on Vue+SpringCloud
CN110733038A (en) * 2019-09-30 2020-01-31 浙江工业大学 Industrial robot remote monitoring and data processing system
US20200042955A1 (en) * 2018-08-03 2020-02-06 Matt Widdows Electronic check generation and transmission system
CN111078426A (en) * 2019-12-03 2020-04-28 紫光云(南京)数字技术有限公司 High concurrency solution under back-end micro-service architecture
CN111918225A (en) * 2020-09-15 2020-11-10 北京值得买科技股份有限公司 Method for sending short message based on multiple operators
CN112040429A (en) * 2020-07-28 2020-12-04 南京云中云信息技术有限公司 Short message management system and method based on distributed storage

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8208914B1 (en) * 2005-11-30 2012-06-26 Kyocera Corporation System and method for transparent communication over a wireless communication network
CN110213728A (en) * 2018-02-28 2019-09-06 腾讯科技(深圳)有限公司 The method of adjustment and device of port weight
US20200042955A1 (en) * 2018-08-03 2020-02-06 Matt Widdows Electronic check generation and transmission system
CN110428253A (en) * 2019-06-19 2019-11-08 平安银行股份有限公司 Trading channel control method, device, computer equipment and storage medium
CN110430173A (en) * 2019-07-19 2019-11-08 河南工程学院 A kind of cloud platform based on Vue+SpringCloud
CN110413681A (en) * 2019-08-01 2019-11-05 上海胜泰信息技术有限公司 A Web end group is in the visualized data processing method of big data technology
CN110733038A (en) * 2019-09-30 2020-01-31 浙江工业大学 Industrial robot remote monitoring and data processing system
CN111078426A (en) * 2019-12-03 2020-04-28 紫光云(南京)数字技术有限公司 High concurrency solution under back-end micro-service architecture
CN112040429A (en) * 2020-07-28 2020-12-04 南京云中云信息技术有限公司 Short message management system and method based on distributed storage
CN111918225A (en) * 2020-09-15 2020-11-10 北京值得买科技股份有限公司 Method for sending short message based on multiple operators

Similar Documents

Publication Publication Date Title
EP3547649A1 (en) Method and system for sending request for acquiring data resource
US20210176310A1 (en) Data synchronization method and system
US10567483B2 (en) Method and apparatus for high performance low latency real time notification delivery
CN110336848B (en) Scheduling method, scheduling system and scheduling equipment for access request
US20070016674A1 (en) Information exchange system, management server, and method for reducing network load used in the same
CN106453136A (en) Method and device used for establishing message queue
CN106302647A (en) message distributing method and server
CN110888735A (en) Distributed message distribution method and device based on consistent hash and scheduling node
CN110138808B (en) Anti-hijack downloading method and system based on CDN
CN113836155A (en) Data processing method and device based on distributed system and storage medium
CN112822648A (en) Short message channel routing method based on random weight algorithm and strategy mode
CN109391593B (en) Retry time determination method and device for media session, storage medium and terminal
CN111787494B (en) Short message sending reliable method based on micro service
US20050270973A1 (en) Cluster architecture communications
CN113342764A (en) Data synchronization method and device among different cloud servers
CN111436162B (en) Processing method and equipment
CN111555965A (en) Message pushing method and system suitable for iOS client
CN117354312A (en) Access request processing method, device, system, computer equipment and storage medium
CN112217735A (en) Information synchronization method and load balancing system
CN111510958A (en) Message access load balancing method and system
US20070238470A1 (en) Conservation of temporary roaming numbers
CN103516758A (en) Method and device for processing service requests of resource route and call center seats
US20130039322A1 (en) Method and device for controlling channel transmission
CN114024968B (en) Message sending method and device based on intermediate equipment and electronic equipment
CN101404674A (en) Call routing method, proxy server and relay device

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

Application publication date: 20210518