Transaction message processing method, electronic equipment, storage medium and program product
By using script files in the payment platform to convert pending messages into suitable messages, the payment platform stability problem caused by the difference in multiple transaction channels is solved, and the isolation and decoupling of transaction channel logic is realized, and transaction stability is improved. and accuracy of message processing.
Patent Information
- Application Number
- CN202411374310.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-01-14
AI Technical Summary
When faced with multiple transaction channels, existing payment platforms have low transaction stability, and need to frequently issue versions to adapt to the differences between different channels, resulting in system instability.
By receiving the pending message and determining the interface call information of the target transaction channel, using script files to convert it into suitable messages, the isolation and decoupling of different transaction channels logic is achieved, and the stability of transaction message processing is improved.
It realizes independent processing between transaction channels, avoids the failure of one channel affecting other channels, improves transaction stability of the payment platform, and allows rapid update of script files without stopping service, enhancing the accuracy of packet processing and efficiency.
Smart Images

Figure CN119313335A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a transaction message processing method, electronic equipment, storage medium and program product. Background Art
[0002] With the development of Internet technology, various payment methods emerge in an endless stream. In the payment scenario, a service usually connects to multiple transaction channels, and each transaction channel has its own unique message processing logic. In order to solve the complex docking logic caused by the differences between different external channels on internal services, a payment platform is designed to adapt to the interfaces of different transaction channels, thereby providing a set of standard interfaces. However, with the acceleration of business changes and the access of a large number of transaction channels, the demand for payment platform releases has become more and more frequent, resulting in low transaction stability of the payment platform. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a transaction message processing method, electronic device, storage medium and program product, which are used to isolate the logical processing of different transaction channels so that the transaction channels do not affect each other, improve the stability of transaction message processing, and further improve the transaction stability of the payment platform.
[0004] In a first aspect, an embodiment of the present application provides a transaction message processing method, the method comprising: receiving a message to be processed; the message to be processed includes interface call information of a target transaction channel; determining a script file corresponding to the interface call information of the target transaction channel; converting the message to be processed into a message suitable for processing by the target transaction channel by executing the script file, and obtaining the converted message.
[0005] The embodiment of the present application determines the script file for processing the message to be processed based on the interface call information of the target transaction channel in the message to be processed, so that different script files are used to process the messages to be processed for different transaction channels. In this process, since the message to be processed is converted into a message suitable for processing by the target transaction channel by executing the script file, the logical processing of different transaction channels under the same payment platform is isolated, and the message processing logic is decoupled from the payment platform, so that the transaction channels do not affect each other. Even if there is a problem with the processing logic of a transaction channel, or a new transaction channel needs to be added, the processing logic of other transaction channels can also be executed normally, which improves the stability of transaction message processing, and thus improves the transaction stability of the payment platform.
[0006] In addition, script files are developed based on programming languages. Unlike configuration files, which can only perform simple field mapping and other functions, script files can perform more flexible processing. At the same time, by using script files to convert the messages to be processed, there is no need for Java coding, and there is no need to recompile and restart the payment platform. Therefore, the script files can be updated quickly and in real time without stopping the service of the payment platform.
[0007] In some embodiments, a message to be processed is converted into a message suitable for processing by a target transaction channel by executing a script file to obtain a converted message, including: performing a deserialization operation on the message to be processed to obtain an intermediate object that conforms to the syntax standard of the script file; calling a processing function in the script file to convert the message to be processed into a message suitable for processing by the target transaction channel to obtain a converted intermediate object; and performing a serialization operation on the converted intermediate object to obtain a converted message.
[0008] The embodiment of the present application processes the message to be processed into an intermediate object that conforms to the script file syntax standard through a deserialization operation, so that the script file can correctly identify and process the message to be processed, thereby improving the accuracy of message processing and thus improving the stability of message processing.
[0009] In some embodiments, the processing performed by the processing function includes at least one of field name conversion processing, message structure adaptation processing, customized field processing, content format processing, field data calculation processing and interface aggregation processing.
[0010] The embodiments of the present application can fully meet the message processing requirements of different transaction channels by considering message processing in different scenarios, thereby improving the stability of message processing.
[0011] In some embodiments, the message to be processed also includes a message type; the message type includes a transaction request message sent to a target transaction channel or a transaction response message received from a target transaction channel; determining the script file corresponding to the interface call information of the target transaction channel includes: determining the script file corresponding to the interface call information and message type of the target transaction channel.
[0012] The embodiment of the present application takes into account that a message can be a transaction request message sent to a target transaction channel or a transaction response message received from a target transaction channel. Therefore, corresponding script files need to be determined for different types of messages to improve the accuracy of message processing, thereby improving the stability of message processing.
[0013] In some embodiments, the interface call information of the target transaction channel includes the target transaction channel name and the target transaction interface name; determining the script file corresponding to the interface call information and message type of the target transaction channel includes: determining the script version number of the current latest version according to the target transaction channel name and the target transaction interface name; concatenating the target transaction channel name, the target transaction interface name, the script version number and the message type to generate a script index name; querying the storage structure according to the script index name to obtain the corresponding script file.
[0014] The embodiment of the present application generates a script index name through the target transaction channel name, target transaction interface name, script version number and message type, so as to quickly determine the unique script file, improve the accuracy and efficiency of message processing, and thus improve the stability of message processing.
[0015] In some embodiments, a storage structure is queried according to a script index name to obtain a corresponding script file, including: querying the memory according to the script index name; if a script file corresponding to the script index name exists in the memory, the corresponding script file is obtained based on the script index name; if a script file corresponding to the script index name does not exist in the memory, the local cache is queried according to the script index name; if a script bytecode file corresponding to the script index name exists in the local cache, the corresponding script bytecode file is obtained based on the script index name, and the script bytecode file is loaded by class loading to obtain the corresponding script file; if the script bytecode file corresponding to the script index name does not exist in the local cache, the database is queried according to the script index name; if a script string corresponding to the script index name exists in the database, the corresponding script string is obtained based on the script index name, and the script string is compiled and class loaded to obtain the corresponding script file.
[0016] The embodiment of the present application takes into account that the memory access speed is much faster than the disk or database. Therefore, the script file is first searched in the memory to reduce the script file loading time; if it is not found in the memory, the local cache is checked again. Since the local cache avoids network delays and database query overhead, the query speed is faster than the database query; when there is no script file in the memory and the local cache, the script string is retrieved from the database, dynamically compiled and loaded, so that the compiled and loaded script file can be put into use immediately. In this process, not only the read and write operations of the database are reduced and the database performance is improved, but also the script files are efficiently managed and executed through multi-level cache and compilation and loading mechanisms, thereby improving the stability of message processing.
[0017] In some embodiments, the method also includes: if there is a script file that is not the latest version in the memory, the script file that is not the latest version is uninstalled by class unloading; if there is a script bytecode file that is not the latest version in the local cache, the script bytecode file that is not the latest version is deleted.
[0018] The embodiment of the present application releases storage resources and improves resource utilization by uninstalling script files that are not the latest version, or deleting script bytecode files that are not the latest version. In addition, the possibility of reading the wrong version file is reduced, the accuracy of message processing is improved, and thus the stability of message processing is improved.
[0019] In a second aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, a storage medium and a bus, wherein the processor and the memory communicate with each other through the bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the method steps of the first aspect.
[0020] In a third aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium, comprising: the computer-readable storage medium stores computer instructions, and the computer instructions enable the computer to execute the method steps of the first aspect.
[0021] In a fourth aspect, an embodiment of the present application provides a computer program product, including: a computer program, which executes the method steps of the first aspect when executed by a processor.
[0022] Other features and advantages of the present application will be described in the subsequent description, and in part will become apparent from the description, or will be understood by implementing the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0024] Figure 1 A schematic diagram of a payment platform developed based on Java and connected with internal services and external payment services provided in an embodiment of the present application;
[0025] Figure 2 A flowchart of a transaction message processing method provided in an embodiment of the present application;
[0026] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The following embodiments of the technical solution of the present application are described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.
[0028] It should be noted that all technical and scientific terms used in this document have the same meanings as those generally understood by technicians in the technical field to which this application belongs; the terms used in this document are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.
[0029] In the description of the embodiments of the present application, “plurality” means more than two, unless otherwise clearly and specifically defined.
[0030] With the development of Internet technology, various payment methods emerge in an endless stream. In the payment scenario, a service usually connects to multiple transaction channels, and each transaction channel has its own unique message processing logic. In order to solve the complex docking logic brought by the differences between different external transaction channels to internal services, a payment platform is designed to adapt to the interfaces of different transaction channels, thereby providing a set of standard interfaces.
[0031] For example, in the transfer interface, the field of the account number in the internal service is named acctNo, but in different external payment services it is accountNo, acct, account, etc. Therefore, it is necessary to map the fields of different external payment services to the standard acctNo field of the internal service through the payment platform.
[0032] Figure 1 A schematic diagram of a Java-based payment platform connected to internal services and external payment services provided in an embodiment of the present application, wherein the payment platform can be a single service implemented based on the Java language, or a sub-service integrated in the internal service.
[0033] like Figure 1 As shown, the payment platform includes a routing module, through which the payment transaction request of the internal service is routed to different transaction channels, including WeChat channel, Alipay channel, online merchant channel, etc., so as to connect with the external payment service through different transaction channels. Among them, the payment transaction request can be understood as a payment transaction message.
[0034] However, the problem with this payment platform is that if the mapping logic of a certain interface of the WeChat channel is changed, the entire payment platform needs to be recompiled and released, and the entire payment platform will be unavailable during the release period. Alternatively, if there is a memory leak in the mapping business code of the WeChat channel, the WeChat channel will consume the resources of other transaction channels, causing other transaction channels to be unavailable.
[0035] With the acceleration of business changes and the access of a large number of transaction channels, the demand for payment platform releases has become more and more frequent, resulting in low stability in transaction message processing.
[0036] It should be known that, in addition to being developed using the Java language, the payment platform can also be developed using other compiled languages, such as developing the payment platform based on C++ or developing the payment platform based on the Go language.
[0037] Therefore, in response to the above problems, an embodiment of the present application provides a transaction message processing method for isolating the logical processing of different transaction channels under the same payment platform so that the transaction channels do not affect each other, thereby improving the stability of transaction message processing and further improving the transaction stability of the payment platform.
[0038] Figure 2 A flow chart of a transaction message processing method provided in an embodiment of the present application. It can be understood that the transaction message processing method provided in the embodiment of the present application can be applied to a terminal device (also referred to as an electronic device) and a server; wherein the terminal device can specifically be a smart phone, a tablet computer, a computer, a personal digital assistant (PDA), etc.; the server can specifically be an application server or a Web server. To facilitate understanding of the technical solution provided in the embodiment of the present application, the application scenario of the transaction message processing method provided in the embodiment of the present application is introduced below, taking the server as the execution subject as an example.
[0039] like Figure 2 As shown, the method includes:
[0040] Step S201, the server receives a message to be processed; the message to be processed includes interface call information of a target transaction channel.
[0041] In the request processing scenario, a complete request processing flow includes the data initiator sending a request message to the data processor, and the data initiator receiving a response message returned by the data processor after processing the request message.
[0042] Therefore, in step S201, the server receives the message to be processed, which may be a message to be processed sent by an internal service. That is, the message to be processed refers to a request message initiated by the internal service to the external payment service.
[0043] It can also be a pending message sent by an external payment service. That is, the pending message refers to the response message returned by the external payment service to the internal service.
[0044] based on Figure 1 As shown in the content, the payment platform service can be deployed in the server so that the payment platform service executes the transaction message processing method. However, it should be known that other services with transaction message processing functions other than the payment platform service can also be deployed in the server so that the transaction message processing function executes the transaction message processing method.
[0045] A transaction channel refers to a channel that connects internal services with external payment services, including at least one of the WeChat channel, Alipay channel, and online merchant channel. Each channel is connected to a corresponding external payment service.
[0046] The target transaction channel refers to the channel where the target external payment service that processes the message to be processed is located.
[0047] Because an external payment service includes multiple interfaces for processing different businesses, the server parses the message to be processed to obtain the interface call information of the target transaction channel. The interface call information is used to describe the information of the target interface accessed by the message to be processed.
[0048] Step S202: The server determines a script file corresponding to the interface call information of the target transaction channel.
[0049] Step S203: the server converts the message to be processed into a message suitable for processing by the target transaction channel by executing the script file, and obtains the converted message.
[0050] The developer analyzes in advance the message formats that can be processed by different external payment services, that is, analyzes the messages suitable for processing by the target transaction channel, and based on the analysis results, develops the corresponding script file using a scripting language and stores the script file in a corresponding storage structure.
[0051] The scripting language can be any one of lua, groovy, javascript, etc.
[0052] The storage structure refers to the way script data is organized and stored in a computer system, which can be at least one of memory, local cache, and database.
[0053] In the process of executing step S202, since the message to be processed may be just a request message or just a response message, the server may determine the script file corresponding to the message to be processed based on the interface call information of the target transaction channel.
[0054] Optionally, in the embodiment of the present application, a Lua script file is selected to edit the script file. To facilitate understanding of the form of the script file, a Lua script template is provided as follows:
[0055] --Message processing
[0056] ---@param requestTable table<string,string>
[0057] local function request_handle(requestTable)
[0058] --Mapping logic processing
[0059] return {
[0060] --Mapped json message
[0061] }
[0062] end
[0063] return request_handle
[0064] Among them, request_handle is the processing function. If the message to be processed is a request message, the input parameter of request_handle is the request message of the internal standard, and the output parameter is the message that has been processed and meets the requirements of the target transaction channel interface; if the message to be processed is a response message, the input parameter of request_handle is the response message returned by the target transaction channel interface, and the output parameter is the response message that meets the internal standard.
[0065] Therefore, after determining the script file, the server uses the message to be processed as an input parameter of the script file, and converts the message to be processed into a message suitable for processing by the target transaction channel by executing the script file to obtain the converted message.
[0066] The embodiment of the present application determines the script file for processing the message to be processed based on the interface call information of the target transaction channel in the message to be processed, so that different messages to be processed are processed using different script files. In this process, since the message to be processed is converted into a message suitable for processing by the target transaction channel by executing the script file, the logical processing of different transaction channels under the same payment platform is isolated, and the message processing logic is decoupled from the payment platform, so that the transaction channels do not affect each other, and the stability of transaction message processing is improved.
[0067] In some embodiments, the server converts the message to be processed into a message suitable for processing by the target transaction channel by executing a script file to obtain the converted message, including: the server deserializes the message to be processed to obtain an intermediate object that conforms to the syntax standard of the script file; the server calls the processing function in the script file to convert the message to be processed into a message suitable for processing by the target transaction channel to obtain the converted intermediate object; the server serializes the converted intermediate object to obtain the converted message.
[0068] During the execution process, in order to facilitate the script file to process and operate the message to be processed, before calling the processing function in the script file to convert the message to be processed into a message suitable for processing by the target transaction channel, it is necessary to deserialize the message to be processed to obtain an intermediate object that conforms to the script file syntax standard.
[0069] For example, the data format of the message to be processed is in the form of a json string, the script file is a lua script file, and the main body of the transaction message processing method is a payment platform developed based on java. Since the lua script file will eventually be translated into the java language of the payment platform for execution when the lua script file is executed, the payment platform is responsible for converting the message into a table object that conforms to the lua syntax standard. Therefore, by deserializing the json string, a table object that conforms to the lua syntax standard is obtained. This facilitates the script file to identify and process the table object obtained through the deserialization operation.
[0070] In order to enable the processed message to be normally transmitted in the network and processed normally by the target external payment service, it is necessary to serialize the converted intermediate object to obtain the converted message, and then send the converted message.
[0071] For example, serialize the table object into a JSON string and send it to the target external payment service via the target transaction channel.
[0072] It should be noted that when sending the converted message, if the message to be processed is a request message initiated by the internal service to the external payment service, the server will send the converted message to the external payment service so that the external payment service can process the converted message.
[0073] If the message to be processed refers to a response message returned by the external payment service to the internal service, the server sends the converted message to the internal service so that the internal service receives the converted response message.
[0074] The embodiment of the present application processes the message to be processed into an intermediate object that conforms to the script file syntax standard through a deserialization operation, so that the script file can correctly identify and process the message to be processed, thereby improving the accuracy of message processing and thus improving the stability of message processing.
[0075] In some embodiments, the processing performed by the processing function includes at least one of field name conversion processing, message structure adaptation processing, customized field processing, content format processing, field data calculation processing and interface aggregation processing.
[0076] During the execution process, considering that different external payment services may use different field names to represent the same data, the processing performed by the processing function includes field name conversion processing.
[0077] Field name conversion processing refers to the processing function converting the field name of the internal service into the field name required by the external payment service, or converting the field name of the external payment service into the field name required by the internal service. For example, the field name of the "account number" field in the internal service is acctNo, but the field name in the external payment service can be accountNo, acct, account or acct_no, etc.
[0078] Consider that even if the field names are the same, the message structures of different external payment services may be different. For example, the internal service may access acctNo directly under the request object, while the external payment service may require access to acctNo under the request->custInfo->acctNo path.
[0079] Therefore, the message structure needs to be adapted to ensure that the data can be organized and transmitted according to the requirements of internal services or external payment services.
[0080] Therefore, the processing performed by the processing function also includes message structure adaptation processing. Message structure adaptation processing refers to the processing function processing the message structure into a structure suitable for target service processing.
[0081] The target service refers to the service that processes the message to be processed. The service can be an internal service or an external payment service, which is determined according to the message type of the message to be processed.
[0082] Consider that some external payment services may require specific fields, which may not be required or have different formats in internal services. For example: external payment service A requires uploading the customer's mobile phone number, while external payment service B requires uploading the customer's landline number, etc.
[0083] Therefore, by identifying these customized fields, and ensuring that these fields are correctly filled and formatted before sending a request message to the external payment service, or ensuring that these fields are correctly deleted and formatted before receiving a response message from the external payment service.
[0084] Therefore, the processing performed by the processing function also includes customized field processing. Customized field processing refers to processing specific fields in the message based on the specific field requirements of the target service through the processing function. The meaning of the target service can be found in the above embodiment, which will not be repeated here.
[0085] Consider that even if the field name and data structure are the same, the format of the data may be different. For example, the transaction date format in the internal service is yyyyMMdd, and the format in the external payment service is yyyy-MM-dd, yyyy:MM:dd, etc. Therefore, the content needs to be formatted before the data is sent to meet the requirements of the target service.
[0086] Therefore, the processing performed by the processing function also includes content format processing. Content format processing refers to the processing function automatically processing the content format in the message into a format that can be recognized by the target service. The meaning of the target service can be found in the above embodiment and will not be repeated here.
[0087] Considering that some fields may need to be calculated, for example, amount calculation, which may involve currency conversion, tax rate calculation, etc., in order to implement the calculation logic and ensure that data fields such as amount are correctly calculated and formatted before sending, the processing performed by the processing function also includes field data calculation processing.
[0088] Field data calculation processing refers to the processing function automatically calculating the fields that need to be calculated in the message.
[0089] Consider that an internal standard interface may need to be implemented through a combination of multiple external interfaces. For example, a simple transfer operation may require a balance query before executing the transfer. Therefore, the external payment service may require a balance query of the payment account first. Only when the balance is sufficient can the transfer interface of the external payment service be called. Otherwise, the transfer transaction failure will be directly returned. Therefore, a process needs to be designed to manage the calling order and dependencies of these interfaces to ensure that all necessary steps can be executed correctly.
[0090] Therefore, the processing performed by the processing function also includes interface aggregation processing. Interface aggregation processing means that the processing function automatically analyzes other interfaces that the target interface called by the message to be processed depends on, and automatically adds these interfaces to the message to be processed to automatically improve the entire calling process.
[0091] The embodiments of the present application improve the comprehensiveness of message processing by considering message processing in different scenarios, thereby improving the stability of message processing.
[0092] In some embodiments, the message to be processed also includes a message type; the message type includes a transaction request message sent to a target transaction channel or a transaction response message received from a target transaction channel; the server determines the script file corresponding to the interface call information of the target transaction channel, including: the server determines the script file corresponding to the interface call information and message type of the target transaction channel.
[0093] Based on the above embodiments, it can be known that since the message to be processed can be a request message or a response message, and the request message is a message initiated by the internal service to the external payment service, and the response message is a message initiated by the external payment service to the internal service, since the executors of the initiating messages are different, the message types are also different. Therefore, if the server can process both the request message and the response message, the processing of different types of messages will also be different.
[0094] Based on this, in order to ensure the accuracy of the determined script file, the server determines the script file corresponding to the message to be processed based on the interface call information and message type of the target transaction channel.
[0095] The embodiment of the present application takes into account that a message can be a transaction request message sent to a target transaction channel or a transaction response message received from a target transaction channel. Therefore, corresponding script files need to be determined for different types of messages to improve the accuracy of message processing, thereby improving the stability of message processing.
[0096] In some embodiments, the interface call information of the target transaction channel includes the target transaction channel name and the target transaction interface name; the server determines the script file corresponding to the interface call information and message type of the target transaction channel, including: the server determines the script version number of the current latest version according to the target transaction channel name and the target transaction interface name; the server concatenates the target transaction channel name, the target transaction interface name, the script version number and the message type to generate a script index name; the server queries the storage structure according to the script index name to obtain the corresponding script file.
[0097] During the execution process, as internal services and external payment services are continuously upgraded, script files also need to be continuously iterated and updated to meet the latest requirements of internal services or external payment services.
[0098] Therefore, when querying the script file, first query the latest script version number. Optionally, determine the latest version of the script version number based on the target transaction channel name and the target transaction interface name.
[0099] After determining the script version number of the latest version, concatenate the target transaction channel name, target transaction interface name, script version number and message type to generate a script index name, so as to query the storage structure through the script index name and obtain the corresponding script file.
[0100] For example: the concatenation format is: target transaction interface name + target transaction channel name + script version number + message type; or: target transaction channel name + target transaction interface name + script version number + message type, etc.
[0101] The embodiment of the present application generates a script index name through the target transaction channel name, target transaction interface name, script version number and message type, thereby determining a unique script file, improving the accuracy of message processing, and thus improving the stability of heat preservation processing. In addition, the script file version control is implemented through the script index name, which facilitates tracking and management of script files of different versions.
[0102] In some embodiments, the server queries the storage structure according to the script index name to obtain the corresponding script file, including: the server queries the memory according to the script index name; if there is a script file corresponding to the script index name in the memory, the server obtains the corresponding script file based on the script index name; if there is no script file corresponding to the script index name in the memory, the server queries the local cache according to the script index name; if there is a script bytecode file corresponding to the script index name in the local cache, the server obtains the corresponding script bytecode file based on the script index name, and loads the script bytecode file through class loading to obtain the corresponding script file; if there is no script bytecode file corresponding to the script index name in the local cache, the server queries the database according to the script index name; if there is a script string corresponding to the script index name in the database, the server obtains the corresponding script string based on the script index name, compiles and class loads the script string to obtain the corresponding script file.
[0103] During the execution process, the memory access speed is much faster than the disk or database, so the script file is first queried in the memory. During the query process, the script index name is used as the key to query the global map variable to determine whether there is a compiled script file, thereby avoiding the need to recompile and load the script every time.
[0104] If there is no script file corresponding to the script index name in the memory, the server queries the local cache according to the script index name to determine whether there is a script bytecode file in the local cache path. The script bytecode file is named after the script index name, such as script index name.class file, and then the script bytecode file is loaded as a script file through class loading and cached in the memory.
[0105] If the local cache does not contain a script bytecode file corresponding to the script index name, the server queries the database based on the script index name. If the database contains a script string corresponding to the script index name, the server obtains the corresponding script string based on the script index name, compiles the script string into a script bytecode file, saves it to the local cache, and then loads the script bytecode file as a script file through class loading and caches it in memory.
[0106] It should be known that since the storage structure can be specifically configured according to actual conditions, the present application also includes the following embodiments:
[0107] Optionally, if the storage structure only has memory, the above embodiment can be simplified as follows: the server queries the memory according to the script index name; if a script file corresponding to the script index name exists in the memory, the server obtains the corresponding script file based on the script index name.
[0108] Optionally, if the storage structure only has memory and local cache, the above embodiment can be simplified as follows: the server queries the memory according to the script index name; if there is a script file corresponding to the script index name in the memory, the server obtains the corresponding script file based on the script index name; if there is no script file corresponding to the script index name in the memory, the server queries the local cache according to the script index name; if there is a script bytecode file corresponding to the script index name in the local cache, the server obtains the corresponding script bytecode file based on the script index name, and loads the script bytecode file through class loading to obtain the corresponding script file.
[0109] Optionally, if the storage structure only has memory and database, the above embodiment can be simplified as follows: the server queries the memory according to the script index name; if there is a script file corresponding to the script index name in the memory, the server obtains the corresponding script file based on the script index name; if there is no script file corresponding to the script index name in the memory, the server queries the database according to the script index name; if there is a script string corresponding to the script index name in the database, the server obtains the corresponding script string based on the script index name, and compiles and class loads the script string to obtain the corresponding script file.
[0110] Optionally, if the storage structure only has a local cache and a database, the above embodiment can be abbreviated as: the server queries the local cache according to the script index name; if there is a script bytecode file corresponding to the script index name in the local cache, the server obtains the corresponding script bytecode file based on the script index name, and loads the script bytecode file through class loading to obtain the corresponding script file; if there is no script bytecode file corresponding to the script index name in the local cache, the server queries the database according to the script index name; if there is a script string corresponding to the script index name in the database, the server obtains the corresponding script string based on the script index name, compiles and class loads the script string to obtain the corresponding script file.
[0111] It should be noted that in the process of obtaining the script file, if there is a script file that is not the latest version in the memory, the script file that is not the latest version will be uninstalled through class unloading; if there is a script bytecode file that is not the latest version in the local cache, the script bytecode file that is not the latest version will be deleted.
[0112] For example: Check whether there is a Lua script object in the memory that is not the latest version. If so, uninstall the old class through class unloading to release memory resources.
[0113] Check whether there are bytecode files of Lua scripts that are not the latest version in the local cache file. If there are, delete the bytecode files of the lower version of Lua scripts.
[0114] The timing of uninstalling a script file that is not the latest version or deleting a script bytecode file that is not the latest version can be executed once each time the script file is obtained, or can be executed periodically. The specific execution method can be set according to the actual situation.
[0115] The embodiment of the present application takes into account that the memory access speed is much faster than the disk or database. Therefore, the script file is first searched in the memory to reduce the script file loading time; if it is not found in the memory, the local cache is checked again. Since the local cache avoids network delays and database query overhead, the query speed is faster than the database query; when there is no script file in the memory and the local cache, the script string is retrieved from the database, dynamically compiled and loaded, so that the compiled and loaded script file can be put into use immediately. In this process, not only the read and write operations of the database are reduced and the database performance is improved, but also the script files are efficiently managed and executed through multi-level cache and compilation and loading mechanisms, thereby improving the stability of message processing.
[0116] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 3As shown, the electronic device includes a processor 301 (processor), a memory 302 (memory) and a bus 303; wherein the processor 301 and the memory 302 communicate with each other through the bus 303. The processor 301 is used to call the program instructions in the memory 302 to execute the methods provided by the above-mentioned method embodiments.
[0117] The processor 301 can be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 301 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. It can implement or execute various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0118] The memory 302 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.
[0119] This embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided by the above-mentioned method embodiments.
[0120] This embodiment provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions enable the computer to execute the methods provided by the above-mentioned method embodiments.
[0121] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0122] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0123] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0124] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A transaction message processing method, characterized in that: The method comprises: Receive a message to be processed; the message to be processed includes interface call information of a target transaction channel; Determine a script file corresponding to the interface call information of the target transaction channel; The to-be-processed message is converted into a message suitable for processing by the target transaction channel by executing the script file, thereby obtaining the converted message.
2. The method according to claim 1, characterized in that The step of converting the to-be-processed message into a message suitable for processing by the target transaction channel by executing the script file to obtain the converted message comprises: Deserialize the message to be processed to obtain an intermediate object that conforms to the syntax standard of the script file; Calling the processing function in the script file to convert the message to be processed into a message suitable for processing by the target transaction channel, and obtaining the converted intermediate object; The converted intermediate object is serialized to obtain a converted message.
3. The method according to claim 2, characterized in that The processing performed by the processing function includes at least one of field name conversion processing, message structure adaptation processing, customized field processing, content format processing, field data calculation processing and interface aggregation processing.
4. The method according to any one of claims 1 to 3, characterized in that: The message to be processed also includes a message type; the message type includes a transaction request message sent to the target transaction channel or a transaction response message received from the target transaction channel; The step of determining a script file corresponding to the interface call information of the target transaction channel includes: Determine a script file corresponding to the interface call information of the target transaction channel and the message type.
5. The method according to claim 4, characterized in that The interface call information of the target transaction channel includes the target transaction channel name and the target transaction interface name; The step of determining the script file corresponding to the interface call information of the target transaction channel and the message type includes: Determine the script version number of the latest version according to the target transaction channel name and the target transaction interface name; Concatenate the target transaction channel name, the target transaction interface name, the script version number and the message type to generate a script index name; The storage structure is queried according to the script index name to obtain the corresponding script file.
6. The method according to claim 5, characterized in that The step of querying the storage structure according to the script index name to obtain the corresponding script file includes: Querying the memory according to the script index name; if a script file corresponding to the script index name exists in the memory, acquiring the corresponding script file based on the script index name; If the script file corresponding to the script index name does not exist in the memory, query the local cache according to the script index name; If a script bytecode file corresponding to the script index name exists in the local cache, the corresponding script bytecode file is obtained based on the script index name, and the script bytecode file is loaded by class loading to obtain the corresponding script file; If the local cache does not contain the script bytecode file corresponding to the script index name, query the database according to the script index name; If there is a script string corresponding to the script index name in the database, the corresponding script string is obtained based on the script index name, and the script string is compiled and class loaded to obtain the corresponding script file.
7. The method according to claim 6, characterized in that The method further comprises: If there is a script file of a version other than the latest version in the memory, uninstall the script file of the version other than the latest version by class unloading; If there is a script bytecode file of a version other than the latest version in the local cache, the script bytecode file of the version other than the latest version is deleted.
8. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the method according to any one of claims 1 to 7 is performed.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is executed.
10. A computer program product, characterized in that include: Computer program instructions, when executed by a processor, perform the method according to any one of claims 1 to 7.
Citation Information
Cited By
Heterogeneous system interaction method and device and storage medium
CN121397081A