Message distribution method and device, equipment and storage medium
Patent Information
- Application Number
- CN202411377652.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-21
AI Technical Summary
但在一次性切换的情况下,不能保证目标数据库可承接所有报文数据,影响目标数据库的性能和报文数据的切换效率
[0043] Embodiments of the present application provide a message offloading method, device, equipment and storage medium; they relate to the field of computer technology, and in particular to the field of data processing technology. In the embodiment of this application, when the original application server determines that it is necessary to perform offload processing on the current incoming packet, it obtains the packet type of the current incoming packet; based on the packet type and the matching offloading rule, determines the storage location of the current incoming packet; based on the storage Location, store the current incoming report into the corresponding database. Provides a method of packet diversion based on the matching relationship between packet types and diversion rules. Through this diversion method, the original database can be switched to the target database, avoiding the need to switch all the packet data to the target database at one time. This reduces the impact on the performance of the target database and ensures that messages can be successfully stored in the corresponding database to improve the efficiency of offload switching. At the same time, a target database with good performance and low cost is introduced to reduce database usage costs.
Smart Images

Figure CN119336498A_ABST
Abstract
Description
Background Art
[0002] With the development of science and technology, database technology is becoming more and more mature. In recent years, target databases with good performance and low cost (such as domestic databases) have become more and more widespread.
[0003] At present, the Oracle database with good performance is used in the financial institution system, but the Oracle database is expensive. Therefore, in order to save costs, the Oracle database used in the financial institution system is gradually transformed into a target database with good performance and low cost, that is, the message data in the Oracle database is switched to the target database.
[0004] When switching the message data in the Oracle database to the target database, all message data are directly saved to the target database. However, in the case of a one-time switch, it cannot be guaranteed that the target database can take over all message data, which affects the performance of the target database and the switching efficiency of the message data.
[0005] Therefore, on the basis of ensuring database performance and message data switching efficiency, achieving message diversion and reducing database usage costs are technical issues that need to be solved at present. Summary of the invention
[0006] The embodiments of the present application provide a message diversion method, apparatus, device and storage medium, which are used to achieve message diversion and reduce database usage costs while ensuring database performance and message data switching efficiency.
[0007] In a first aspect, an embodiment of the present application provides a message diversion method, the method comprising:
[0008] When it is determined that the current incoming report needs to be diverted, the message type of the current incoming report is obtained;
[0009] Determine the storage location of the current incoming message based on the message type and the matching diversion rules;
[0010] Based on the storage location, the current incoming report is stored in the corresponding database.
[0011] In a second aspect, an embodiment of the present application provides a message splitting device, the device comprising:
[0012] An acquisition unit, used to acquire the message type of the current incoming message when determining that diversion processing needs to be performed on the current incoming message;
[0013] A determination unit, configured to determine a storage location of a current incoming message based on a message type and a matching diversion rule;
[0014] The storage unit is used to store the current incoming report into the corresponding database based on the storage location.
[0015] In a possible implementation, the acquiring unit is specifically configured to:
[0016] After obtaining the current incoming report from the message queue, read the total diversion identifier in the configuration file;
[0017] If the total diversion flag indicates diversion processing, it is determined that diversion processing needs to be performed on the current incoming report.
[0018] In a possible implementation, the acquiring unit is specifically configured to:
[0019] If it is determined that the initiator identifier and the receiver identifier of the current incoming message are consistent, then it is determined that the message type of the current incoming message is a self-sent and self-received message;
[0020] If it is determined that the service type code of the current incoming report is the specified information, then the message type of the current incoming report is determined to be a return message;
[0021] If it is determined that the type parsing field of the current incoming report is a receipt field, then the message type of the current incoming report is determined to be a receipt message;
[0022] If it is determined that the type parsing field of the current incoming report is other fields, then it is determined that the message type of the current incoming report is other non-receipt messages.
[0023] In a possible implementation, the message type is a self-sent and self-received message or a receipt message; and the determining unit is specifically configured to:
[0024] Calling a structured query language (SQL) to query whether there is a message with the same message ID as the current incoming message stored in the original database based on the diversion rule;
[0025] When it is determined that the original database stores a transmission message with the same message identifier as the current incoming message, the storage location is determined to be the original database; otherwise, the storage location is determined to be the target database.
[0026] In a possible implementation manner, if the message type is a return message, the determining unit is specifically configured to:
[0027] Based on the diversion rules, read the default diversion identifier configured for the return message in the configuration file;
[0028] If the default diversion flag indicates diversion, the storage location is determined to be the target database, otherwise the storage location is determined to be the original database.
[0029] In a possible implementation, if the message type is other non-receipt messages, the determining unit is specifically configured to:
[0030] Based on the diversion rule, read the corresponding relationship between the routing identifier configured for other non-receipt messages and the diversion mode in the configuration file, and determine the diversion mode matching the other non-receipt messages;
[0031] Based on the diversion method, determine the storage location of the current incoming report.
[0032] In a possible implementation, when determining the storage location of the current incoming report based on the diversion method, the determining unit is specifically configured to:
[0033] If the diversion method is diversion by number segment, when other non-receipt messages are located in the specified number segment, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database;
[0034] If the diversion method is dual-transmission, the storage location is determined to be the original database and the target database;
[0035] If the diversion method is diversion by target list, when other non-receipt messages hit the target list, the storage location is determined to be the target database, otherwise the storage location is determined to be the original database;
[0036] If the diversion method is special processing for collection and payment, then based on the judgment mark of the message type information in other non-receipt messages, it is determined to be diverted by number segment, and when other non-receipt messages are located in the specified number segment, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database; or, based on the judgment mark of the message type information in other non-receipt messages, it is determined to be diverted by notification number, and when other non-receipt messages are located in the specified notification number, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database.
[0037] In a possible implementation, if the storage location is a target database, the storage unit is specifically used to:
[0038] The current message is sent to the target server through a HyperText Transfer Protocol (HTTP) request, so that the target server stores the current message in the target database.
[0039] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the computer program to implement the steps of the message diversion method provided in the embodiment of the present application.
[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the message diversion method provided in the embodiment of the present application are implemented.
[0041] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and the computer program is stored in a computer-readable storage medium; when the processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of the message diversion method provided in the embodiment of the present application.
[0042] The beneficial effects of this application are as follows:
[0043] The embodiments of the present application provide a message diversion method, device, equipment and storage medium; they relate to the field of computer technology, and in particular to the field of data processing technology. In the embodiments of the present application, when the original application server determines that it is necessary to perform diversion processing on the current incoming message, it obtains the message type of the current incoming message; based on the message type and the matching diversion rule, it determines the storage location of the current incoming message; based on the storage location, it stores the current incoming message in the corresponding database. A method for message diversion based on the matching relationship between the message type and the diversion rule is provided. Through this diversion method, switching from the original database to the target database can be achieved, avoiding switching all the message data to the target database at one time, reducing the impact on the performance of the target database, and ensuring that the message can be smoothly stored in the corresponding database, thereby improving the efficiency of diversion switching; at the same time, a target database with good performance and low cost is introduced to reduce the cost of using the database. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0045] Figure 1 A schematic diagram of a financial institution system provided in an embodiment of the present application;
[0046] Figure 2 A flow chart of a message diversion method provided in an embodiment of the present application;
[0047] Figure 3 A schematic diagram of a specific implementation of a message diversion method provided in an embodiment of the present application;
[0048] Figure 4 A schematic diagram of a return message diversion method provided in an embodiment of the present application;
[0049] Figure 5 A schematic diagram of another non-receipt message diversion method provided in an embodiment of the present application;
[0050] Figure 6A structural diagram of a message diversion device provided in an embodiment of the present application;
[0051] Figure 7 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.
[0053] The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. "Multiple" in the present application can mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.
[0054] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0055] In the technical solution of this application, the acquisition, transmission, storage, and use of data are in compliance with the requirements of relevant national laws and regulations.
[0056] Before introducing the message diversion method provided in the embodiment of the present application, in order to facilitate understanding, the technical background of the embodiment of the present application is first introduced in detail below.
[0057] In recent years, target databases with good performance and low cost (such as domestic databases) have begun to emerge. In order to support domestic databases and save costs, the Oracle databases used in financial institutions' systems are gradually transformed into domestic databases with good performance and low cost, that is, the message data in the Oracle database is switched to the domestic database.
[0058] When switching the message data in the Oracle database to the domestic database, all message data is directly saved in the domestic database. However, in the case of a one-time switch, it cannot be guaranteed that the domestic database can take over all message data, which affects the performance of the domestic database and the switching efficiency of message data.
[0059] Therefore, on the basis of ensuring database performance and message data switching efficiency, achieving message diversion and reducing database usage costs are technical issues that need to be solved at present.
[0060] In view of this, the embodiments of the present application provide a message diversion method, apparatus, device and storage medium for achieving message diversion and reducing database usage costs while ensuring database performance and message data switching efficiency.
[0061] In an embodiment of the present application, after the original application server obtains the current incoming report from the message queue (MQ), it first determines whether it is necessary to perform diversion processing on the current incoming report. When it is determined that diversion processing is required for the current incoming report, the message type of the current incoming report is obtained; then, based on the message type and the matching diversion rules, the storage location of the current incoming report is determined; finally, based on the storage location, the current incoming report is stored in a database corresponding to the value.
[0062] The embodiment of the present application provides a method for message diversion based on the matching relationship between message type and diversion rule. Through this diversion method, the switching from the original database to the target database can be realized, avoiding switching all message data to the target database at one time, reducing the impact on the performance of the target database, and ensuring that the message can be smoothly stored in the corresponding database, thereby improving the diversion switching efficiency; at the same time, a target database with good performance and low cost is introduced; and in the following period of time, the original database used in the financial institution system will gradually be transformed into the target database.
[0063] The following is a brief description of the application scenarios set in this application. It should be noted that the following scenarios are only used to illustrate the embodiments of this application and are not limiting. In specific implementation, the technical solutions provided in the embodiments of this application can be flexibly applied according to actual needs.
[0064] See also Figure 1 , Figure 1 A schematic diagram of a financial institution system provided for an embodiment of the present application, the financial institution system includes: an original application server 100, an original database 110 corresponding to the original application server 100, a target application server 120, and a target database 130 corresponding to the target application server 120.
[0065] In a possible implementation, the original application server 100 and the target application server 120 can be connected to each other through a communication network. The communication network can be a wired network or a wireless network. Therefore, the original application server 100 and the target application server 120 can be directly or indirectly connected through a wired or wireless communication mode. For example, the original application server 100 can be indirectly connected to the target application server 120 through a wireless access point, or the original application server 100 can be directly connected to the target application server 120 through the Internet, and this application is not limited here.
[0066] Among them, the original application server 100 and the target application server 120 can be independent physical servers, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0067] In a possible application scenario, the original database 110 is an Oracle database, and the target database 130 is a domestically produced database with good performance and low cost.
[0068] The above application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementation methods of the present application are not limited in this regard.
[0069] To further illustrate the message diversion technical solution provided in the embodiment of the present application, the message diversion method provided in the exemplary implementation of the present application is described below with reference to the accompanying drawings.
[0070] See also Figure 2 , Figure 2 A flow chart of a message diversion method provided in an embodiment of the present application includes the following steps:
[0071] Step S200: When it is determined that the current incoming message needs to be diverted, the message type of the current incoming message is obtained.
[0072] In an embodiment of the present application, after the original application server obtains the current incoming report from the message queue, it reads the total diversion identifier in the configuration file; and determines whether the current incoming report needs to be diverted based on the total diversion identifier in the configuration file.
[0073] For example, if the total diversion flag indicates diversion processing, it is determined that diversion processing needs to be performed on the current incoming report. When performing diversion processing on the current incoming report, the message type of the current incoming report is first obtained, and then based on the message type and the matching diversion rule, it is determined whether to divert the current incoming report. If diversion is performed, it is determined to store the current incoming report in the target database, otherwise the current incoming report is stored in the original database; the specific implementation method can be found in the following related content, which will not be repeated here.
[0074] In another exemplary embodiment, if the total diversion flag indicates no diversion processing, it is determined to store the current incoming report directly into the original database.
[0075] The total diversion flag may be in the form of "0" or "1" to indicate whether diversion processing is performed; for example, "1" indicates diversion processing, and "0" indicates no diversion processing.
[0076] In a possible implementation, when it is determined that the current incoming message needs to be diverted, the message-related information of the current incoming message is obtained, and based on the obtained message-related information, the message type of the current incoming message is determined; wherein the message-related information includes but is not limited to: an initiator identifier, a receiver identifier, incoming message details, and a type analysis field. It should be noted that the message-related information can be obtained by parsing the current incoming message.
[0077] When determining the type of the current incoming message based on the acquired message-related information:
[0078] If it is determined that the initiator identifier and the receiver identifier of the current incoming message are consistent, then it is determined that the message type of the current incoming message is a self-sent and self-received message;
[0079] Traverse the incoming report details, and if it is determined that the business type code of the current incoming report is the specified information, then determine that the message type of the current incoming report is a return report message; wherein the specified information is A105;
[0080] If it is determined that the type parsing field of the current incoming report is a receipt field, then the message type of the current incoming report is determined to be a receipt message;
[0081] If it is determined that the type parsing field of the current incoming report is other fields, then it is determined that the message type of the current incoming report is other non-receipt messages.
[0082] Step S201, based on the message type and the matching diversion rule, determine the storage location of the current incoming message.
[0083] In an embodiment of the present application, after determining the type of the currently incoming message, the corresponding diversion rule is determined based on the correspondence between the message type configured in the configuration file and the diversion rule, and then the storage location of the currently incoming message is determined based on the determined diversion rule.
[0084] In a possible implementation, when the message type is a self-sent and self-received message or a receipt message, the diversion rule matching the message type is: determine whether there is a sent message with the same message identifier as the current incoming message stored in the original database, if so, determine not to divert, otherwise determine to divert.
[0085] Therefore, when the message type is a self-sent and self-received message or a receipt message, when determining the storage location of the current incoming message based on the message type and the matching diversion rule: call the SQL statement, based on the diversion rule, to query whether the original database stores a sending message with the same message identifier as the current incoming message; when it is determined that the original database stores a sending message with the same message identifier as the current incoming message, determine not to divert, and the storage location is the original database; when it is determined that the original database does not store a sending message with the same message identifier as the current incoming message, determine to divert, and the storage location is the target database.
[0086] In a possible implementation, when the message type is a return report message, the diversion rule matching the message type is: determining whether to divert based on a default diversion identifier configured for the return report message.
[0087] Therefore, when the message type is a return report message, when determining the storage location of the current incoming message based on the message type and the matching diversion rules: read the default diversion identifier configured for the return report message in the configuration file; if the default diversion identifier indicates diversion, determine the storage location as the target database; if the default diversion identifier indicates no diversion, determine the storage location as the original database.
[0088] Among them, the default diversion flag can use "0" or "1" to indicate whether the return report message is diverted; for example, "1" indicates that the return report message is diverted, and "0" indicates that the return report message is not diverted.
[0089] In one possible implementation, when the message type is other non-receipt messages, the diversion rule matching the message type is: based on the correspondence between the routing identifier configured for other non-receipt messages and the diversion method, determine the diversion method that matches the other non-receipt messages, and determine whether to divert based on the diversion method.
[0090] Therefore, when the message type is a self-sent and self-received message or a receipt message, when determining the storage location of the current incoming message based on the message type and the matching diversion rule: read the correspondence between the routing identifier and the diversion method configured for other non-receipt messages in the configuration file, and determine the diversion method that matches other non-receipt messages; based on the diversion method, determine the storage location of the current incoming message.
[0091] Exemplarily, the target routing identifier of other non-receipt messages is determined, and the correspondence between the routing identifier configured in the configuration file and the diversion method is determined, and the target routing identifier is matched with the routing identifier in the correspondence, and the diversion method corresponding to the other non-receipt messages is determined based on the matching result, and then based on the diversion method, the storage location of the current incoming message is determined.
[0092] Among them, the correspondence between the routing identifier and the diversion method includes but is not limited to: the diversion method corresponding to the routing identifier "0" is diversion by number segment, the diversion method corresponding to the routing identifier "1" is double-sending, the diversion method corresponding to the routing identifier "2" is diversion by target list, and the diversion method corresponding to the routing identifier "3" is special processing for collection and payment.
[0093] In the embodiment of the present application, when the diversion method is determined to be diversion by number segment based on the routing identifier matching result, it is determined whether other non-receipt messages are within the specified number segment. When other non-receipt messages are within the specified number segment, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database;
[0094] When the diversion mode is determined to be dual-transmission based on the route matching result, it is determined that the current incoming report needs to be stored in both the original database and the target database, so the storage locations are the original database and the target database;
[0095] When the diversion method is determined to be diversion according to the target list based on the route matching result, it is determined whether other non-receipt messages hit the target list. When other non-receipt messages hit the target list, the storage location is determined to be the target database. When other non-receipt messages do not hit the target list, the storage location is determined to be the original database; wherein the target list can be a blacklist or a whitelist;
[0096] When the diversion method is determined to be special processing of collection and payment based on the route matching result, the sub-diversion method is determined based on the judgment identifier of the message type information in other non-receipt messages. For example, when the judgment identifier is "10", the sub-diversion method is determined to be diversion by number segment, and when the judgment identifier is "11", the sub-diversion method is determined to be diversion by notification number;
[0097] Furthermore, when the sub-diversion method is diversion by number segment, it is determined whether other non-receipt messages are within the specified number segment. When other non-receipt messages are within the specified number segment, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database; when the sub-diversion method is diversion by notification number, it is determined whether other non-receipt messages are within the specified notification number. When other non-receipt messages are within the specified notification number, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database.
[0098] Step S202: based on the storage location, store the current incoming report into the corresponding database.
[0099] In one possible implementation, if the storage location is the original database, the current message is directly stored in the original database; if the storage location is the target database, the current message is sent to the target server via an HTTP request so that the target server stores the current message in the target database.
[0100] It should be noted that the content of the configuration file involved in the embodiment of the present application can be modified according to actual conditions, that is, the diversion rules can be gradually modified to eventually achieve the target database replacing the original database.
[0101] In the embodiment of the present application, when the original application server obtains the current incoming message from the message queue and determines that the current incoming message needs to be diverted, the message type of the current incoming message can be gradually determined, and further diverted based on the message type; illustratively, first determine whether the current incoming message is a self-sent and self-received message, if it is a self-sent and self-received message, execute the diversion logic of the self-sent and self-received message, if it is not a self-sent and self-received message, then continue to determine whether the current incoming message is a return message, etc. Figure 3 , Figure 3 A specific implementation diagram of a message diversion method provided in an embodiment of the present application includes the following steps:
[0102] Step S300, obtaining the current incoming report from the message queue;
[0103] Step S301, reading the total diversion identifier in the configuration file;
[0104] Step S302, judging whether to perform diversion processing on the current incoming report based on the total diversion flag, if yes, executing step S303, otherwise executing step S305;
[0105] Step S303, judging whether the current incoming message is a self-sent and self-received message according to the initiator identifier and the receiver identifier of the current incoming message, if so, executing step S304, otherwise executing step S307;
[0106] Step S304, calling an SQL statement to query whether there is a sent message with the same message ID as the current incoming message stored in the original database, if yes, executing step S305, otherwise executing step S306;
[0107] Step S305, determining not to split the traffic, and storing the current incoming report in the original database;
[0108] Step S306, determining the diversion, sending the current message to the target server through an HTTP request, so that the target server stores the current message in the target database;
[0109] Step S307, traverse the current report details, determine whether the current service type code is A105, if so, execute Figure 4 Steps S400 to S403 are shown, otherwise, step S308 is executed;
[0110] Step S308, read the configuration file, and determine whether the current incoming message is a receipt message in combination with the type analysis field of the current incoming message. If so, execute steps S304 to S306; otherwise, execute Figure 5 Steps S500 to S513 are shown.
[0111] See also Figure 4 , Figure 4 A schematic diagram of a return message diversion method provided in an embodiment of the present application includes the following steps:
[0112] Step S400, determining that the current incoming report is a return report message, and reading a default diversion identifier configured for the return report message in a configuration file;
[0113] Step S401, judging whether to divert based on the default diversion flag, if yes, executing step S402, otherwise executing step S403;
[0114] Step S402, determining the diversion, sending the current message to the target server through an HTTP request, so that the target server stores the current message in the target database;
[0115] Step S403: determine not to split the traffic, and store the current incoming report in the original database.
[0116] See also Figure 5 , Figure 5 A schematic diagram of another non-receipt message diversion method provided in an embodiment of the present application includes the following steps:
[0117] Step S500, determining that the current message is other non-receipt messages, reading the configuration file, and determining the diversion mode that matches the current incoming message according to the correspondence between the routing identifier configured for other non-receipt messages and the diversion mode;
[0118] Step S501, if the diversion mode is diversion by number segment, determine whether the current incoming report is in the specified number segment, if so, execute step S502, otherwise execute step S503;
[0119] Step S502, determining not to split the traffic, and storing the current incoming report in the original database;
[0120] Step S503, determining the diversion, sending the current message to the target server through an HTTP request, so that the target server stores the current message in the target database;
[0121] Step S504, if the diversion mode is double sending, the current incoming message is stored in the original database, and the current message is sent to the target server through an HTTP request, so that the target server stores the current message in the target database;
[0122] Step S505, if the diversion method is diversion by target list, determine whether the current report hits the target list, if so, execute step S506, otherwise execute step S507;
[0123] Step S506, determining the diversion, sending the current message to the target server through an HTTP request, so that the target server stores the current message in the target database;
[0124] Step S507, determining not to split the traffic, and storing the current incoming report in the original database;
[0125] Step S508, if the diversion method is special processing of collection and payment, then the sub-diversion method is determined based on the judgment mark of the message type information in the current incoming message;
[0126] Step S509, if the sub-division mode is diversion by number segment, determine whether the current incoming report is in the specified number segment, if so, execute step S510, otherwise execute step S511;
[0127] Step S510, determining not to split the traffic, and storing the current incoming report in the original database;
[0128] Step S511, determine the diversion, and send the current message to the target server through an HTTP request, so that the target server stores the current message in the target database;
[0129] Step S512, if the sub-division mode is diversion by notification number, determine whether the current incoming report is in the diversion of the specified notification number, if so, execute step S512, otherwise execute step S513;
[0130] Step S512, determining not to split the traffic, and storing the current incoming report in the original database;
[0131] Step S513, determine the diversion, and send the current message to the target server through an HTTP request, so that the target server stores the current message in the target database.
[0132] It should be noted that the logic of the message diversion method provided by the present application is implemented based on machine language, such as C language.
[0133] In the present application, a method for performing message diversion based on the matching relationship between message type and diversion rule is provided. Through this diversion method, the switching from the original database to the target database can be realized, avoiding switching all message data to the target database at one time, reducing the impact on the performance of the target database, and ensuring that the message can be smoothly stored in the corresponding database, thereby improving the diversion switching efficiency; at the same time, a target database with good performance and low cost is introduced to reduce the cost of using the database.
[0134] Based on the same inventive concept, the present application embodiment provides a message splitting device structure diagram, see Figure 6 , Figure 6 A structural diagram of a message diversion device provided in an embodiment of the present application, the message diversion device 600 includes:
[0135] The acquisition unit 601 is used to acquire the message type of the current incoming message when it is determined that the current incoming message needs to be diverted;
[0136] A determination unit 602, configured to determine a storage location of a current incoming message based on a message type and a matching diversion rule;
[0137] The storage unit 603 is used to store the current incoming report into the corresponding database based on the storage location.
[0138] In a possible implementation, the acquiring unit 601 is specifically configured to:
[0139] After obtaining the current incoming report from the message queue, read the total diversion identifier in the configuration file;
[0140] If the total diversion flag indicates diversion processing, it is determined that diversion processing needs to be performed on the current incoming report.
[0141] In a possible implementation, the acquiring unit 601 is specifically configured to:
[0142] If it is determined that the initiator identifier and the receiver identifier of the current incoming message are consistent, then it is determined that the message type of the current incoming message is a self-sent and self-received message;
[0143] If it is determined that the service type code of the current incoming report is the specified information, then the message type of the current incoming report is determined to be a return message;
[0144] If it is determined that the type parsing field of the current incoming report is a receipt field, then the message type of the current incoming report is determined to be a receipt message;
[0145] If it is determined that the type parsing field of the current incoming report is other fields, then it is determined that the message type of the current incoming report is other non-receipt messages.
[0146] In a possible implementation, the message type is a self-sent and self-received message or a receipt message; the determining unit 602 is specifically configured to:
[0147] Calling SQL statements to query whether there is a message with the same message ID as the current incoming message stored in the original database based on the diversion rules;
[0148] When it is determined that the original database stores a transmission message with the same message identifier as the current incoming message, the storage location is determined to be the original database; otherwise, the storage location is determined to be the target database.
[0149] In a possible implementation, if the message type is a return message, the determining unit 602 is specifically configured to:
[0150] Based on the diversion rules, read the default diversion identifier configured for the return message in the configuration file;
[0151] If the default diversion flag indicates diversion, the storage location is determined to be the target database, otherwise the storage location is determined to be the original database.
[0152] In a possible implementation, if the message type is other non-receipt messages, the determining unit 602 is specifically configured to:
[0153] Based on the diversion rule, read the corresponding relationship between the routing identifier configured for other non-receipt messages and the diversion mode in the configuration file, and determine the diversion mode matching the other non-receipt messages;
[0154] Based on the diversion method, determine the storage location of the current incoming report.
[0155] In a possible implementation, when determining the storage location of the current incoming report based on the diversion method, the determining unit 602 is specifically configured to:
[0156] If the diversion method is diversion by number segment, when other non-receipt messages are located in the specified number segment, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database;
[0157] If the diversion method is dual-transmission, the storage location is determined to be the original database and the target database;
[0158] If the diversion method is diversion by target list, when other non-receipt messages hit the target list, the storage location is determined to be the target database, otherwise the storage location is determined to be the original database;
[0159] If the diversion method is special processing for collection and payment, then based on the judgment mark of the message type information in other non-receipt messages, it is determined to be diverted by number segment, and when other non-receipt messages are located in the specified number segment, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database; or, based on the judgment mark of the message type information in other non-receipt messages, it is determined to be diverted by notification number, and when other non-receipt messages are located in the specified notification number, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database.
[0160] In a possible implementation, if the storage location is a target database, the storage unit 603 is specifically used to:
[0161] The current message is sent to the target server through an HTTP request, so that the target server stores the current message in the target database.
[0162] It should be noted that although several units (or modules) of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units (or modules) described above can be concretized in one unit (or module). Conversely, the features and functions of one unit (or module) described above can be further divided into multiple units (or modules) for concretization. Of course, when implementing the present application, the functions of each unit (or module) can also be implemented in the same one or more software or hardware.
[0163] In the embodiments of the present application, the term unit (or module) refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the function of the module or unit.
[0164] After introducing the message diversion method and device according to an exemplary embodiment of the present application, another exemplary embodiment of the present application, an electronic device, is introduced next.
[0165] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.
[0166] In a possible implementation, the electronic device provided in the embodiment of the present application may include at least a processor and a memory. The memory stores a computer program, and when the computer program is executed by the processor, the processor executes any step of the message diversion method in various exemplary implementations of the present application.
[0167] In this embodiment, the structure of the electronic device can be as follows Figure 7 As shown, it includes a memory 701 , a communication module 703 and one or more processors 702 .
[0168] The memory 701 is used to store computer programs executed by the processor 702. The memory 701 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation sets, etc.
[0169] The memory 701 may be a volatile memory, such as a random-access memory (RAM); the memory 701 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 701 may be any other medium that can be used to carry or store a desired computer program in the form of an operation or data structure and can be accessed by a computer, but is not limited thereto. The memory 701 may be a combination of the above memories.
[0170] The processor 702 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 702 is configured to implement the above-mentioned message diversion method when calling the computer program stored in the memory 701 .
[0171] The communication module 703 is used to communicate with the target device and other servers.
[0172] The specific connection medium between the memory 701, the communication module 703 and the processor 702 is not limited in the embodiment of the present application. Figure 7 In the embodiment, the memory 701 and the processor 702 are connected via a bus 704. The bus 704 is connected to the processor 702 via a bus 704. Figure 7 The connections between the other components are only for illustration and are not intended to be limiting. The bus 704 can be divided into an address bus, a data bus, a control bus, etc. For ease of description, Figure 7 The diagram shows that only one thick line is used, but this does not mean that there is only one bus or only one type of bus.
[0173] The memory 701 stores a computer storage medium, and the computer storage medium stores a computer executable operation, and the computer executable operation is used to implement the message diversion method of the embodiment of the present application. The processor 702 is used to execute the above-mentioned message diversion method.
[0174] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, and a computer program product includes: a computer program code, when the computer program code is executed on a computer, the computer executes any of the message diversion methods discussed above. Since the principle of solving the problem by the above-mentioned computer-readable storage medium is similar to that of the message diversion method, the implementation of the above-mentioned computer-readable storage medium can refer to the implementation of the method, and the repeated parts will not be repeated.
[0175] Based on the same inventive concept, the embodiment of the present application also provides a computer program product, which includes: computer program code, when the computer program code is run on a computer, the computer executes any of the message diversion methods discussed above. Since the principle of solving the problem by the above computer program product is similar to that of the message diversion method, the implementation of the above computer program product can refer to the implementation of the method, and the repeated parts will not be repeated.
[0176] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0177] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0178] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0179] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of user-operated steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0180] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A message diversion method, characterized in that: The method comprises: When it is determined that the current incoming report needs to be diverted, the message type of the current incoming report is obtained; Determining a storage location of the current incoming message based on the message type and the matching diversion rule; Based on the storage location, the current incoming report is stored in a corresponding database.
2. The method according to claim 1, characterized in that The determining that the current incoming report needs to be diverted includes: After obtaining the current incoming report from the message queue, reading the total diversion identifier in the configuration file; If the total diversion flag indicates diversion processing, it is determined that diversion processing needs to be performed on the current incoming report.
3. The method according to claim 1, characterized in that The method of obtaining the type of the currently received message includes: If it is determined that the initiator identifier and the receiver identifier of the current incoming message are consistent, then determining that the message type of the current incoming message is a self-sent and self-received message; If it is determined that the service type code of the current incoming report is specified information, then determining that the message type of the current incoming report is a return message; If it is determined that the type parsed field of the current incoming report is a receipt field, then determining that the message type of the current incoming report is a receipt message; If it is determined that the type parsing field of the current incoming report is other fields, then it is determined that the message type of the current incoming report is other non-receipt messages.
4. The method according to any one of claims 1 to 3, characterized in that: The message type is a self-sent and self-received message or a receipt message; The determining, based on the message type and the matching diversion rule, the storage location of the current incoming message includes: Calling a structured query statement SQL, based on the diversion rule, to query whether a sent message with the same message identifier as the current incoming message is stored in the original database; When it is determined that the original database stores a transmission message with the same message identifier as the current incoming message, the storage location is determined to be the original database; otherwise, the storage location is determined to be the target database.
5. The method according to any one of claims 1 to 3, characterized in that: If the message type is a return message; The determining, based on the message type and the matching diversion rule, the storage location of the current incoming message includes: Based on the diversion rule, read the default diversion identifier configured for the de-reporting message in the configuration file; If the default diversion flag indicates diversion, the storage location is determined to be a target database; otherwise, the storage location is determined to be an original database.
6. The method according to any one of claims 1 to 3, characterized in that: If the message type is other non-receipt message; The determining, based on the message type and the matching diversion rule, the storage location of the current incoming message includes: Based on the diversion rule, reading the corresponding relationship between the routing identifier configured for the other non-receipt message and the diversion mode in the configuration file, and determining the diversion mode matching the other non-receipt message; Based on the diversion method, a storage location of the current incoming report is determined.
7. The method according to claim 6, characterized in that The determining, based on the diversion mode, a storage location of the current incoming report includes: If the diversion method is diversion by number segment, then when the other non-receipt messages are located in the specified number segment, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database; If the diversion mode is dual-transmission, determining the storage location as the original database and the target database; If the diversion method is diversion according to the target list, then when the other non-receipt message hits the target list, the storage location is determined to be the target database, otherwise the storage location is determined to be the original database; If the diversion method is special processing for collection and payment, then based on the judgment mark of the message type information in the other non-receipt messages, it is determined that the diversion is based on the number segment, and when the other non-receipt messages are located in the specified number segment, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database; or, based on the judgment mark of the message type information in the other non-receipt messages, it is determined that the diversion is based on the notification number, and when the other non-receipt messages are located in the specified notification number, the storage location is determined to be the original database, otherwise the storage location is determined to be the target database.
8. The method according to any one of claims 1 to 3, characterized in that: If the storage location is a target database; Based on the storage location, storing the current incoming report in a corresponding database includes: The current message is sent to the target server via a Hypertext Transfer Protocol (HTTP) request, so that the target server stores the current message in the target database.
9. A message diversion device, characterized in that: The device comprises: an acquisition unit, configured to acquire a message type of the current incoming message when determining that a diversion process needs to be performed on the current incoming message; A determination unit, configured to determine a storage location of the current incoming message based on the message type and the matching diversion rule; A storage unit is used to store the current incoming report in a corresponding database based on the storage location.
10. An electronic device, characterized in that: include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory, and execute the steps included in any one of the methods of claims 1-8 according to the obtained program instructions.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer is enabled to execute the method according to any one of claims 1 to 8.