Context data reading and writing method, reading and writing device, processor and business system
By writing the data of the request message to the storage area of the context according to the shared data type and the non-shared data type, and only including shared data in the response message, the problem that context data reading and writing in the prior art cannot ensure data security, and the effect of data security and visible range control is achieved.
Patent Information
- Application Number
- CN202111631104.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2041-12-28
AI Technical Summary
In the prior art, the reading and writing methods of context data cannot ensure data security and cannot meet the requirements of only partial data being passed, and different data having different visible ranges.
By receiving the request message and dividing it into multiple data parts according to the data type, it is written to the shared data area and the non-shared data area respectively, and only the data of the shared data area is included in the response message to prevent non-shared data leakage.
Improve data security, ensure that non-shared data will not be leaked, and meet the needs of different data with different visible ranges.
Smart Images

Figure CN114297709B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of reading and writing, and in particular, to a context data reading and writing method, a reading and writing device, a computer-readable storage medium, a processor and a business system. Background Art
[0002] At present, the industry generally uses a Map data structure for context. Data is placed in the Map in the form of key-value pairs. The Map is bound to the current thread to achieve data sharing within the same thread. When context data is needed to assemble request and response messages, all data in the context is placed in the message.
[0003] In current transaction application scenarios, text-based data messages are commonly used to transmit requests. The backend service parses the request message, verifies the data, processes and calculates it, and then assembles the response message to return. Backend services are often not simple local calculations, but coarse-grained composite services formed by combining multiple atomic services through service orchestration. In the service orchestration scenario, there is a need for data transmission and sharing, that is, the data is cached in the context data area after calculation and processing, and data sharing is achieved within a certain range. When the composite service calls the atomic service, it needs to use the data in the context to assemble the request message. After the data is processed and calculated, it needs to use the data in the context to assemble the response message to return.
[0004] The existing technical solution has a single structure, and all data are put together. From the data structure point of view, all data are homogeneous, and the data life cycle is exactly the same. When using the context to assemble request messages and response messages, all data are transmitted together. It cannot meet the needs of only transmitting part of the data and having different visible ranges for different data.
[0005] The above information disclosed in the background technology section is only used to enhance the understanding of the background technology of the technology described in this article. Therefore, the background technology may contain certain information that does not form the prior art known in this country for those skilled in the art. Summary of the invention
[0006] The main purpose of the present application is to provide a context data reading and writing method, a reading and writing device, a computer-readable storage medium, a processor and a business system to solve the problem that the context data reading and writing method in the prior art cannot ensure data security.
[0007] According to one aspect of an embodiment of the present invention, a method for reading and writing context data is provided, comprising: receiving a first request message, and dividing the data of the first request message into multiple data parts according to a data type, the data type corresponding one-to-one to a storage area of a first context, the data type including a shared data type and a non-shared data type; writing the multiple data parts into a storage area corresponding to the first context; processing the data of the first context; reading the data of the storage area of the first context corresponding to the shared data type, and writing the read data into a response message to generate a first response message.
[0008] Optionally, a first request message is received, and data of the first request message is divided into multiple data parts according to data types, and the data types correspond one-to-one to the storage area of the first context, including: dividing the data of the first request message into a first data part, a second data part and a third data part, the first data part is data in a message header of the first request message, the second data part is sharable data in a message body of the first request message, and the third data part is non-shared data in the message body of the first request message, and the storage area of the first context includes a first public domain, a first shared domain and a first private domain, the first public domain is the storage area corresponding to the data type of the first data part, the first public domain is the storage area corresponding to the data type of the second data part, and the first private domain is the storage area corresponding to the data type of the third data part.
[0009] Optionally, writing the plurality of data portions into the storage area corresponding to the first context includes: writing the first data portion into the first public domain, writing the second data portion into the first shared domain, and writing the third data portion into the first private domain.
[0010] Optionally, data in the storage area of the first context corresponding to the shared data type is read, and the read data is written into a response message to generate a first response message, including: writing the first public domain into a message header of the response message, and writing the data of the first shared domain into a message body of the response message to generate the first response message.
[0011] Optionally, after writing multiple data parts into the storage area corresponding to the first context, the method also includes: when the service receiving the first request message is a combined service, reading the data of the first public domain and the first shared domain and writing the read data into a second request message; sending the second request message to the atomic service of the combined service; receiving a second response message from the atomic service, the second response message being a response message generated by the atomic service after processing the second request message; updating the data of the message body of the second response message to the first public domain, and updating the data of the message header of the second response message to the first shared domain.
[0012] Optionally, the second response message is a response message generated by the atomic service when processing the second request message, and the process includes: the atomic service divides the data of the second request message into fourth data and fifth data, the fourth data is the data of the message header of the second request message, and the fifth data is the message body data of the second request message, and the storage area of the second context corresponding to the atomic service includes a second public domain, a second shared domain and a second private domain; the atomic service writes the fourth data into the corresponding second public domain, and writes the fifth data into the corresponding second shared domain; the atomic service processes the data of the second context; writes the data of the second public domain into the message header of the response message, and writes the data of the second shared domain into the message body of the response message, to generate the second response message.
[0013] According to another aspect of an embodiment of the present invention, a context data reading and writing device is also provided, including: a first receiving unit, used to receive a first request message, and divide the data of the first request message into multiple data parts according to a data type, the data type corresponds one-to-one to a storage area of a first context, and the data type includes a shared data type and a non-shared data type; a writing unit, used to write the multiple data parts into a corresponding storage area of the first context; a processing unit, used to process the data of the first context; and a generating unit, used to read the data of the storage area of the first context corresponding to the shared data type, and write the read data into a response message to generate a first response message.
[0014] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein the program executes any one of the methods described.
[0015] According to yet another aspect of the embodiments of the present invention, a processor is provided, wherein the processor is used to run a program, wherein any one of the methods is executed when the program is run.
[0016] According to one aspect of an embodiment of the present invention, a business system is further provided, including a service and a context data reading and writing device, one service corresponds to one context, and the context data reading and writing device executes any one of the methods described.
[0017] In an embodiment of the present invention, in the above-mentioned context data reading and writing method, first, a first request message is received and the data of the above-mentioned first request message is divided into multiple data according to the data type, the above-mentioned data type corresponds to the storage area of the first context one by one, and the above-mentioned data type includes a shared data type and a non-shared data type; then, the multiple data are written into the corresponding storage area of the above-mentioned first context; thereafter, the data of the above-mentioned first context is processed; finally, the data of the storage area of the above-mentioned first context corresponding to the above-mentioned shared data is read, and the read data is written into the response message to generate a first response message. The method writes the data of the first request message into different storage areas of the first context according to the shared data type and the non-shared data type, and generates the first response message using the processed shared data, so that the generated first response message does not contain data of the non-shared data type, so as to prevent the leakage of data of the non-shared data type. Compared with the prior art, when the context data is needed to assemble the request message and the response message, all the data in the context is put into the message, which improves the data security and solves the problem that the context data reading and writing method in the prior art cannot ensure data security. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] Figure 1 A schematic diagram showing a method for reading and writing context data according to an embodiment of the present application is shown;
[0020] Figure 2 A schematic diagram showing a context data reading and writing device according to an embodiment of the present application is shown;
[0021] Figure 3 A schematic diagram showing the mapping relationship between different data areas in a context and a message according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0022] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0023] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0026] Map: a container that stores elements by key;
[0027] Context: In programming, a memory area where data can be freely stored and accessed by the program.
[0028] Atomic service: A service used to implement a specific business logic and can be deployed independently.
[0029] Service orchestration: Arrange and combine one or more atomic services in a certain order to form a coarser-grained service.
[0030] Composite service: Add common pre-processing logic and common post-processing logic based on service orchestration, which can be deployed independently.
[0031] As mentioned in the background technology, the context data reading and writing methods in the prior art cannot ensure data security. In order to solve the above problem, in a typical implementation of the present application, a context data reading and writing method, a reading and writing device, a computer-readable storage medium, a processor and a business system are provided.
[0032] According to an embodiment of the present application, a method for reading and writing context data is provided.
[0033] Figure 1 is a flow chart of a method for reading and writing context data according to an embodiment of the present application. Figure 1As shown, the method comprises the following steps:
[0034] Step S101, receiving a first request message, and dividing the data of the first request message into a plurality of data parts according to data types, wherein the data types correspond one-to-one to storage areas of a first context, and the data types include shared data types and non-shared data types;
[0035] Step S102, writing the plurality of data parts into the storage area corresponding to the first context;
[0036] Step S103, processing the data of the first context;
[0037] Step S104 , reading data from the storage area of the first context corresponding to the shared data type, and writing the read data into a response message to generate a first response message.
[0038] In the above-mentioned method for reading and writing context data, first, a first request message is received and the data of the above-mentioned first request message is divided into multiple data according to the data type, the above-mentioned data type corresponds to the storage area of the first context one by one, and the above-mentioned data type includes a shared data type and a non-shared data type; then, the multiple data are written into the corresponding storage area of the above-mentioned first context; thereafter, the data of the above-mentioned first context is processed; finally, the data of the storage area of the above-mentioned first context corresponding to the above-mentioned shared data is read, and the read data is written into the response message to generate a first response message. The method writes the data of the first request message into different storage areas of the first context according to the shared data type and the non-shared data type, and generates the first response message using the processed shared data, so that the generated first response message does not contain data of the non-shared data type, so as to prevent the leakage of data of the non-shared data type. Compared with the prior art, when the context data is needed to assemble the request message and the response message, all the data in the context is put into the message, which improves data security and solves the problem that the method for reading and writing context data in the prior art cannot ensure data security.
[0039] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0040] In one embodiment of the present application, a first request message is received, and data of the first request message is divided into multiple data parts according to data types, and the data types correspond one-to-one to storage areas of the first context, including: dividing the data of the first request message into a first data part, a second data part and a third data part, the first data part is data of a message header of the first request message, the second data part is sharable data of a message body of the first request message, the third data part is non-shared data of a message body of the first request message, and the storage area of the first context includes a first public domain, a first shared domain and a first private domain, the first public domain is the storage area corresponding to the data type of the first data part, the first public domain is the storage area corresponding to the data type of the second data part, and the first private domain is the storage area corresponding to the data type of the third data part. In this embodiment, for the above-mentioned first request message received, the data of the above-mentioned first request message is divided into three parts, namely, a first data part, a second data part and a third data part, and the first data part, the second data part and the third data part are stored in the first public domain, the first shared domain and the first private domain respectively. That is, this scheme stores the sharable data and the non-shared data separately by placing the divided data into different areas, and the non-shared data will not be included when the response message is generated subsequently, which further ensures that the non-shared data will not be leaked, and further ensures the high security of the data.
[0041] In order to further ensure the high security of data, in another embodiment of the present application, multiple data parts are written into the storage area corresponding to the first context, including: writing the first data part into the first public domain, writing the second data part into the first shared domain, and writing the third data part into the first private domain.
[0042] In another embodiment of the present application, the data in the storage area of the first context corresponding to the shared data type is read, and the read data is written into a response message to generate a first response message, including: writing the first public domain into the message header of the response message, and writing the data of the first shared domain into the message body of the response message to generate the first response message. In this scheme, the first public domain is written into the message header of the response message, and the data of the first shared domain is written into the message body of the response message to obtain the first response message, so that data sharing is realized within a certain range, and non-shared data is further guaranteed not to be written into the first response message, which further solves the problem that the context data reading and writing method in the prior art cannot ensure data security.
[0043] In another embodiment of the present application, after writing the multiple data parts into the storage area corresponding to the first context, the method further includes: in a case where the service receiving the first request message is a combined service, reading the data of the first public domain and the first shared domain and writing the read data into a second request message; sending the second request message to the atomic service of the combined service; receiving a second response message of the atomic service, wherein the second response message is a response message generated by the atomic service after processing the second request message; updating the data of the message header of the second response message to the first public domain, and updating the data of the message body of the second response message to the first shared domain. In this embodiment, after the atomic service receives the second request message sent by the composite service, the atomic service generates a second response message and sends the second response message to the composite service. After receiving the second response message, the composite service updates the data of the message header of the second response message to the first public domain, and updates the data of the message body of the second response message to the first shared domain, thereby realizing the transfer and mapping of sharable data between the composite service and the atomic service, further ensuring that non-shared data will not be leaked, and further ensuring the high security of the data.
[0044] In one embodiment of the present application, the second response message is a process in which the atomic service processes the second request message and generates a response message, including: the atomic service divides the data of the second request message into fourth data and fifth data, the fourth data is the data of the message header of the second request message, the fifth data is the message body data of the second request message, and the storage area of the second context corresponding to the atomic service includes the second public domain, the second shared domain and the second private domain; the atomic service writes the fourth data into the corresponding second public domain, and writes the fifth data into the corresponding second shared domain; the atomic service processes the data of the second context; writes the data of the second public domain into the message header of the response message, and writes the data of the second shared domain into the message body of the response message, to generate the second response message. Since the second request message received by the atomic service only includes the data of the first public domain and the first shared domain, and does not include the data of the first private domain, the context processed by the atomic service and the response message generated do not include the data of the first private domain, which can ensure that the atomic service cannot view the data of the first private domain of the composite service, and ensure that the non-shared data of the composite service will not be leaked.
[0045] The present application also provides a context data reading and writing device. It should be noted that the context data reading and writing device of the present application can be used to execute the context data reading and writing method provided by the present application. The context data reading and writing device provided by the present application is introduced below.
[0046] Figure 2 Schematic diagram of a context data reading and writing device according to an embodiment of the present application. Figure 2 As shown, the device comprises:
[0047] A first receiving unit 10 is used to receive a first request message, and divide the data of the first request message into a plurality of data parts according to data types, wherein the data types correspond to storage areas of the first context one by one, and the data types include shared data types and non-shared data types;
[0048] A writing unit 20, used for writing the plurality of data parts into a storage area corresponding to the first context;
[0049] A processing unit 30, configured to process the data of the first context;
[0050] The generating unit 40 is configured to read data from the storage area of the first context corresponding to the shared data type, and write the read data into a response message to generate a first response message.
[0051] In the context data reading and writing device, the first receiving unit is used to receive the first request message, and divide the data of the first request message into multiple data parts according to the data type, the data type corresponds to the storage area of the first context one by one, and the data type includes a shared data type and a non-shared data type; the writing unit is used to write the multiple data parts into the corresponding storage area of the first context; the processing unit is used to process the data of the first context; the generating unit is used to read the data of the storage area of the first context corresponding to the shared data type, and write the read data into the response message to generate the first response message. The device writes the data of the first request message into different storage areas of the first context according to the shared data type and the non-shared data type, and generates the first response message using the processed shared data, so that the generated first response message does not contain the data of the non-shared data type, so as to prevent the leakage of the data of the non-shared data type. Compared with the prior art, when the context data is needed to assemble the request message and the response message, all the data in the context is put into the message, which improves the data security and solves the problem that the context data reading and writing method in the prior art cannot ensure the data security.
[0052] In one embodiment of the present application, the first receiving unit includes a first division module, which is used to divide the data of the first request message into a first data part, a second data part and a third data part, the first data part is the data of the message header of the first request message, the second data part is the sharable data of the message body of the first request message, and the third data part is the non-shared data of the message body of the first request message. The storage area of the first context includes a first public domain, a first shared domain and a first private domain. The first public domain is the storage area corresponding to the data type of the first data part, the first public domain is the storage area corresponding to the data type of the second data part, and the first private domain is the storage area corresponding to the data type of the third data part. In this embodiment, for the above-mentioned first request message received, the data of the above-mentioned first request message is divided into three parts, namely, a first data part, a second data part and a third data part, and the first data part, the second data part and the third data part are stored in the first public domain, the first shared domain and the first private domain respectively. That is, this scheme stores the sharable data and the non-shared data separately by placing the divided data into different areas, and the non-shared data will not be included when the response message is generated subsequently, which further ensures that the non-shared data will not be leaked, and further ensures the high security of the data.
[0053] In order to further ensure the high security of data, in another embodiment of the present application, the above-mentioned writing unit includes a first writing module, which is used to write the above-mentioned first data part into the above-mentioned first public domain, write the above-mentioned second data part into the above-mentioned first shared domain, and write the above-mentioned third data part into the above-mentioned first private domain.
[0054] In another embodiment of the present application, the generation unit includes a first generation module, which is used to write the first public domain into the message header of the response message, write the data of the first shared domain into the message body of the response message, and generate the first response message. In this scheme, the first public domain is written into the message header of the response message, and the data of the first shared domain is written into the message body of the response message to obtain the first response message, so that data sharing is realized within a certain range, and non-shared data is further guaranteed not to be written into the first response message, which further solves the problem that the reading and writing methods of context data in the prior art cannot ensure data security.
[0055] In another embodiment of the present application, after writing the multiple data parts into the storage area corresponding to the first context, the device also includes a reading unit, a sending unit, a second receiving unit and an updating unit, wherein the reading unit is used to read the data of the first public domain and the first shared domain and write the read data into the second request message when the service receiving the first request message is a combined service; the sending unit is used to send the second request message to the atomic service of the combined service; the second receiving unit is used to receive a second response message of the atomic service, and the second response message is a response message generated by the atomic service after processing the second request message; the updating unit updates the data of the message header of the second response message to the first public domain, and updates the data of the message body of the second response message to the first shared domain. In this embodiment, after the atomic service receives the second request message sent by the composite service, the atomic service generates a second response message and sends the second response message to the composite service. After receiving the second response message, the composite service updates the data of the message header of the second response message to the first public domain, and updates the data of the message body of the second response message to the first shared domain, thereby realizing the transfer and mapping of sharable data between the composite service and the atomic service, further ensuring that non-shared data will not be leaked, and further ensuring the high security of the data.
[0056] In one embodiment of the present application, the second receiving unit includes a second division module, a second writing module, a processing module and a second generation module, wherein the second division module is used for the atomic service to divide the data of the second request message into fourth data and fifth data, the fourth data is the data of the message header of the second request message, and the fifth data is the message body data of the second request message, and the storage area of the second context corresponding to the atomic service includes a second public domain, a second shared domain and a second private domain; the second writing module is used for the atomic service to write the fourth data into the corresponding second public domain, and write the fifth data into the corresponding second shared domain; the processing module is used for the atomic service to process the data of the second context; the second generation module is used to write the data of the second public domain into the message header of the response message, and write the data of the second shared domain into the message body of the response message, to generate the second response message. Since the second request message received by the atomic service only includes the data of the first public domain and the first shared domain, but does not include the data of the first private domain, the context processed by the atomic service and the generated response message do not include the data of the first private domain. This ensures that the atomic service cannot view the data of the first private domain of the composite service, and ensures that the non-shared data of the composite service will not be leaked.
[0057] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the following will be described in conjunction with specific embodiments:
[0058] Example
[0059] like Figure 3 As shown, it is a mapping relationship diagram between different data areas of the context and the message. After receiving the first request message, the composite service divides the data of the first request message into the first data part, the second data part and the third data part, writes the request header (first data part) of the first request message to the first public domain of the storage area of the first context, writes the request body (second data part) of the first request message to the first shared domain of the storage area of the first context, and writes the data visible only in this service (third data part) to the first private domain of the storage area of the first context. When calling the atomic service, the composite service uses the first context structure of the composite service, writes the data stored in the first public domain of the first context to the request header of the second request message, and writes the data stored in the first shared domain of the first context to the request body of the second request message. After receiving the second request message sent by the composite service, the atomic service obtains the request header (i.e., the fourth data) and the request body (i.e., the fifth data) from the second request message, and writes the message header in the second request message to the second public domain of the storage area of the second context, and writes the request body in the second request message to the second shared domain of the storage area of the second context. During the atomic service processing, the data of the second context can be processed. After the atomic service processing is completed, the data of the second public domain is written into the response header of the second response message, and the data of the second shared domain is written into the response body of the second response message to generate the second response message. After the composite service obtains the second response message of the atomic service, it reads the data of the second public domain and the second shared domain from the second response message, and overwrites the storage area of the first context corresponding to the local composite service.
[0060] The context data reading and writing device includes a processor and a memory. The first receiving unit, writing unit, processing unit and generating unit are all stored in the memory as program units. The processor executes the program units stored in the memory to implement corresponding functions.
[0061] The processor includes a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to one or more, and the problem that the reading and writing method of context data in the prior art cannot ensure data security can be solved by adjusting the kernel parameters.
[0062] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0063] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the method for reading and writing context data is implemented.
[0064] An embodiment of the present invention provides a processor, and the processor is used to run a program, wherein the method for reading and writing context data is executed when the program is running.
[0065] In a typical embodiment of the present application, a business system is further provided, including a service and a context data reading and writing device, one service corresponds to one context, and the context data reading and writing device executes any one of the above methods.
[0066] The business system includes a service and a context data reading and writing device, one service corresponds to one context, and the context data reading and writing device performs any one of the above methods. In the above method, first, a first request message is received and the data of the first request message is divided into multiple data according to the data type, the data type corresponds to the storage area of the first context one by one, and the data type includes a shared data type and a non-shared data type; then, the multiple data are written into the corresponding storage area of the first context; then, the data of the first context is processed; finally, the data of the storage area of the first context corresponding to the shared data is read, and the read data is written into a response message to generate a first response message. The method writes the data of the first request message into different storage areas of the first context according to the shared data type and the non-shared data type, and generates the first response message using the processed shared data, so that the generated first response message does not contain data of the non-shared data type, so as to prevent the leakage of the non-shared data type. Compared with the prior art, when the context data is needed to assemble the request message and the response message, all the data in the context is put into the message, which improves the data security and solves the problem that the context data reading and writing method in the prior art cannot ensure data security.
[0067] An embodiment of the present invention provides a device, the device comprising a processor, a memory, and a program stored in the memory and executable on the processor, and when the processor executes the program, at least the following steps are implemented:
[0068] Step S101, receiving a first request message, and dividing the data of the first request message into a plurality of data parts according to data types, wherein the data types correspond one-to-one to storage areas of a first context, and the data types include shared data types and non-shared data types;
[0069] Step S102, writing the plurality of data parts into the storage area corresponding to the first context;
[0070] Step S103, processing the data of the first context;
[0071] Step S104 , reading data from the storage area of the first context corresponding to the shared data type, and writing the read data into a response message to generate a first response message.
[0072] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0073] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing at least the following method steps:
[0074] Step S101, receiving a first request message, and dividing the data of the first request message into a plurality of data parts according to data types, wherein the data types correspond one-to-one to storage areas of a first context, and the data types include shared data types and non-shared data types;
[0075] Step S102, writing the plurality of data parts into the storage area corresponding to the first context;
[0076] Step S103, processing the data of the first context;
[0077] Step S104 , reading data from the storage area of the first context corresponding to the shared data type, and writing the read data into a response message to generate a first response message.
[0078] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0079] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the above-mentioned units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0080] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0081] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0082] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a computer-readable storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present invention. The aforementioned computer-readable storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0083] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
[0084] 1) In the context data reading and writing method of the present application, first, a first request message is received and the data of the first request message is divided into multiple data according to the data type, the data type corresponds to the storage area of the first context one by one, and the data type includes a shared data type and a non-shared data type; then, the multiple data are written into the corresponding storage area of the first context; thereafter, the data of the first context is processed; finally, the data of the storage area of the first context corresponding to the shared data is read, and the read data is written into the response message to generate a first response message. The method writes the data of the first request message into different storage areas of the first context according to the shared data type and the non-shared data type, and generates the first response message using the processed shared data, so that the generated first response message does not contain data of the non-shared data type, so as to prevent the leakage of the non-shared data type. Compared with the prior art, when the context data is needed to assemble the request message and the response message, all the data in the context is put into the message, which improves the data security and solves the problem that the context data reading and writing method in the prior art cannot ensure the data security.
[0085] 2) In the context data reading and writing device of the present application, the first receiving unit is used to receive the first request message, and divide the data of the first request message into multiple data parts according to the data type, the data type corresponds to the storage area of the first context one by one, and the data type includes a shared data type and a non-shared data type; the writing unit is used to write the multiple data parts into the corresponding storage area of the first context; the processing unit is used to process the data of the first context; the generating unit is used to read the data of the storage area of the first context corresponding to the shared data type, and write the read data into the response message to generate the first response message. The device writes the data of the first request message into different storage areas of the first context according to the shared data type and the non-shared data type, and generates the first response message using the processed shared data, so that the generated first response message does not contain the data of the non-shared data type, so as to prevent the leakage of the data of the non-shared data type. Compared with the prior art, when the context data is needed to assemble the request message and the response message, all the data in the context is put into the message, which improves the data security and solves the problem that the context data reading and writing method in the prior art cannot ensure the data security.
[0086] 3) In the business system of the present application, a service and context data reading and writing device are included, one service corresponds to one context, and the context data reading and writing device performs any one of the above methods. In the above method, first, a first request message is received and the data of the first request message is divided into multiple data according to the data type, the data type corresponds to the storage area of the first context one by one, and the data type includes a shared data type and a non-shared data type; then, the multiple data are written into the corresponding storage area of the first context; thereafter, the data of the first context is processed; finally, the data of the storage area of the first context corresponding to the shared data is read, and the read data is written into the response message to generate a first response message. The method writes the data of the first request message into different storage areas of the first context according to the shared data type and the non-shared data type, and generates the first response message using the processed shared data, so that the generated first response message does not contain data of the non-shared data type to prevent the leakage of the non-shared data type. Compared with the prior art, when the context data is needed to assemble the request message and the response message, all the data in the context is put into the message, which improves the data security and solves the problem that the context data reading and writing method in the prior art cannot ensure data security.
[0087] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for reading and writing context data, characterized in that: include: receiving a first request message, and dividing data of the first request message into a plurality of data parts according to data types, wherein the data types correspond one-to-one to storage areas of the first context, and the data types include shared data types and non-shared data types; writing a plurality of the data portions into a storage area corresponding to the first context; Processing the data of the first context; Reading data from a storage area of the first context corresponding to the shared data type, and writing the read data into a response message to generate a first response message; Receive a first request message, and divide the data of the first request message into multiple data parts according to the data type, and the data type corresponds to the storage area of the first context one by one, including: dividing the data of the first request message into a first data part, a second data part and a third data part, the first data part is the data of the message header of the first request message, the second data part is the sharable data of the message body of the first request message, and the third data part is the non-shared data of the message body of the first request message, and the storage area of the first context includes a first public domain, a first shared domain and a first private domain, the first public domain is the storage area corresponding to the data type of the first data part, the first shared domain is the storage area corresponding to the data type of the second data part, and the first private domain is the storage area corresponding to the data type of the third data part; Writing the plurality of data parts into the storage area corresponding to the first context includes: writing the first data part into the first public domain, writing the second data part into the first shared domain, and writing the third data part into the first private domain; Reading data from the storage area of the first context corresponding to the shared data type, and writing the read data into a response message to generate a first response message, including: writing the first public domain into a message header of the response message, writing the data of the first shared domain into a message body of the response message, to generate the first response message.
2. The method according to claim 1, characterized in that After writing the plurality of data portions into the storage area corresponding to the first context, the method further comprises: In a case where the service receiving the first request message is a combined service, reading data from the first public domain and the first shared domain and writing the read data into a second request message; Sending the second request message to the atomic service of the composite service; Receive a second response message from the atomic service, where the second response message is a response message generated by the atomic service after processing the second request message; The data of the message header of the second response message is updated to the first public domain, and the data of the message body of the second response message is updated to the first shared domain.
3. The method according to claim 2, characterized in that The process of generating a response message by the atomic service processing the second request message includes: The atomic service divides the data of the second request message into fourth data and fifth data, the fourth data is the data of the message header of the second request message, the fifth data is the message body data of the second request message, and the storage area of the second context corresponding to the atomic service includes a second public domain, a second shared domain and a second private domain; The atomic service writes the fourth data into the corresponding second public domain, and writes the fifth data into the corresponding second shared domain; The atomic service processes the data of the second context; The data in the second public domain is written into a message header of a response message, and the data in the second shared domain is written into a message body of the response message, so as to generate the second response message.
4. A context data reading and writing device, characterized in that: include: A first receiving unit, configured to receive a first request message, and divide data of the first request message into a plurality of data parts according to a data type, wherein the data type corresponds one-to-one to a storage area of a first context, and the data type includes a shared data type and a non-shared data type; A writing unit, used for writing the plurality of data parts into a storage area corresponding to the first context; A processing unit, used for processing the data of the first context; A generating unit, configured to read data from a storage area of the first context corresponding to the shared data type, and write the read data into a response message to generate a first response message; The first receiving unit includes a first dividing module, which is used to divide the data of the first request message into a first data part, a second data part and a third data part, the first data part is the data of the message header of the first request message, the second data part is the sharable data of the message body of the first request message, and the third data part is the non-shared data of the message body of the first request message. The storage area of the first context includes a first public domain, a first shared domain and a first private domain, the first public domain is the storage area corresponding to the data type of the first data part, the first shared domain is the storage area corresponding to the data type of the second data part, and the first private domain is the storage area corresponding to the data type of the third data part; The writing unit comprises a first writing module, configured to write the first data portion into the first public domain, write the second data portion into the first shared domain, and write the third data portion into the first private domain; The generating unit includes a first generating module, which is used to write the first public domain into a message header of a response message, write the data of the first shared domain into a message body of the response message, and generate the first response message.
5. A computer-readable storage medium, characterized in that: A computer program is stored thereon, characterized in that when the computer program is executed by a processor, the method described in any one of claims 1 to 3 is implemented.
6. A business system, comprising a device for reading and writing service and context data, wherein one service corresponds to one context, characterized in that: The context data reading and writing device executes the method described in any one of claims 1 to 3.
Citation Information
Patent Citations
Method and device for optimizing data link layer message
CN108234393A
Context data control
CN109154895A