CN110764930A - Request or response processing method and device based on message mode - Google Patents

Request or response processing method and device based on message mode Download PDF

Info

Publication number
CN110764930A
CN110764930A CN201910999363.3A CN201910999363A CN110764930A CN 110764930 A CN110764930 A CN 110764930A CN 201910999363 A CN201910999363 A CN 201910999363A CN 110764930 A CN110764930 A CN 110764930A
Authority
CN
China
Prior art keywords
message
target
request message
context data
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910999363.3A
Other languages
Chinese (zh)
Other versions
CN110764930B (en
Inventor
王明
张海洋
李鹏
王步放
王海
段锴
崔华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Travelsky Technology Co Ltd
Original Assignee
China Travelsky Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Travelsky Technology Co Ltd filed Critical China Travelsky Technology Co Ltd
Priority to CN201910999363.3A priority Critical patent/CN110764930B/en
Publication of CN110764930A publication Critical patent/CN110764930A/en
Application granted granted Critical
Publication of CN110764930B publication Critical patent/CN110764930B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Abstract

The application discloses a request or response processing method and a device based on a message mode, wherein a processing process in a business service system does not synchronously wait for a response after initiating asynchronous call to a service provider, but acquires a new message as a target message to be processed currently, and executes the request or response processing method based on the message mode for the newly determined target message; and after the asynchronous response message comes back, performing service processing. In this way, the throughput of the business service system can be improved.

Description

Request or response processing method and device based on message mode
Technical Field
The present application relates to the field of communications technologies, and in particular, to a request or response processing method and apparatus based on a message mode.
Background
With the expansion of enterprise plates, the increase of business services and the development of internet technology, an enterprise system platform is gradually split into a plurality of business service systems by a centralized single system according to service contents, and compared with the interaction among the modules in the centralized single system, the interaction among the business service systems is more complex. Currently, if a business service system needs to Call other business service systems in the process of processing a certain business request, the business service system is realized by a processing process based on RPC (remote procedure Call) synchronous Call.
However, in some scenarios, the response time of the RPC synchronous call is long, for example, when the service system a needs to synchronously call the service system B and the service system C in the process of processing a certain service request, the response time of the service system B is 2 seconds, the response time of the service system C is 3 seconds, the response time of the RPC synchronous call is 5 seconds, and in this time period, the processing process for processing the service request is in a state of waiting for a response, and cannot process other service requests, and therefore, the throughput of the service system a is affected.
Therefore, how to improve the throughput of the service system becomes a technical problem to be solved by a person skilled in the art.
Disclosure of Invention
In view of the above, the present application is proposed to provide a request or response processing method and apparatus based on a message mode that overcomes or at least partially solves the above problems. The specific scheme is as follows:
a request or reply processing method based on a message mode, the method comprising:
acquiring a target message to be processed currently;
determining attributes of the target message;
when the target message is a request message, determining a service provider corresponding to the request message, generating context data corresponding to the request message, storing the context data, initiating asynchronous call to the service provider, acquiring a new message as the target message to be processed currently, returning to execute the step of determining the attribute of the target message and sequentially executing subsequent steps;
when the target message is a response message, determining a target request message corresponding to the response message, acquiring target context data corresponding to the target request message, judging whether the response message is the last response message of the target request message according to the target context data, if so, deleting the target context data, and returning all responses of the target request message to a service consumer; if not, the target context data is updated.
Optionally, the method further comprises:
receiving a request message sent by a service consumer and/or receiving a response message sent by a service provider;
and storing the request message sent by the service consumer and/or the response message sent by the service provider into a message queue component.
Optionally, the obtaining of the target message to be currently processed includes:
and acquiring the current target message to be processed from the message queue component.
Optionally, the generating context data corresponding to the request message includes:
generating a transaction number corresponding to the request message;
acquiring an original request message of the request message;
acquiring a key value pair corresponding to the request message, wherein the key value pair is used for pointing to original interactive data corresponding to the request message;
and taking the transaction number, the original request message, the key value pair and the original interaction data as context data corresponding to the request message.
Optionally, the saving the context data includes:
and storing the context data into a shared memory component.
Optionally, the storing the context data in a shared memory component includes:
recording the transaction number and the original request message based on an AsynHead function;
recording the key-value pair based on the AsynCtx function;
and recording the original interaction data based on the AsynData function.
A request or response processing apparatus based on a message mode, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target message to be processed currently;
a message attribute determining unit, configured to determine an attribute of the target message;
a request message processing unit, configured to determine, when the target message is a request message, a service provider corresponding to the request message, generate context data corresponding to the request message, store the context data, initiate asynchronous call to the service provider, trigger the acquisition unit to acquire a new message as a target message to be processed currently, and trigger the message attribute determination unit and the request message processing unit to perform subsequent processing;
a response message processing unit, configured to determine, when the target message is a response message, a target request message corresponding to the response message, obtain target context data corresponding to the target request message, determine, according to the target context data, whether the response message is a last response message of the target request message, if so, delete the target context data, and return all responses of the target request message to a service consumer; if not, the target context data is updated.
Optionally, the apparatus further comprises:
the receiving unit is used for receiving a request message sent by a service consumer and/or receiving a response message sent by a service provider;
and the message storage unit is used for storing the request message sent by the service consumer and/or the response message sent by the service provider into the message queue component.
Optionally, the obtaining unit is specifically configured to:
and acquiring the current target message to be processed from the message queue component.
Optionally, the request message processing unit includes: a context data generation subunit, configured to:
generating a transaction number corresponding to the request message;
acquiring an original request message of the request message;
acquiring a key value pair corresponding to the request message, wherein the key value pair is used for pointing to original interactive data corresponding to the request message;
and taking the transaction number, the original request message, the key value pair and the original interaction data as context data corresponding to the request message.
Optionally, the request message processing unit includes: a context data saving subunit, configured to:
and storing the context data into a shared memory component.
Optionally, the context data saving subunit is specifically configured to:
recording the transaction number and the original request message based on an AsynHead function;
recording the key-value pair based on the AsynCtx function;
and recording the original interaction data based on the AsynData function.
A storage medium on which a program is stored, which when executed by a processor implements a request or response processing method based on a message pattern as described above.
An electronic device comprising a memory for storing a program and a processor for executing the program, wherein the program is operable to perform a message pattern based request or response handling method as described above.
By means of the technical scheme, the application discloses a request or response processing method and device based on a message mode, and the method and device are used for acquiring a target message to be processed currently; determining attributes of the target message; when the target message is a request message, determining a service provider corresponding to the request message, generating context data corresponding to the request message, storing the context data, initiating asynchronous call to the service provider, acquiring a new message as the target message to be processed currently, returning to execute the step of determining the attribute of the target message and sequentially executing subsequent steps; when the target message is a response message, determining a target request message corresponding to the response message, acquiring target context data corresponding to the target request message, judging whether the response message is the last response message of the target request message according to the target context data, if so, deleting the target context data, and returning all responses of the target request message to a service consumer; if not, the target context data is updated. Based on the method and the device, after a processing process in the business service system initiates asynchronous call to a service provider, the processing process does not synchronously wait for response, but acquires a new message as a target message to be processed currently, executes the request or response processing method based on the message mode for the newly determined target message, and processes the business after the asynchronous response message returns. In this way, the throughput of the business service system can be improved.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flowchart of a request or response processing method based on a message mode according to an embodiment of the present application;
fig. 2 is a flowchart illustrating a method for generating context data corresponding to the request message according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a shared memory device according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram illustrating a specific implementation of a slab memory allocation algorithm provided in the embodiment of the present application;
fig. 5 is a schematic structural diagram of a request or response processing apparatus based on a message mode according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The following describes in detail specific implementations provided in embodiments of the present application.
Referring to fig. 1, fig. 1 is a schematic flow chart of a request or response processing method based on a message mode according to an embodiment of the present application, where an execution subject of the method is any one processing thread in a business service system, and the method specifically includes the following steps:
step S101: and acquiring the target message to be processed currently.
And the service provider sends a response message to the business service system. As an implementable manner, the processing thread may receive a message directly from a service consumer or a service provider and determine that the received message is a target message currently to be processed. In the process that the business service system processes the target message by using the request or response processing method based on the message mode provided by the embodiment of the application, a traffic peak may occur, and at this time, the business service system may further store the request message received from the service consumer and/or the response message received from the service provider into the message queue. Therefore, as another possible implementation, the processing thread may obtain the target message to be processed currently from the message queue.
Step S102: determining whether the attribute of the target message is a request message or a response message; when the target message is a request message, step S103 is executed, and when the target message is a response message, step S104 is executed.
Specifically, the attribute of the target message may be determined according to the sender of the target message, and when the sender of the target message is a service consumer, the attribute of the target message is determined to be a request message, and when the sender of the target message is a service provider, the attribute of the target message is determined to be a response message.
Step S103: determining a service provider corresponding to the request message, generating context data corresponding to the request message, storing the context data, initiating asynchronous call to the service provider, acquiring a new message as a target message to be processed currently, returning to execute the step S102 and sequentially executing subsequent steps;
step S104: determining a target request message corresponding to the response message, acquiring target context data corresponding to the target request message, judging whether the response message is the last response message of the target request message according to the target context data, if so, deleting the target context data, and returning all responses of the target request message to a service consumer; if not, the target context data is updated.
The embodiment discloses a request or response processing method based on a message mode, which is used for acquiring a target message to be processed currently; determining attributes of the target message; when the target message is a request message, determining a service provider corresponding to the request message, generating context data corresponding to the request message, storing the context data, initiating asynchronous call to the service provider, acquiring a new message as the target message to be processed currently, returning to execute the step of determining the attribute of the target message and sequentially executing subsequent steps; when the target message is a response message, determining a target request message corresponding to the response message, acquiring target context data corresponding to the target request message, judging whether the response message is the last response message of the target request message according to the target context data, if so, deleting the target context data, and returning all responses of the target request message to a service consumer; if not, the target context data is updated. Based on the method of the embodiment, after initiating asynchronous call to a service provider, a processing process in a business service system does not synchronously wait for a response, but acquires a new message as a target message to be processed currently, and executes the request or response processing method based on the message mode of the application on the newly determined target message; and after the asynchronous response message comes back, performing service processing. In this way, the throughput of the business service system can be improved.
Referring to fig. 2, fig. 2 is a schematic flowchart of a method for generating context data corresponding to the request message according to an embodiment of the present application, where the method specifically includes the following steps:
s201: and generating a transaction number corresponding to the request message.
S202: and acquiring an original request message of the request message.
S203: and acquiring a key value pair corresponding to the request message, wherein the key value pair is used for pointing to the original interactive data corresponding to the request message.
S204: and taking the transaction number, the original request message, the key value pair and the original interaction data as context data corresponding to the request message.
In the present application, the context data is saved to the shared memory component. The structure of the shared memory component is shown in fig. 3, specifically, the shared memory includes N +1 packets (groups), the size of the entire shared memory and the offset of a hash bucket (e.g., "bug entry" shown in the figure) are recorded based on the AsynCtl function, the transaction number and the original request information of each message are recorded based on the AsynCtx function, the application context is specifically a pair of key value pairs (e.g., "key _" and "value _" shown in the figure), and the original data is recorded based on the asyncdata function.
Therefore, in the embodiment of the present application, the saving the context data to the shared memory component includes: recording the transaction number and the original request message based on an AsynHead function; recording the key-value pair based on the AsynCtx function; and recording the original interaction data based on the AsynData function.
The AsynHead function, the AsynCtx function and the AsynData function all adopt a slab memory allocation algorithm, and because the logical addresses of each process added (attach) to the shared memory are different, the slab memory allocation algorithm can be realized based on the offset of the Nginxslab memory allocation algorithm. A specific implementation diagram of the slab memory allocation algorithm is shown in fig. 4.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a request or response processing device based on a message mode according to an embodiment of the present application, where the device specifically includes the following units:
an acquiring unit 51 configured to acquire a target message to be currently processed;
a message attribute determining unit 52, configured to determine an attribute of the target message;
a request message processing unit 53, configured to determine, when the target message is a request message, a service provider corresponding to the request message, generate context data corresponding to the request message, store the context data, initiate asynchronous call to the service provider, trigger an acquisition unit to acquire a new message as a target message to be currently processed, and trigger the message attribute determining unit and the request message processing unit to perform subsequent processing;
a response message processing unit 54, configured to determine, when the target message is a response message, a target request message corresponding to the response message, obtain target context data corresponding to the target request message, determine, according to the target context data, whether the response message is a last response message of the target request message, if yes, delete the target context data, and return all responses of the target request message to a service consumer; if not, the target context data is updated.
Optionally, the apparatus further comprises:
the receiving unit is used for receiving a request message sent by a service consumer and/or receiving a response message sent by a service provider;
and the message storage unit is used for storing the request message sent by the service consumer and/or the response message sent by the service provider into the message queue component.
Optionally, the obtaining unit is specifically configured to:
and acquiring the current target message to be processed from the message queue component.
Optionally, the request message processing unit includes: a context data generation subunit, configured to:
generating a transaction number corresponding to the request message;
acquiring an original request message of the request message;
acquiring a key value pair corresponding to the request message, wherein the key value pair is used for pointing to original interactive data corresponding to the request message;
and taking the transaction number, the original request message, the key value pair and the original interaction data as context data corresponding to the request message.
Optionally, the request message processing unit includes: a context data saving subunit, configured to:
and storing the context data into a shared memory component.
Optionally, the context data saving subunit is specifically configured to:
recording the transaction number and the original request message based on an AsynHead function;
recording the key-value pair based on the AsynCtx function;
and recording the original interaction data based on the AsynData function.
It should be noted that specific implementations of the above units have been described in detail in the method embodiments, and please refer to relevant contents in the method embodiments, which is not described in detail in this embodiment.
The request or response processing device based on the message mode comprises a processor and a memory, wherein the units are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can set one or more than one, and the message processing is realized by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present application provides a storage medium on which a program is stored, which, when executed by a processor, implements the message mode-based request or response processing method.
The embodiment of the application provides a processor, which is used for running a program, wherein the request or response processing method based on the message mode is executed when the program runs.
The embodiment of the application provides an electronic device, the electronic device comprises a processor, a memory and a program which is stored on the memory and can be run on the processor, and the following steps are realized when the processor executes the program:
acquiring a target message to be processed currently;
determining attributes of the target message;
when the target message is a request message, determining a service provider corresponding to the request message, generating context data corresponding to the request message, storing the context data, initiating asynchronous call to the service provider, acquiring a new message as the target message to be processed currently, returning to execute the step of determining the attribute of the target message and sequentially executing subsequent steps;
when the target message is a response message, determining a target request message corresponding to the response message, acquiring target context data corresponding to the target request message, judging whether the response message is the last response message of the target request message according to the target context data, if so, deleting the target context data, and returning all responses of the target request message to a service consumer; if not, the target context data is updated.
Optionally, the method further comprises:
receiving a request message sent by a service consumer and/or receiving a response message sent by a service provider;
and storing the request message sent by the service consumer and/or the response message sent by the service provider into a message queue component.
Optionally, the obtaining of the target message to be currently processed includes:
and acquiring the current target message to be processed from the message queue component.
Optionally, the generating context data corresponding to the request message includes:
generating a transaction number corresponding to the request message;
acquiring an original request message of the request message;
acquiring a key value pair corresponding to the request message, wherein the key value pair is used for pointing to original interactive data corresponding to the request message;
and taking the transaction number, the original request message, the key value pair and the original interaction data as context data corresponding to the request message.
Optionally, the saving the context data includes:
and storing the context data into a shared memory component.
Optionally, the storing the context data in a shared memory component includes:
recording the transaction number and the original request message based on an AsynHead function;
recording the key-value pair based on the AsynCtx function;
and recording the original interaction data based on the AsynData function.
The electronic device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
acquiring a target message to be processed currently;
determining attributes of the target message;
when the target message is a request message, determining a service provider corresponding to the request message, generating context data corresponding to the request message, storing the context data, initiating asynchronous call to the service provider, acquiring a new message as the target message to be processed currently, returning to execute the step of determining the attribute of the target message and sequentially executing subsequent steps;
when the target message is a response message, determining a target request message corresponding to the response message, acquiring target context data corresponding to the target request message, judging whether the response message is the last response message of the target request message according to the target context data, if so, deleting the target context data, and returning all responses of the target request message to a service consumer; if not, the target context data is updated.
Optionally, the method further comprises:
receiving a request message sent by a service consumer and/or receiving a response message sent by a service provider;
and storing the request message sent by the service consumer and/or the response message sent by the service provider into a message queue component.
Optionally, the obtaining of the target message to be currently processed includes:
and acquiring the current target message to be processed from the message queue component.
Optionally, the generating context data corresponding to the request message includes:
generating a transaction number corresponding to the request message;
acquiring an original request message of the request message;
acquiring a key value pair corresponding to the request message, wherein the key value pair is used for pointing to original interactive data corresponding to the request message;
and taking the transaction number, the original request message, the key value pair and the original interaction data as context data corresponding to the request message.
Optionally, the saving the context data includes:
and storing the context data into a shared memory component.
Optionally, the storing the context data in a shared memory component includes:
recording the transaction number and the original request message based on an AsynHead function;
recording the key-value pair based on the AsynCtx function;
and recording the original interaction data based on the AsynData function.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation 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 may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for processing a request or a response based on a message mode, the method comprising:
acquiring a target message to be processed currently;
determining attributes of the target message;
when the target message is a request message, determining a service provider corresponding to the request message, generating context data corresponding to the request message, storing the context data, initiating asynchronous call to the service provider, acquiring a new message as the target message to be processed currently, returning to execute the step of determining the attribute of the target message and sequentially executing subsequent steps;
when the target message is a response message, determining a target request message corresponding to the response message, acquiring target context data corresponding to the target request message, judging whether the response message is the last response message of the target request message according to the target context data, if so, deleting the target context data, and returning all responses of the target request message to a service consumer; if not, the target context data is updated.
2. The method of claim 1, further comprising:
receiving a request message sent by a service consumer and/or receiving a response message sent by a service provider;
and storing the request message sent by the service consumer and/or the response message sent by the service provider into a message queue component.
3. The method of claim 2, wherein obtaining the target message to be processed currently comprises:
and acquiring the current target message to be processed from the message queue component.
4. The method of claim 1, wherein generating context data corresponding to the request message comprises:
generating a transaction number corresponding to the request message;
acquiring an original request message of the request message;
acquiring a key value pair corresponding to the request message, wherein the key value pair is used for pointing to original interactive data corresponding to the request message;
and taking the transaction number, the original request message, the key value pair and the original interaction data as context data corresponding to the request message.
5. The method of claim 4, wherein said saving said context data comprises:
and storing the context data into a shared memory component.
6. The method of claim 5, wherein saving the context data to a shared memory component comprises:
recording the transaction number and the original request message based on an AsynHead function;
recording the key-value pair based on the AsynCtx function;
and recording the original interaction data based on the AsynData function.
7. A request or response processing apparatus based on a message mode, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target message to be processed currently;
a message attribute determining unit, configured to determine an attribute of the target message;
a request message processing unit, configured to determine, when the target message is a request message, a service provider corresponding to the request message, generate context data corresponding to the request message, store the context data, initiate asynchronous call to the service provider, trigger the acquisition unit to acquire a new message as a target message to be processed currently, and trigger the message attribute determination unit and the request message processing unit to perform subsequent processing;
a response message processing unit, configured to determine, when the target message is a response message, a target request message corresponding to the response message, obtain target context data corresponding to the target request message, determine, according to the target context data, whether the response message is a last response message of the target request message, if so, delete the target context data, and return all responses of the target request message to a service consumer; if not, the target context data is updated.
8. The apparatus of claim 7, further comprising:
the receiving unit is used for receiving a request message sent by a service consumer and/or receiving a response message sent by a service provider;
and the message storage unit is used for storing the request message sent by the service consumer and/or the response message sent by the service provider into the message queue component.
9. A storage medium on which a program is stored, the program implementing the message pattern-based request or response processing method according to any one of claims 1 to 7 when executed by a processor.
10. An electronic device comprising a memory for storing a program and a processor for executing the program, wherein the program when executed performs the message schema-based request or response processing method of any of claims 1 to 7.
CN201910999363.3A 2019-10-21 2019-10-21 Request or response processing method and device based on message mode Active CN110764930B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910999363.3A CN110764930B (en) 2019-10-21 2019-10-21 Request or response processing method and device based on message mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910999363.3A CN110764930B (en) 2019-10-21 2019-10-21 Request or response processing method and device based on message mode

Publications (2)

Publication Number Publication Date
CN110764930A true CN110764930A (en) 2020-02-07
CN110764930B CN110764930B (en) 2022-07-26

Family

ID=69331483

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910999363.3A Active CN110764930B (en) 2019-10-21 2019-10-21 Request or response processing method and device based on message mode

Country Status (1)

Country Link
CN (1) CN110764930B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112306695A (en) * 2020-11-19 2021-02-02 中国民航信息网络股份有限公司 Data processing method and device, electronic equipment and computer storage medium
WO2024002390A1 (en) * 2022-06-29 2024-01-04 深圳市大族数控科技股份有限公司 Pcb device message response method and apparatus, and computer device and storage medium

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101166128A (en) * 2006-10-16 2008-04-23 琥珀技术有限公司 A method for providing third-party service and corresponding system
CN101388039A (en) * 2008-11-11 2009-03-18 深圳市金蝶中间件有限公司 Response message executing method and device
CN105099989A (en) * 2014-04-24 2015-11-25 阿里巴巴集团控股有限公司 Service request processing and service processing result acquiring method, device and system
CN106547610A (en) * 2016-10-11 2017-03-29 北京国电通网络技术有限公司 The method and system that a kind of distributed transaction is submitted to
CN106874130A (en) * 2017-02-06 2017-06-20 西多多信息科技(北京)有限公司 The processing method of distributed transaction in a kind of micro services framework
CN106997305A (en) * 2013-10-29 2017-08-01 华为技术有限公司 A kind of transaction methods and device
CN107517254A (en) * 2017-08-22 2017-12-26 北京梅泰诺通信技术股份有限公司 A kind of dynamic data demand processing system and method
CN108009022A (en) * 2017-11-06 2018-05-08 联动优势科技有限公司 A kind of message treatment method and server
CN108243233A (en) * 2016-12-26 2018-07-03 深圳远征技术有限公司 A kind of method and client for improving Web application performances
CN109660617A (en) * 2018-12-18 2019-04-19 中电科华云信息技术有限公司 A kind of information push method based on server cluster
CN109684048A (en) * 2018-11-22 2019-04-26 华为技术有限公司 The method and device of affairs is handled in affairs submission system
CN110287040A (en) * 2019-06-26 2019-09-27 苏宁消费金融有限公司 A kind of realization system of remote call service frame
CN110311974A (en) * 2019-06-28 2019-10-08 东北大学 A kind of cloud storage service method based on asynchronous message

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101166128A (en) * 2006-10-16 2008-04-23 琥珀技术有限公司 A method for providing third-party service and corresponding system
CN101388039A (en) * 2008-11-11 2009-03-18 深圳市金蝶中间件有限公司 Response message executing method and device
CN106997305A (en) * 2013-10-29 2017-08-01 华为技术有限公司 A kind of transaction methods and device
CN105099989A (en) * 2014-04-24 2015-11-25 阿里巴巴集团控股有限公司 Service request processing and service processing result acquiring method, device and system
CN106547610A (en) * 2016-10-11 2017-03-29 北京国电通网络技术有限公司 The method and system that a kind of distributed transaction is submitted to
CN108243233A (en) * 2016-12-26 2018-07-03 深圳远征技术有限公司 A kind of method and client for improving Web application performances
CN106874130A (en) * 2017-02-06 2017-06-20 西多多信息科技(北京)有限公司 The processing method of distributed transaction in a kind of micro services framework
CN107517254A (en) * 2017-08-22 2017-12-26 北京梅泰诺通信技术股份有限公司 A kind of dynamic data demand processing system and method
CN108009022A (en) * 2017-11-06 2018-05-08 联动优势科技有限公司 A kind of message treatment method and server
CN109684048A (en) * 2018-11-22 2019-04-26 华为技术有限公司 The method and device of affairs is handled in affairs submission system
CN109660617A (en) * 2018-12-18 2019-04-19 中电科华云信息技术有限公司 A kind of information push method based on server cluster
CN110287040A (en) * 2019-06-26 2019-09-27 苏宁消费金融有限公司 A kind of realization system of remote call service frame
CN110311974A (en) * 2019-06-28 2019-10-08 东北大学 A kind of cloud storage service method based on asynchronous message

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112306695A (en) * 2020-11-19 2021-02-02 中国民航信息网络股份有限公司 Data processing method and device, electronic equipment and computer storage medium
WO2024002390A1 (en) * 2022-06-29 2024-01-04 深圳市大族数控科技股份有限公司 Pcb device message response method and apparatus, and computer device and storage medium

Also Published As

Publication number Publication date
CN110764930B (en) 2022-07-26

Similar Documents

Publication Publication Date Title
JP6876806B2 (en) Blockchain Consensus Formation Methods and Devices
CN108985742B (en) Transaction processing method and device and block chain system
US20180027061A1 (en) Method and apparatus for elastically scaling virtual machine cluster
CN107276970B (en) Unbinding and binding method and device
CN107179940B (en) Task execution method and device
CN110764930B (en) Request or response processing method and device based on message mode
CN110806971A (en) Version testing method and device and electronic equipment
CN111694639A (en) Method and device for updating address of process container and electronic equipment
CN114036031B (en) Scheduling system and method for resource service application in enterprise digital middleboxes
CN108647102B (en) Service request processing method and device of heterogeneous system and electronic equipment
CN108108126B (en) Data processing method, device and equipment
CN114020444A (en) Calling system and method for resource service application in enterprise digital middleboxes
CN113656180A (en) System and method for batch processing files under unitized architecture and related products
CN110958278B (en) API gateway-based data processing method and system and API gateway
CN109977317B (en) Data query method and device
CN109542401B (en) Web development method and device, storage medium and processor
CN115934292A (en) Calling method, device and equipment of microservice application
CN112738181B (en) Method, device and server for cluster external IP access
CN112596882A (en) Method, device and system for scheduling delayed tasks
CN109561123B (en) Token caching method and device
CN114625410A (en) Request message processing method, device and equipment
CN113946489A (en) Data acquisition method, system, device and storage medium
US20150379548A1 (en) Method and System for Data Processing
CN112583742A (en) Message processing method and device
CN108089927B (en) Method and device for realizing message communication based on Web Worker

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant