A microservice business processing method and related device
By determining the storage unit corresponding to the business interface and update events in the microservice processing system and configuring the corresponding business interface, the problem of inefficient microservice development in the existing technology is solved, and more efficient business processing is achieved and deadlocks are avoided.
Patent Information
- Application Number
- CN202111560283.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-20
- Publication Date
- 2025-05-20
- Estimated Expiration
- 2041-12-20
AI Technical Summary
During the development process, existing microservice processing systems need to conduct cumbersome business interface docking and consider issues such as concurrent processing efficiency, thread safety and transaction consistency, resulting in inefficient development and possible deadlocks.
By determining the service interfaces of multiple service systems and the storage units corresponding to multiple update events, the storage units are configured according to the requirements of the update events, and the update events from the message terminal are received, and the configured service interface is called to update the service objects in the storage unit.
The microservice development process is simplified, the workload of business interface docking is reduced, the development efficiency is improved, and the risk of deadlock is avoided.
Smart Images

Figure CN114238352B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of microservice processing, and specifically relates to a microservice business processing method and related devices. Background Art
[0002] Currently, existing microservice processing systems include multiple subsystems, and developers must first dock them before they can carry out corresponding business logic development. At the same time, during the development process, elements such as concurrent processing efficiency, thread safety, and transaction consistency must also be considered. These tasks have little to do with the business logic, but they have to be completed. When implemented poorly, it affects the processing efficiency of the business and even causes deadlocks. Even if it can be successfully completed, it will consume a large amount of time for development, debugging, and optimization, which compresses the time available for business development and is also not conducive to quickly creating a microservice that supports new businesses. Summary of the Invention
[0003] In view of the deficiencies of the above-mentioned existing technologies, the purpose of this application is to provide a microservice business processing method and related devices, aiming to improve the development efficiency of microservice businesses.
[0004] To achieve the above purpose, this application has taken the following technical solutions:
[0005] In a first aspect, an embodiment of this application provides a microservice business processing method, which is applied to a server. The method includes:
[0006] Determine multiple business interfaces of multiple business systems;
[0007] Determine the storage units corresponding to multiple update events to be processed. The storage units include multiple business objects, and the multiple update events are respectively associated with the multiple business objects. Business objects of the same type are stored in the same storage unit;
[0008] Configure the corresponding storage unit according to the business interface requirements of each update event;
[0009] Receive update events from a message terminal;
[0010] Call the configured business interface according to the received update event, and use the configured business interface to update the business objects in the corresponding storage unit according to the received update event.
[0011] In a second aspect, an embodiment of this application provides a microservice business processing device, which is applied to a server. The device includes:
[0012] A first determination unit, configured to determine multiple business interfaces of multiple business systems;
[0013] A second determination unit, configured to determine storage units corresponding to multiple update events to be processed, where the storage units include multiple service objects, the multiple update events are respectively associated with the multiple service objects, and service objects of the same type are stored in the same storage unit;
[0014] A configuration unit, configured to configure corresponding storage units according to the service interface requirements of each of the update events;
[0015] A receiving unit, configured to receive a first update event from a message terminal, where the first update event is any one of the multiple update events;
[0016] A processing unit, configured to call a configured service interface according to the received update event, and use the configured service interface to update service objects in the corresponding storage unit according to the received update event.
[0017] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory. The memory is used to store one or more programs and is configured to be executed by the processor. The programs include instructions for performing the steps in the method described in the first aspect.
[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program for electronic data exchange. The computer program enables a computer to execute the instructions for performing the steps in the method described in the first aspect.
[0019] Implementing the embodiments of the present application has the following beneficial effects:
[0020] It can be seen that in the microservice business processing method and related devices described in the embodiments of the present application, by determining multiple service interfaces of multiple service systems; determining storage units corresponding to multiple update events to be processed, where the storage units include multiple service objects, the multiple update events are respectively associated with the multiple service objects, and service objects of the same type are stored in the same storage unit; configuring corresponding storage units according to the service interface requirements of each of the update events; receiving an update event from a message terminal; calling a configured service interface according to the received update event, and using the configured service interface to update service objects in the corresponding storage unit according to the received update event. In this way, the storage units are configured based on service interfaces and update events, so that when creating a server, only the configuration work of microservices needs to be performed, and there is no need to perform cumbersome service interface docking and other work, improving the efficiency of microservice development. Description of the Drawings
[0021] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.
[0022] Figure 1 It is a schematic flowchart of a microservice business processing method provided by an embodiment of the present application;
[0023] Figure 2 It is a block diagram of the functional units of a microservice business processing device provided by an embodiment of the present application;
[0024] Figure 3 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0025] To enable those skilled in the art to better understand the solutions of the present application, the following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope protected by the present application.
[0026] The terms "first", "second", etc. in the specification and claims of the present application and the above accompanying drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products, or devices.
[0027] Referring to "embodiment" in this context means that a specific feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0028] In this application, "at least one" refers to one or more, and "more" refers to two or more. In this application, "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, a and b, a and c, b and c, or a, b and c, where each of a, b, c can be an element itself, or a set containing one or more elements.
[0029] It should be noted that the equals involved in the embodiments of the present application can be used in conjunction with greater than, and is applicable to the technical solution adopted when greater than, and can also be used in conjunction with less than, and is applicable to the technical solution adopted when less than. It should be noted that when equals is used in conjunction with greater than, it cannot be used in conjunction with less than; when equals is used in conjunction with less than, it cannot be used in conjunction with greater than. In the embodiments of the present application, "of", "corresponding, relevant" and "corresponding" can sometimes be used interchangeably. It should be noted that when the distinction is not emphasized, the meanings to be expressed are consistent.
[0030] First, some of the terms involved in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.
[0031] 1. Microservices: Microservices include WeChat housekeeper, WeChat application solutions, WeChat customer service client, and manual WeChat customer service. Microservices are auxiliary management platforms for WeChat public platform accounts, which strengthen the interactive marketing promotion and customer relationship maintenance functions of WeChat public accounts. The microservice platform has developed several important operation management modules customized for merchants, such as "personalized management, marketing promotion, customer relationship management, and membership card management". Microservice products for small and medium-sized enterprises provide comprehensive operation management standardization services such as automatic response menus, micro-website generation and management, WeChat CRM system services, and WeChat public platform customer service services. It is a multifunctional WeChat operation management platform. WeChat housekeeper is to connect corporate WeChat public accounts through technical platforms, operation management, etc., to help enterprises provide WeChat users with more complete service information, user interactive experience, marketing effects and other enterprise application solutions. Provide corporate customers with customer service, product promotion, interactive marketing, market research, product orders and other operation and system function services based on the WeChat platform.
[0032] Currently, existing microservice processing systems include multiple subsystems, and developers must first interface them before they can develop corresponding business logics. Meanwhile, during the development process, elements such as concurrent processing efficiency, thread safety, and transaction consistency must also be considered. These tasks have little to do with the business logic but still have to be completed. When implemented poorly, it affects the processing efficiency of the business or even causes deadlocks. Even if it can be successfully completed, it will consume a large amount of time for development, debugging, and optimization, squeezing the time available for business development and being unfavorable for quickly creating a microservice that supports new businesses. In addition, the current technological focus in the industry is mainly on providing more advanced in-memory databases and message middleware. For the middle part of microservices, that is, the intermediate support framework that can be compatible with different message middleware and database products and support the rapid implementation of businesses, there are still relatively few. Many systems regard this part of the logic as an inherent part of each system, but in fact, this part has little to do with the business and does not need to be developed repeatedly in each system, thus causing unnecessary workload.
[0033] In view of the above problems, the present application provides a microservice business processing method, which can be applied to the scenario of microservice processing. Through this method, multiple business interfaces of the multiple business systems can be determined; at least one storage unit corresponding to multiple update events to be processed can be determined, the at least one storage unit includes multiple business objects, each update event among the multiple update events is respectively associated with at least one business object among the multiple business objects, and business objects of the same type among the multiple business objects are stored in the same storage unit; configure the at least one storage unit according to the business interface requirements of the multiple update events; receive a first update event from a message terminal, the first update event being any one of the multiple update events; and update the business objects in the corresponding storage unit by calling the configured business interface according to the first update event. This solution can be applicable to a variety of scenarios, including but not limited to the application scenarios mentioned above.
[0034] The following uses a specific embodiment to illustrate the information query method provided by the present application.
[0035] As Figure 1 shown, Figure 1 is a flowchart of a microservice business processing method provided by an embodiment of the present application. The microservice business processing method is applied to a server, and the method includes:
[0036] Step 101, determine multiple business interfaces of multiple business systems.
[0037] Exemplarily, the multiple business systems include: message middleware, in-memory database, and physical database. The message middleware, in-memory database, and physical database can all be multiple.
[0038] Among them, the message middleware supports high-speed transfer and distribution of data between microservices; the in-memory database is used to improve the query / processing performance of data; and the physical database is used for data persistence.
[0039] In specific implementation, when creating a microservice, through direct configuration, the business interface can be directly called to process corresponding update events, without the need to dock with each business system before creating the microservice and other operations.
[0040] Step 102: Determine the storage units corresponding to multiple update events to be processed.
[0041] Among them, the storage unit includes multiple business objects, and the multiple update events are respectively associated with the multiple business objects. Business objects of the same type are stored in the same storage unit.
[0042] In a possible embodiment, a business object, such as an order or an account, is called a Business Object, abbreviated as BO. We call a storage unit that places all similar BOs in memory, similar to a table in an in-memory database, a BoCache. Therefore, all business logics in a microservice can be abstracted into a process, that is, receiving a message -> obtaining the BoCache to be updated -> updating the BOs in the BoCache. And the update process can be further split into: obtaining the business primary key of the BO -> performing the legality verification of the update -> executing the update operation -> executing the subsequent persistence and publishing actions.
[0043] It can be seen that in this embodiment, the update events of the business objects are abstracted into a fixed processing process, so that each business object can be uniformly configured.
[0044] Step 103: Configure the corresponding storage unit according to the business interface requirements of each update event.
[0045] In a possible embodiment, the configuring the corresponding storage unit according to the business interface requirements of each update event includes: configuring a unique identifier for the storage unit; initializing and configuring the business interface to be called by the storage unit to process the corresponding update event; and configuring the processing flow for the storage unit.
[0046] Exemplarily, the unique identifier is used to identify the corresponding storage unit, and each first update event includes a unique identifier to determine which storage unit the first update event is directed to.
[0047] The following takes the BoCache of an account BO in a simple account management microservice as an example to illustrate the basic working principle of the framework.
[0048] First, set a unique identifier for the BoCache, and the configuration code is as follows: <bean id="portfolioCache" class="com.pingan.pilot.tap.cache.BoCache">.
[0049] Secondly, the BoCache needs to call the database loading function, message subscription function, data query function, and data initialization function. Therefore, configure the business interfaces corresponding to these functions for the BoCache to implement the corresponding update event processing. The configuration of the database loading function is as follows: <property name="loadHql" value="from PortfolioBO_OTW" / >; the configuration of the message subscription function is as follows: <property name="subscribeSql" value="select * from innerPortfolioData" / >; the configuration of the data query function is as follows: <property name="replyTopic" value="portfolioData" / >; the configuration of the data initialization function is as follows: <property name="initializationListeners" ref="initPortfolio" / >
[0050] Finally, configure the processing flow of the update event for the BoCache. Since all business logics in a microservice can be abstracted into the following process: receiving a message -> obtaining the BoCache that needs to be updated -> updating the BO in the BoCache; and the update process can be further split into the following process: obtaining the business primary key of the BO -> performing the legality check of the update -> executing the update operation -> performing the subsequent persistence and publishing actions. Therefore, the configuration of the fixed processing flow can be carried out.
[0051] It can be seen that in this embodiment, the storage unit is configured based on the business interface and the update event, so that only the configuration work of the microservice needs to be carried out when creating the server, and there is no need to carry out cumbersome business interface docking and other work, improving the efficiency of microservice development.
[0052] Step 104: Receive an update event from the message terminal.
[0053] Among them, the update event is any one of the multiple update events.
[0054] Exemplarily, the message terminal may be any user device, such as a mobile phone, a tablet computer, a desktop computer, etc., and the user can initiate the update event through corresponding operations.
[0055] Step 105: Call the configured service interface according to the received update event, and use the configured service interface to update the service object in the corresponding storage unit according to the received update event.
[0056] In a possible embodiment, before calling the configured service interface according to the received update event and using the configured service interface to update the service object in the corresponding storage unit according to the received update event, the method further includes:
[0057] Load the data of the service object in the database into the memory through the service interface corresponding to the data loading function; subscribe to messages through the service interface corresponding to the message subscription function; connect to the corresponding service interface to provide data query services; all listeners configured in initializationListeners will complete corresponding work after the data initialization is completed and before the microservice officially works.
[0058] Specifically, the data loading function uses the Hibernate framework for data loading. The data loading only interacts with Hibernate through HQL and does not interact with the specific database. Therefore, it is not limited to using a certain database product. As long as it is supported by Hibernate, different database vendor adapters can be selected to support data loading from different databases, achieving database independence.
[0059] Furthermore, subscribe to messages according to the message subscription function, and then obtain the message from the message bus encapsulated in the message queue (the message queue is a function provided by the basic platform). This means that all requests that meet the subscription conditions will be used as an update event for a BO. After being distributed by the message middleware, it will be processed by this BoCache.
[0060] Furthermore, according to the configuration of replyTopic, connect to the service interface corresponding to the query function to provide data query services, that is, all queries initiated to the message middleware with the specified value as the topic will be distributed to this BoCache for processing. Specifically, the message bus separates and manages different types of data according to the concept of "topic". The topics include but are not limited to "entrustment", "transaction", "position", "market quotation", etc. Specific queries can limit the query parameters, and BoCache will return the BO that meets the query conditions to the query end through the message middleware.
[0061] Furthermore, all the listeners configured in initializationListeners will complete the corresponding work after the data initialization is completed and before the microservice officially starts working. The initialization process includes but is not limited to: updating some fields that are not stored in the database, or establishing an association relationship with other BOs, etc.
[0062] It can be seen that in this embodiment, the storage unit is configured based on the business interface required by the update event.
[0063] In a possible embodiment, the update event includes a business primary key and updated data; calling the configured business interface according to the received update event, and using the configured business interface to update the business object in the corresponding storage unit according to the received update event, including: obtaining the business primary key of the update event, the business primary key including an update target and an update action, the update target including a unique identifier for indicating the first business object to be updated, and the update action including any one of the following: add, delete, and modify; calling the configured business interface according to the business primary key and the updated data in the update event to update the first business object according to the update event.
[0064] In a specific implementation, each first update event carries the corresponding business primary key and the corresponding updated data, and the business primary key is composed of an update target and an update action. After receiving the first update event, first obtain the business primary key therein to determine the update target and the specific update action.
[0065] It can be seen that in this embodiment, the processing of the update event is implemented.
[0066] In a possible embodiment, the method further includes: after receiving the update event, checking the updated data and the business primary key in the update event; determining whether the content of the update event is missing; when the content is missing, sending a prompt message to the business system that sent the update event.
[0067] In a specific implementation, the content to be checked is: checking some non-null fields configured in notNullPropertie, combining the business primary key according to the request content and keyPattern to determine the update target and the update action, and at the same time, multiple updateValidators can be configured to perform more complex custom checks on the content to be passed in, so as to implement the corresponding business logic.
[0068] It can be seen that in this embodiment, the pre-check before the update is implemented.
[0069] In a possible embodiment, updating the first business object according to the update event by calling the configured business interface based on the business primary key and the update data in the update event includes: determining the first business object to be updated according to the business primary key; creating an update copy in the storage unit of the first business object, where the content of the update copy is the same as that of the first business object; inputting the data in the update event and the address of the update copy as interface parameters into the corresponding first business interface; and calling the first business interface to execute the corresponding update action to update the content of the business copy to obtain an updated copy.
[0070] In specific implementation, once the update target is determined according to the business primary key, after parameter configuration, an update copy will be created in the storage unit. The update copy mainly provides an update intermediate process to avoid abnormal situations such as data errors or misoperations. Further, the framework will use the addresses of the old and new BOs as interface parameters and pass them to the updateListener interface for processing. This part of the interface includes some processing interfaces configured according to parameters (such as updateProperties in the above example, which sets the updatedOn attribute of the BO to the current time during update), and also includes some custom updaters (such as portfolioUpdatetor in the above example) to perform more complex updates or update other associated BOs, and finally obtain an updated copy.
[0071] It can be seen that in this embodiment, an update in the form of a copy is realized, avoiding the situation where the original data cannot be restored due to update errors.
[0072] In a possible embodiment, after obtaining the updated copy, the method further includes: replacing the content of the first business object with the content of the updated copy; and publishing update information to the business system associated with the first business object.
[0073] In specific implementation, after obtaining the updated copy, the content of the first business object is replaced with the content of the updated copy to implement the update of the first business object. Finally, update information is published to the business system associated with the first business object to notify these business systems that the first business object has been updated.
[0074] It can be seen that in this embodiment, the publication of update information is realized.
[0075] In a possible embodiment, the method further includes: queuing the update events with the same business primary key during the update process; if an exception occurs in the currently processed update event, directly cancel the current update operation and delete the update copy.
[0076] On the other hand, during the update process, the business primary key will be locked, and other requests for the same business primary key will be queued for processing. If any exception occurs during the processing, the current business operation will be safely cancelled. Since all the processing in the updateListener operates on a copy in the in-memory database and no changes will be made to the existing data until it is finally put into the in-memory database, when writing custom update logic, there is no need to consider the atomicity and rollback of the operations, as the framework already provides these guarantees by default.
[0077] It can be seen that in this embodiment, the deletion of abnormal updates is achieved.
[0078] In summary, a microservice business processing method and related device provided by this application determine multiple business interfaces of the multiple business systems; determine at least one storage unit corresponding to multiple update events to be processed, where the at least one storage unit includes multiple business objects, each update event in the multiple update events is respectively associated with at least one business object in the multiple business objects, and business objects of the same type in the multiple business objects are stored in the same storage unit; configure the at least one storage unit according to the business interface requirements of the multiple update events; receive a first update event from a message terminal, where the first update event is any one of the multiple update events; and update the business objects in the corresponding storage unit by calling the configured business interface according to the first update event. In this way, by configuring the storage unit based on the business interface and the update event, when creating a server, only the configuration work of the microservice needs to be carried out, and there is no need to carry out cumbersome work such as business interface docking, improving the efficiency of microservice development.
[0079] The above mainly introduces the solution of the embodiment of this application from the perspective of the execution process on the method side. It can be understood that in order for the server to implement the above functions, it includes the corresponding hardware structure and / or software module for executing each function. Those skilled in the art should easily realize that, combining the units and algorithm steps of each example described in the embodiments provided in this article, this application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving the hardware depends on the specific application and design constraint conditions of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0080] Embodiments of the present application can divide the server into functional units according to the above method examples. For example, each functional unit can be divided corresponding to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. It should be noted that the division of units in the embodiments of the present application is illustrative, only a logical function division, and there can be other division methods in actual implementation.
[0081] Please refer to Figure 2 , Figure 2 which is a block diagram of the composition of functional units of a microservice business processing device 20 provided by an embodiment of the present application. The microservice business processing device 20 is applied to a server, and the device includes:
[0082] A first determination unit 21, configured to determine multiple service interfaces of multiple service systems;
[0083] A second determination unit 22, configured to determine storage units corresponding to multiple update events to be processed. The storage units include multiple service objects, and the multiple update events are respectively associated with the multiple service objects. Service objects of the same type are stored in the same storage unit;
[0084] A configuration unit 23, configured to configure a corresponding storage unit according to the service interface requirements of each update event;
[0085] A receiving unit 24, configured to receive update events from a message terminal;
[0086] A processing unit 25, configured to call the configured service interface according to the received update event, and update the service objects in the corresponding storage unit according to the received update event by using the configured service interface.
[0087] It can be seen that in this embodiment, the storage unit is configured based on the service interface and the update event, so that when creating a server, only the configuration work of microservices needs to be performed, and there is no need to perform cumbersome service interface docking and other work, improving the efficiency of microservice development.
[0088] In a possible embodiment, the update event includes a business primary key and update data. In the aspect of calling a configured business interface according to the received update event and using the configured business interface to update a business object in a corresponding storage unit according to the received update event, the processing unit 25 is specifically configured to: obtain the business primary key of the update event, where the business primary key includes an update target and an update action, the update target includes a unique identifier for indicating a first business object to be updated, and the update action includes any one of the following: addition, deletion, and modification; call the configured business interface according to the business primary key and the update data in the update event to update the first business object according to the update event.
[0089] In a possible embodiment, in the aspect of calling the configured business interface according to the business primary key and the update data in the update event to update the first business object according to the update event, the processing unit 25 is specifically configured to: determine the first business object to be updated according to the business primary key; create an update copy in the storage unit of the first business object, where the content of the update copy is the same as the content of the first business object; input the data in the update event and the address of the update copy as interface parameters into a corresponding first business interface; call the first business interface to execute a corresponding update action to update the content of the update copy to obtain an updated copy.
[0090] In a possible embodiment, after the aspect of obtaining the updated copy, the processing unit 25 is further configured to: replace the content of the first business object with the content of the updated copy; and publish update information to a business system associated with the first business object.
[0091] In a possible embodiment, the device further includes: a queue unit for queuing update events with the same business primary key during the update process; and a deletion unit for directly canceling the current update operation and deleting the update copy when an exception occurs in the currently processed update event.
[0092] In a possible embodiment, in the aspect of configuring a corresponding storage unit according to the business interface requirements of each update event, the configuration unit 23 is specifically configured to: configure a unique identifier for the storage unit; perform initialization configuration for the business interface to be called by the storage unit to process a corresponding update event; and configure a processing flow for the storage unit.
[0093] In a possible embodiment, the device further includes: an inspection unit, configured to inspect the update data and the service primary key in the update event after receiving the update event; a judgment unit, configured to judge whether the content of the update event is missing; and a sending unit, configured to send a prompt message to the service system that sends the update event when the content is missing.
[0094] The present invention also provides a computer-readable storage medium storing one or more programs, which can be executed by one or more processors to implement the steps in the method described in the above embodiments.
[0095] Please refer to Figure 3 , Figure 3 FIG. is a schematic diagram of an electronic device provided by an embodiment of the present application. The electronic device 30 includes an application processor 31, a memory 32, a communication interface 33, and one or more programs 321. The application processor 31 is communicatively connected to the memory 32 and the communication interface 33 through an internal communication bus.
[0096] Specifically, the one or more programs 321 are stored in the memory 32 and configured to be executed by the application processor 31. The one or more programs 321 include instructions for executing any step in the embodiments of the present application.
[0097] Wherein, the communication interface 33 may include a cellular network communication module, a Wi-Fi communication module, etc.
[0098] Wherein, the application processor 31 may be, for example, a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logical blocks, units, and circuits described in connection with the disclosure of the present application. The processor may also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and so on. The communication unit may be the communication interface 33, a transceiver, a transceiver circuit, etc., and the storage unit may be the memory 32.
[0099] The memory 32 can be a volatile memory, a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0100] In addition, the specific processes of loading and executing multiple instructions by the above storage medium and the instruction processor in the mobile terminal have been described in detail in the above method, and will not be repeated here one by one.
[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A microservice business processing method, applied to a server, characterized in that: The method comprises: Determine multiple business interfaces of multiple business systems, wherein the multiple business systems include message middleware, in-memory database, and physical database, wherein the message middleware is used to support high-speed transmission and distribution of data between microservices, the in-memory database is used to improve data query / processing performance, and the physical database is used for data persistence; Determine storage units corresponding to multiple update events to be processed, wherein the storage unit includes multiple business objects, the multiple update events are respectively associated with the multiple business objects, and business objects of the same type are stored in the same storage unit; Configuring a corresponding storage unit according to the business interface requirements of each update event; Receive update events from the message terminal; Calling a configured business interface according to a received update event, and using the configured business interface to perform update processing on a business object in a corresponding storage unit according to the received update event; The method further comprises: Load the data of business objects in the database into the memory through the business interface corresponding to the data loading function; subscribe to messages through the business interface corresponding to the message subscription function; connect with the business interface corresponding to the query function to provide data query service; complete the corresponding work for all listeners configured in initializationListeners after data initialization is completed and before the microservice officially works.
2. The method according to claim 1, characterized in that The update event includes the business primary key and update data; The calling of a configured service interface according to the received update event, and using the configured service interface to perform update processing on the service object in the corresponding storage unit according to the received update event, includes: Obtaining the business primary key of the update event, the business primary key includes an update target and an update action, the update target includes a unique identifier, the unique identifier is used to indicate the first business object to be updated, and the update action includes any one of the following: adding, deleting and modifying; The configured business interface is called according to the business primary key and the update data in the update event to perform update processing on the first business object according to the update event.
3. The method according to claim 2, characterized in that The calling of a configured business interface according to the business primary key and the update data in the update event to perform update processing on the first business object according to the update event includes: Determining the first business object to be updated according to the business primary key; Creating an updated copy in a storage unit of the first business object, wherein the content of the updated copy is the same as the content of the first business object; Inputting the data in the update event and the address of the update copy as interface parameters into the corresponding first service interface; The first service interface is called to perform a corresponding update action to update the content of the update copy and obtain an updated copy.
4. The method according to claim 3, characterized in that After obtaining the updated copy, the method further includes: Replace the content of the first business object with the content of the updated copy; The update information is published to the business system associated with the first business object.
5. The method according to claim 3, characterized in that: The method further comprises: During the update process, update events of the same business primary key are queued for processing; If an exception occurs in the currently processed update event, the update operation is directly canceled and the update copy is deleted.
6. The method according to any one of claims 1 to 5, characterized in that: The configuring a corresponding storage unit according to the business interface requirements of each update event includes: Configuring a unique identifier for the storage unit; Initialize configuration of the service interface to be called by the storage unit to process the corresponding update event; A processing flow is configured for the storage unit.
7. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: After receiving the update event, checking the update data and the business primary key in the update event; Determining whether the content of the update event is missing; When the content is missing, a prompt message is sent to the business system that sent the update event.
8. A microservice business processing device, the device is used to execute the method according to any one of claims 1 to 7, the device is applied to a server, characterized in that: The device comprises: A first determining unit, used to determine multiple business interfaces of multiple business systems; A second determining unit is used to determine storage units corresponding to the multiple update events to be processed, wherein the storage unit includes multiple business objects, the multiple update events are respectively associated with the multiple business objects, and the business objects of the same type are stored in the same storage unit; A configuration unit, configured to configure a corresponding storage unit according to a business interface requirement of each update event; A receiving unit, used for receiving an update event from a message terminal; The processing unit is used to call the configured business interface according to the received update event, and use the configured business interface to perform update processing on the business object in the corresponding storage unit according to the received update event.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store one or more programs and is configured to be executed by the processor, wherein the programs include instructions for executing the steps in the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program for electronic data exchange is stored, wherein the computer program enables a computer to execute instructions of the steps in the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data processing method, system, computer device and storage medium
WO2019232962A1