Data source switching method and system for air ticket flight

Through the flight data source switching method of air ticket flight, automatic switching and data verification are achieved using the data source schedule and cache mechanism, the service interruption problem caused by a single data source failure is solved, and the reliability and accuracy of flight information query is improved.

CN119166884APending Publication Date: 2024-12-20苏州思客科技(集团)有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411263764.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

In the prior art, when airlines and travel agencies obtain flight information, the failure of a single data provider leads to service interruption, and the data source cannot be switched in time, affecting the user experience.

Method used

Design a data source switching method for air ticket flights, automatically switch to the next available data source by initializing the ticket supply data source schedule, ensuring service continuity, and improving the reliability and accuracy of data sources through cache and anomaly detection models.

Benefits of technology

It realizes rapid switching and data verification in the event of data source failure, ensuring that users obtain the latest and accurate flight information, and improving service reliability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166884A_ABST
    Figure CN119166884A_ABST
Patent Text Reader

Abstract

The invention relates to the field of data source switching, and discloses a data source switching method and system for air ticket flights. The data source switching method for the air ticket flight comprises the following steps: sending a query instruction; in response to the query instruction, sending service data to an air ticket supply data source; the air ticket supply data source executes the service data and sends query data; when the execution of the currently adopted air ticket supply data source is abnormal, initiating a switching request; in the initialized air ticket supply data source scheduling table, the other air ticket supply data source responding to the switching request executes service data, and switched query data is returned; wherein the number of the air ticket supply data sources is multiple, and the initialized air ticket supply data source scheduling table records connection information of the multiple selectable air ticket supply data sources. Through configuration and initialization of the air ticket supply data source scheduling table and automatic fault switching, the capability of coping with the abnormal condition of multiple air ticket data sources is improved, and the stability, reliability and user experience of flight information query service are guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data source switching, and in particular to a data source switching method and system for air tickets and flights. Background Art

[0002] With the accelerated pace of life, the development of the global economy and the tourism industry, people's demand for air travel is increasing. At the same time, with the rapid development of the Internet and IT technology, online ticket booking and inquiry systems have emerged.

[0003] In general, airlines and travel agencies usually rely on multiple data suppliers to obtain flight information. If they rely only on a single supplier, when the supplier's service fails, such as network problems, server failures, maintenance downtime, etc., travelers will not be able to obtain the latest flight information, resulting in the inability to conduct normal flight inquiries. Inevitably, due to network failures, service interruptions, etc., data anomalies may be encountered when querying flight information. When there is a problem with the supplier's data source, traditional solutions usually require manual intervention to switch the data source, which can easily lead to long service interruptions. This is not only time-consuming and labor-intensive, but also cannot guarantee the timeliness and accuracy of the switch, which seriously affects the user experience. Summary of the invention

[0004] The object of the present invention is to provide a data source switching method and system for air ticket flights, thereby overcoming the deficiencies in the prior art.

[0005] In order to achieve the above-mentioned invention object, the technical solution adopted by the present invention includes: A first aspect of the present invention provides a data source switching method for air tickets and flights, comprising: Issue a query command; In response to the query instruction, sending business data to the ticket supply data source; The ticket supply data source executes the business data and sends query data; It is characterized in that the ticket supply data source is set to be multiple, and the data source switching method further includes the following steps: When the currently used ticket supply data source performs abnormally, a switching request is initiated; In the initialized ticket supply data source scheduling table, another ticket supply data source responding to the switching request executes the service data and returns the switched query data; The initialized air ticket supply data source scheduling table records connection information of a plurality of optional air ticket supply data sources.

[0006] In this solution, when the ticket supply data source executes abnormally, the server can automatically initiate a switch and switch to the next ticket supply data source in the initialization ticket supply data source schedule to ensure timely provision of ticket query services and improve reliability.

[0007] Furthermore, the process of constructing the initialization ticket supply data source scheduling table specifically includes: Get a first collection including multiple first air ticket supply data sources; Configure the first air ticket supply data source in the first set to obtain configuration information; Determine a first configuration file by combining multiple configuration information; The initialization air ticket supply data source schedule is determined according to the first configuration file.

[0008] Further, according to the first configuration file, determining the initialization ticket supply data source schedule specifically includes: identifying priorities of the plurality of first ticket supply data sources in the configuration information; The plurality of first air ticket supply data sources are sorted according to the priority, and a scheduling list of initialization air ticket supply data sources is determined.

[0009] Further, after determining the initialization ticket supply data source scheduling list according to the first configuration file, the method further includes: Preset cache update cycle; Cache the data of the air ticket supply data source according to the initialization air ticket supply data source scheduling list and cache update cycle; When the ticket supply data source in the initialized ticket supply data source schedule table does not respond to the switching request, calling the cached data; According to the called cache data, the business data is executed, and the query data is returned to the main control terminal.

[0010] Furthermore, the data source switching method for air tickets and flights also includes: Bringing the offline air ticket supply data source online to the initialization air ticket supply data source scheduling list as the second air ticket supply data source; Configuring the second air ticket supply data source to obtain second configuration information; Add the second configuration information to the first configuration file to obtain a second configuration file; According to the second configuration file, a second data source scheduling list is obtained to replace the first list as an update list.

[0011] Further, in the schedule table of initializing the ticket supply data source, another ticket supply data source responding to the switching request executes the service data and returns the query data after the switching, including: In the initialization ticket supply data source scheduling table, a plurality of ticket supply data sources that respond to the switching request are obtained; Based on the preset screening rules, the query data returned by the ticket supply data source responding to the switching request is compared to obtain the screening results as the query data.

[0012] Furthermore, based on the preset screening rules, the query data returned by the ticket supply data source responding to the switching request is compared, specifically including: Obtain query data returned by the ticket supply data source in response to the switching request; Parsing the returned query data to obtain core information fields; Compare the core information fields with the pre-set standard data to obtain the comparison results; When the comparison result satisfies the first screening rule, determining that the query data is first-type erroneous data; When the comparison result satisfies the second screening rule, determining that the query data is second-type erroneous data; Filter out the first type of erroneous data and the second type of erroneous data.

[0013] Furthermore, the data source switching method for air tickets and flights also includes: Build anomaly detection models based on historical data; Based on a preset inspection cycle, the schedule table of the data source for initializing the air ticket supply is input into the anomaly detection model for identification, and an identification result including at least the data source connection status, response time, and data integrity is obtained; When the recognition result satisfies the first detection condition, outputting data in the first format; When the recognition result satisfies the second detection condition, outputting data in a second format; An abnormality log is generated according to the first format data and the second format data.

[0014] A second aspect of the present invention provides a data source switching system for air tickets and flights, comprising: The main control terminal is used to issue query instructions to the server; The server is used to respond to the query instruction and send business data to the ticket supply data source; The ticket supply data source is used to execute business data and send query data to the main control terminal; The server is further configured to initiate a switching request when the currently used ticket supply data source performs abnormally; In the initialized ticket supply data source scheduling table, another ticket supply data source responding to the switching request executes the service data and returns the switched query data; There are multiple ticket supply data sources, and the initialization ticket supply data source scheduling table records the connection information of multiple optional ticket supply data sources.

[0015] A third aspect of the present invention provides a computer-readable storage medium storing a data source switching program, which can be executed by at least one processor to enable the at least one processor to perform the steps of a data source switching method for air tickets and flights.

[0016] Compared with the prior art, the advantages of the present invention include at least: First, in a data source switching method for air tickets and flights provided by the present invention, the first air ticket supply data source is configured, and data sources of different suppliers can be accessed directly according to the configuration file, which is more flexible and safe.

[0017] Second, in a data source switching method for air tickets and flights provided by the present invention, the priority of the first air ticket supply data source in the configuration information is identified, and the first air ticket supply data source is sorted according to the priority, and the scheduling list of the initialization air ticket supply data source is determined, so that the air ticket supply data source with better quality can be queried first to obtain more accurate information.

[0018] Third, in a data source switching method for air tickets and flights provided by the present invention, data of the air ticket supply data source is cached. When the ticket supply data source in the initialization ticket supply data source schedule table does not respond to the switching request, the cache is called to execute business data, and flight data can be read when all data sources are unavailable. In addition, the cache cycle is preset, and the data in the cache can be automatically updated regularly to ensure the timeliness and accuracy of the cached data.

[0019] Fourth, in a data source switching method for air tickets and flights provided by the present invention, in the initialization of the air ticket supply data source scheduling table, multiple air ticket supply data sources that respond to the switching request are obtained, and based on the preset screening rules, the query data returned by the air ticket supply data sources that respond to the switching request are compared, and inconsistent or erroneous data can be screened out to ensure that the user obtains accurate flight information.

[0020] Fifth, in a data source switching method for air tickets and flights provided by the present invention, based on a preset inspection cycle, the initialization air ticket supply data source schedule is input into the anomaly detection model for identification, and whether there is an abnormality in the data source is identified, and the availability of the data source is monitored in real time. The relevant logs of the abnormal results are recorded for easy maintenance.

[0021] Sixth, in a data source switching method for air tickets and flights provided by the present invention, the second air ticket supply data source is configured to obtain second configuration information, the second configuration information is added to the first configuration file to obtain the second configuration file, and the second data source scheduling list is obtained according to the second configuration file. In this way, the data source scheduling table can be updated in time, the data source with abnormal conditions can be offline, and the maintained data source can be online to obtain the latest data source scheduling list. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 It is a flowchart of a data source switching method for air tickets and flights provided by an embodiment of the present invention; Figure 2 It is a structural schematic diagram of a data source switching system for air tickets and flights provided by an embodiment of the present invention; Figure 3 It is an interactive diagram of a data source switching system for air tickets and flights provided by an embodiment of the present invention.

[0023] Description of reference numerals: 100. Data source switching system for air tickets and flights; 11. Main control terminal; 12. Server; 13. Air ticket supply data source. DETAILED DESCRIPTION

[0024] In view of the deficiencies in the prior art, the inventor of this case has proposed the technical solution of the present invention after long-term research and extensive practice. The technical solution, its implementation process and principle will be further explained as follows.

[0025] Please refer to Figure 1 , a data source switching method for air tickets and flights provided by an embodiment of the present invention, comprising: S100: Issue a query instruction.

[0026] S200: In response to the query instruction, the business data is sent to the ticket supply data source.

[0027] S300: The air ticket supply data source executes the business data and sends query data.

[0028] S400: When the currently used ticket supply data source performs abnormally, a switching request is initiated.

[0029] S500: In the initialized ticket supply data source scheduling table, another ticket supply data source responding to the switching request executes the service data and returns the switched query data.

[0030] The ticket supply data source is set to be multiple. The initialization ticket supply data source scheduling table records the connection information of multiple optional ticket supply data sources.

[0031] The following describes it step by step.

[0032] S100: Issue a query instruction.

[0033] It is understandable that the main control terminal sends a query instruction to the server.

[0034] The main control terminal here can be understood as a mobile terminal that has established a network connection relationship with the server.

[0035] In the data source switching method for air tickets and flights provided in this application, the master control terminal can be understood as a mobile terminal directly controlled by the user and having established a network connection relationship with the server. For example, when querying air tickets and flights, the user uses a mobile phone, tablet computer, laptop computer, desktop computer, etc.

[0036] Specifically, the main control terminal sends a query instruction based on business logic to the server.

[0037] The business logic can be understood as the rules and processes that an entity unit should have in order to provide services to another entity unit. In the specific air ticket flight query scenario, the business logic can be understood as a set of reasonable rules and processes formulated between the main control terminal and the server based on existing information.

[0038] The query instruction can be understood as the corresponding operation data sent by the main control terminal when the main control terminal user makes a corresponding operation on the main control terminal. In the specific air ticket and flight query scenario, the query instruction sent by the main control terminal can be understood as the corresponding operation data sent by the main control terminal of the user's mobile phone, tablet computer, laptop, desktop computer, etc. to the server.

[0039] S200: In response to the query instruction, the business data is sent to the ticket supply data source.

[0040] It is understandable that the server responds to the query instruction and sends the business data to the ticket supply data source. When the server receives the query instruction sent by the main control terminal, it responds to the query instruction. Then, according to the received query instruction, it generates an execution command corresponding to the query instruction and sends the business data to the ticket supply data source.

[0041] S300: The air ticket supply data source executes the business data and sends query data.

[0042] In the specific air ticket and flight query application scenario provided in this application, the air ticket supply data source executes business data and sends the query data to the main control terminal. When the tablet, computer, etc. operated by the user queries the air ticket and flight, it issues a command to the server. The server responds to the query command and sends business data to the air ticket supply data source. Based on the business data, the air ticket supply data source sends the query data to the tablet, computer, etc. operated by the user.

[0043] S400: When the currently used ticket supply data source performs abnormally, a switching request is initiated.

[0044] It is understood that abnormal situations include but are not limited to network problems, server failures, maintenance downtime, etc.

[0045] When a supplier's data source has a problem, it is easy to cause a long service interruption, seriously affecting the user experience. Therefore, it is necessary to switch in time, and the server initiates a switch request.

[0046] S500: In the initialization ticket supply data source scheduling table, another ticket supply data source responding to the switching request executes the business data and returns the switched query data to the main control terminal. The initialization ticket supply data source scheduling table records the connection information of multiple optional ticket supply data sources. The ticket supply data source is set to be multiple.

[0047] In some embodiments, the process of constructing the schedule table for initializing the air ticket supply data source specifically includes: Get a first collection including multiple first air ticket supply data sources; Configure the first air ticket supply data source in the first set to obtain configuration information; Combining the plurality of configuration information, determining a first configuration file; The initialization air ticket supply data source schedule is determined according to the first configuration file.

[0048] The first air ticket supply data source here can be understood as the initial air ticket supply data source, and no abnormal situation occurs by default at this time. Specifically, the supply data source for querying flight information is first configured to obtain the configuration information of each supply data source. Combining multiple configuration information, determine the first configuration file. The configuration information here includes API interface, access credentials, priority, etc. According to the first configuration file, determine the initialization air ticket supply data source scheduling list. When the user needs to query flight information, the first configuration file is read in the code, and according to the first configuration file, try to access the data sources of different suppliers in the initialization air ticket supply data source scheduling list.

[0049] In some embodiments, determining the initialization ticket supply data source schedule according to the first configuration file includes: identifying priorities of the plurality of first ticket supply data sources in the configuration information; The plurality of first air ticket supply data sources are sorted according to the priority, and a scheduling list of initialization air ticket supply data sources is determined.

[0050] It is understandable that the data quality of data sources from different suppliers may vary, including missing values, erroneous data, duplicate data, etc. Considering the difference in data quality, the priority of the first air ticket supply data source in the configuration information is identified, and then the first air ticket supply data source is sorted according to the priority to determine the initialization of the air ticket supply data source scheduling list. In this way, the air ticket supply data source with better data quality can be queried first, which not only improves the search speed, but also improves the accuracy of the data.

[0051] In some embodiments, after determining the initialization of the ticket supply data source scheduling list according to the first configuration file, the method further includes: Preset cache update cycle; Cache the data of the air ticket supply data source according to the initialization air ticket supply data source scheduling list and cache update cycle; When the ticket supply data source in the initialized ticket supply data source schedule table does not respond to the switching request, calling the cached data; According to the called cache data, the business data is executed, and the query data is returned to the main control terminal.

[0052] In some embodiments, the cache data of the air ticket supply data source includes: Use consistent hashing algorithm sharding to store the data of the air ticket supply data source into a distributed cache.

[0053] When the ticket supply data source in the initialized ticket supply data source schedule table does not respond to the switching request, data is retrieved from the cache, the cache data is called, and the cache data is verified before being used for business execution.

[0054] In some embodiments, the caching step further comprises: Refresh cached data periodically or in real time to ensure data freshness.

[0055] Set up failover and fallback mechanisms to ensure that data support is still provided when the cache node fails or the data source is unavailable.

[0056] Multi-data center deployment, data backup, and automatic fault detection ensure rapid recovery when a failure occurs.

[0057] Specifically, the timed refresh of cache data can be understood as the system regularly refreshes the cache data according to the preset cache refresh cycle to ensure the freshness of the data. The real-time refresh of cache data can be understood as in the process of business execution, if the expiration or abnormality of the cache data is detected, the refresh mechanism will be immediately triggered to re-acquire the data from the real-time data source and update the cache. Set up failover. If a cache node fails, the system will automatically transfer to the backup node and continue to read data from the backup cache. Set up a fallback mechanism. When all cache nodes cannot provide valid data, re-request the data source or generate default query results based on historical data. In addition, when caching important business data, the data is synchronously written to two or more nodes to prevent data loss caused by single point failure. Multi-data center deployment can be understood as the distributed cache system is deployed across multiple data centers to ensure that when a single data center fails, other data centers can seamlessly take over the business. Data backup can be understood as regularly backing up cache data off-site, and restoring data from backup when a disaster is detected. Automatic fault detection and switching can be understood as automatic switching when a cache failure is detected.

[0058] In a specific application scenario, when the ticket supply data source schedule is initialized, the system will store the query data of the ticket supply data source in the distributed cache according to the preset cache update cycle. The cache update cycle here can be set to, but not limited to, 1 hour. After responding to the query instruction and sending the business data to the ticket supply data source, the query result is stored in the cache according to the freshness and importance of the data. The data will be accompanied by a timestamp and TTL (Time-to-Live) information when it is stored, which will be used for subsequent cache refresh and expiration processing. When the ticket supply data source in the initialized ticket supply data source schedule does not respond to the switching request, the system will trigger the fault tolerance mechanism and call the cache data from the distributed cache. The target cache node is determined using a consistent hashing algorithm to retrieve the corresponding cache data. After the data is retrieved, the retrieved data is verified with the timestamp in the cache to ensure that the data is not expired or has expired within the tolerance range. According to the cached data called, the business data is executed, and the query data is returned to the master terminal. The query operation is performed using the cached data to generate a result similar to that returned by the real-time data source. This result will be displayed on the master terminal or used for subsequent operations.

[0059] When all ticket supply data sources are unavailable, the system cannot provide any flight information. At this time, the main control terminal cannot obtain any flight information, which seriously affects the user experience. In a further implementation scheme, when all ticket supply data sources are unavailable, the data in the cache can be called to provide basic query services, ensure the basic availability of the service, improve emergency response capabilities, and ensure service continuity in extreme situations. In addition, the cache data can be updated regularly by presetting the cache cycle, which improves the timeliness of the data, improves the accuracy of the data, and enhances the user experience.

[0060] Preferably, when the ticket supply data source in the initialized ticket supply data source scheduling table can respond to the switching request, that is, when the ticket supply data source is operational, the data in the cache is automatically updated to ensure the timeliness and accuracy of the cache data.

[0061] In this solution, on the one hand, the consistent hashing algorithm is used to distribute cached data to different nodes, ensuring the uniform distribution and high availability of cached data. Data is stored in multiple nodes in pieces to improve access speed and system scalability. On the other hand, the LRU (Least Recently Used) strategy is used to manage cached data to ensure that the most frequently used data remains in the cache. And through distributed locks, the consistency of cached data among multiple nodes is guaranteed. The status of the node is monitored in real time, and an exception report is generated to ensure that the system can respond in time when a disaster occurs.

[0062] In some embodiments, in the initialization of the ticket supply data source schedule, another ticket supply data source responding to the switching request executes the service data and returns the query data after the switching, including: In the initialization ticket supply data source scheduling table, a plurality of ticket supply data sources that respond to the switching request are obtained; Based on the preset screening rules, the query data returned by the ticket supply data source responding to the switching request is compared to obtain the screening results as the query data.

[0063] It is understandable that when multiple ticket supply data sources are switched, data inconsistency is prone to occur. For example, the data update frequency and accuracy of different ticket supply data sources may be different, which may cause the flight information queried by the user to be incomplete or inaccurate, affecting the user's decision. Based on the above problems, the present application compares the query data returned by the ticket supply data source that responds to the switching request based on the preset screening rules, filters out inconsistent or erroneous data, and returns the filtered data as query data to the main control terminal.

[0064] In some implementation schemes, based on preset screening rules, the query data returned by the ticket supply data source in response to the switching request is compared, specifically including: Obtain query data returned by the ticket supply data source in response to the switching request; Parsing the returned query data to obtain core information fields; Compare the core information fields with the pre-set standard data to obtain the comparison results; When the comparison result satisfies the first screening rule, determining that the query data is first-type erroneous data; When the comparison result satisfies the second screening rule, determining that the query data is second-type erroneous data; Filter out the first type of erroneous data and the second type of erroneous data.

[0065] Specifically, after obtaining the query data returned by multiple ticket supply data sources in response to the switching request, first parse the query data returned by each data source to extract the core information fields including at least price, flight number, seat type, departure time, and arrival time. Compare the extracted core information fields with the pre-set standard data. The standard data here can be understood as standard price, standard flight number, standard seat type, standard departure time and arrival time. Compare the core information fields with the pre-set standard data to obtain a comparison result.

[0066] When the comparison result satisfies the first screening rule, the query data is determined to be the first type of error data. The first screening rule here can be understood as the core information field of the query data returned by the data source is inconsistent with the standard data. Exemplarily, the price exceeds the standard price, the flight number does not match, the seat type is inconsistent, etc. At this time, the query data is determined to be the first type of error data. When the comparison result meets the second screening rule, the query data is determined to be the second type of error data. The second screening rule here can be understood as the core information field of the query data returned by the data source is wrong. Exemplarily, there are format errors, missing key fields, data duplication or logical conflicts (for example, the departure time is later than the arrival time), etc. At this time, the query data is determined to be the second type of error data. Filter out the first type of error data and the second type of error data. According to the remaining valid data sources, the screening results are obtained, the screening results are used as the query data of the switching request, and the query data is returned to the main control terminal for further processing.

[0067] In a further implementation scheme, a consistency check is performed during the process of switching the air ticket supply data source to ensure the consistency and accuracy of the data returned by different air ticket supply data sources, provide reliable flight information, ensure that users obtain accurate flight information, and help users make correct decisions.

[0068] In a specific ticket data source switching scenario of the present application, different ticket supply data sources are accessed in sequence according to the priority order in the configuration file. When it is detected that the current ticket supply data source is unavailable, it automatically switches to the next available ticket supply data source. When multiple ticket supply data sources are available, load balancing is achieved to optimize query efficiency. When multiple ticket supply data sources are unavailable, the data in the distributed cache is called to ensure the basic availability of the service.

[0069] For details, please refer to the following code for the automatic switching process: public List <flightinfo>GetFlights(string departure, stringdestination, DateTime date) { lock (lockObject) { try { Return suppliers[currentSupplierIndex].GetFlights(departure, destination, date); } catch (Exception ex) { / / Try to get data from other data sources for (int i = 0; i <suppliers.Count; i++) { if (i != currentSupplierIndex&&healthChecks[i].IsHealthy()) { try { currentSupplierIndex = i; return suppliers[i].GetFlights(departure,destination, date); } catch { / / Ignore exceptions from other data sources and continue trying the next data source } } } } / / If all data sources are unavailable, try to get data from the cache return cache.GetFlights(departure, destination, date); } } Generally, it is impossible to detect and respond to abnormal situations of data sources in real time. Once a problem occurs, it is impossible to automatically downgrade or switch to an alternative data source, resulting in a significant decrease in service reliability and availability.

[0070] Based on this, in some implementation schemes, the data source switching method for air tickets and flights further includes: Build anomaly detection models based on historical data; Based on a preset inspection cycle, the schedule table of the data source for initializing the air ticket supply is input into the anomaly detection model for identification, and an identification result including at least the data source connection status, response time, and data integrity is obtained; When the recognition result satisfies the first detection condition, outputting data in the first format; When the recognition result satisfies the second detection condition, outputting data in a second format; An abnormality log is generated according to the first format data and the second format data.

[0071] It is understandable that the anomaly detection model is obtained by training historical data at least by a machine learning anomaly detection algorithm (Exception Detection Algorithm), and can detect the content of the initialization ticket supply data source scheduling table. According to the preset inspection cycle, the anomaly detection model checks the data source connection status, response time, data integrity and other indicators in the initialization ticket supply data source scheduling table to identify common abnormal situations. Exemplary, abnormal situations include but are not limited to data source connection failure, too long response time, and incomplete data return. Data source connection failure, that is, the data source cannot establish a connection or the connection times out. The response time is too long, that is, the response time of the data source exceeds the preset time threshold. The data return is incomplete, that is, the returned data lacks key fields or is in the wrong format. The model will be gradually optimized during the training process to ensure that it can accurately detect abnormal situations.

[0072] Preferably, the anomaly detection model presets the number of checks. The check data may be a threshold value for the number of ticket supply data sources, that is, the minimum number of reliable data sources. The number can be determined by analyzing historical performance data, business requirements, and supplier stability assessments, to avoid excessive detection of data sources and slow detection efficiency. In a specific anomaly detection scenario, the initialized ticket supply data source scheduling table is input into the anomaly detection model for identification, and it can also be detected whether the number of data sources actually responding matches the preset number of checks. When the number of data sources actually responding does not match the preset number of checks, the identification result also includes inconsistent data returns.

[0073] When the recognition result meets the first detection condition, the first format data is output. When the recognition result meets the second detection condition, the second format data is output. The first detection condition here can be understood as no anomaly in the initialization of the ticket supply data source scheduling table. The second detection condition can be understood as anomaly in the initialization of the ticket supply data source scheduling table. When the inspection results of all data sources meet the preset standards and the number of responses is consistent with the preset inspection number, the system outputs the "no anomaly" result, indicating that the system is in a normal state and outputs the first format data. The first format data can be: output status code: 200; output message: "No anomalies detected"; output data: a list of supply data sources without anomalies and related information such as response time. When any of the inspection conditions is not met, the system outputs the second format data. The second format data includes: output status code: 500; output message: "Anomalies detected"; output data: anomaly type, name of the data source where the anomaly occurred, and anomaly details. While outputting the abnormal result, further classify and locate the specific anomaly type, generate detailed anomaly log records, and facilitate subsequent analysis and troubleshooting. These records include but are not limited to: anomaly type, specific data source name where the anomaly occurred, timestamp of the anomaly, and detailed description of the anomaly. Exception types include but are not limited to connection exceptions, response time exceptions, and data integrity exceptions. Exception details include but are not limited to the error code of the connection failure, the specific time of the response timeout, the field name of the missing data, etc.

[0074] When an anomaly is detected, an alarm is triggered and a notification is sent to the operation and maintenance personnel. The notification content includes the anomaly type, data source information, and recommended troubleshooting steps. At the same time, preliminary diagnostic suggestions are automatically generated based on the anomaly log, such as "check data source connection configuration" and "increase response time threshold", so that the operation and maintenance personnel can quickly troubleshoot and repair. The operation and maintenance personnel can distinguish the error type through the anomaly log and conduct corresponding problem troubleshooting for different error types and descriptions.

[0075] In further solutions, through real-time monitoring and automated processing mechanisms, the system can detect abnormal conditions of data sources in real time and automatically switch to ensure the continuity and stability of services.

[0076] For specific steps, please refer to the following code: public Monitoring Component(List <isupplierquery>suppliers, List <ihealthcheck>healthChecks, TimeSpan healthCheckInterval, DistributedCachecache) { if (suppliers == null || suppliers.Count == 0) throw new ArgumentException("The list of ticket supply data sources cannot be empty"); if (suppliers.Count != healthChecks.Count) throw new ArgumentException("The ticket supply data source and health check quantity do not match"); this.suppliers = suppliers; this.healthChecks = healthChecks; this.healthCheckInterval = healthCheckInterval; this.cache = cache; this.currentSupplierIndex = 0; / / Initialize the timer and perform regular health checks healthCheckTimer = new Timer(CheckHealth, null,healthCheckInterval, healthCheckInterval); } private void CheckHealth(object state) { lock (lockObject) { for (int i = 0; i <healthChecks.Count; i++) { if (healthChecks[i].IsHealthy()) { if (currentSupplierIndex != i) { currentSupplierIndex = i; } return; } } } } Specifically, when a data query anomaly is detected for a certain air ticket supply data source, the anomaly information is recorded and an early warning message is sent to the person in charge. When the anomaly count exceeds the preset anomaly threshold, the problematic air ticket supply data source is automatically offline and automatically adjusted to the next air ticket supply data source. When the offline air ticket supply data source meets certain requirements, it will be put back online.

[0077] In some implementation schemes, based on a preset inspection cycle, the schedule table of the data source for initializing the air ticket supply is input into the anomaly detection model for identification, and after obtaining the identification result including at least the data source connection status, response time, and data integrity, the following is further included: Real-time detection of data source anomalies. When the anomaly count reaches the preset anomaly threshold, an early warning notification is sent to the person in charge, and the data source is automatically taken offline. The anomalies here include core errors and link errors. Exemplary, core errors include price errors, cabin code errors, etc. Connection errors include network connection timeouts, etc. When the anomaly count of a certain air ticket supply data source reaches or exceeds 3 times, it is determined that the data source needs to be taken offline, and an early warning message is sent to the person in charge. The early warning message includes the name of the data source, the cumulative number of anomalies, the time when the most recent anomaly occurred, and detailed log records. After the early warning message is issued, the abnormal data source is removed from the initialized air ticket supply data source scheduling list and adjusted to the next available air ticket supply data source. The offline data source status will be marked as "needs evaluation" and stop accepting new query requests.

[0078] Subsequently, the person in charge evaluates the interface response speed and data accuracy of the offline data source through the abnormal log of the offline data source. Specifically, the response time data in the log is used to evaluate whether the average response speed of the data source meets the system requirements. If the response time continues to be within the preset threshold range (such as within 2 seconds), this evaluation passes. The person in charge needs to check the integrity and accuracy of the data recorded in the log to ensure that there is no missing, incorrect or duplicate data. If no data anomalies are found in the recent multiple tests, this evaluation passes.

[0079] After completing the log analysis and stress testing, if the data source continues to perform normally, the person in charge will approve the data source to be put back online and restore its position in the scheduling list. Specifically, the person in charge should require the system to run the test for a period of time, perform stress testing and multiple queries on the data source, and ensure that the data source no longer has abnormalities during the test. The data source is usually required to perform normally in at least 3 consecutive tests. If the interface response speed and data accuracy meet the standards and no new abnormalities occur during the test, the person in charge can re-mark the data source as "available" and re-add it to the initialized ticket supply data source scheduling list as the second ticket supply data source.

[0080] The data source that is back online will be counted again and a new monitoring cycle will begin. Specifically, once a data source is back online, the system will reset its previous anomaly count and start a new monitoring cycle. If anomalies occur again in the data source after it is back online, the system will re-count and evaluate it.

[0081] In some embodiments, the data source switching method for air tickets and flights further includes: Bringing the offline air ticket supply data source online to the initialization air ticket supply data source scheduling list as the second air ticket supply data source; Configuring the second air ticket supply data source to obtain second configuration information; Add the second configuration information to the first configuration file to obtain a second configuration file; According to the second configuration file, a second data source scheduling list is obtained to replace the first list as an update list.

[0082] The second air ticket supply data source here can be understood as an air ticket supply data source that has been offline and has reached the online standard.

[0083] Specifically, for the ticket supply data source that has been offline, pre-online preparation is carried out. By observing the interface log statistics for a period of time, if the threshold required for going online again is reached, a message is sent to the person in charge, and the interface response speed and data accuracy related logs are manually evaluated to achieve re-online. Configure the online ticket supply data source to obtain the second configuration information. Add the second configuration information to the first configuration file to obtain the second configuration file. According to the second configuration file, obtain the second data source scheduling list, that is, update the source scheduling list. In addition, in order to improve accuracy, the administrator can also manually update the ticket supply data source in the configuration file, and the system will automatically read the new configuration and readjust the data source list.

[0084] Please refer to Figure 2 The present embodiment also provides a data source switching system 100 for air tickets and flights for executing a data source switching method. The data source switching system 100 includes: The main control terminal 11 is used to send a query instruction to the server 12; The server 12 is used to respond to the query instruction and send business data to the ticket supply data source 13; The ticket supply data source 13 is used to execute business data and send query data to the main control terminal 11; The server 12 is also used to initiate a switching request when the currently used ticket supply data source 13 performs abnormally; In the initialized ticket supply data source scheduling table, another ticket supply data source responding to the switching request executes the service data and returns the switched query data; There are multiple ticket supply data sources 13, and the initialization ticket supply data source scheduling table records the connection information of multiple optional ticket supply data sources.

[0085] For details, please refer to Figure 3 , the main control terminal 11 sends a query instruction to the server 12. After the server 12 responds to the query instruction, it concurrently queries N data sources and sends business data to N ticket supply data sources 13. After the ticket supply data source 13 executes the business data and sends the query data to the server 12, the user of the main control terminal 11 obtains the returned query data. Preferably, the data source switching system 100 includes a monitoring module and a cache module. The monitoring module is used to monitor the abnormal situation of the ticket data source and record the abnormal log. The abnormal ticket data source goes offline, and after the abnormality is eliminated, the data source goes online again. The cache module is used to cache the data of the ticket supply data source so that the cache can be called when all data sources are unavailable, ensuring the basic availability of the service, improving the emergency response capability, and ensuring the continuity of the service in extreme cases. When the monitoring module detects that the currently used ticket supply data source 13 executes abnormally, the server 12 initiates a switching request, concurrently queries N-1 data sources, and in the initialized ticket supply data source scheduling table, another ticket supply data source that responds to the switching request executes the business data and returns the switched query data. There are multiple ticket supply data sources 13, and the initialization ticket supply data source scheduling table records the connection information of multiple optional ticket supply data sources.

[0086] This embodiment also provides a computer-readable storage medium, which stores a data source switching program. The data source switching program can be executed by at least one processor to enable the at least one processor to perform the steps of the data source switching method for air tickets and flights.

[0087] It should be understood that the above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made according to the spirit of the present invention should be included in the protection scope of the present invention.< / ihealthcheck> < / isupplierquery> < / flightinfo>

Claims

1. A data source switching method for air tickets and flights, comprising: Issue a query command; In response to the query instruction, sending business data to the ticket supply data source; The ticket supply data source executes the business data and sends query data; It is characterized in that the ticket supply data source is set to be multiple, and the data source switching method further includes the following steps: When the currently used ticket supply data source performs abnormally, a switching request is initiated; In the initialized ticket supply data source scheduling table, another ticket supply data source responding to the switching request executes the service data and returns the switched query data; The initialized air ticket supply data source scheduling table records connection information of a plurality of optional air ticket supply data sources.

2. The data source switching method for air tickets and flights according to claim 1, characterized in that: The process of constructing the initialization ticket supply data source scheduling table specifically includes: Get a first collection including multiple first air ticket supply data sources; Configure the first air ticket supply data source in the first set to obtain configuration information; Determine a first configuration file by combining multiple configuration information; The initialization air ticket supply data source schedule is determined according to the first configuration file.

3. The data source switching method for air tickets and flights according to claim 2, characterized in that: Determining the initialization ticket supply data source schedule according to the first configuration file specifically includes: identifying priorities of the plurality of first ticket supply data sources in the configuration information; The plurality of first air ticket supply data sources are sorted according to the priority, and a scheduling list of initialization air ticket supply data sources is determined.

4. The data source switching method for air tickets and flights according to claim 2, characterized in that: After determining the initialization ticket supply data source scheduling list according to the first configuration file, the method further includes: Preset cache update cycle; Cache the data of the air ticket supply data source according to the initialization air ticket supply data source scheduling list and cache update cycle; When the ticket supply data source in the initialized ticket supply data source schedule table does not respond to the switching request, calling the cached data; According to the called cache data, the business data is executed, and the query data is returned to the main control terminal.

5. The data source switching method for air tickets and flights according to claim 2, characterized in that: Also includes: Bringing the offline air ticket supply data source online to the initialization air ticket supply data source scheduling list as the second air ticket supply data source; Configuring the second air ticket supply data source to obtain second configuration information; Add the second configuration information to the first configuration file to obtain a second configuration file; According to the second configuration file, a second data source scheduling list is obtained to replace the first list as an update list.

6. The data source switching method for air ticket flights according to claim 1, characterized in that: In the initialization of the ticket supply data source scheduling table, another ticket supply data source responding to the switching request executes the service data and returns the query data after the switching, including: In the initialization ticket supply data source scheduling table, a plurality of ticket supply data sources that respond to the switching request are obtained; Based on the preset screening rules, the query data returned by the ticket supply data source responding to the switching request is compared to obtain the screening results as the query data.

7. The data source switching method for air tickets and flights according to claim 6, characterized in that: Based on the preset screening rules, the query data returned by the ticket supply data source that responds to the switching request is compared, including: Obtain query data returned by the ticket supply data source in response to the switching request; Parsing the returned query data to obtain core information fields; Compare the core information fields with the pre-set standard data to obtain the comparison results; When the comparison result satisfies the first screening rule, determining that the query data is first-type erroneous data; When the comparison result satisfies the second screening rule, determining that the query data is second-type erroneous data; Filter out the first type of erroneous data and the second type of erroneous data.

8. The data source switching method for air ticket flights according to claim 1, characterized in that: Also includes: Build anomaly detection models based on historical data; Based on a preset inspection cycle, the schedule table of the data source for initializing the air ticket supply is input into the anomaly detection model for identification, and an identification result including at least the data source connection status, response time, and data integrity is obtained; When the recognition result satisfies the first detection condition, outputting data in the first format; When the recognition result satisfies the second detection condition, outputting data in a second format; An abnormality log is generated according to the first format data and the second format data.

9. A data source switching system for air tickets and flights, characterized in that: include: The main control terminal is used to issue query instructions to the server; The server is used to respond to the query instruction and send business data to the ticket supply data source; The ticket supply data source is used to execute business data and send query data to the main control terminal; The server is further configured to initiate a switching request when the currently used ticket supply data source performs abnormally; In the initialized ticket supply data source scheduling table, another ticket supply data source responding to the switching request executes the service data and returns the switched query data; There are multiple ticket supply data sources, and the initialization ticket supply data source scheduling table records the connection information of multiple optional ticket supply data sources.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a data source switching program, which can be executed by at least one processor to enable the at least one processor to perform the steps of the data source switching method for air tickets and flights as described in any one of claims 1 to 8.

Citation Information

Cited By

  • Multi-source data fusion processing method for air ticket scheme generation and comparison

    CN121581914A