Independent station data directional synchronization method and device, equipment and medium

By responding to data source change events in independent stores, using worker thread pools and message queues to achieve directional synchronization solves the problems of slow data synchronization and insufficient security in traditional e-commerce platforms, and achieves efficient, accurate and secure data synchronous.

CN118673080AActive Publication Date: 2024-09-20GUANGZHOU SHANGYUN NETWORK TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410722324.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-09-20
Estimated Expiration
2044-06-05

AI Technical Summary

Technical Problem

Traditional e-commerce platforms synchronize the data of all online stores to the plug-in database in the plug-in system, resulting in high storage costs, slow data query and call speed, and security risks.

Method used

By responding to the data source change event of the independent store, we obtain the change log and target store identification, use the worker thread pool and message queue to achieve directional synchronization, and only synchronize the relevant plug-in database with the data source to ensure the accuracy and real-time performance of the data. and security.

Benefits of technology

It achieves efficient, accurate and secure data synchronization, reduces storage costs, improves data query and call speed, and ensures data privacy and consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673080A
    Figure CN118673080A
Patent Text Reader

Abstract

The invention relates to an independent station data directional synchronization method and device, equipment and a medium in the technical field of e-commerce, and the method comprises the steps: responding to a data source change event of an independent station shop, and obtaining a change log corresponding to the data source change event and a target shop identifier in the change log, specifying a target worker thread in a worker thread pool according to the target store identifier, distributing the target store identifier and the change log to the thread, starting the target worker thread to judge whether a plug-in identifier associated with the target store identifier exists, if so, constructing a to-be-synchronized change message corresponding to the change log, and synchronizing the to-be-synchronized change message to the target store identifier; and writing the to-be-synchronized change message into a target theme associated with the plug-in identifier in the message queue, and starting a plug-in developer thread corresponding to the plug-in identifier to consume the to-be-synchronized change message in the subscribed target theme, so that the plug-in database associated with the plug-in identifier and the data source realize data synchronization. According to the method, the directional synchronization requirement of a large amount of independent station data can be efficiently and accurately processed, and the accuracy, the real-time performance and the consistency of data synchronization and the security of the independent station data are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of e-commerce technology, and in particular to a method for directional synchronization of independent station data and its corresponding device, computer equipment, and computer-readable storage medium. Background Art

[0002] In the e-commerce platform, a plug-in system is designed to support the online stores built on independent stations to access different functions as needed. Merchants of online stores can choose the required plug-ins by themselves to enable the corresponding functions of the plug-ins. However, the plug-ins in the plug-in system need to provide corresponding functions based on the data of the corresponding online stores, which requires synchronizing the data of the online stores to the plug-in database of the plug-in selected by the merchants of the online stores.

[0003] In traditional technology, the data of all online stores in the e-commerce platform are usually synchronized to the plug-in database of each plug-in in the plug-in system, so that each plug-in database stores the data of all online stores. This implementation method not only has extremely high storage costs, but also stores data of most online stores that have not selected the corresponding plug-in, resulting in extremely slow data query and call speeds. In addition, the data of the online stores corresponding to each independent station are isolated from each other, so that the data of each online store can only be used by the online store itself or its authorized person. There will be security risks if the data of these online stores are synchronized to the plug-in database of the plug-in without the online store selecting the corresponding plug-in.

[0004] In view of the shortcomings of traditional practices, the applicant has been engaged in research in related fields for a long time and has taken a different approach to solve industry problems in the field of e-commerce technology. Summary of the invention

[0005] The primary purpose of the present application is to solve at least one of the above problems and to provide a stand-alone station data directional synchronization method and its corresponding device, computer equipment, and computer program product.

[0006] In order to meet the various objectives of this application, this application adopts the following technical solutions:

[0007] A method for directional synchronization of independent station data provided for one of the purposes of the present application includes the following steps:

[0008] Respond to the data source change event of the independent station store, obtain the change log corresponding to the data source change event and the target store ID therein;

[0009] Specify a target worker thread in a worker thread pool according to the target store identifier, and distribute the target store identifier and the change log to the target worker thread;

[0010] The target worker thread is enabled to determine whether there is a plug-in identifier associated with the target store identifier. If the plug-in identifier exists, the target worker thread constructs a change message to be synchronized corresponding to the change log and writes it to a target topic associated with the plug-in identifier in the message queue;

[0011] The plug-in developer thread corresponding to the plug-in identifier is enabled to consume the to-be-synchronized change message in the target topic to which it subscribes, so that the plug-in database associated with the plug-in identifier achieves data synchronization with the data source.

[0012] On the other hand, a stand-alone station data directional synchronization device provided to meet one of the purposes of the present application includes an event response module, a thread distribution module, a topic insertion module, and a message consumption module, wherein the event response module is used to respond to the data source change event of the stand-alone station store, and obtain the change log corresponding to the data source change event and the target store identifier therein; the thread distribution module is used to specify the target worker thread in the worker thread pool according to the target store identifier, and distribute the target store identifier and the change log to the target worker thread; the topic insertion module is used to enable the target worker thread to determine whether there is a plug-in identifier associated with the target store identifier. When the plug-in identifier exists, the target worker thread constructs a change message to be synchronized corresponding to the change log, and writes it to the target topic associated with the plug-in identifier in the message queue; the message consumption module is used to enable the plug-in developer thread corresponding to the plug-in identifier to consume the change message to be synchronized in the target topic it subscribes to, so that the plug-in database associated with the plug-in identifier can achieve data synchronization with the data source.

[0013] On the other hand, a computer device provided to meet one of the purposes of the present application includes a central processing unit and a memory, wherein the central processing unit is used to call and run a computer program stored in the memory to execute the steps of the independent station data directional synchronization method described in the present application.

[0014] On the other hand, a computer program product provided to meet another purpose of the present application includes a computer program / instruction, which, when executed by a processor, implements the steps of the method described in any embodiment of the present application.

[0015] The technical solution of this application has many advantages, including but not limited to the following aspects:

[0016] This application first responds to the data source change event of the independent station store, and obtains the relevant change log and target store identifier. Then, the corresponding target worker thread in the worker thread pool is specified according to the target store identifier, and the change log and target store identifier are distributed to it. After that, the target worker thread determines whether there is a plug-in identifier associated with the target store identifier. If it exists, it constructs the change log corresponding to the change message to be synchronized and writes it to the target topic associated with the plug-in identifier in the message queue. Further, the plug-in developer thread consumes the change message to be synchronized from the target topic it subscribes to, and completes the data synchronization between the plug-in database associated with the plug-in identifier and the data source. It can be seen that the data of the independent station store can be synchronized to the plug-in database associated with the independent station store, ensuring that the redundant data of the unassociated independent station store will not be stored in the plug-in database, ensuring the accuracy, real-time and consistency of data synchronization. At the same time, the data security of each independent station store is guaranteed, ensuring that only the plug-in database associated with the independent station store will store the data of the independent station store. Secondly, by using the worker thread pool combined with the thread distribution mechanism, the directional synchronization requirements of a large number of independent station data can be efficiently and accurately handled, ensuring high throughput and timely response. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0018] Figure 1 The network architecture of the e-commerce platform exemplified in this application;

[0019] Figure 2 A flowchart of a typical embodiment of the independent station data directional synchronization method of the present application;

[0020] Figure 3 A schematic diagram of a process for determining a target worker thread in a worker thread pool in an embodiment of the present application;

[0021] Figure 4 A schematic diagram of a process for determining a plug-in identifier associated with a target store identifier in an embodiment of the present application;

[0022] Figure 5 A schematic diagram of a process for processing a plug-in change message related to a target store identifier in an associated topic in an embodiment of the present application;

[0023] Figure 6 A schematic diagram of a process for constructing a plug-in change message and writing it into an associated topic in a message queue in an embodiment of the present application;

[0024] Figure 7 A schematic diagram of the process of initializing and building a store plug-in table in an embodiment of the present application;

[0025] Figure 8 This is a principle block diagram of the independent station data directional synchronization device of the present application;

[0026] Fig. 9 A schematic diagram of the structure of a computer device used in this application. DETAILED DESCRIPTION

[0027] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.

[0028] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0029] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with those in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.

[0030] like Figure 1 In the network architecture shown, the e-commerce platform 82 is deployed on the Internet to provide corresponding services to its users. Similarly, the devices 80 of the merchant users of the e-commerce platform 82 and the devices 81 of the consumer users are also connected to the Internet to use the services provided by the e-commerce platform.

[0031] The exemplary e-commerce platform 82 provides supply and demand matching of products and / or services to the general public with the help of Internet infrastructure. In the e-commerce platform 82, products and / or services are provided as commodity information. To simplify the description, the concepts of commodity, product, etc. are used in this application to refer to the products and / or services in the e-commerce platform 82, which may specifically be physical products, digital products, tickets, service subscriptions, other offline services, etc.

[0032] In reality, all entities can access the e-commerce platform 82 as users, use various online services provided by the e-commerce platform 82, and achieve the purpose of participating in the business activities achieved by the e-commerce platform 82. These entities can be natural persons, legal persons or social organizations, etc. Corresponding to the two types of entities, merchants and consumers in business activities, the e-commerce platform 82 has two types of users, merchant users and consumer users. All entities in the product distribution chain in business activities, including manufacturers, sellers, retailers, logistics providers, etc., can use online services in the e-commerce platform 82 as merchant users, while consumers in business activities, including real or potential consumers, can use online services in the e-commerce platform 82 as their corresponding consumer users. In actual business activities, the same entity can act as both a merchant user and a consumer user, and this should be understood flexibly.

[0033] The infrastructure used to deploy the e-commerce platform 82 mainly includes the backend architecture and frontend equipment. The backend architecture runs various online services through the service cluster, including middleware or frontend services for the platform, services for consumers, services for merchants, etc., to enrich and improve its service functions; the frontend equipment mainly covers the terminal devices used by users to access the e-commerce platform 82 as clients, including but not limited to various mobile terminals, personal computers, point-of-sale devices, etc. For example, merchant users can enter product information for their online stores through their terminal devices 80, or generate their product information using the interfaces opened by the e-commerce platform; consumer users can access the webpage of the online store implemented by the e-commerce platform 82 through their terminal devices 81, trigger the shopping process through the shopping buttons provided on the webpage, and call various online services provided by the e-commerce platform 82 during the shopping process, so as to achieve the purpose of shopping orders.

[0034] In some embodiments, the e-commerce platform 82 may be implemented by a processing facility including a processor and a memory, the processing facility storing a set of instructions that, when executed, cause the e-commerce platform 82 to perform the e-commerce and support functions involved in the present application. The processing facility may be part of a server, client, network infrastructure, mobile computing platform, cloud computing platform, fixed computing platform, or other computing platform, and provides electronic components, merchant equipment, payment gateways, application developers, marketing channels, transportation providers, customer equipment, point-of-sale equipment, etc. of the e-commerce platform 82.

[0035] The e-commerce platform 82 can be implemented as online services such as cloud computing services, software as a service (SaaS), infrastructure as a service (IaaS), platform as a service (PaaS), desktop as a service (DaaS), hosted software as a service, mobile backend as a service (MBaaS), information technology management as a service (ITMaaS), etc. In some embodiments, the various functional components of the e-commerce platform 82 can be implemented to be suitable for operation on various platforms and operating systems. For example, for an online store, its administrator users enjoy the same or similar functions regardless of various embodiments such as iOS, Android, HomonyOS, or web pages.

[0036] The e-commerce platform 82 can realize the corresponding independent station for each merchant to run its corresponding online store, and provide the merchant with the corresponding business management engine instance for the merchant to establish, maintain and run one or more online stores in one or more independent stations. The business management engine instance can be used for content management, task automation and data management of one or more online stores, and various specific business processes of the online store can be configured through interfaces or built-in components to support the implementation of business activities. The independent station is the infrastructure of the e-commerce platform 82 with cross-border service functions. Merchants can maintain their online stores more centrally and autonomously based on the independent station. The independent station usually has a domain name and storage space dedicated to the merchant, and different independent stations are relatively independent. The e-commerce platform 82 can provide standardized or personalized technical support for a large number of independent stations, so that merchant users can customize their own business management engine instance and use this business management engine instance to maintain one or more online stores they own.

[0037] The online store can implement backend configuration and maintenance by having the merchant user log in to its business management engine instance as an administrator. With the support of various online services provided by the infrastructure of the e-commerce platform 82, the merchant user can configure various functions in its online store as an administrator, view various data, etc. For example, the merchant user can manage various aspects of its online store, such as viewing the online store's recent activities, updating the online store's product catalog, managing orders, recent visit activities, total order activities, etc.; the merchant user can also view more detailed information about the business and visitors to the merchant's online store by obtaining reports or metrics, such as showing a sales summary of the merchant's overall business, specific sales and participation data of active sales marketing channels, etc.

[0038] The e-commerce platform 82 may provide communication facilities and associated merchant interfaces for providing electronic communications and marketing, such as utilizing electronic message aggregation facilities to collect and analyze communication interactions between merchants, consumers, merchant devices, customer devices, point-of-sale devices, etc., aggregating and analyzing communications, such as for increasing the potential for providing product sales, etc. For example, a consumer may have a question related to a product, which may generate a dialogue between the consumer and the merchant (or an automated processor-based agent on behalf of the merchant), where the communication facility is responsible for interacting and providing the merchant with analysis on how to increase the probability of a sale.

[0039] In some embodiments, an application suitable for installation in a terminal device can be provided to serve the access needs of different users, so that various users can access the e-commerce platform 82 by running the application in the terminal device, such as the merchant backend module of the online store in the e-commerce platform 82, etc. In the process of implementing business activities through these functions, the e-commerce platform 82 can implement various functions related to supporting the implementation of business activities as middleware or online services and open corresponding interfaces, and then implant the toolkit corresponding to the interface access function into the application to implement function expansion and task implementation. The business management engine can include a series of basic functions, and expose these functions to online services and / or application calls through APIs. Online services and applications use corresponding functions by remotely calling corresponding APIs.

[0040] With the support of various components of the business management engine instance, the e-commerce platform 82 can provide online shopping functions, allowing merchants to establish connections with customers in a flexible and transparent manner. Consumer users can select items online, create product orders, provide the delivery address of the goods in the product order, and complete the payment confirmation of the product order. Then, the merchant can review and complete or cancel the order. The review component carried by the business management engine instance can realize the compliance use of business processes to ensure that the order is suitable for fulfillment before actual fulfillment. Orders may sometimes be fraudulent and need to be verified (such as ID card checks). There is a payment method that requires merchants to wait to ensure that funds are received, which can play a role in preventing such risks, etc. Order risks may be generated by fraud detection tools submitted by third parties through order risk APIs, etc. Before fulfillment, merchants may need to obtain payment information or wait to receive payment information in order to mark the order as paid, so that the merchant can prepare to deliver the product. Such situations can be reviewed accordingly. The review process can be implemented by the fulfillment component. Merchants can use the fulfillment component to review, adjust work, and trigger related fulfillment services, such as: manual fulfillment services, which are used when merchants pick and pack products in boxes, purchase shipping labels and enter their tracking numbers, or simply mark items as fulfilled; custom fulfillment services, which can define email notifications; API fulfillment services, which can trigger third-party applications to create fulfillment records in third parties; legacy fulfillment services, which can trigger custom API calls from the business management engine to third parties; gift card fulfillment services. You can provide the generation of numbers and activate gift cards. Merchants can use the order printer application to print shipping orders. The fulfillment process can be executed when the items are packed in boxes and ready for shipping, tracking, delivery, consumer receipt verification, etc.

[0041] The e-commerce platform 82 can provide plug-in services to all independent station stores therein. The plug-in service is a service provided by the e-commerce platform 82 to the merchants of the independent station stores through the plug-in system developed and maintained by the e-commerce platform 82. The plug-in system provides multiple plug-ins with different functions, such as but not limited to, intelligent customer service plug-in: it can be used to act as the customer service role of the independent station store, and automatically reply to some preset consulting questions and / or scripts based on the preset question and answer data of the independent station store; product image design plug-in: it can be used to use the layer template data or default layer template data set by the merchants of the independent station store to further design the product header image, product detail image and other product images to enhance the marketing effect of the product image; logistics transfer order search plug-in: it can be used to use the product title data of the independent station store to retrieve the corresponding logistics transfer order; data analysis plug-in: it can be used to help the independent station store collect, analyze and display the operation data of the store. Data, including traffic sources, customer behavior, sales trends, etc., so that merchants can make more informed business decisions; Inventory management plug-in: can be used to monitor and manage the inventory data of independent station stores in real time, and issue alarms when inventory is insufficient to avoid overselling and out-of-stock situations; Marketing campaign management plug-in: can be used to create and track various promotional activities, such as coupons, limited-time discounts, member points, etc., to attract consumers and increase sales; Marketing promotion plug-in: can be used to use artificial intelligence technology to construct marketing promotion tweets based on the product data and / or marketing campaign data of the independent station store, and send them to social media, search engines, product audiences and other promotion channels associated with the independent station store; Store decoration plug-in: can be used to match the corresponding front-end decoration interface template based on the product data and / or marketing campaign data of the independent station store, so as to optimize the visual effect of the store decoration and improve the efficiency of the store decoration.

[0042] A stand-alone station data directional synchronization method of the present application can be programmed as a computer program product and deployed in a client or server for execution. For example, in the exemplary application scenario of the present application, it can be deployed and implemented in a server of an e-commerce customer service platform, thereby accessing an interface opened after the computer program product is running and performing human-computer interaction with the process of the computer program product through a graphical user interface to execute the method.

[0043] See also Figure 2 The independent station data directional synchronization method of the present application, in its typical embodiment, includes the following steps:

[0044] Step S1100: respond to the data source change event of the independent station store, and obtain the change log corresponding to the data source change event and the target store identifier therein;

[0045] An independent website refers to a new type of official website (website) built on the SaaS technology platform, which has an independent domain name, content, data, and private rights and interests, has the responsibility of an operating entity, is supported by social cloud computing capabilities, and can independently and freely connect to third-party software tools, publicity and promotion media and channels. Usually, merchants build and operate the independent website store on the independent website, allowing the independent website store to display its products on the independent website and provide consumers with e-commerce services such as browsing products, adding shopping carts, logistics delivery, placing orders, and after-sales service on the independent website store. Since the independent website stores on different independent websites are independent entities, all their data are isolated from each other. Therefore, all data of each independent website store is private.

[0046] The e-commerce platform of the present application is a platform that provides services to all independent station stores therein, including plug-in services, website building services, customer services, etc. The plug-in service is a service provided by the e-commerce platform to the merchants of the independent station stores through the plug-in system developed and maintained by the platform. The plug-in system provides multiple plug-ins with different functions. Merchants of the independent station stores can choose to subscribe to the corresponding plug-ins as needed, or cancel the subscription and give up the use of the corresponding plug-ins. In addition, when a merchant chooses to subscribe to a plug-in, the plug-in needs to use the data of the merchant's independent station store stored in its plug-in database to provide the corresponding function. In order to ensure that the plug-in can smoothly realize its designed functions, the plug-in database needs to contain all the data of the merchant's independent station store.

[0047] For each independent station store, the e-commerce platform associates all the data of the independent station store with the store ID of the independent station store and stores it in the platform database. The platform database can be any relational database, including MySQL, PostgreSQL, Oracle Database, and SQL Server. All the data of each independent station store stored in the platform database is the data source corresponding to each independent station store. The store ID of each independent station store is unique, that is, each store ID uniquely points to the corresponding single independent station store to distinguish other independent station stores. The setting of each store ID can be implemented by any algorithm such as UUID, self-increment ID, GUID, Snowflake, etc., and technical personnel in this field can flexibly implement it. The platform database is stored in a local persistent storage medium to ensure long-term storage and data will not be lost in the event of a power outage.

[0048] A third-party collection tool is used to monitor the changes of each data source in the platform database, and the corresponding change log is collected in real time. The change can be INSERT (insert) or DELETE (delete) or UPDATE (modify). When the platform database is implemented based on MySQL, the third-party collection tool can use canal to subscribe to MySQL binlog to capture the change log generated by the change of the data source in the platform database; when the platform database is implemented based on any one of MySQL, PostgreSQL, Oracle Database, etc., the third-party collection tool can use Debezium to capture the change log generated by the change of the data source in the platform database. Accordingly, when the data source in the platform database changes, the server of the e-commerce platform responds to the data source change event of the independent station store, obtains the change log corresponding to the data source corresponding to the data source change event captured by the third-party collection tool, and extracts the store ID from it as the target store ID.

[0049] Step S1200: specify a target worker thread in a worker thread pool according to the target store identifier, and distribute the target store identifier and the change log to the target worker thread;

[0050] The worker thread pool includes a plurality of worker threads, and the specific number of worker threads can be set by those skilled in the art as required. Each worker thread is pre-marked with a unique thread identifier.

[0051] The server activates the worker thread pool, uses a hash routing algorithm to first obtain a hash value corresponding to the target store identifier, and then determines a single worker thread in the worker thread pool mapped by the hash value, uses it as the target worker thread, and distributes the target store identifier and the change log to the target worker thread. The hash routing algorithm can be any one of a hash modulus algorithm, a consistent hash algorithm, etc., and those skilled in the art can flexibly implement it.

[0052] Step S1300: Enable the target worker thread to determine whether there is a plug-in identifier associated with the target store identifier. If there is a plug-in identifier, the target worker thread constructs a change message to be synchronized corresponding to the change log, and writes it to a target topic associated with the plug-in identifier in the message queue;

[0053] In one embodiment, the server enables a target worker thread to traverse all the association pairs in the platform database to determine whether there is an association pair containing a target store identifier among these association pairs. When such an association pair exists, the target worker thread obtains the plug-in identifier in the association pair and confirms it as the plug-in identifier associated with the target store identifier, which means that the merchant of the independent station store pointed to by the target store identifier subscribes to the plug-in pointed to by the plug-in identifier. After that, the target worker thread calls the third-party collection tool to determine the corresponding primary key, change type, changed fields and their assigned contents according to the change log, and formats the primary key, change type, changed fields and their assigned contents into a JSON-formatted change message to be synchronized. Then, the target worker thread, as the producer of the message queue, takes the topic associated with the plug-in identifier in the message queue as the target topic, and writes the change message to be synchronized in the target topic. The primary key is a globally unique identifier of the changed data in the change log, such as an ID; the change type is a textual representation of the change of the changed data in the change log, including a corresponding item among INSERT (insert), DELETE (delete), and UPDATE (modify); the changed field and its assigned content correspond to the changed field name of the changed data in the change log and the specific content assigned to the field of the field name.

[0054] The association pair in the platform database is created and updated by an independent maintenance thread enabled by the server. Specifically, when a merchant of an independent station store subscribes to a plug-in in the first plug-in system, an independent maintenance thread is enabled to associate the store ID of the independent station store with the plug-in ID of the plug-in to construct an association pair to complete its creation and write the association pair into the platform database; when the merchant of the independent station store subscribes to other plug-ins other than the plug-in in the plug-in system, an independent maintenance thread is enabled, and in the association pair, the plug-in ID of the other plug-in is added and associated with the store ID; when the merchant of the independent station store unsubscribes from the plug-in, in the association pair, the plug-in ID of the unsubscribed plug-in associated with the store ID is deleted, and then, it is determined whether the plug-in ID associated with the store ID in the association pair is empty. If it is empty, the association pair is deleted in the platform database, otherwise the association pair is retained in the platform database.

[0055] Each plug-in in the plug-in system has its corresponding unique plug-in identifier, that is, each plug-in identifier uniquely points to a corresponding single plug-in to distinguish other plug-ins. The setting of each plug-in identifier can be implemented by using any algorithm such as UU ID, self-increment ID, GU ID, Snowflake, etc., and technical personnel in this field can implement it flexibly.

[0056] The message queue is built using Kafka, which is a high-throughput distributed publish-subscribe messaging system. The program that writes messages to Kafka is called a Producer. The program that subscribes to and consumes messages in Kafka is called a Consumer. Each message in Kafka has a category, which is called a Topic, and each message belongs to and only belongs to one Topic.

[0057] Step S1400: enabling the plug-in developer thread corresponding to the plug-in identifier to consume the to-be-synchronized change message in the subscribed target topic, so that the plug-in database associated with the plug-in identifier can achieve data synchronization with the data source.

[0058] The server enables the plug-in developer thread corresponding to the plug-in identifier as a consumer of the message queue, which subscribes to the topic associated with the plug-in identifier in the message queue, namely the target topic, and pulls the change message to be synchronized from the target topic for consumption. The plug-in developer thread uses the JSON deserialization tool to deserialize the change message to be synchronized into the corresponding data object, and then uses the parsing algorithm to parse the data object to construct the corresponding database operation statement (such as SQL statement). The database operation statement is executed in the plug-in database associated with the plug-in identifier, and the same change as the data source can be achieved, such as executing the corresponding operation of inserting, deleting or modifying data, so that the data in the plug-in database will be synchronized with the data in the data source. The JSON deserialization tool and parsing algorithm can be flexibly implemented by those skilled in the art.

[0059] Each plug-in in the plug-in system has a plug-in developer thread corresponding to its plug-in identifier. Each plug-in developer thread subscribes to the topic of the plug-in identifier associated with the plug-in developer thread in the message queue to consume the pending change messages in the topic, so that the plug-in data associated with the plug-in identifier can be synchronized with the corresponding data source. Through this step, the plug-in system can respond to changes in the data source in a timely manner to ensure the accuracy and effectiveness of the plug-in function. At the same time, the process of enabling the plug-in developer thread and consuming pending change messages also ensures the overall efficient operation and data consistency.

[0060] It can be known from the typical embodiments of the present application that the technical solution of the present application has many advantages, including but not limited to the following aspects:

[0061] This application first responds to the data source change event of the independent station store, and obtains the relevant change log and target store identifier. Then, the corresponding target worker thread in the worker thread pool is specified according to the target store identifier, and the change log and target store identifier are distributed to it. After that, the target worker thread determines whether there is a plug-in identifier associated with the target store identifier. If it exists, it constructs the change log corresponding to the change message to be synchronized and writes it to the target topic associated with the plug-in identifier in the message queue. Further, the plug-in developer thread consumes the change message to be synchronized from the target topic it subscribes to, and completes the data synchronization between the plug-in database associated with the plug-in identifier and the data source. It can be seen that the data of the independent station store can be synchronized to the plug-in database associated with the independent station store, ensuring that the redundant data of the unassociated independent station store will not be stored in the plug-in database, ensuring the accuracy, real-time and consistency of data synchronization. At the same time, the data security of each independent station store is guaranteed, ensuring that only the plug-in database associated with the independent station store will store the data of the independent station store. Secondly, by using the worker thread pool combined with the thread distribution mechanism, the directional synchronization requirements of a large number of independent station data can be efficiently and accurately handled, ensuring high throughput and timely response.

[0062] See also Figure 3 In a further embodiment, step S1200, specifying a target worker thread in a worker thread pool according to the target store identifier, comprises the following steps:

[0063] Step S1210, enabling multiple worker threads to form a worker thread pool, and marking the thread identifier corresponding to each worker thread;

[0064] The server enables multiple worker threads to form a worker thread pool, so that multiple worker thread pools can work simultaneously, improving the overall execution efficiency. Then, for each worker thread, the thread ID of the worker thread is marked, and each thread ID uniquely points to a corresponding single worker thread to distinguish other worker threads. The setting of each thread ID can be implemented by any algorithm such as UUID, self-incrementing ID, GUID, Snowflake, etc., and those skilled in the art can flexibly implement it.

[0065] Step S1220: A hash routing algorithm is used to determine a mapped target thread identifier according to a hash value corresponding to the target store identifier, and a worker thread marked with the target thread identifier is used as a target worker thread.

[0066] The hash routing algorithm may be any one of a hash modulus algorithm, a consistent hash algorithm, etc., and those skilled in the art may flexibly implement it.

[0067] In one embodiment, the hash routing algorithm is implemented based on a consistent hashing algorithm. Specifically, the hash value corresponding to each thread identifier and the hash value corresponding to the target store identifier are calculated using the MD5 algorithm or the SHA-1 algorithm. These hash values ​​are respectively mapped to the same hash ring, and the position of each hash value on the hash ring is determined. Starting from the hash value position of the target store identifier, the hash value position is searched clockwise until the hash value position of the first worker thread is found. The thread identifier corresponding to the hash value position of the first worker thread is used as the target thread identifier, and then the worker thread marked with the target thread identifier is used as the target worker thread. The hash ring is a virtual ring that organizes the entire hash space in a clockwise direction, which contains 2 to the power of 32 positions.

[0068] In this embodiment, by creating a worker thread pool consisting of multiple worker threads and providing a unique identifier for each thread, a hash routing algorithm is used to quickly and accurately direct the data to a specific worker thread according to the hash value of the target store identifier, so that the data of the same target store identifier is processed on the same worker thread, which not only achieves uniform orientation of different target store identifiers and improves overall work efficiency, but also ensures that the time overhead of orientation is small due to the high efficiency of the hash algorithm. In addition, the scalability of the method ensures flexibility during system expansion, and new work requirements can be adapted by simply adding threads and updating the mapping relationship. At the same time, the competition overhead between threads is avoided through a predetermined allocation strategy to ensure stability and reliability.

[0069] See also Figure 4 In a further embodiment, step S1300, enabling the target worker thread to determine whether there is a plug-in identifier associated with the target store identifier, includes the following steps:

[0070] Step S1310, enabling the target worker thread to query whether there is an association relationship pair containing the target store identifier in the preset store plug-in table;

[0071] The server enables a target worker thread to traverse all association relationship pairs in a preset store plug-in table to determine whether there is an association relationship pair containing the target store identifier among these association relationship pairs.

[0072] The store plug-in table is created and updated by the server. To this end, the server first initializes the construction of the store plug-in table. The master-slave replication protocol of the relational database can be used to copy all the association pairs in the platform database to the created store plug-in table. Further, when a merchant of any independent station store subscribes to or unsubscribes from a plug-in, which causes the corresponding association pair in the store plug-in table to change, the server updates the association pair in the store plug-in table accordingly, so that each association pair in the store plug-in table ensures real-time and accurate representation of the corresponding latest plug-in subscribed by the independent station store. The specific implementation of the store plug-in table being created and updated by the server is further disclosed by the subsequent embodiments. This step is not discussed for the time being. Of course, those skilled in the art can also flexibly implement it according to the disclosure herein. For example, after the store plug-in table is initialized and constructed, the CDC (Change Data Capture) technology is used to synchronize the changes of all association pairs in the platform database to the store plug-in table in real time, so that all association pairs in the store plug-in table can achieve data synchronization with all association pairs in the platform database.

[0073] Step S1320: When the association relationship pair exists, the target worker thread confirms that there is a plug-in identifier in the association relationship pair that is associated with the target store identifier.

[0074] When there is an association pair containing the target store identifier, the target worker thread obtains the plug-in identifier in the association pair and confirms it as the plug-in identifier associated with the target store identifier, which means that the merchant of the independent station store pointed to by the target store identifier subscribes to the plug-in pointed to by the plug-in identifier.

[0075] In this embodiment, the target worker thread queries the store plug-in table to determine the association pair containing the target store identifier, and determines the plug-in identifier therein as being associated with the target store identifier. This allows the plug-in identifier associated with the target store identifier to be determined quickly and accurately. In addition, there is no need to use the association pair in the platform database, thereby ensuring the security and accuracy of the association pair in the platform database. Therefore, when necessary, for example, if the store plug-in table maintained in the server fails, the store plug-in table is lost due to server restart, etc., the store plug-in table can be rebuilt with the help of the master-slave replication protocol relying on all current association pairs in the platform database to ensure robustness.

[0076] See also Figure 5 In a further embodiment, step S1200, before specifying a target worker thread in a worker thread pool according to the target store identifier and distributing the target store identifier and the change log to the target worker thread, comprises the following steps:

[0077] Step S2210, responding to the message insertion event of the associated topic in the message queue, obtaining a plug-in change message corresponding to the message insertion event, and when the plug-in change message includes the target store identifier, serving as a target plug-in change message;

[0078] The associated topic is a topic in the message queue that is specifically used to place all plug-in change messages.

[0079] When a merchant of any independent station store in the e-commerce platform subscribes or unsubscribes to a plug-in, it will trigger the insertion of the corresponding plug-in change message in the associated topic in the message queue, and trigger the message insertion event of the associated topic in the message queue accordingly. The plug-in change message includes the store ID, plug-in ID, and plug-in change type. The plug-in change type represents the corresponding one of the store subscription plug-in and the store unsubscribe plug-in. In response to this, the server responds to the message insertion event, obtains the plug-in change message corresponding to the message insertion event from the associated topic, and uses it as the target plug-in change message when it contains the target store ID.

[0080] Step S2220: specify a target worker thread in a worker thread pool according to the target store identifier, and distribute the target plug-in change message to the target worker thread;

[0081] The worker thread pool includes a plurality of worker threads, and the specific number of worker threads can be set by those skilled in the art as required. Each worker thread is pre-marked with a unique thread identifier.

[0082] The server activates the worker thread pool, uses a hash routing algorithm to first obtain a hash value corresponding to the target store identifier, and then determines a single worker thread in the worker thread pool mapped by the hash value, uses it as the target worker thread, and distributes the target plug-in change message to the target worker thread. The hash routing algorithm can be any one of a hash modulus algorithm, a consistent hash algorithm, etc., and those skilled in the art can flexibly implement it.

[0083] Step S2230: When the plug-in change type in the target plug-in change message represents a store subscription plug-in, the target worker thread is enabled to retrieve all store data associated with the target store identifier from the platform database, construct a to-be-synchronized change message corresponding to each store data representing an insertion change, and write each to-be-synchronized change message into a target topic associated with the plug-in identifier in the target plug-in change message in the message queue;

[0084] Enable the target worker thread to retrieve all the data associated with the target store ID from the platform database, that is, all the store data, and then for each retrieved data, construct the change type of the data as I NSERT, construct the changed fields of the data and their assigned contents as the field name of the current data and the specific contents of the fields of the field name, construct the primary key of the data as the global unique identifier of the current data, and use the JSON serialization tool to format the primary key, change type, changed fields and their assigned contents into a JSON-formatted change message to be synchronized, and then the target worker thread, as the producer of the message queue, takes the subject of the associated plug-in ID in the message queue as the target subject, and writes the change message to be synchronized in the target subject. The JSON serialization tool can be flexibly implemented by those skilled in the art.

[0085] Step S2240: When the plug-in change type in the target plug-in change message represents a store unsubscribing from a plug-in, enable the target worker thread to retrieve all store data associated with the target store identifier from the platform database, construct a change message to be synchronized corresponding to each store data representing the deletion change, and write each change message to be synchronized into the target topic associated with the plug-in identifier in the target plug-in change message in the message queue.

[0086] Enable the target worker thread to retrieve all the data associated with the target store identifier from the platform database, that is, all the store data, and then for each retrieved data, construct the change type of the data as DELETE, construct the changed fields of the data and their assigned contents as the field name of the current data and the specific contents assigned to the field of the field name, construct the primary key of the data as the global unique identifier of the current data, and use the JSON serialization tool to format the primary key, change type, changed fields and their assigned contents into a JSON-formatted change message to be synchronized. Then, as the producer of the message queue, the target worker thread uses the topic of the associated plug-in identifier in the message queue as the target topic, and writes the change message to be synchronized into the target topic.

[0087] In this embodiment, when a message insertion event occurs in the message queue, the plug-in change message corresponding to the event is first obtained, and the message is checked whether it contains the target store identifier. If it is included, it is regarded as a target plug-in change message, and it is distributed to the corresponding target worker thread for processing. According to the change type in the plug-in change message, the target worker thread performs different operations. If the change type represents that the store has subscribed to the plug-in, the target worker thread will retrieve all store data associated with the target store identifier from the platform database, and construct a change message to be synchronized representing the insertion change for each store data, and then write these messages to the target topic in the message queue associated with the plug-in identifier. On the contrary, if the change type represents that the store has canceled the subscription to the plug-in, the target worker thread constructs a change message to be synchronized representing the deletion change, and also writes them to the target topic. It can be seen that the data synchronization between the plug-in database and the data source can be ensured to be dynamic and real-time. By responding to the subscription and unsubscription behavior of the independent station store to the plug-in in real time, the change message to be synchronized in the message queue can be updated in time, thereby ensuring the consistency and accuracy of synchronization. In addition, the efficiency of synchronization processing is also improved, because the worker thread pool can process the plug-in changes corresponding to multiple independent station stores in parallel, reducing the total time required for synchronization. In general, this embodiment achieves efficient and real-time synchronization of the relationship between independent station stores and plug-ins through its directional synchronization mechanism.

[0088] See also Figure 6 In a further embodiment, before step S2210, responding to the message insertion event of the associated topic in the message queue, the following steps are included:

[0089] Step S2200: In response to the plug-in change event, enable an independent service thread to obtain the store ID, plug-in ID and plug-in change type corresponding to the plug-in change event to construct a plug-in change message;

[0090] When a merchant of any independent station store in the e-commerce platform subscribes to or unsubscribes from a plug-in, it will trigger the associated topic in the message queue to insert the corresponding plug-in change message. Specifically, the server responds to the plug-in change event, enables an independent service thread to obtain the store ID corresponding to the plug-in change event, that is, the store ID of the independent station store at this time, the plug-in ID, that is, the plug-in ID of the plug-in at this time, and the plug-in change type, that is, if the merchant subscribes to a plug-in at this time, it represents the store subscribing to the plug-in; if the merchant unsubscribes from a plug-in at this time, it represents the store unsubscribing from the plug-in, and the store ID, plug-in ID, and plug-in change type constitute a plug-in change message.

[0091] Step S2201: The independent service thread writes the plug-in change message into the associated topic in the message queue.

[0092] Furthermore, the independent service thread, as a producer of the message queue, writes a plug-in change message into an associated topic in the message queue. The associated topic is a topic in the message queue specifically for placing all plug-in change messages.

[0093] In this embodiment, when a plug-in change event occurs, the independent service thread actively obtains the store ID, plug-in ID and change type involved, and constructs a plug-in change message accordingly. Subsequently, the thread writes the constructed plug-in change message into the associated topic in the message queue, ensuring that the subsequent worker thread can perform corresponding data synchronization operations according to these messages. It can be seen that a mechanism for quickly responding to plug-in change events is implemented, so that the corresponding plug-in change message can be inserted into the associated topic in the message queue in a timely manner, ensuring the timeliness and accuracy of subsequent data synchronization. Through the intervention of the independent service thread, the subsequent worker thread can handle the subscription and unsubscription events of the plug-in more flexibly, improving the automation and efficiency of the data synchronization process. In addition, the method also improves scalability and maintainability, because the independent service thread can be developed and optimized as a separate module without making large-scale modifications to the entire synchronization process. This modular design idea not only ensures stability and reliability, but also provides convenience for possible future functional expansion.

[0094] In a further embodiment, after step S2230 or step S2240, writing each to-be-synchronized change message into the target topic associated with the plug-in identifier in the target plug-in change message in the message queue, the following steps are included:

[0095] Step S3200: Enable the target worker thread to make corresponding changes to the association relationship between the target store ID and the plug-in ID in a preset store plug-in table according to the plug-in change type in the target plug-in change message.

[0096] The store plug-in table is created and updated by the server. For this purpose, the server first initializes and builds the store plug-in table. The master-slave replication protocol of the relational database can be used to copy all the association pairs in the platform database to the created store plug-in table. Further, when a merchant of any independent station store subscribes to or cancels a plug-in, which causes the corresponding association pair in the store plug-in table to change, the server updates the association pair in the store plug-in table accordingly, so that each association pair in the store plug-in table ensures real-time and accurate representation of the corresponding latest plug-in subscribed by the independent station store. For the update of the store plug-in table here, specifically, taking the case where the merchant of the independent station store pointed to by the target store identifier subscribes to or cancels a plug-in, which causes the corresponding association pair in the store plug-in table to change as an example, at this time, when the target working thread is enabled to confirm that the plug-in change type in the target plug-in change message is a plug-in representing the subscription of the store, the plug-in identifier is added to the association pair containing the target store identifier in the store plug-in table and is associated with the target store identifier; when the target working thread confirms that the plug-in change type in the target plug-in change message is a plug-in representing the cancellation of the subscription of the store, the plug-in identifier associated with the target store identifier is deleted from the association pair containing the target store identifier in the store plug-in table.

[0097] In this embodiment, the target work thread changes the association between the target store ID and the plug-in ID in the preset store plug-in table according to the plug-in change type in the target plug-in change message, so as to update the store plug-in table. It can be seen that the data consistency and accuracy of the store plug-in table can be ensured.

[0098] See also Figure 7 In a further embodiment, before step S1100, responding to the data source change event of the independent station store, the following steps are included:

[0099] Step S1000: In response to the initialization construction event of the store plug-in table, all association pairs are obtained from the platform database, each association pair including an associated store ID and a plug-in ID;

[0100] In order not to use the association relationship pairs in the platform database, the server responds to the initialization construction event of the store plug-in table and adopts the master-slave replication protocol of the relational database, that is, to replicate all the association relationship pairs in the platform database.

[0101] Step S1010: Create a store plug-in table and store all the association relationship pairs therein.

[0102] Further, a new shop plug-in table is created, and all the copied association relationship pairs are stored in the shop plug-in table. In a recommended embodiment, the shop plug-in table is cached in a local memory to ensure that the shop plug-in table can be read and written at high speed.

[0103] In this embodiment, the process of initializing the construction of the store plug-in table is revealed, which lays the foundation for the subsequent use of the association relationship pairs in the platform database without relying on them. It can ensure the consistency between the association relationship pairs in the store plug-in table and the association relationship pairs in the platform database, and avoid affecting the accuracy of the association relationship pairs in the platform database.

[0104] See also Figure 8 , an independent station data directional synchronization device provided to meet one of the purposes of the present application is a functional embodiment of the independent station data directional synchronization method of the present application. On the other hand, the device is an independent station data directional synchronization device provided to meet one of the purposes of the present application, including an event response module 1100, a thread distribution module 1200, a topic insertion module 1300, and a message consumption module 1400, wherein the event response module 1100 is used to respond to the data source change event of the independent station store, obtain the change log corresponding to the data source change event and the target store identifier therein; the thread distribution module 1200 is used to specify the worker thread pool according to the target store identifier The target worker thread in the message queue distributes the target store identifier and the change log to the target worker thread; a topic insertion module 1300 is used to enable the target worker thread to determine whether there is a plug-in identifier associated with the target store identifier. When the plug-in identifier exists, the target worker thread constructs a change message to be synchronized corresponding to the change log and writes it to the target topic associated with the plug-in identifier in the message queue; a message consumption module 1400 is used to enable the plug-in developer thread corresponding to the plug-in identifier to consume the change message to be synchronized in the target topic it subscribes to, so that the plug-in database associated with the plug-in identifier can achieve data synchronization with the data source.

[0105] In a further embodiment, the thread distribution module 1200 includes: a thread marking submodule, which is used to enable multiple worker threads to form a worker thread pool and mark the thread identifier corresponding to each worker thread; a hash routing submodule, which is used to use a hash routing algorithm to determine the mapped target thread identifier according to the hash value corresponding to the target store identifier, and use the worker thread marked with the target thread identifier as the target worker thread.

[0106] In a further embodiment, the theme insertion module 1300 includes: a first thread enabling sub-module, used to enable the target worker thread to query whether there is an association relationship pair containing the target store identifier in a preset store plug-in table; a relationship pair confirmation sub-module, used to, when the association relationship pair exists, the target worker thread confirms the existence of a plug-in identifier in the association relationship pair associated with the target store identifier.

[0107] In a further embodiment, the thread distribution module 1200 includes: a first event response submodule, which is used to respond to a message insertion event of an associated topic in a message queue, obtain a plug-in change message corresponding to the message insertion event, and use the plug-in change message as a target plug-in change message when the plug-in change message contains the target store identifier; a first thread distribution submodule, which is used to specify a target worker thread in a worker thread pool according to the target store identifier, and distribute the target plug-in change message to the target worker thread; and a second thread enabling submodule, which is used to enable the target worker thread to retrieve the associated plug-in from the platform database when the plug-in change type in the target plug-in change message represents a store subscription plug-in. All the store data of the target store identifier are constructed, and a change message to be synchronized corresponding to each store data representing an insertion change is constructed, and each change message to be synchronized is written into the message queue to be associated with the target topic of the plug-in identifier in the target plug-in change message; the third thread enables the sub-module, which is used to enable the target worker thread to retrieve all the store data associated with the target store identifier from the platform database when the plug-in change type in the target plug-in change message represents the store unsubscribing from the plug-in, construct a change message to be synchronized corresponding to each store data representing a deletion change, and write each change message to be synchronized into the message queue to be associated with the target topic of the plug-in identifier in the target plug-in change message.

[0108] In a further embodiment, before the first event response submodule, it includes: a second event response submodule, which is used to respond to the plug-in change event, enable an independent service thread to obtain the store identifier, plug-in identifier and plug-in change type corresponding to the plug-in change event to construct a plug-in change message; a first topic insertion submodule, which is used for the independent service thread to write the plug-in change message to the associated topic in the message queue.

[0109] In a further embodiment, after the second thread enabling submodule or the third thread enabling submodule, it includes: a fourth thread enabling submodule, which is used to enable the target worker thread to make corresponding changes to the association relationship between the target store identifier and the plug-in identifier in the preset store plug-in table based on the plug-in change type in the target plug-in change message.

[0110] In a further embodiment, before the event response module 1100, it includes: a third event response sub-module, which is used to respond to the initialization construction event of the store plug-in table, obtain all association relationship pairs from the platform database, and each association relationship pair includes an associated store identifier and a plug-in identifier; a table creation sub-module, which is used to create a store plug-in table and store all the association relationship pairs therein.

[0111] In order to solve the above technical problems, the present application also provides a computer device. Fig. 9 As shown, a schematic diagram of the internal structure of a computer device. The computer device includes a processor, a computer-readable storage medium, a memory, and a network interface connected via a system bus. Among them, the computer-readable storage medium of the computer device stores an operating system, a database, and computer-readable instructions. The database may store a control information sequence. When the computer-readable instructions are executed by the processor, the processor can implement a method for directional synchronization of independent station data. The processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor can execute the method for directional synchronization of independent station data of the present application. The network interface of the computer device is used to connect and communicate with a terminal. Those skilled in the art can understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0112] In this embodiment, the processor is used to execute Figure 8 The memory stores the program code and various data required to execute the above modules or submodules. The network interface is used to transmit data between user terminals or servers. The memory in this embodiment stores the program code and data required to execute all modules / submodules in the independent station data directional synchronization device of this application, and the server can call the program code and data of the server to execute the functions of all submodules.

[0113] The present application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the independent station data directional synchronization method of any embodiment of the present application.

[0114] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments of the present application can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a computer-readable storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0115] In summary, the present application can efficiently and accurately handle the directional synchronization needs of a large amount of independent station data, ensuring the accuracy, real-time, consistency of data synchronization, and the security of independent station data.

[0116] It will be understood by those skilled in the art that the various operations, methods, steps, measures, and schemes in the processes discussed in this application may be alternated, changed, combined, or deleted. Furthermore, other steps, measures, and schemes in the various operations, methods, and processes discussed in this application may also be alternated, changed, rearranged, decomposed, combined, or deleted. Furthermore, the steps, measures, and schemes in the various operations, methods, and processes in the prior art that are open source and in this application may also be alternated, changed, rearranged, decomposed, combined, or deleted.

[0117] The above is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for directional synchronization of independent station data, characterized in that: The steps include: Respond to the data source change event of the independent station store, obtain the change log corresponding to the data source change event and the target store ID therein; Specify a target worker thread in a worker thread pool according to the target store identifier, and distribute the target store identifier and the change log to the target worker thread; The target worker thread is enabled to determine whether there is a plug-in identifier associated with the target store identifier. If the plug-in identifier exists, the target worker thread constructs a change message to be synchronized corresponding to the change log and writes it to a target topic associated with the plug-in identifier in the message queue; The plug-in developer thread corresponding to the plug-in identifier is enabled to consume the to-be-synchronized change message in the target topic to which it subscribes, so that the plug-in database associated with the plug-in identifier achieves data synchronization with the data source.

2. The independent station data directional synchronization method according to claim 1, characterized in that: Specifying a target worker thread in a worker thread pool according to the target store identifier includes the following steps: Enable multiple worker threads to form a worker thread pool, and mark the thread ID corresponding to each worker thread; A hash routing algorithm is used to determine the target thread identifier mapped thereto according to the hash value corresponding to the target store identifier, and the worker thread marked with the target thread identifier is used as the target worker thread.

3. The independent station data directional synchronization method according to claim 1, characterized in that: Enabling the target worker thread to determine whether there is a plug-in identifier associated with the target store identifier includes the following steps: Enable the target worker thread to query a preset store plug-in table to see whether there is an association relationship pair containing the target store identifier; When the association relationship pair exists, the target worker thread confirms that there is a plug-in identifier in the association relationship pair associated with the target store identifier.

4. The independent station data directional synchronization method according to claim 1, characterized in that: The process includes the following steps before specifying a target worker thread in a worker thread pool according to the target store identifier and distributing the target store identifier and the change log to the target worker thread: In response to a message insertion event of an associated topic in a message queue, a plug-in change message corresponding to the message insertion event is obtained, and when the plug-in change message includes the target store identifier, the plug-in change message is used as a target plug-in change message; Specify a target worker thread in a worker thread pool according to the target store identifier, and distribute the target plug-in change message to the target worker thread; When the plug-in change type in the target plug-in change message represents a store subscription plug-in, the target worker thread is enabled to retrieve all store data associated with the target store identifier from the platform database, construct a pending synchronization change message corresponding to each store data representing an insertion change, and write each pending synchronization change message into the target topic associated with the plug-in identifier in the target plug-in change message in the message queue; When the plug-in change type in the target plug-in change message represents that a store cancels its subscription to a plug-in, the target worker thread is enabled to retrieve all store data associated with the target store identifier from the platform database, and a pending change message is constructed for each store data corresponding to the deletion change, and each pending change message is written into the target topic associated with the plug-in identifier in the target plug-in change message in the message queue.

5. The independent station data directional synchronization method according to claim 4, characterized in that: Before responding to the message insertion event of the associated topic in the message queue, the following steps are included: In response to the plug-in change event, enable an independent service thread to obtain the store ID, plug-in ID and plug-in change type corresponding to the plug-in change event to construct a plug-in change message; The independent service thread writes the plug-in change message to the associated topic in the message queue.

6. The independent station data directional synchronization method according to claim 4, characterized in that: After each change message to be synchronized is written to the target topic associated with the plug-in identifier in the target plug-in change message in the message queue, it includes: The target worker thread is enabled to make corresponding changes to the association relationship between the target store identifier and the plug-in identifier in a preset store plug-in table according to the plug-in change type in the target plug-in change message.

7. The independent station data directional synchronization method according to claim 1, characterized in that: Before responding to the data source change event of the independent station store, the following steps are included: In response to the initialization construction event of the store plug-in table, all association pairs are obtained from the platform database, each association pair including an associated store ID and a plug-in ID; A store plug-in table is created, and all the association relationship pairs are stored therein.

8. An independent station data directional synchronization device, characterized in that: include: The event response module is used to respond to the data source change event of the independent station store and obtain the change log corresponding to the data source change event and the target store identifier therein; A thread distribution module, used for specifying a target worker thread in a worker thread pool according to the target store identifier, and distributing the target store identifier and the change log to the target worker thread; A topic insertion module is used to enable the target worker thread to determine whether there is a plug-in identifier associated with the target store identifier. When the plug-in identifier exists, the target worker thread constructs a change message to be synchronized corresponding to the change log and writes it to a target topic associated with the plug-in identifier in the message queue; The message consumption module is used to enable the plug-in developer thread corresponding to the plug-in identifier to consume the to-be-synchronized change message in the target topic it subscribes to, so that the plug-in database associated with the plug-in identifier can achieve data synchronization with the data source.

9. A computer device comprising a central processing unit and a memory, characterized in that: The central processing unit is used to call and run the computer program stored in the memory to execute the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: It stores a computer program implemented according to the method described in any one of claims 1 to 7 in the form of computer-readable instructions, and when the computer program is called and executed by a computer, the steps included in the corresponding method are executed.

Citation Information

Patent Citations

  • Workflow engine data synchronization method and device, medium and electronic equipment

    CN111339186A

  • Data synchronization method and device, electronic equipment and storage medium

    CN113760920A

  • Data query service centralized control method and device, equipment, medium and product

    CN115640303A

  • Customer-device application sites accessible via merchant-managed identifiers

    US20220058723A1