Data transmission method and related equipment
The server receives and converts data formats to adapt to the interface information of different systems, and solves the problem of low data transmission efficiency in communication between internal service platforms and third-party platforms, and realizes efficient data transmission and flexible system docking.
Patent Information
- Application Number
- CN202510421852.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-08-15
Smart Images

Figure CN120492522A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of server technology, and in particular to a data transmission method and related equipment. Background Art
[0002] Digital transformation is a high-level transformation that develops digital technologies and supporting capabilities based on digital conversion (Digitization) and digital upgrading (Digitalization) with the goal of establishing a digital business model.
[0003] The digital transformation process requires the establishment of numerous third-party service platforms and the establishment of communication between internal service platforms and these third-party service platforms. Because different service platforms may use different languages and communication protocols, communication between internal service platforms currently requires the internal service platform to generate request data for each third-party service platform based on the language and communication protocol used by each third-party service platform, and then send the corresponding request data to each third-party service platform. This results in low data transmission efficiency.
[0004] Based on this, a solution is urgently needed to solve the above technical problems. Summary of the Invention
[0005] The present application provides a data transmission method and related equipment, which aim to solve the problem of low data transmission efficiency.
[0006] To achieve the above objectives, this application adopts the following technical solutions:
[0007] First aspect: An embodiment of the present application provides a data transmission method, which receives request data sent by a first system, where the request data includes standard data corresponding to the first system and at least one event type; obtains interface information of a second system corresponding to the event type based on the event type; converts the format of the standard data into a format matching the interface information to obtain the converted request data; and sends the converted request data to the second system.
[0008] In the method provided in the embodiment of the present application, the server can convert the format of the standard data into a format that matches the interface information. There is no need for the first system to convert the standard data one by one for the interface information corresponding to each second system, so that communication between the first system and at least one second system can be achieved, which can effectively improve data transmission efficiency.
[0009] In one possible implementation, based on the event type, interface information of the second system corresponding to the event type is obtained, including: determining whether the event type is a configured event type; in response to the event type being a configured event type, obtaining interface information of the second system corresponding to the event type, so as to format the standard data and obtain the converted request data.
[0010] In one possible implementation, in response to the event type being a configured event type, interface information of the second system corresponding to the event type is obtained, including: in response to the event type being a configured event type, determining whether the format of the standard data is correct; in response to the format of the standard data being correct, obtaining interface information of the second system corresponding to the event type, thereby intercepting malformed request data and improving the accuracy of the converted request data.
[0011] In one possible implementation, based on the event type, interface information of the second system corresponding to the event type is obtained, including: determining identification information corresponding to the event type based on the event type; obtaining interface information of the second system corresponding to the identification information so as to convert the format of the standard data into a format that matches the interface information.
[0012] In one possible implementation, the format of the standard data in the request data is converted into a format that matches the interface information to obtain the converted request data, including: according to the correspondence between the data format supported by the second system corresponding to the target interface in the interface information and the data format supported by the first system, the format of the standard data in the request data is converted into a format that matches the interface information to obtain the converted request data.
[0013] In an embodiment of the present application, since the interface information is pre-configured with the data format supported by the second system corresponding to the target interface and the correspondence between the data format supported by the first system, after obtaining the requested data, the standard data can be directly format converted based on the correspondence, thereby improving the data conversion efficiency and thus improving the data transmission efficiency.
[0014] In one possible implementation, according to the event type, interface information of the second system corresponding to the event type is obtained, including: determining whether the application corresponding to the requested data subscribes to the event type; in response to the application subscribing to the event type, according to the event type, obtaining interface information of the second system corresponding to the event type.
[0015] In one possible implementation, a method for configuring interface information of the second system includes: in response to an event type being a configured event type, determining whether a target interface corresponding to the event type exists; the target interface is used to connect the first system and the second system; in response to the existence of the target interface corresponding to the event type, editing the interface information of the target interface; in response to the non-existence of the target interface corresponding to the time type, adding interface information of the target interface.
[0016] In one possible implementation, in response to an event type being an unconfigured event type, identification information and data format corresponding to the event type are configured; based on the identification information and data format corresponding to the event type, a target interface corresponding to the event type is added, and interface information of the target interface is configured.
[0017] In the embodiment of the present application, a configuration-driven approach is adopted. When it is necessary to modify the interface information or add a new target interface, the interface information can be edited or a new target interface can be added based on the configuration management module without modifying the code, thereby improving the flexibility and scalability of the system and enabling rapid response to changes in business needs.
[0018] In a possible implementation, after sending the converted request data to the second system, the method further includes: obtaining a request result generated by the second system in response to the converted request data; and sending the request result to the first system.
[0019] In one possible implementation, a log is generated based on at least one of the request data, the converted request data, and the request result, providing rich data support for subsequent analysis and optimization, and facilitating performance analysis and optimization adjustments.
[0020] In a second aspect, the present application provides a data transmission device, comprising: a receiving unit, an acquiring unit, a converting unit, and a sending unit;
[0021] The receiving unit is configured to receive request data sent by the first system, where the request data includes standard data corresponding to the first system and at least one event type;
[0022] The acquiring unit is configured to acquire, according to the event type, interface information of the second system corresponding to the event type;
[0023] The conversion unit is configured to convert the format of the standard data into a format matching the interface information, and obtain the converted request data;
[0024] The sending unit is configured to send the converted request data to the second system.
[0025] A third aspect: The present application provides a computing device, which includes: a processor and a memory; the memory is used to store program code and transmit the program code to the processor; the processor is used to execute the steps of a data transmission method as described above according to the instructions in the program code.
[0026] Fourth aspect: The present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a data transmission method as described above are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A schematic diagram of an application scenario of a data transmission method provided in an embodiment of the present application;
[0028] Figure 2 A flowchart of an interface information configuration method provided in an embodiment of the present application;
[0029] Figure 3 A schematic diagram of configuring a target interface provided in an embodiment of the present application;
[0030] Figure 4 A schematic diagram of a newly added target interface provided in an embodiment of the present application;
[0031] Figure 5 A schematic diagram of a configuration structure provided in an embodiment of the present application;
[0032] Figure 6 A flowchart of an event type subscription method provided in an embodiment of the present application;
[0033] Figure 7 A flowchart of a data transmission method provided in an embodiment of the present application;
[0034] Figure 8 A schematic diagram of parameter conversion provided in an embodiment of the present application;
[0035] Figure 9 A flowchart of another data transmission method provided in an embodiment of the present application;
[0036] Figure 10 A schematic diagram of the structure of a data transmission device provided in an embodiment of the present application;
[0037] Figure 11 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The terms "first", "second" and "third" in the specification, claims and drawings of this application are used to distinguish different objects rather than to limit a specific order.
[0039] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0040] The digital transformation process requires the establishment of numerous third-party service platforms and the establishment of communication between internal service platforms and these third-party service platforms. Because different service platforms may use different languages and communication protocols, internal service platforms currently need to generate request data tailored to each third-party service platform based on the language and communication protocol used by each platform, and then send the corresponding request data to each third-party service platform.
[0041] For example, when the internal server platform needs to communicate with third-party service platform A and third service platform B, the internal server needs to generate request data that matches the language and communication protocol used by third-party service platform A based on the language and communication protocol used by third-party service platform A, and send it to third service platform A; based on the language and communication protocol used by third-party service platform B, generate request data that matches the language and communication protocol used by third-party service platform B, and send it to service platform B.
[0042] It is understandable that the internal server can first send the corresponding request data to the third-party service platform A, or it can first send the corresponding request data to the third-party service platform B; except for the different languages and communication protocols, the content of the request data sent by the internal server to the third-party service platform A and the third-party service platform B can be the same or different.
[0043] Since the internal server needs to generate corresponding request data based on the language and communication protocol used by each third-party service platform, and send request information matching the language and communication protocol used by each third-party service platform, there is a problem of low data transmission efficiency.
[0044] Based on this, an embodiment of the present application provides a data transmission method, which receives request data sent by a first system through a server, the request data including standard data corresponding to the first system and at least one event type; according to the event type, obtains interface information of the second system corresponding to the event type; converts the format of the standard data in the request data into a format that matches the interface information, obtains the converted request data; and sends the converted request data to the second system. In the method provided by the embodiment of the present application, the server can convert the format of the standard data into a format that matches each interface information, without the first system having to convert the standard data one by one for the interface information corresponding to each second system, thereby achieving communication between the first system and at least one second system, which can effectively improve data transmission efficiency.
[0045] like Figure 1 As shown in the figure, this figure is a schematic diagram of an application scenario of a data transmission method provided in an embodiment of the present application.
[0046] In an embodiment of the present application, the first system can communicate with at least one second system through a configuration management module, wherein the configuration management module includes a message receiving module, a subscription module, a configuration module, a message conversion module, and a recording module.
[0047] The message receiving module is used to provide a unified public application programming interface (API), such as the Representational State Transfer API (RESTful API). Based on this API, the module can receive request data sent by the first system and send the request result returned by the second system to the first system.
[0048] The subscription module is used to authenticate the application corresponding to the requested data and query the configuration information after passing the authentication.
[0049] Exemplarily, the subscription module may include a unique identifier and an authorization key for each application, wherein the unique identifier of the application may be composed of one or more of the application's identifier (such as ID), name, version number, etc., and is used to uniquely identify an application in the system; the authorization key is used to verify the legitimacy of the application in the message receiving module.
[0050] Exemplarily, the subscription module may match the unique identifier of the application with the unique identifier of the application in the request data to identify the application, and detect the permissions of the application based on the authorization key to determine whether the application has the permission to send the request data to the second system, or receive the request result sent by the second system.
[0051] The process of authenticating the application based on the subscription module in the embodiment of the present application can ensure the security of data transmission, adapt to various authentication mechanisms, and improve the security and reliability of the system.
[0052] The configuration module is used to call the interface information of the corresponding second system according to the request data. The interface information may include but is not limited to a Uniform Resource Locator (URL), a request method, a request header, a request body template, etc.
[0053] In the embodiment of the present application, the interface information of multiple second systems can be uniformly managed based on the configuration module, which can simplify the docking process, facilitate maintenance and expansion, and the interface of the second system can be added or modified without modifying the code.
[0054] The message conversion module is used to convert the format of the standard data in the request data into a format that matches the interface information to obtain the converted request data.
[0055] After obtaining the converted request data, the converted request data is sent to the corresponding second system by calling the interface of the second system corresponding to the interface information.
[0056] For example, when it is necessary to send request data to multiple second systems, such as the first system needs to send request data to the second system A, the second system B, the second system C, and the second system D, the configuration module can call the interface information of the second system A, the second system B, the second system C, and the second system D according to the request data, and the message conversion module converts the request data into multiple converted request data that match the interface information of the second system A, the second system B, the second system C, and the second system D respectively.
[0057] After obtaining the converted request data that matches each of the multiple interface information, the server can uniformly call the interfaces of the second systems corresponding to each of the multiple interface information, and send the multiple converted request data to the corresponding second systems respectively.
[0058] After each second system generates a request result in response to the converted request data, the second system may send the request result to the first system through the configuration management module.
[0059] In one example, the configuration management module may send the request results generated by each second system to the first system respectively.
[0060] In another example, the configuration management module may combine request results generated by multiple second systems to obtain a combined result, and send the combined result to the first system.
[0061] In a possible implementation, the configuration management module includes a recording module, which is used to record data in data transmission, such as request data and request results.
[0062] In the embodiment of the present application, by recording the data in the data transmission, it can facilitate subsequent data analysis and optimization, help to quickly locate problems and optimize, and improve the system operation efficiency and reliability.
[0063] A data transmission method provided in an embodiment of the present application is introduced below with reference to the accompanying drawings.
[0064] In the embodiment of the present application, by configuring the interface information of the second system in advance, the configured interface information can be directly called during the subsequent data transmission process to achieve communication between the first system and the second system. Figure 2 As shown in the figure, this figure is a flowchart of an interface information configuration method provided in an embodiment of the present application.
[0065] S201: The server determines whether the event type is a configured event type.
[0066] In an embodiment of the present application, the server includes a configuration management module for implementing communication between the first system and the second system. To enable subsequent communication between the first system and the second system, the configured interface information can be directly invoked and request data converted into request data that matches the language and communication protocol used by the second system. Therefore, the interface information of each second system must be preconfigured based on the configuration management module.
[0067] The first system includes multiple applications. The server can configure one or more event types for each application. Each event type can include one or more target events.
[0068] Event types may include but are not limited to notification events, text events, download events, etc. Taking the event type as an example, target events included in the notification event may include but are not limited to email notifications, SMS notifications, etc.
[0069] For example, there are event type A, event type B, and event type C. When event type A and event type B are configured but event type C is not configured, if the current event type is event type A or event type B, the server determines that the event type is a configured event type and can execute S202; if the current event type is event type C, the server determines that the event type is an unconfigured event type and can execute S206.
[0070] S202: When the server determines that the event type is a configured event type, it determines whether a target interface corresponding to the target event exists.
[0071] The target interface is used to connect the first system and the second system.
[0072] like Figure 3 As shown, for each event type, one or more target interfaces can be configured for it, and each target interface can be used to execute a different target event.
[0073] Taking notification events as an example, notification events may include email notifications, SMS notifications, etc. Email notifications and SMS notifications may correspond to different target interfaces respectively.
[0074] For example, for a notification event, a target interface 1 corresponding to an email notification has been configured, that is, the target interface 1 is used to implement email notification between the first system and the second system.
[0075] When the target event is an email notification, the server can determine that the target interface corresponding to the email notification exists, that is, there is a target interface 1 for executing the email notification; when the target event is an SMS notification, the server can determine that the target interface corresponding to the SMS notification does not exist, that is, there is no target interface for executing the SMS notification.
[0076] S203: When the server determines that the target interface corresponding to the target event exists, it determines that the interface information of the target interface has been configured.
[0077] In the embodiment of the present application, the interface information of the target interface may include but is not limited to the request address, request method, parameters, and return value.
[0078] Among them, the request address is used to indicate the specific resource that the first system wants to access or operate; the request method includes but is not limited to GET request, POST request, and PUT request; the parameter is used to indicate the correspondence between the data format supported by the second system corresponding to the target interface and the data format supported by the first system; the return value is used to indicate the mapping relationship between the return value of the second system corresponding to the target interface and the return value of the first system.
[0079] When the interface information of the target interface has been configured, the subsequent server can, after obtaining the request data sent by the first system, call the target interface and convert the format of the standard data in the request data based on the parameters in the interface information of the target interface to obtain the converted request data that conforms to the data format supported by the second system.
[0080] S204: When the server determines that the target interface corresponding to the target event does not exist, the server adds a new target interface.
[0081] When the server determines that the target interface corresponding to the target event does not exist, it means that the target interface corresponding to the target event has not been configured. In this case, a new target interface can be added.
[0082] For example, Figure 4 As shown, for the notification event, the target interface 1 corresponding to the email notification has been configured, that is, the target interface 1 is used to implement the email notification between the system 1 and the system 2.
[0083] When the target event is a text message notification, the server can determine that the target interface corresponding to the text message notification does not exist, that is, there is no target interface for executing the text message notification. At this time, the server can add target interface 2 as the target interface corresponding to the text message notification.
[0084] S205: The server edits the interface information of the newly added target interface.
[0085] In the embodiment of the present application, the server can edit the interface information of the target interface based on the target event corresponding to the target interface. The edited content may include but is not limited to the request address, request method, parameters and return value.
[0086] S206: When the server determines that the event type is an unconfigured event type, it configures identification information and data format corresponding to the event type.
[0087] Each event type corresponds to unique identification information (ID).
[0088] S207: The server adds interface information of the target interface corresponding to the target event based on the identification information and data format corresponding to the event type.
[0089] When the event type is determined to be an unconfigured event type, the target interface corresponding to the target event may be directly determined to be unconfigured. Thus, when the event type is determined to be an unconfigured event type, the server may, after configuring the identification information and data format corresponding to the event type, add a target interface corresponding to each target event and edit the interface information of the target interface.
[0090] S208: The server obtains the configured event type.
[0091] After executing S203, S205, or S207, the configured event type can be obtained, and the configured event type includes at least one configured target interface.
[0092] like Figure 5 As shown in the figure, this figure is a schematic diagram of a configuration structure provided in an embodiment of the present application.
[0093] Taking the event type of notification event as an example, when the notification event is a configured event type, as shown in the figure, the identification information corresponding to the notification event is TO_MESSAGE; it is described as sending a message to each second system in a unified manner; the standard data format includes information such as title, content, recipient, copy, and attachment; the interface information of the target interface corresponding to each second system includes information such as request address, request method, and parameters.
[0094] Exemplarily, as shown in the figure, the parameters corresponding to the second system A indicate the correspondence between the data format supported by the second system A and the data format supported by the first system, that is, if the standard data sent by the first system contains "title" and "content", the converted data sent by the server to the second system is still expressed as "title" and "content"; if the standard data sent by the first system contains "receiver", the server can convert the "receiver" into "recipient"; if the standard data sent by the first system contains "cc", the server can convert the "cc" into "ccRecipient"; if the standard data sent by the first system contains "attachment", the server can convert the "attachment" into "enclousure".
[0095] The parameters corresponding to the second system B indicate the correspondence between the data formats supported by the second system B and the data formats supported by the first system, that is, if the standard data sent by the first system contains "title", the server can convert the "title" into "title1"; if the standard data sent by the first system contains "content", the server can convert the "content" into "content1"; if the standard data sent by the first system contains "receiver", the server can convert the "receiver" into "recipient1"; if the standard data sent by the first system contains "cc", the server can convert the "cc" into "ccRecipient1"; if the standard data sent by the first system contains "attachment", the server can convert the "attachment" into "enclousure", and so on.
[0096] In the embodiment of the present application, based on the configuration management module, the interface information of each second system can be uniformly configured and managed. After the interface information of each second system is configured, in the process of communication between the first system and the second system, the configured interface information can be directly called to convert the request data sent by the first system into request data that matches the language and communication protocol used by the second system, which simplifies the docking process, is easy to maintain and expand, solves the problem of inconsistent data formats between different systems, and improves the efficiency and accuracy of data transmission. At the same time, the method provided in the embodiment of the present application adopts a configuration-driven approach. When it is necessary to modify the interface information or add a new target interface, the interface information can be edited or a new target interface can be added based on the configuration management module without modifying the code, thereby improving the flexibility and scalability of the system and being able to quickly respond to changes in business needs.
[0097] In the embodiment of the present application, by pre-subscribing to the event type for each application, the server can call the configured interface information to realize the communication between the first system and the second system when it determines that the application has subscribed to the corresponding event type. Figure 6 As shown in the figure, this figure is a flowchart of an event type subscription method provided in an embodiment of the present application.
[0098] S601: The server determines whether the application subscribes to an event type.
[0099] If the server determines that the application has subscribed to the event type, it means that the application has subscribed to at least one target event under the event type, and the server may execute S602; if the server determines that the application has not subscribed to the event type, it may execute S603.
[0100] S602: The server determines whether the subscribed event types include the target event.
[0101] If the server determines that the event types subscribed by the application do not include the target event, S604 is executed; otherwise, S605 is executed.
[0102] S603: The server subscribes to the event type.
[0103] The server may execute S602 after subscribing to the event type.
[0104] S604: The server adds a new target event for the event type.
[0105] If the server determines that the event types subscribed by the application do not include the target event, the server may add a new target event.
[0106] S605: The server subscribes to a target event in the event type for the application.
[0107] After the server subscribes to the target event in the event type for the application, the application has the authority to send request data corresponding to the target event to the second system and receive the request result returned by the second system.
[0108] S606: Subscription completed.
[0109] For example, in the case of subscribing application A to an email notification event, the server may first determine whether application A has subscribed to the notification event.
[0110] In one possible implementation, if it is determined that application A has subscribed to notification events, it is determined whether the subscribed notification events include email notifications. If the subscribed notification events include email notifications, application A is subscribed to the target event of email notifications. If the subscribed event types do not include email notifications, the target event of email notifications is first added. After adding the target event of email notifications, application A is subscribed to email notifications.
[0111] In one possible implementation, if it is determined that application A is not subscribed to notification events, application A is subscribed to notification events. After subscribing application A to notification events, it is determined whether the subscribed notification events include email notifications. If the subscribed notification events include email notifications, application A is subscribed to the target event of email notifications. If the subscribed event types do not include email notifications, email notifications are first added as a target event. After adding the target event of email notifications, application A is subscribed to email notifications.
[0112] In this embodiment of the present application, by pre-subscribing each application to a target event under an event type, the server can subsequently authenticate each application after receiving the request data sent by the first system. If it is determined that the application has not subscribed to the target event corresponding to the request data, no subsequent data processing is performed. If it is determined that the application has subscribed to the target event corresponding to the request data, the configured interface information can be called to enable communication between the first and second systems. This process ensures the security of data transmission, adapts to various authentication mechanisms, and improves the security and reliability of the system.
[0113] like Figure 7 As shown, the figure is a flowchart of a data transmission method provided in an embodiment of the present application, including S701-S704.
[0114] S701: The server receives request data sent by the first system.
[0115] The request data includes standard data corresponding to the first system and at least one event type.
[0116] In an embodiment of the present application, the first system may include the enterprise's internal service platform, such as a product innovation platform, a digital operation platform, a data middle platform, a technology middle platform, etc.
[0117] S702: The server obtains interface information of the second system corresponding to the event type according to the event type.
[0118] Among them, the second system can be a third-party service platform, which is used to provide auxiliary services for the internal service platform, including but not limited to providing network environment and various technical support, providing payment intermediary services, and providing software services.
[0119] In the embodiment of the present application, each event type may include at least one target event, and each target event corresponds to a target interface of the second system. The server may obtain interface information of the target interface corresponding to at least one target event under the event type according to the event type.
[0120] Taking the notification event as an example, the server can obtain the interface information of the second system corresponding to at least one target event under the notification event based on the notification event. For example, the server obtains the interface information of the second system corresponding to the email notification and the interface information of the second system corresponding to the SMS notification.
[0121] In one possible implementation, during the process of obtaining the interface information of the second system corresponding to the event type, the server determines whether the event type is a configured event type. If the event type is determined to be a configured event type, the server may obtain the interface information of the second system corresponding to the event type. If the event type is determined to be an unconfigured event type, the server may return an error message.
[0122] Relevant technicians can determine that the event type is an unconfigured event type based on the error information, and thus can configure the event type based on the method described in S201-S208 above.
[0123] In the embodiment of the present application, when it is determined that the event type is a configured event type, the server can detect whether the format of the standard data is correct.
[0124] If it is determined that the format of the standard data is correct, the server may obtain the interface information of the second system corresponding to the event type. If it is determined that the format of the standard data is incorrect, the server may return error information.
[0125] For example, if the format of the standard data is correct, including information such as the title, content, recipients, carbon copies, and attachments, if the server detects that at least one of the following is missing from the standard data, it can be determined that the format of the standard data is incorrect. In this case, the server can return relevant error information.
[0126] In a possible implementation, the server may determine identification information corresponding to the event type based on the event type, and obtain interface information of the second system corresponding to the identification information through the identification information.
[0127] The interface information of the second system may include but is not limited to a Uniform Resource Locator (URL), a request method, a request header, a request body template, and the like.
[0128] A URL is a string of characters used to identify the location of a resource on the internet. It provides a standardized way for users to access various online resources, such as web pages, images, videos, and files. The structure of a URL typically includes, but is not limited to, the protocol, domain name, port number, and path.
[0129] Among them, the protocol is used to specify the protocol type used to access resources. In the embodiment of the present application, different second systems may correspond to different protocols, such as Hypertext Transfer Protocol (HTTP), Secure Hypertext Transfer Protocol (HTTPS), and File Transfer Protocol (FTP); the domain name is used to identify the name of the server or website where the resource is located; the port number is used to specify a specific port on the server to receive the request data sent by the first system; the path is used to specify the specific location of the resource on the server.
[0130] The request method may include but is not limited to GET request, POST request, etc.
[0131] In one possible implementation, in the process of obtaining the interface information of the second system corresponding to the event type, the server determines whether the application corresponding to the requested data subscribes to the target event under the event type. If it is determined that the application subscribes to the target event under the event type, the server can obtain the interface information of the second system corresponding to the event type based on the event type.
[0132] If it is determined that the application has subscribed to the target event under this event type, a corresponding error message may be returned, so that relevant technical personnel can promptly identify the problem, or subscribe the application to the target event based on the above S601-S606 as needed.
[0133] S703: The server converts the format of the standard data in the request data into a format that matches the interface information, and obtains the converted request data.
[0134] In an embodiment of the present application, the server can convert the format of the standard data in the request data into a format that matches the interface information based on the correspondence between the data format supported by the second system corresponding to the target interface in the parameters of the interface information and the data format supported by the first system, and obtain the converted request data.
[0135] For example, Figure 8 As shown, when the event type is notification, the format of standard data is as follows:
[0136] {"title":"Title",
[0137] "content": "content",
[0138] "receiver": "recipient",
[0139] "cc": "copy person",
[0140] "attachment": "Attachment"}.
[0141] The corresponding relationship between the data format supported by the second system and the data format supported by the first system corresponding to the target interface indicated by the parameters in the interface information is as follows:
[0142] {"title":"title",
[0143] "content": "content",
[0144] "recipient": "receiver",
[0145] "ccRecipient": "cc",
[0146] "enclosure":"attachment"}.
[0147] Based on the correspondence between the data format supported by the second system corresponding to the target interface and the data format supported by the first system, it can be determined that the "title" in the second system corresponds to the "title" in the first system; the "content" in the second system corresponds to the "content" in the first system; the "recipient" in the second system corresponds to the "receiver" in the first system; the "ccRecipient" in the second system corresponds to the "cc" in the first system; and the "enclousure" in the second system corresponds to the "attachment" in the first system.
[0148] The server converts the format of the standard data in the request data into a format that matches the interface information based on the correspondence between the data format supported by the second system and the data format supported by the first system corresponding to the target interface in the interface information. The converted request data is represented as follows:
[0149] {"title":"Title",
[0150] "content": "content",
[0151] "recipient": "recipient",
[0152] "ccRecipient": "cc recipient",
[0153] "enclousure": "enclosure"}.
[0154] S704: The server sends the converted request data to the second system.
[0155] The format of the converted request data meets the data transmission requirements of the second system, and the second system can generate a corresponding request result in response to the converted request data.
[0156] S705: The server obtains the request result and sends the request result to the first system.
[0157] After generating the request result, the second system may send the request result to the first system through the server.
[0158] In one example, the server may send the request results generated by each second system to the first system respectively.
[0159] In another example, the server may combine and process the request results generated by multiple second systems to obtain a combined result, and send the combined result to the first system.
[0160] To sum up, the method provided in the embodiment of the present application can enable the server to convert the format of standard data into a format that matches each interface information. There is no need for the first system to convert the standard data one by one for the interface information corresponding to each second system, so that communication between the first system and at least one second system can be achieved, which can effectively improve data transmission efficiency.
[0161] The following combination Figure 9 A data transmission method provided in an embodiment of the present application is generally introduced.
[0162] S901: The first system sends request data to a configuration conversion module.
[0163] The request data includes standard data corresponding to the first system and at least one event type.
[0164] S902: The configuration conversion module determines whether the application corresponding to the request data subscribes to the target event under the event type.
[0165] If the configuration conversion module determines that the application has subscribed to the target event of the event type, it may execute S903; otherwise, it may execute S909.
[0166] S903: The configuration conversion module determines whether the target event exists.
[0167] If the configuration conversion module determines that the target event exists, S904 is executed; otherwise, S909 is executed.
[0168] S904: The configuration conversion module determines whether the format of the standard data is correct.
[0169] If it is determined that the format of the standard data is correct, the configuration conversion module may execute S905 ; if it is determined that the format of the standard data is incorrect, the configuration conversion module may execute S909 .
[0170] S905: The configuration conversion module obtains interface information of the target interface.
[0171] When it is determined that the format of the standard data is correct, the configuration conversion module obtains the interface information of the target interface corresponding to the target event.
[0172] S906. The configuration conversion module converts the format of the standard data in the request data into a format that matches the interface information, and obtains the converted request data.
[0173] S907: The configuration conversion module sends the converted request data to the second system.
[0174] S908: The configuration conversion module determines whether the converted request data is sent successfully.
[0175] If the configuration conversion module determines that the converted request data fails to be sent, S909 may be executed; otherwise, S910 is executed and success information is returned.
[0176] S909: The configuration conversion module returns error information.
[0177] Exemplarily, when the configuration conversion module determines that the application has not subscribed to the target event under the event type, the configuration conversion module may return a first error message; when the configuration conversion module determines that the target event does not exist, the configuration conversion module may return a second error message; when the configuration conversion module determines that the format of the standard data is incorrect, the configuration conversion module may return a third error message; when the configuration conversion module determines that the converted request data fails to be sent, the configuration conversion module may return a fourth error message.
[0178] S911. Configure the conversion module to record data during data transmission.
[0179] The method provided in the embodiments of the present application can detect the call status of each target interface in real time, and can generate a log based on at least one of the request data, the converted request data, and the request result, facilitating subsequent analysis and optimization. By comprehensively detecting the call status of the target interface in the embodiments of the present application, it is helpful to promptly discover and resolve problems and improve the stability of system operation. Detailed logging can provide rich data support, which is helpful for performance analysis and optimization adjustments.
[0180] To sum up, the method provided in the embodiment of the present application can enable the server to convert the format of standard data into a format that matches each interface information. There is no need for the first system to convert the standard data one by one for the interface information corresponding to each second system, so that communication between the first system and at least one second system can be achieved, which can effectively improve data transmission efficiency.
[0181] In the embodiment of the present application, based on the configuration management module, the interface information of each second system can be uniformly configured and managed. After the interface information of each second system is configured, during the communication between the first system and the second system, the configured interface information can be directly called to convert the request data sent by the first system into request data that matches the language and communication protocol used by the second system. This simplifies the docking process, is easy to maintain and expand, solves the problem of inconsistent data formats between different systems, and improves the efficiency and accuracy of data transmission. By adopting a configuration-driven approach, when it is necessary to modify the interface information or add a new target interface, the interface information can be edited or a new target interface can be added based on the configuration management module without modifying the code, thereby improving the flexibility and scalability of the system and enabling rapid response to changes in business needs.
[0182] At the same time, the method provided in the embodiment of the present application supports multiple communication protocols and data formats, including but not limited to HTTP, HTTPS, RESTful API, Simple Object Access Protocol (SOAP), etc., and is suitable for different types of service platforms and application scenarios, such as Internet of Things (IoT) platforms, financial services, medical information systems, smart homes, e-commerce platforms, and government informationization, etc., and has wide applicability.
[0183] The present application also provides a data transmission device, such as Figure 10 As shown in the figure, this figure is a structural schematic diagram of a data transmission device provided in an embodiment of the present application. Its specific implementation method is consistent with the implementation method and the technical effect achieved in the embodiment of the above method, and some contents will not be repeated here.
[0184] A data transmission device 1010, comprising:
[0185] The receiving unit 1011 is configured to receive request data sent by the first system, where the request data includes standard data corresponding to the first system and at least one event type;
[0186] An acquiring unit 1012 is configured to acquire, according to the event type, interface information of a second system corresponding to the event type;
[0187] The conversion unit 1013 is configured to convert the format of the standard data in the request data into a format matching the interface information, and obtain the converted request data;
[0188] The sending unit 1014 is configured to send the converted request data to the second system.
[0189] In a possible implementation, the acquiring unit is specifically configured to:
[0190] Determine whether the event type is a configured event type;
[0191] In response to the event type being a configured event type, interface information of the second system corresponding to the event type is acquired to perform format conversion on the standard data to obtain converted request data.
[0192] In a possible implementation, the acquiring unit is specifically configured to:
[0193] In response to the event type being a configured event type, determining whether a format of the standard data is correct;
[0194] In response to the format of the standard data being correct, interface information of the second system corresponding to the event type is acquired.
[0195] In a possible implementation, the acquiring unit is specifically configured to:
[0196] According to the event type, determine the identification information corresponding to the event type;
[0197] The interface information of the second system corresponding to the identification information is acquired.
[0198] In a possible implementation, the conversion unit is specifically configured to:
[0199] According to the correspondence between the data format supported by the second system corresponding to the target interface in the interface information and the data format supported by the first system, the format of the standard data in the request data is converted into a format matching the interface information to obtain the converted request data.
[0200] In a possible implementation, the acquiring unit is specifically configured to:
[0201] Determine whether the application corresponding to the requested data subscribes to the event type;
[0202] In response to the application subscribing to the event type, according to the event type, the interface information of the second system corresponding to the event type is acquired.
[0203] In a possible implementation, the apparatus further includes a configuration unit;
[0204] The configuration unit is specifically used to determine whether a target interface corresponding to the event type exists in response to the event type being a configured event type; the target interface is used to connect the first system and the second system; in response to the existence of the target interface corresponding to the event type, the interface information of the target interface is edited; in response to the non-existence of the target interface corresponding to the time type, the interface information of the target interface is newly added.
[0205] In one possible implementation, the configuration unit is specifically used to configure the identification information and data format corresponding to the event type in response to the event type being an unconfigured event type; based on the identification information and data format corresponding to the event type, add a target interface corresponding to the event type, and configure the interface information of the target interface.
[0206] In a possible implementation, the apparatus further includes: a request result sending unit;
[0207] The request result sending unit is used to obtain the request result generated by the second system in response to the converted request data; and send the request result to the first system.
[0208] In a possible implementation, the apparatus includes: a log generating unit;
[0209] The log generating unit is configured to generate a log based on at least one of the request data, the converted request data, and the request result.
[0210] To sum up, the device provided in the embodiment of the present application can be used by the server to convert the format of standard data into a format that matches each interface information. There is no need for the first system to convert the standard data one by one for the interface information corresponding to each second system, so that communication between the first system and at least one second system can be achieved, which can effectively improve data transmission efficiency.
[0211] like Figure 11 As shown in FIG, this figure is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. In this embodiment, the computing device can be a server, which can include but is not limited to a cabinet server, a rack server, a blade server, etc., or a general-purpose server, a GPU server, a DPU server, etc., without limitation.
[0212] The computing device includes a memory 1101 , a processor 1102 and a communication interface 1103 ; wherein the memory 1101 stores computer instructions, and the processor 1102 is configured to execute the computer instructions, so that the computing device executes the steps of the data transmission method shown above.
[0213] In some embodiments, the processor 1102 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0214] In some embodiments, the memory 1101 may be a volatile memory or a non-volatile memory, such as a register. Specifically, a volatile memory refers to a memory in which the data stored therein will be lost when the power supply is interrupted. Among them, the volatile memory is mainly a random access memory (RAM), including a static random access memory (SRAM) and a dynamic random access memory (DRAM). A non-volatile memory refers to a memory in which the data stored therein will not be lost even if the power supply is interrupted. Common non-volatile memories include read-only memory (ROM), optical disks, magnetic disks, solid-state hard disks, and various memory cards based on flash memory technology.
[0215] In some embodiments, the memory 1101 has executable codes, and the processor 1102 executes the codes. The communication interface 1103 can be used to implement communication between the client control terminal and the server.
[0216] The bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0217] For ease of understanding, Figure 10 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0218] This embodiment further provides a computer-readable storage medium, which includes instructions. When the instructions are executed on a computing device, the computing device executes the above-mentioned related method steps to implement the method in the above-mentioned embodiment.
[0219] The above is only a specific embodiment of the present application, but the scope of protection of this application is not limited to this. Any changes or substitutions within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A data transmission method, characterized in that: include: receiving request data sent by the first system, where the request data includes standard data corresponding to the first system and at least one event type; According to the event type, acquiring interface information of a second system corresponding to the event type; Converting the format of the standard data into a format matching the interface information to obtain converted request data; The converted request data is sent to the second system.
2. The method according to claim 1, characterized in that The acquiring, according to the event type, interface information of the second system corresponding to the event type includes: Determining whether the event type is a configured event type; In response to the event type being a configured event type, interface information of the second system corresponding to the event type is acquired.
3. The method according to claim 2, characterized in that In response to the event type being a configured event type, acquiring interface information of the second system corresponding to the event type includes: In response to the event type being a configured event type, determining whether a format of the standard data is correct; In response to the format of the standard data being correct, interface information of the second system corresponding to the event type is acquired.
4. The method according to claim 1, wherein The acquiring, according to the event type, interface information of the second system corresponding to the event type includes: Determining identification information corresponding to the event type according to the event type; Acquire interface information of the second system corresponding to the identification information.
5. The method according to claim 1, wherein The converting the format of the standard data in the request data into a format matching the interface information to obtain the converted request data includes: According to the correspondence between the data format supported by the second system corresponding to the target interface in the interface information and the data format supported by the first system, the format of the standard data in the request data is converted into a format matching the interface information to obtain the converted request data.
6. The method according to claim 1, characterized in that The acquiring, according to the event type, interface information of the second system corresponding to the event type includes: Determining whether the application corresponding to the request data subscribes to the event type; In response to the application subscribing to the event type, interface information of the second system corresponding to the event type is acquired according to the event type.
7. The method according to claim 1, characterized in that The method for configuring the interface information of the second system includes: In response to the event type being a configured event type, determining whether a target interface corresponding to the event type exists; the target interface is used to connect the first system and the second system; In response to the existence of the target interface corresponding to the event type, the interface information of the target interface is edited; in response to the non-existence of the target interface corresponding to the time type, the interface information of the target interface is newly added.
8. The method according to claim 1, characterized in that Also includes: In response to the event type being an unconfigured event type, configuring identification information and a data format corresponding to the event type; Based on the identification information and data format corresponding to the event type, a target interface corresponding to the event type is added, and interface information of the target interface is configured.
9. The method according to any one of claims 1 to 8, characterized in that After sending the converted request data to the second system, the method further includes: obtaining a request result generated by the second system in response to the converted request data; The request result is sent to the first system.
10. The method according to claim 9, characterized in that The method further comprises: A log is generated based on at least one of the request data, the converted request data, and the request result.
11. A computing device, characterized in that The computing device includes: a processor and a memory; The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the steps of a data transmission method according to any one of claims 1 to 10 according to instructions in the program code.