Packet type conversion method, device and equipment, and storage medium

By using a microservice gateway to perform type conversion on target packets through mapping relationships, the problem of existing technologies being unable to support the conversion of diverse source data types is solved, enabling packet conversion of diverse source data types and improving the efficiency of business servers.

CN118827779BActive Publication Date: 2025-12-09CHINA MOBILE M2M +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311798335.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-25
Publication Date
2025-12-09
Estimated Expiration
2043-12-25

AI Technical Summary

Technical Problem

Existing message type conversion methods only support XML and JSON types, which cannot meet the conversion needs of diverse source data types, especially in scenarios such as file management.

Method used

The microservice gateway receives business requests, uses pre-stored mapping relationships to perform type conversion on target messages, generates target type messages, and supports the conversion of diverse source data types.

Benefits of technology

It enables message conversion for diverse types of source data, improving the efficiency and flexibility of the business server in executing target business operations and simplifying the client's invocation method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118827779B_ABST
    Figure CN118827779B_ABST
Patent Text Reader

Abstract

The application discloses a message type conversion method and device, equipment and storage medium, and relates to the technical field of communication. The method is applied to a micro-service gateway, and comprises the following steps: receiving a service request sent by a service server, and sending the service request to a storage server, wherein the service request comprises a target user identifier; receiving a target message sent by the storage server, wherein the target message is a message corresponding to the target user identifier in the storage server, the storage server comprises messages of multiple users, different user identifiers correspond to different messages, and the target message is array stream data; performing type conversion on the target message according to a pre-stored mapping relationship, generating a target type message of the target user, and the mapping relationship comprises a corresponding relationship between array stream data of multiple source objects and array stream data of multiple target type objects; and sending the target type message to the service server, so that the service server executes a target service corresponding to the service request according to the target type message.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of communication, and particularly relates to a message type conversion method and device, equipment and a storage medium. BACKGROUND

[0002] With the development and progress of the Internet, application systems are no longer simply independent, and they need to interact with other systems in messages. For example, the messages provided by each system are not consistent, so message type conversion is needed when interfacing. With the deepening and convenience of digitization, in many scenarios, the source data of the interactive message is no longer limited to text types, and they can be file, picture, video, voice and other types, especially in the file management scenario, the types of source data are diverse. In the current business data interaction, only XML (Extensible Markup Language, XML) type or JSON (JavaScript Object Notation, JSON) type message conversion methods can be supported, which cannot meet the message conversion needs of the existing diversified type source data. SUMMARY

[0003] The embodiments of the present application provide a message type conversion method, device, equipment and storage medium, which can meet the message conversion needs of diversified type source data without limiting the type of message.

[0004] In a first aspect, the embodiments of the present application provide a message type conversion method applied to a micro-service gateway, and the method comprises the following steps:

[0005] receiving a business request sent by a business server, and sending the business request to a storage server, wherein the business request comprises a target user identifier, and the target user identifier uniquely corresponds to the identity of a target user;

[0006] receiving a target message sent by the storage server, wherein the target message is a message corresponding to the target user identifier in the storage server, the storage server comprises messages of a plurality of users, different user identifiers correspond to different messages, and the target message is array stream data;

[0007] performing type conversion on the target message according to a pre-stored mapping relationship, to generate a target type message of the target user, wherein the mapping relationship comprises a corresponding relationship between array stream data of a plurality of source objects and array stream data of a plurality of target type objects;

[0008] sending the target type message to the business server, so that the business server performs a target business corresponding to the business request according to the target type message.

[0009] In a second aspect, an embodiment of the present application provides a message type conversion device applied to a micro-service gateway, the device comprising:

[0010] A first sending module configured to receive a service request sent by a service server and send the service request to a storage server, the service request comprising a target user identifier, the target user identifier uniquely corresponding to the identity of a target user;

[0011] A receiving module configured to receive a target message sent by the storage server, the target message being a message corresponding to the target user identifier in the storage server, the storage server comprising messages of a plurality of users, different user identifiers corresponding to different messages, and the target message being array stream data;

[0012] A conversion module configured to perform type conversion on the target message according to a pre-stored mapping relationship to generate a target type message of the target user, the mapping relationship comprising a corresponding relationship between array stream data of a plurality of source objects and array stream data of a plurality of target type objects;

[0013] A second sending module configured to send the target type message to the service server, so that the service server performs a target service corresponding to the service request according to the target type message.

[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory storing computer program instructions; the processor implements the message type conversion method of any one of the above when executing the computer program instructions.

[0015] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium storing computer program instructions, the computer program instructions being executed by a processor to implement the message type conversion method of any one of the above.

[0016] In a fifth aspect, an embodiment of the present application provides a computer program product, instructions in the computer program product being executed by a processor of an electronic device to enable the electronic device to perform the message type conversion method of any one of the above.

[0017] The message type conversion method, device, equipment and storage medium provided by the embodiments of the present application are applied to a micro-service gateway, can receive a service request sent by a service server, and send the service request to a storage server. The service request comprises a target user identifier, and the target user identifier uniquely corresponds to the identity of a target user. The target message sent by the storage server is a message corresponding to the target user identifier in the storage server. The storage server comprises messages of multiple users, different user identifiers correspond to different messages, and the target message is array stream data. The target message is type-converted according to a pre-stored mapping relationship, a target type message of the target user is generated, the mapping relationship comprises a corresponding relationship between array stream data of multiple source objects and array stream data of multiple target type objects, and the target type message is sent to the service server, so that the service server executes a target service corresponding to the service request according to the target type message. In this way, the embodiments of the present application can type-convert the target message according to the mapping relationship between the array stream data of the multiple source objects and the array stream data of the multiple target type objects, obtain the target type message, do not need to limit the type of the message, and achieve the message conversion requirement of diversified type source data. BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments of the present application will be briefly introduced. Those skilled in the art can obtain other drawings according to these drawings without paying creative labor.

[0019] Figure 1 is a flowchart of a message type conversion method provided by the embodiments of the present application;

[0020] Figure 2 is a flowchart of a scene embodiment of a message type conversion method provided by the embodiments of the present application;

[0021] Figure 3 is a schematic diagram of another scene embodiment of a message type conversion method provided by the embodiments of the present application;

[0022] Figure 4 is a structural schematic diagram of a message type conversion device provided by the embodiments of the present application;

[0023] Figure 5 is a structural schematic diagram of an electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0024] The features and exemplary embodiments of the various aspects of the present application will be described in detail below with reference to the drawings. For the purpose of clarity, the description is divided into the following sections: technical scheme, advantages, and specific embodiments. The specific embodiments described herein are intended for purposes of illustration only and are not intended to limit the scope of the present application. The present application can be implemented in ways other than those specifically set forth herein without departing from the spirit and scope of the present application. The following description is presented to enable any person skilled in the art to make and use the present application.

[0025] It should be noted that the relational terms herein, such as first and second, are used solely to distinguish one from another entity or action without necessarily requiring or implying any actual relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, an element defined by the statement "comprising" does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0026] With the development and progress of the Internet, application systems are no longer simply independent, and they need to interact with other systems. For example, the messages provided by each system are not consistent, so message type conversion is needed when interfacing. With the deepening and convenience of digitization, in many scenarios, the source data of the interactive message is no longer limited to text types, and they can be files, pictures, videos, voice, etc. types, especially in the file management scenario, the types of source data are diverse. In the current business data interaction, only the message conversion mode of XML (Extensible Markup Language, XML) type or JSON (JavaScript Object Notation, JSON) type can be supported, which has been unable to meet the message conversion needs of the existing diversified type source data.

[0027] To solve the problems in the prior art, the present application provides a message type conversion method, device, equipment and storage medium. First, the message type conversion method provided by the present application will be introduced.

[0028] Figure 1 The flowchart of the message type conversion method provided by an embodiment of the present application is shown. As shown in FIG. 1, the message type conversion method provided by the present application includes the following steps. Figure 1As shown, a message type conversion method is applied to a micro-service gateway. The method can include the following steps S101-S104:

[0029] S101, receiving a service request sent by a service server, and sending the service request to a storage server, the service request including a target user identifier, the target user identifier uniquely corresponding to the identity of a target user;

[0030] S102, receiving a target message sent by the storage server, the target message being a message corresponding to the target user identifier in the storage server, the storage server including messages of multiple users, different user identifiers corresponding to different messages, and the target message being array stream data;

[0031] S103, type-converting the target message according to a pre-stored mapping relationship to generate a target type message of the target user, the mapping relationship including a corresponding relationship between array stream data of multiple source objects and array stream data of multiple target type objects;

[0032] S104, sending the target type message to the service server, so that the service server performs a target service corresponding to the service request according to the target type message.

[0033] The message type conversion method of the present application is applied to a micro-service gateway, which can receive a service request sent by a service server, and send the service request to a storage server, the service request including a target user identifier, the target user identifier uniquely corresponding to the identity of a target user; receive a target message sent by the storage server, the target message being a message corresponding to the target user identifier in the storage server, the storage server including messages of multiple users, different user identifiers corresponding to different messages, and the target message being array stream data; type-convert the target message according to a pre-stored mapping relationship to generate a target type message of the target user, the mapping relationship including a corresponding relationship between array stream data of multiple source objects and array stream data of multiple target type objects; and send the target type message to the service server, so that the service server performs a target service corresponding to the service request according to the target type message. In this way, the present application can type-convert a target message according to a corresponding mapping relationship between array stream data of multiple source objects and array stream data of multiple target type objects to obtain a target type message, without limiting the type of the message, thereby achieving the message conversion requirement of diversified type source data.

[0034] The message type conversion method is mainly applied to a micro-service gateway, which is an intermediate layer component for managing and scheduling micro-services. The request can be routed to a corresponding micro-service instance according to a request URL and other identification information. In this way, the client only needs to communicate with the gateway, without directly interacting with each micro-service, thereby simplifying the calling mode of the client. In the present application, it is not limited to this, but can also be other terminal devices with data processing capabilities.

[0035] The specific implementation of each step will be described below.

[0036] In S101, the business server can be a server for executing a business. For example, it can be a service consumer that retrieves customer profile information in other systems to generate a report. In the present application, the business server is not limited to a service consumer, but can also be a server for other businesses. The selection is based on the actual needs of the user, and is not limited herein.

[0037] The business request can be a service request for a service consumer to query customer profile information. Of course, different business requirements correspond to different service requests. The business request includes a target user identifier, which uniquely corresponds to the identity of the target user and is used to query the corresponding message in the storage server.

[0038] In S102, the storage server can be a storage cluster that includes messages of multiple users, with different user identifiers corresponding to different messages. The message can be the profile information of the user. The target message is the message corresponding to the target user identifier in the storage server.

[0039] The target message can be array stream data, specifically byte array stream data. ByteArrayInputStream / ByteArrayOutputStream is a stream provided by Java IO library, which is used to read and write byte array data. ByteArrayInputStream is an input stream that accepts a byte array as an input source. Through ByteArrayInputStream, data can be read byte by byte from the byte array. It provides some methods, such as read() for reading the next byte, available() for getting the number of readable bytes, skip() for skipping the specified number of bytes, etc. ByteArrayOutputStream is an output stream that can save the written data to a byte array. Through ByteArrayOutputStream, data can be written to the byte array. It provides some methods, such as write() for writing a byte, toByteArray() for getting the written byte array, size() for getting the number of written bytes, etc.

[0040] In S103, the mapping relationship can include the corresponding relationship between the array stream data of the plurality of source objects and the array stream data of the plurality of target type objects. The source object is exemplarily corresponding to the customer profile information, including files, pictures, videos, audio, etc. The target type object is exemplarily a JSON object. In this embodiment, the target type object is not limited to a JSON object, but can also be set according to actual user needs, which is not limited here.

[0041] Regardless of any type of data, it can be received through the byte array stream, and the type is converted to the target type according to the mapping relationship after receiving the array stream.

[0042] In S104, the target type message is sent to the business server, which is exemplarily a micro-service gateway based on TCP / IP network communication protocol to send the target type message to the business server.

[0043] The business server executes the target business corresponding to the business request according to the target type message, which is exemplarily a service consumer executing related statistics and report generation according to the user profile information of the JSON object.

[0044] As an implementation manner of the present application, in order to improve the efficiency of the business server in executing the target business, before S103, it can also include:

[0045] Obtaining a plurality of service template files, the service template files including service template features, different service template files corresponding to different categories of source objects;

[0046] Parsing the service template features in the plurality of service template files to obtain array stream data of the plurality of source objects;

[0047] According to the array stream data of the plurality of source objects, a mapping relationship between the array stream data of the plurality of target type objects is generated.

[0048] The service template file can be a configuration file or template used to describe a microservice. By registering this information in the service discovery registry center, other services or clients can easily discover and call the microservice. Such template files can be provided to developers for easy registration and configuration of microservices.

[0049] The plurality of service template files are obtained, and the microservice gateway obtains all service template files registered by the storage server through the service discovery registry center.

[0050] The service template file can include service template features. For example, the service template file corresponding to customer basic information includes service template features such as username, gender, and birth date, and the service template file corresponding to customer communication record information includes service template features such as connection base station information, start time, end time, call partner, and voice recording.

[0051] Different service template files correspond to different categories of source objects. For example, the service template file corresponding to customer basic information has picture and text type source objects, and the service template file corresponding to customer communication record information has file or voice source objects.

[0052] The service template features in the plurality of service template files are parsed to obtain array stream data of the plurality of source objects. For example, the service template features in the plurality of service template files can be binary parsed according to specified positions and lengths to obtain array stream data of each source object.

[0053] According to the array stream data of the plurality of source objects, a mapping relationship between the array stream data of the plurality of target type objects is generated. For example, the array stream data of the "name" field of the source object can be mapped to the array stream data of the "fullName" field of the target type object, and the array stream data of the "address" field of the source object can be mapped to the array stream data of the "city", "state", and "country" fields of the target type object.

[0054] In the embodiment, the service template features in the plurality of service template files are parsed to obtain array stream data of the plurality of source objects, and a mapping relationship corresponding to the array stream data of the plurality of target type objects is generated in advance according to the array stream data of the plurality of source objects, so that the micro-service gateway can perform type conversion on the target message according to the pre-stored mapping relationship, and when the target type message of the target user is generated, the efficiency of the business server in executing the target business is improved.

[0055] As another implementation manner of the application, in order to facilitate the maintenance of the mapping relationship, after the mapping relationship corresponding to the array stream data of the plurality of target type objects is generated according to the array stream data of the plurality of source objects, the method can further include:

[0056] In response to the change of the service template file, the field information in the mapping relationship is updated.

[0057] In the embodiment, when the service template file provided by the storage server is changed, the micro-service gateway reacquires and parses the service template file to update the field information, so that the maintenance of the mapping relationship is facilitated.

[0058] In some embodiments, the micro-service gateway can include a service registration and discovery center, and the service registration and discovery center can include the service address of the storage server.

[0059] The S101 can specifically include:

[0060] The business request sent by the business server is received.

[0061] In response to the business request, the service address of the pre-registered storage server is called in the service registration and discovery center.

[0062] According to the service address, the business request is sent to the storage server.

[0063] The micro-service gateway can include a service registration and discovery center, which is an important component in the micro-service architecture and can be used to manage and maintain the registration and discovery of micro-services.

[0064] The service registration and discovery center can include the service address of the storage server. If the micro-service gateway does not pre-register and save the service address of the storage server in advance, the user needs to manually input the service address of the storage server when sending the business request to the storage server, which results in low efficiency of sending the business request.

[0065] In the embodiment, the micro-service gateway can call the pre-registered service address of the storage server in the service registration and discovery center in response to the business request, and quickly send the business request to the storage server according to the service address, thereby improving the business processing efficiency.

[0066] In some embodiments, the storage server can include at least one storage sub-server, and different storage sub-servers include different categories of messages.

[0067] The S102 can specifically include:

[0068] Receiving at least one target message sent by at least one storage sub-server.

[0069] The storage server can include at least one storage sub-server, and different storage sub-servers include different categories of messages. For example, a first storage sub-server stores customer basic information including username, gender, birth date, etc., and a second storage sub-server stores customer communication records including connection base station information, start time, end time, call opposite, voice recording, etc.

[0070] In this embodiment, the distributed storage mode of storing different categories of messages by different storage sub-servers not only can dynamically expand or reduce the storage capacity according to user demand, provide flexible storage resource management, but also can realize parallel processing and load balancing, thereby improving read-write performance and system throughput.

[0071] As another implementation manner of the present application, in order to code reusability and development efficiency, before the S103, the method can further include:

[0072] Defining a function interface of array stream data of the source object and array stream data of the target type object according to the pre-stored mapping relationship;

[0073] The S103 can specifically include:

[0074] Converting the target message according to the function interface to generate the target type message of the target user.

[0075] The function interface can be RewriteFunction<T, R> for example. T represents the information of the source object, which can be customer profile information including files, pictures, videos, audio, etc. R represents the information of the target type object, which is a JSON object.

[0076] The function interface of array stream data of the source object and array stream data of the target type object defined according to the pre-stored mapping relationship can be ModifyResponseBodyGatewayFilterFactory in the micro-service gateway based on the mapping relationship to write a custom RewriteFunction<T, R> for example.

[0077] In this embodiment, by customizing RewriteFunction <T, R>, the mapping relationship can be encapsulated into a reusable component, so that in multiple message type conversion scenarios, the component can be directly used without the need to repeatedly write the same mapping relationship, thereby improving code reusability and development efficiency.

[0078] In order to facilitate the understanding of the message type conversion method in the embodiments of the present application, the actual application process of the message type conversion method is described here.

[0079] The embodiments of the present application provide a message type conversion method, which can convert the customer archive information with various types such as files, pictures and voice based on a micro-service gateway, and the detailed steps are as follows:

[0080] 1. As shown in Figure 2 , a service provider (i.e. the storage server) registers a service to a service discovery registration center. In the archive retrieval scenario, the service provider mainly refers to the user archive storage cluster. It is necessary to register the service template file, service address and other related contents to the service discovery registration center.

[0081] 2. The micro-service gateway obtains the service template file registered in the service discovery registration center and parses it to automatically generate the field mapping relationship between the source object and the target object and store it in the storage medium of the micro-service gateway. In archive management, archive information is stored according to categories, and each category of archive has a standardized service template. The mapping relationship between the source object and the target object can be obtained according to the service template characteristics in the service template file. The customer archive information, such as the customer basic information containing the username, gender, birth date, etc., the customer communication record containing the connection base station information, start time, end time, call the opposite party, voice record, etc.

[0082] 3. The service consumer (i.e. the business server) subscribes to the service interface it needs and the corresponding interface response field. The service consumer selects the field information it needs from the mapping relationship of the target object parsed according to the service template characteristics, and if no selection is made, all field information in the default mapping relationship is returned.

[0083] 4. The microservice gateway configures different filter chains ModifyResponseBodyGatewayFilterFactory according to services, which can perform different message type conversions for different services in the subsequent. ModifyResponseBodyGatewayFilterFactory in the microservice gateway is based on the mapping relationship to write a custom RewriteFunction<T, R>, where T represents the source object information, corresponding to the customer profile information, including files, pictures, videos, audio, etc., and R represents the target object information, which can be a JSON object. Therefore, in the microservice gateway, no matter what type of data, it can be received through the Byte array stream, and after receiving the array stream, it is converted to the target type according to the conversion type configured by the request.

[0084] Exemplarily, for non-application / json, text / * file stream request content, such as application / octet-stream, image / jpeg type, ModifyRequestBodyGatewayFilterFactory and ModifyResponseBodyGatewayFilterFactory in the microservice gateway can be used to realize the conversion based on the custom RewriteFunction<T, R>.

[0085] The code of the above custom RewriteFunction<T, R> is as follows:

[0086] @Slf4j

[0087] public class CustomRewriteFunction implements RewriteFunction<byte[],byte[]>{

[0088] @Override

[0089] public Publisher<byte[]>apply(ServerWebExchange exchange,byte[]bytes){

[0090] if(ServerWebExchangeUtils.isAlreadyRouted(exchange)){

[0091] / / Response content conversion

[0092] / / Get the response type that the client can receive

[0093] List <mediatype>acceptType=

[0094] exchange.getRequest().getHeaders().getAccept();

[0095] / / Convert information

[0096] bytes=convert(bytes,acceptType);

[0097] }

[0098] return Mono.just(bytes);

[0099] }

[0100] }

[0101] 5. For example Figure 3 As shown, service consumers initiate service query requests (i.e., the aforementioned business requests) according to their own needs, including a unique customer identifier (i.e., the aforementioned user identifier).

[0102] 6. The microservice gateway queries the service address in the service registration and discovery center and calls the services provided by the customer profile management storage cluster (i.e., multiple service providers).

[0103] 7. After receiving the request, the customer file management storage cluster locates the customer file information stored in the storage medium (i.e., the target message mentioned above) based on the customer identifier.

[0104] 8. The microservice gateway receives customer profile information returned by the customer profile management storage cluster and, based on the configured RewriteFunction in ModifyResponseBodyGatewayFilterFactory,...<T,R> The customer profile information is converted to generate a JSON object in the target format (i.e., the target type message mentioned above).

[0105] 9. Service consumers receive JSON objects returned by the gateway, which can be used for related statistics and report generation.

[0106] In this embodiment of the application, when the service provider's service template file changes, the gateway will re-obtain the service template file and parse it, and automatically update the interface field information.

[0107] Based on the message type conversion method provided in the above embodiments, this application also provides specific implementation methods of the message type conversion device, please refer to the following embodiments.

[0108] like Figure 4 As shown, the message type conversion device 400 provided by the embodiment of the present application is applied to a micro-service gateway, and the device 400 can include the following modules: a first sending module 401, a receiving module 402, a conversion module 403, and a second sending module 404.

[0109] The first sending module 401 is configured to receive a service request sent by a service server, and send the service request to a storage server, wherein the service request includes a target user identifier, and the target user identifier uniquely corresponds to the identity of a target user.

[0110] The receiving module 402 is configured to receive a target message sent by the storage server, wherein the target message is a message corresponding to the target user identifier in the storage server, the storage server includes messages of multiple users, different user identifiers correspond to different messages, and the target message is array stream data.

[0111] The conversion module 403 is configured to perform type conversion on the target message according to a pre-stored mapping relationship, to generate a target type message of the target user, wherein the mapping relationship includes a corresponding relationship between array stream data of multiple source objects and array stream data of multiple target type objects.

[0112] The second sending module 404 is configured to send the target type message to the service server, so that the service server performs a target service corresponding to the service request according to the target type message.

[0113] The message type conversion device of the embodiment of the present application is applied to a micro-service gateway, can receive a service request sent by a service server, and send the service request to a storage server, wherein the service request includes a target user identifier, and the target user identifier uniquely corresponds to the identity of a target user; receive a target message sent by the storage server, wherein the target message is a message corresponding to the target user identifier in the storage server, the storage server includes messages of multiple users, different user identifiers correspond to different messages, and the target message is array stream data; perform type conversion on the target message according to a pre-stored mapping relationship, to generate a target type message of the target user, wherein the mapping relationship includes a corresponding relationship between array stream data of multiple source objects and array stream data of multiple target type objects; and send the target type message to the service server, so that the service server performs a target service corresponding to the service request according to the target type message. In this way, the embodiment of the present application can perform type conversion on a target message according to a mapping relationship between array stream data of multiple source objects and array stream data of multiple target type objects, to obtain a target type message, without limiting the type of the message, and achieving the message conversion requirement of diversified type source data.

[0114] As an implementation manner of the present application, in order to improve the efficiency of the service server in executing a target service, the above device 400 can further include:

[0115] The acquisition module is configured to acquire a plurality of service template files, the service template files including service template features, and different service template files corresponding to different categories of source objects.

[0116] The parsing module is configured to parse the service template features in the plurality of service template files to obtain array stream data of a plurality of source objects.

[0117] The generation module is configured to generate a mapping relationship corresponding to array stream data of a plurality of target type objects according to the array stream data of the plurality of source objects.

[0118] As another implementation form of the present application, in order to facilitate the maintenance of the mapping relationship, the apparatus 400 can further include:

[0119] The update module is configured to update field information in the mapping relationship in response to a change in the service template file.

[0120] In some embodiments, the micro-service gateway can include a service registration and discovery center, and the service registration and discovery center can include service addresses of storage servers.

[0121] The first sending module 401 can specifically include:

[0122] The receiving unit is configured to receive a service request sent by a service server.

[0123] The calling unit is configured to call a service address of a pre-registered storage server in the service registration and discovery center in response to the service request.

[0124] The sending unit is configured to send the service request to the storage server according to the service address.

[0125] In some embodiments, the storage server can include at least one storage sub-server, and different storage sub-servers include different categories of messages.

[0126] The receiving module 402 is specifically configured to receive at least one target message sent by at least one storage sub-server.

[0127] As still another implementation form of the present application, in order to improve code reusability and development efficiency, the apparatus 400 can further include:

[0128] The definition module is configured to define a function interface of the array stream data of the source object and the array stream data of the target type object according to the pre-stored mapping relationship.

[0129] The conversion module 403 can be further configured to perform type conversion on the target message according to the function interface to generate a target type message of a target user.

[0130] Figure 5 A hardware structure schematic diagram of an electronic device provided by an embodiment of the present application is shown.

[0131] The electronic device can include a processor 501 and a memory 502 storing computer program instructions.

[0132] Specifically, the processor 501 can include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement one or more embodiments of the present application.

[0133] The memory 502 can include a mass storage for data or instructions. By way of example and not limitation, the memory 502 can include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. The memory 502 can include removable or non-removable (or fixed) media, where appropriate. The memory 502 can be internal or external to the integrated gateway disaster recovery device, where appropriate. In certain embodiments, the memory 502 is non-volatile, solid-state memory.

[0134] In certain embodiments, the memory 502 can include read-only memory (ROM), random access memory (RAM), a magnetic disk storage medium, an optical storage medium, a flash memory device, an electrical, optical, or other physical / tangible memory storage device. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software that, when executed (by one or more processors), is operable to perform operations described with reference to the methods according to an aspect of the present disclosure.

[0135] The processor 501 implements any of the packet type conversion methods in the above embodiments by reading and executing the computer program instructions stored in the memory 502.

[0136] In one example, the electronic device can further include a communication interface 503 and a bus 510. As shown, the processor 501, the memory 502, and the communication interface 503 are connected through the bus 510 and complete communication therebetween. Figure 5

[0137] The communication interface 503 is mainly used to realize the communication between the modules, devices, units and / or equipment in the embodiments of the present application. ​

[0138] Bus 510 includes hardware, software, or both, to couple electronic devices to each other in a network. While Figure 5 illustrates a bus and multiple devices coupled in a network, the application contemplates a wider array of networking environments for the various configurations of the application. For example, wireless networks, Token Ring networks, and other types of networks could be used in addition to or in place of the bus. Bus 510 can include any of a variety of bus structures including, for example, a bus in accordance with Industry Standard Architecture (ISA), Extended ISA (EISA), Peripheral Component Interconnect (PCI), PCI-X, PCI-Express (PCI-X), serial bus, or any combination of these bus structures.

[0139] The electronic device can perform the packet type conversion method in the embodiments of the application, thereby realizing the packet type conversion method and device described in combination Figure 1 and Figure 4 with the above embodiments.

[0140] In addition, in combination with the packet type conversion method in the above embodiments, the embodiments of the application can provide a computer readable storage medium to realize. The computer readable storage medium has computer program instructions stored thereon; the computer program instructions are executed by a processor to realize any one of the packet type conversion methods in the above embodiments.

[0141] In combination with the packet type conversion method in the above embodiments, the embodiments of the application can provide a computer program product, instructions in the computer program product are executed by a processor of an electronic device, so that the electronic device executes the packet type conversion method in any one of the above.

[0142] It needs to be clear that the application is not limited to the specific configurations and processes described above and shown in the drawings. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between steps, after understanding the spirit of the application.

[0143] The functions noted in the description of the structural block diagrams above can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application specific integrated circuits (ASICs), appropriate firmware, plug-ins, functional cards, and the like. When implemented in software, the elements of the present application are program or code segments that are used to perform the required tasks. The program or code segments can be stored in a machine-readable medium or transmitted through a data signal carried in a carrier wave over a transmission medium or communication link. A "machine-readable medium" includes any medium that can store or transport information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, and the like. The code segments can be downloaded via computer networks such as the Internet, intranets, and the like.

[0144] It is also important to note that the examples mentioned in the present application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the steps mentioned above, that is, the steps can be performed in the order mentioned in the examples, or in an order different from the examples, or several steps can be performed simultaneously.

[0145] The computer program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other processing device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other processing device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer program instructions can also be stored in a computer readable medium that can direct a computer, other programmable data processing apparatus, or other processing device to operate in a particular manner, such that the instructions stored in the computer readable medium produce an article of manufacture including instructions which implement the function / act specified in the flowchart and / or block diagram block or blocks. The computer program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other processing device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other processing device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer program instructions can also be stored in a computer readable medium that can direct a computer, other programmable data processing apparatus, or other processing device to operate in a particular manner, such that the instructions stored in the computer readable medium produce an article of manufacture including instructions which implement the function / act specified in the flowchart and / or block diagram block or blocks.

[0146] The above merely describes a specific implementation of the present application. Those skilled in the art can clearly understand the specific working processes of the system, modules and units described above for the convenience and brevity of description, and can refer to the corresponding processes in the foregoing method embodiments, which will not be described herein again. It should be understood that the protection scope of the present application is not limited to this, and any person skilled in the art can easily think of various equivalent modifications or replacements within the technical range disclosed by the present application, and these modifications or replacements should be covered within the protection scope of the present application.< / mediatype>

Claims

1. A method for message type conversion, characterized by, The method applied to a micro-service gateway comprises: receiving a service request sent by a service server and sending the service request to a storage server, the service request comprising a target user identifier uniquely corresponding to the identity of a target user; receiving a target message sent by the storage server, the target message being a message corresponding to the target user identifier in the storage server, the storage server comprising messages of a plurality of users, different user identifiers corresponding to different messages, and the target message being array stream data; performing type conversion on the target message according to a pre-stored mapping relationship to generate a target type message of the target user, the mapping relationship comprising a corresponding relationship between array stream data of a plurality of source objects and array stream data of a plurality of target type objects; sending the target type message to the service server to enable the service server to perform a target service corresponding to the service request according to the target type message.

2. The method of claim 1, wherein, Before the type conversion on the target message according to the pre-stored mapping relationship to generate the target type message of the target user, the method further comprises: obtaining a plurality of service template files, the service template files comprising service template features, different service template files corresponding to different categories of source objects; parsing the service template features in the plurality of service template files to obtain array stream data of the plurality of source objects; generating a mapping relationship between array stream data of a plurality of target type objects according to the array stream data of the plurality of source objects.

3. The method of claim 2, wherein, After the generation of the mapping relationship between array stream data of a plurality of target type objects according to the array stream data of the plurality of source objects, the method further comprises: updating field information in the mapping relationship in response to changes in the service template files.

4. The method of claim 1, wherein, The micro-service gateway comprises a service registration and discovery center, the service registration and discovery center comprising service addresses of the storage server; The receiving of the service request sent by the service server and the sending of the service request to the storage server comprise: receiving a service request sent by a service server; in response to the service request, invoking a pre-registered service address of the storage server in the service registration and discovery center; sending the service request to the storage server according to the service address.

5. The method of claim 1, wherein, The storage server comprises at least one storage sub-server, different storage sub-servers comprising different categories of messages; The receiving of the target message sent by the storage server comprises: receiving at least one target message sent by the at least one storage sub-server.

6. The method of claim 1, wherein, Before the type conversion on the target message according to the pre-stored mapping relationship to generate the target type message of the target user, the method further comprises: defining a function interface of the array stream data of the source objects and the array stream data of the target type objects according to a pre-stored mapping relationship; The type conversion on the target message according to the pre-stored mapping relationship to generate the target type message of the target user comprises: The target message is type-converted according to the function interface to generate a target type message of the target user.

7. A packet type conversion apparatus characterized by comprising: The device is applied to a micro-service gateway, and the device comprises: A first sending module is configured to receive a service request sent by a service server and send the service request to a storage server, wherein the service request comprises a target user identifier, and the target user identifier uniquely corresponds to an identity of a target user; A receiving module is configured to receive a target message sent by the storage server, wherein the target message is a message corresponding to the target user identifier in the storage server, the storage server comprises messages of a plurality of users, different user identifiers correspond to different messages, and the target message is array stream data; A conversion module is configured to type-convert the target message according to a pre-stored mapping relationship to generate a target type message of the target user, wherein the mapping relationship comprises a corresponding relationship between array stream data of a plurality of source objects and array stream data of a plurality of target type objects; A second sending module is configured to send the target type message to the service server, so that the service server executes a target service corresponding to the service request according to the target type message.

8. An electronic device, comprising: The device comprises a processor and a memory storing computer program instructions; and the processor implements the message type conversion method according to any one of claims 1-6 when executing the computer program instructions.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer program instructions, and the computer program instructions are executed by the processor to implement the message type conversion method according to any one of claims 1-6.

10. A computer program product, characterised in that, The instructions in the computer program product are executed by the processor of the electronic device, so that the electronic device can execute the message type conversion method according to any one of claims 1-6.

Citation Information

Patent Citations

  • File content extraction method, device and apparatus, and computer readable storage medium

    CN109710894A

  • Data processing method and device, storage medium and program product

    CN114328482A