CN113326142A - Message processing method and device - Google Patents

Message processing method and device Download PDF

Info

Publication number
CN113326142A
CN113326142A CN202010130081.2A CN202010130081A CN113326142A CN 113326142 A CN113326142 A CN 113326142A CN 202010130081 A CN202010130081 A CN 202010130081A CN 113326142 A CN113326142 A CN 113326142A
Authority
CN
China
Prior art keywords
message processing
request
type
engine
execution result
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
CN202010130081.2A
Other languages
Chinese (zh)
Other versions
CN113326142B (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202010130081.2A priority Critical patent/CN113326142B/en
Publication of CN113326142A publication Critical patent/CN113326142A/en
Application granted granted Critical
Publication of CN113326142B publication Critical patent/CN113326142B/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/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/541Client-server
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/549Remote execution

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a method and a device for processing messages, and relates to the technical field of computers. One embodiment of the method comprises: acquiring a message processing request, wherein the message processing request comprises the type of a request end; determining a first message processing engine from message processing engines of different types according to the type of the request terminal; executing a first message processing procedure related to the message processing request by using the first message processing engine, wherein the first message processing procedure is related to the type of the request terminal; and determining whether a second message processing process corresponding to the message processing request is executed by using a second message processing engine according to a first execution result of the first message processing process, wherein the second message processing engines executing the second message processing process are the same for different types of request terminals. The implementation mode reduces the repetition rate of codes and improves the maintainability of the system.

Description

Message processing method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a message.
Background
When different types of clients (such as an APP (application) and a webpage) access the same website, the corresponding access methods respectively include different processing procedures, for example, the different types of clients have different login logics corresponding to a background.
Based on different processing procedures when different types of clients access a website, in the prior art, for the same website, corresponding to different types of clients, processing programs are respectively deployed on different servers, so that when the different types of clients access the website, access requests are routed to the servers corresponding to the types of the clients, and the access requests are processed by using the corresponding programs.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
many of the same processes exist when different types of clients access websites, for example, the paths and ways of background query caching are the same. Therefore, in the existing mode, the programs corresponding to the same processing procedure are repeated, which results in over-high code repeatability, and the mode of deploying multiple sets of programs and multiple servers on the same website improves the maintenance difficulty of the system.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method for processing a message, which can use a set of codes to process message processing requests sent by different types of request terminals, that is, use a set of codes to implement access functions of different types of request terminals, thereby reducing a repetition rate of the codes. Moreover, the set of codes can be only deployed on one set of servers, so that the maintenance difficulty of the system is reduced.
To achieve the above object, according to an aspect of an embodiment of the present invention, a method of message processing is provided.
The message processing method of the embodiment of the invention comprises the following steps:
acquiring a message processing request, wherein the message processing request comprises the type of a request end;
determining a first message processing engine from message processing engines of different types according to the type of the request terminal;
executing a first message processing procedure related to the message processing request by using the first message processing engine, wherein the first message processing procedure is related to the type of the request terminal;
and determining whether a second message processing process corresponding to the message processing request is executed by using a second message processing engine according to a first execution result of the first message processing process, wherein the second message processing engines executing the second message processing process are the same for different types of request terminals.
Alternatively,
said performing, with said first message processing engine, a first message processing procedure associated with said message processing request, comprising:
and acquiring the message processing parameters related to the request terminal by using the first message processing engine, and converting the message processing parameters into a form meeting the parameter requirements according to the parameter requirements of the second message processing engine.
Alternatively,
the first processing procedure is an authentication procedure related to the request end.
Alternatively,
when determining to execute the second message processing process according to the first execution result, the method further includes:
and returning a second execution result of the second message processing process to the request end.
Alternatively,
the returning a second execution result of the second message processing procedure to the request end includes:
and converting the second execution result into a form meeting the parameter requirement of the request terminal by using a third message processing engine corresponding to the type of the request terminal, and sending the converted second execution result to the request terminal.
Alternatively,
the message handling request includes the type of the requestor in the form of non-from and non-source parameters.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a message processing apparatus.
The message processing device of the embodiment of the invention comprises: the device comprises a request acquisition module, an engine determination module, a first processing module and a second processing module; wherein the content of the first and second substances,
the request acquisition module is used for acquiring a message processing request, and the message processing request comprises the type of a request end;
the engine determining module is used for determining a first message processing engine from different types of message processing engines according to the type of the request terminal;
the first processing module is configured to execute a first message processing procedure related to the message processing request by using the first message processing engine, where the first message processing procedure is related to the type of the requesting end;
the second processing module is configured to determine whether a second message processing process corresponding to the message processing request is executed by using a second message processing engine according to a first execution result of the first message processing process, where the second message processing engines executing the second message processing process are the same for different types of request terminals.
Optionally, the first processing module is configured to acquire, by using the first message processing engine, a message processing parameter related to the request end, and convert, according to a parameter requirement of the second message processing engine, the message processing parameter into a form meeting the parameter requirement.
Alternatively,
and when the second message processing process is determined to be executed according to the first execution result, the second processing module is further configured to return a second execution result of the second message processing process to the request end.
Alternatively,
the second processing module is further configured to convert the second execution result into a form meeting the parameter requirement of the request end by using a third message processing engine corresponding to the type of the request end, and send the converted second execution result to the request end.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided an electronic device for message processing.
An electronic device for processing a message according to an embodiment of the present invention includes: one or more processors; a storage device, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement a method of message processing according to an embodiment of the present invention.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable storage medium.
A computer-readable storage medium of an embodiment of the present invention has stored thereon a computer program that, when executed by a processor, implements a method of message processing of an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: a first message processing procedure related to the type of the request side is performed using a first message processing engine corresponding to the type of the request side, and then a second message processing procedure may be performed using a second message processing engine, which is the same for different types of request sides, according to a first execution result of the first processing procedure, that is, a second message processing procedure corresponding to different types of request sides may be performed using the second message processing engine. Therefore, the first message processing engine corresponding to the type of the request terminal executes the processing process related to the type of the request terminal, and the second message processing engine executes the message processing process unrelated to the type of the request terminal, so that the message processing requests of different types of request terminals are processed by one set of codes, and the code repetition rate is reduced. Moreover, the set of codes can be only deployed on one set of servers, so that the maintenance difficulty of the system is reduced.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of a method of message processing according to an embodiment of the invention;
FIG. 2 is a schematic diagram of the main steps of another method of message processing according to an embodiment of the invention;
FIG. 3 is a schematic diagram of the main modules of a message processing apparatus according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of the main steps of yet another method of message processing according to an embodiment of the invention;
FIG. 5 is a schematic diagram of the main blocks of another message processing apparatus according to an embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments of the present invention and the technical features of the embodiments may be combined with each other without conflict.
Fig. 1 is a schematic diagram of the main steps of a method of message processing according to an embodiment of the present invention.
As shown in fig. 1, a method for processing a message according to an embodiment of the present invention mainly includes the following steps:
step S101: and acquiring a message processing request, wherein the message processing request comprises the type of a request end.
In a message handling request, the type of the requester may be included in the form of non-from and non-source parameters.
For example, when the message processing request is to access a personal homepage of a certain website, the user may send the message processing request to the background from different types of requesting terminals (e.g., a mobile phone webpage, a mobile phone app, a pc webpage, or an applet, etc.), where domain names of websites indicated by message processing requests sent by different types of requesting terminals are the same, if the domain names are www.6.com, the different types are parameters indicating the type of the requesting terminal, for example, the message processing request sent by the pc webpage terminal is www.6.com/pc, the message processing request sent by the mobile phone app terminal is www.6.com/app, and the message processing request sent by the mobile phone webpage terminal is www.6.com/m. In this example, the contents "pc", "app" and "m" after "/" respectively represent the type of the requesting end, that is, in the message processing request, the type of the requesting end is indicated in a parameter form in which a field corresponding to the type is added after "/".
In the prior art, the type of the request end is usually indicated in the message processing request in a parameter form of adding a field corresponding to the type of the request end after "from" or "source", for example, in the prior art, the message processing request sent by the pc webpage end is www.6.com/from pc, and the message processing request sent by the mobile phone app end is www.6.com/source app. Therefore, the conventional message processing device can determine the type of the request end according to the obvious parameter ("from" or "source") in the message processing request, and once the message processing request is maliciously acquired, the source of the message processing request can be easily identified. Further, when the message processing request is maliciously tampered, such as from or source is modified to an arbitrary value, the conventional message processing apparatus needs to determine the parameter before recognizing the message processing request as an error url.
In the embodiment of the present invention, the type of the request end is included in the form of non-from and non-source parameters, where the parameter form of adding a field corresponding to the type after "/" is used to indicate the type of the request end, which is only one possible implementation manner provided in the embodiment of the present invention, and in an application process, the parameter form of adding any other field except "/" and a field corresponding to the type may also be used to indicate the type of the request end according to actual requirements. If the parameter form of "//" plus a field corresponding to the type is used to indicate the type of the requesting end, it is only necessary to define "/" or any other field in advance, that is, the parameter form indicating the type of the requesting end is written in advance in the message processing apparatus provided in the embodiment of the present invention. Thus, even if a message processing request is maliciously acquired, it is difficult for a malicious acquirer to infer the meaning of a parameter including the type of a requester from one message processing request. And if the message processing request is maliciously tampered, if the "/" is tampered as any other character, before the parameter judgment, the message processing request cannot be mapped to the corresponding processor, and the message processing device provided by the embodiment of the invention can directly return 404 to the request end, thereby being beneficial to improving the security of the message processing request and improving the processing efficiency of the message processing request.
Step S102: and determining a first message processing engine from different types of message processing engines according to the type of the request terminal.
In the embodiment of the present invention, a plurality of different types of message processing engines may be preset, the message processing engines may be interceptors or filters, and the message processing engines may process message processing requests at a controller or an action layer. Each message processing engine corresponds to a type of a request end, for example, the first message processing engines corresponding to a mobile phone webpage, a mobile phone app or a pc webpage are different from each other, the first message processing engine corresponding to the mobile phone webpage is an m-end interceptor, the first message processing engine corresponding to the mobile phone app is an app-end interceptor, and the first message processing engine corresponding to the pc webpage is a pc-end interceptor.
After receiving the message processing request, the message processing apparatus according to the embodiment of the present invention may determine, according to the message processing request including the type of the request end (for example, determining that the type of the request end is a pc web page by identifying "/pc" in the message processing request www.6.com/pc), a first message processing engine corresponding to the type of the request end from different types of message processing engines, where in this example, when the request end is a pc web page, the corresponding first message processing engine is a pc-end interceptor.
It is worth mentioning that, when the second execution result does not need to be converted according to the parameter form required by each request end, that is, the message processing apparatus may directly return the second execution result to the corresponding request end, the first message processing engine may also adopt a WEB Filter (Filter).
Step S103: executing, with the first message processing engine, a first message processing procedure associated with the message processing request, the first message processing procedure associated with the type of the requesting end.
After the first message processing engine corresponding to the request end is determined, a first message processing process related to the message processing request and the type of the request end can be executed by utilizing the first message processing engine.
The first processing procedure may be an authentication procedure related to the type of the requesting end, and the authentication procedure may be a login authentication procedure, an authentication of whether a session is expired, an authentication of whether an account has an access right, or the like. For example, different request terminals respectively adopt cookies or tokens to log in and verify account passwords, or for iteratively developed websites, different request terminals have separate login systems, a background needs to redirect to different login pages according to the types of the request terminals when login interception verification is performed, or different request terminals correspond to different access permissions, for example, an account can only be accessed through a pc webpage. Therefore, in the embodiment of the present invention, the first message processing engine corresponding to the type of the request side is used to execute the authentication process related to the request side, so that different message processing processes are used according to the authentication logic of different types of request sides.
Step S104: and determining whether a second message processing process corresponding to the message processing request is executed by using a second message processing engine according to a first execution result of the first message processing process, wherein the second message processing engines executing the second message processing process are the same for different types of request terminals.
When the first message processing procedure is a verification procedure related to the type of the requesting end, the successful execution of the first execution result indicates that the verification is passed, in which case the second message processing procedure can be continued. The second message processing process is a core method part requested by the message processing request, and in order to reduce the repetition rate of codes, the same set of codes are adopted in the second message processing processes corresponding to different types of request terminals, and the codes are executed by the same second message processing engine.
In order to facilitate the second message processing engine to execute the second message processing process, the first message processing engine acquires the message processing parameters related to the request terminal in the first message processing process, and converts the message processing parameters into a form meeting the parameter requirements according to the parameter requirements of the second message processing engine.
For example, for the message processing parameter of the user pin, the name of the pc webpage is userPin, the name of the mobile app end is pin, and the mobile webpage end is called userName. Therefore, in order to facilitate the second message processing engine to execute the second message processing process, the name of the message processing parameter needs to be converted according to the parameter requirement of the second message processing engine, so as to convert the name of the message processing parameter into a form meeting the parameter requirement of the second message processing engine, for example, the names of the user pins sent by different types of request terminals are all converted into userPin. For the converted userPin, the userPin can be put into an http serverletRequest parameter object with a uniform web request, and then the subsequent process directly acquires the "userPin" parameter, which can be implemented at least by the following procedures: string userPin ═ request.getattruib ("userPin"). toshring ().
For example, for the message processing parameter of time, the format of the time parameter of the pc web page may be yyyy-MM-dd HH: MM: ss (yyyy represents year, MM represents month, dd represents day, and HH represents minute, and ss represents second), while the format of the time parameter represented by the mobile phone app side is yyyyy/MM/dd HH/MM/ss, or the format of the pc web page is 24 hours system, while the format of the mobile phone app side is 12 hours system. If the message processing parameters in different formats are directly sent to the second message processing engine, the second message processing engine may not be able to process the message processing parameters, and therefore, in the first message processing process, the first message processing engine corresponding to the type of the request end is used to convert the message processing parameters into a format meeting the parameter requirements of the second message processing engine.
That is, when the first message processing engine executes the first message processing procedure, in addition to executing the corresponding verification procedure according to the type of the corresponding request end, the first message processing engine may also encapsulate the message processing parameters of the corresponding request end, or convert the message processing parameters into a form required by the second message processing engine. Therefore, after the message processing requests sent by different types of request terminals pass through the first message processing engine corresponding to the types of the message processing requests, the message processing parameters of the message processing requests are converted into a uniform form, so that the second message processing engine can execute the second message processing process according to the message processing parameters with uniform forms.
The second message processing procedure is a core method part requested by the message processing request, and the specific execution object and the execution procedure thereof are subject to the content requested by the message processing request, and may be, for example, unified verification of parameters, object conversion, operation on database/cache/ES, verification compression and watermarking on pictures or uploading pictures to a server, and the like, or may be, for example, performing logic processing, conversion, preliminary encapsulation, recording of core logs, transmitting MQ messages to drive other related processes, and the like on data.
After executing the second message processing procedure, the message processing apparatus may further return a second execution result of the second message processing procedure to the type of request terminal. That is to say, as shown in fig. 2, the message processing method provided in the embodiment of the present invention may include the following steps:
step S201: and acquiring a message processing request, wherein the message processing request comprises the type of a request end.
Step S202: and determining a first message processing engine from different types of message processing engines according to the type of the request terminal.
Step S203: performing, with the first message processing engine, a validation process relating to the message processing request and the type of requestor; when the verification result of the verification process is that the verification is successful, step S204 is executed, and when the verification result of the verification process is that the verification is failed, the current flow is ended.
Step S204: and executing a second message processing process corresponding to the message processing request by using a second message processing engine.
The second message processing engine executing the second message processing procedure is the same for different types of requesters.
Step S205: and returning the execution result of the second message processing process to the request end.
The following describes the message processing method provided by the embodiment of the present invention in detail, taking an example that a user sends a message processing request through a mobile phone app and requests to access a shopping cart of the user. In this embodiment, a user sends a message processing request through a mobile phone app end, after receiving the message processing request, the message processing device determines an app end interceptor corresponding to the app end according to the type of the request end included in the message processing request, then verifies the user information by using the app end interceptor, if the verification fails, does not execute a second message processing process, and at this time, returns a result of the verification failure to the app end, so that the app end prompts the user to input correct user information (a user name, a password, and the like); if the verification is successful, the relevant message processing parameters (such as user information) are converted into a form meeting the parameter requirements of the second message processing engine, and the parameter requirements can be agreed in advance. And then, acquiring shopping cart content corresponding to the user information by using a second message processing engine, and then returning the shopping cart content to the app side.
In addition, because the data forms adopted by the different types of requesters are inconsistent, for example, some requesters require the second execution result to be returned in the form of a java object, and other requesters require the second execution result to be returned in the form of jsonp or json. Therefore, in order to facilitate the processing of the second execution result by the different types of request terminals, in the embodiment of the present invention, a third message processing engine corresponding to the type of the request terminal may be used to convert the second execution result into a form meeting the parameter requirement of the request terminal, and send the converted second execution result to the request terminal.
The third message processing engine corresponding to the type of the request end may be the same as the first message processing engine corresponding to the third message processing engine, or may be a different message processing engine. When the third message processing engine and the first message processing engine are different message processing engines, the message processing method provided by the embodiment of the present invention may be implemented by the message processing apparatus as shown in fig. 3, and when the message processing requests sent by different types of request terminals are processed by the message processing apparatus as shown in fig. 3, the different types of request terminals may include the type of the request terminal by adding a path to the message processing request when sending the message processing request, for example, a message processing request aa.com/6/app sent by the app terminal, where "/app" indicates the type of the app terminal, a message processing request aa.com/6/m sent by a mobile phone web terminal (hereinafter, referred to as m terminal), where "/m" indicates the type of the mobile phone web terminal, a message processing request aa.6/pc sent by the pc web terminal, the "/pc" indicates the type of pc web page.
When the message processing device processes each message processing request, firstly, according to the type of the request end included in each message processing request, the first message processing engine corresponding to each request end is determined, then the first message processing engine respectively corresponding to each request terminal is utilized to process the logic (such as verification process) unique to different request terminals in the pre-processing layer, and finally, processing a second execution result of the second message processing process by using a third message processing engine on a post-processing layer, and converting the second execution result into a form meeting the requirements of a request end so as to facilitate the request end to display or further process the second execution result and the like.
According to the above embodiment, as shown in fig. 4, the message processing method provided by the embodiment of the present invention may include the following steps:
step S401: and acquiring a message processing request, wherein the message processing request comprises the type of a request end.
Step S402: and determining a first message processing engine from different types of message processing engines according to the type of the request terminal.
Step S403: performing, with the first message processing engine, a validation process relating to the message processing request and the type of requestor; when the verification result of the verification process is that the verification is successful, step S404 is executed, and when the verification result of the verification process is that the verification is failed, the current flow is ended.
Step S404: and executing a second message processing process corresponding to the message processing request by using a second message processing engine.
The second message processing engine executing the second message processing procedure is the same for different types of requesters.
Step S405: and converting the second execution result into a form meeting the parameter requirement of the request terminal by using a third message processing engine corresponding to the type of the request terminal, and sending the converted second execution result to the request terminal.
According to the method for processing the message of the embodiment of the invention, it can be seen that the first message processing engine corresponding to the type of the request end is used for executing the first processing procedure related to the type of the request end, and then the second message processing engine which is the same for different types of request ends is used for executing the second message processing procedure requested by different types of request ends according to the first execution result of the first processing procedure. Therefore, the first message processing engine corresponding to the type of the request terminal executes the processing process related to the type of the request terminal, and the second message processing engine executes the message processing process unrelated to the type of the request terminal, so that the message processing requests of different types of request terminals are processed by one set of codes, and the code repetition rate is reduced. Moreover, the set of codes can be only deployed on one set of servers, so that the maintenance difficulty of the system is reduced. In addition, when the second message processing process has the requirement of increasing or decreasing functions, only the core method corresponding to the second message processing process needs to be changed, so that the easy maintainability of the code and the code development efficiency are improved.
Fig. 5 is a schematic diagram of main blocks of an apparatus for message processing according to an embodiment of the present invention.
As shown in fig. 5, an apparatus 500 for message processing according to an embodiment of the present invention includes: a request acquisition module 501, an engine determination module 502, a first processing module 503 and a second processing module 504; wherein the content of the first and second substances,
the request obtaining module 501 is configured to obtain a message processing request, where the message processing request includes a type of a request end;
the engine determining module 502 is configured to determine, according to the type of the request end, a first message processing engine from message processing engines of different types;
the first processing module 503 is configured to execute a first message processing procedure related to the message processing request by using the first message processing engine, where the first message processing procedure is related to the type of the requesting end;
the second processing module 504 is configured to determine whether a second message processing process corresponding to the message processing request is executed by using a second message processing engine according to the first execution result of the first message processing process, where the second message processing engines executing the second message processing process are the same for different types of request terminals.
In an embodiment of the present invention, the first processing module 503 is configured to obtain, by using the first message processing engine, a message processing parameter related to the request end, and convert, according to a parameter requirement of the second message processing engine, the message processing parameter into a form meeting the parameter requirement.
In an embodiment of the present invention, the first processing procedure is an authentication procedure related to the requesting end.
In an embodiment of the present invention, when it is determined to execute the second message processing procedure according to the first execution result, the second processing module 504 is further configured to return a second execution result of the second message processing procedure to the request end.
In an embodiment of the present invention, the second processing module 504 is further configured to convert the second execution result into a form meeting the parameter requirement of the request end by using a third message processing engine corresponding to the type of the request end, and send the converted second execution result to the request end.
In one embodiment of the invention, the message handling request includes the type of the requestor in the form of non-from and non-source parameters.
The apparatus for message processing according to the embodiment of the present invention may be seen that a first message processing engine corresponding to a type of a requester is used to perform a first process related to the type of the requester, and then a second message processing engine, which is the same for different types of requesters, may be used to perform a second message processing process according to a first execution result of the first process, that is, a second message processing engine may be used to perform the second message processing process requested by different types of requesters. Therefore, the first message processing engine corresponding to the type of the request terminal executes the processing process related to the type of the request terminal, and the second message processing engine executes the message processing process unrelated to the type of the request terminal, so that the message processing requests of different types of request terminals are processed by one set of codes, and the code repetition rate is reduced. Moreover, the set of codes can be only deployed on one set of servers, so that the maintenance difficulty of the system is reduced. In addition, when the second message processing process has the requirement of increasing or decreasing functions, only the core method corresponding to the second message processing process needs to be changed, so that the easy maintainability of the code and the code development efficiency are improved.
Fig. 6 illustrates an exemplary system architecture 600 of a message processing apparatus or method to which embodiments of the invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. Various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, and the like, may be installed on the terminal devices 601, 602, and 603.
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server that provides various services, such as a background management server that supports shopping websites browsed by users using the terminal devices 601, 602, and 603. The background management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (e.g., target push information and product information) to the terminal device.
It should be noted that the method for processing a message provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, a device for processing a message is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a request acquisition module, an engine determination module, a first processing module, and a second processing module. The names of these modules do not in some cases constitute a limitation on the module itself, and for example, the request acquisition module may also be described as a "module that acquires a message processing request".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: acquiring a message processing request, wherein the message processing request comprises the type of a request end; determining a first message processing engine from message processing engines of different types according to the type of the request terminal; executing a first message processing procedure related to the message processing request by using the first message processing engine, wherein the first message processing procedure is related to the type of the request terminal; and determining whether a second message processing process corresponding to the message processing request is executed by using a second message processing engine according to a first execution result of the first message processing process, wherein the second message processing engines executing the second message processing process are the same for different types of request terminals.
According to the technical solution of the embodiment of the present invention, a first message processing engine corresponding to a type of a request end is used to execute a first processing procedure related to the type of the request end, and then a second message processing engine, which is the same for different types of request ends, can be used to execute a second message processing procedure requested by different types of request ends according to a first execution result of the first processing procedure. Therefore, the first message processing engine corresponding to the type of the request terminal executes the processing process related to the type of the request terminal, and the second message processing engine executes the message processing process unrelated to the type of the request terminal, so that the message processing requests of different types of request terminals are processed by one set of codes, and the code repetition rate is reduced. Moreover, the set of codes can be only deployed on one set of servers, so that the maintenance difficulty of the system is reduced. In addition, when the second message processing process has the requirement of increasing or decreasing functions, only the core method corresponding to the second message processing process needs to be changed, so that the easy maintainability of the code and the code development efficiency are improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A method of message processing, comprising:
acquiring a message processing request, wherein the message processing request comprises the type of a request end;
determining a first message processing engine from message processing engines of different types according to the type of the request terminal;
executing a first message processing procedure related to the message processing request by using the first message processing engine, wherein the first message processing procedure is related to the type of the request terminal;
and determining whether a second message processing process corresponding to the message processing request is executed by using a second message processing engine according to a first execution result of the first message processing process, wherein the second message processing engines executing the second message processing process are the same for different types of request terminals.
2. The method of claim 1, wherein performing, with the first message processing engine, a first message processing procedure associated with the message processing request comprises:
and acquiring the message processing parameters related to the request terminal by using the first message processing engine, and converting the message processing parameters into a form meeting the parameter requirements according to the parameter requirements of the second message processing engine.
3. The method of claim 1, wherein the first process is an authentication process associated with the requesting end.
4. The method according to claim 1, wherein when it is determined to execute the second message processing procedure according to the first execution result, further comprising:
and returning a second execution result of the second message processing process to the request end.
5. The method of claim 4, wherein returning the second execution result of the second message processing procedure to the requesting end comprises:
and converting the second execution result into a form meeting the parameter requirement of the request terminal by using a third message processing engine corresponding to the type of the request terminal, and sending the converted second execution result to the request terminal.
6. The method of claim 1,
the message handling request includes the type of the requestor in the form of non-from and non-source parameters.
7. An apparatus for message processing, comprising: the device comprises a request acquisition module, an engine determination module, a first processing module and a second processing module; wherein the content of the first and second substances,
the request acquisition module is used for acquiring a message processing request, and the message processing request comprises the type of a request end;
the engine determining module is used for determining a first message processing engine from different types of message processing engines according to the type of the request terminal;
the first processing module is configured to execute a first message processing procedure related to the message processing request by using the first message processing engine, where the first message processing procedure is related to the type of the requesting end;
the second processing module is configured to determine whether a second message processing process corresponding to the message processing request is executed by using a second message processing engine according to a first execution result of the first message processing process, where the second message processing engines executing the second message processing process are the same for different types of request terminals.
8. The apparatus of claim 7,
the first processing module is configured to acquire, by using the first message processing engine, a message processing parameter related to the request end, and convert, according to a parameter requirement of the second message processing engine, the message processing parameter into a form meeting the parameter requirement.
9. The apparatus of claim 7,
and when the second message processing process is determined to be executed according to the first execution result, the second processing module is further configured to return a second execution result of the second message processing process to the request end.
10. The apparatus of claim 9,
the second processing module is further configured to convert the second execution result into a form meeting the parameter requirement of the request end by using a third message processing engine corresponding to the type of the request end, and send the converted second execution result to the request end.
11. An electronic device for message processing, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
12. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN202010130081.2A 2020-02-28 2020-02-28 Message processing method and device Active CN113326142B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010130081.2A CN113326142B (en) 2020-02-28 2020-02-28 Message processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010130081.2A CN113326142B (en) 2020-02-28 2020-02-28 Message processing method and device

Publications (2)

Publication Number Publication Date
CN113326142A true CN113326142A (en) 2021-08-31
CN113326142B CN113326142B (en) 2024-06-18

Family

ID=77412703

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010130081.2A Active CN113326142B (en) 2020-02-28 2020-02-28 Message processing method and device

Country Status (1)

Country Link
CN (1) CN113326142B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101237333A (en) * 2007-01-31 2008-08-06 北京邮电大学 An universal service platform for supporting multiple services based on multi-network fusion
CN102045371A (en) * 2009-10-20 2011-05-04 中兴通讯股份有限公司 Business processing device and video querying and searching method
WO2018098735A1 (en) * 2016-11-30 2018-06-07 深圳益强信息科技有限公司 Synchronous teaching-based message processing method and device
US20190182309A1 (en) * 2017-12-08 2019-06-13 Salesforce.Com, Inc. Apparatus and method for low-latency message request/response processing
CN110147398A (en) * 2019-04-25 2019-08-20 北京字节跳动网络技术有限公司 A kind of data processing method, device, medium and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101237333A (en) * 2007-01-31 2008-08-06 北京邮电大学 An universal service platform for supporting multiple services based on multi-network fusion
CN102045371A (en) * 2009-10-20 2011-05-04 中兴通讯股份有限公司 Business processing device and video querying and searching method
WO2018098735A1 (en) * 2016-11-30 2018-06-07 深圳益强信息科技有限公司 Synchronous teaching-based message processing method and device
US20190182309A1 (en) * 2017-12-08 2019-06-13 Salesforce.Com, Inc. Apparatus and method for low-latency message request/response processing
CN110147398A (en) * 2019-04-25 2019-08-20 北京字节跳动网络技术有限公司 A kind of data processing method, device, medium and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
杨慧;丁志刚;郑树泉;: "基于规则的消息处理引擎的设计与实现", 计算机应用与软件, no. 10, 15 October 2013 (2013-10-15) *

Also Published As

Publication number Publication date
CN113326142B (en) 2024-06-18

Similar Documents

Publication Publication Date Title
CN109040316B (en) HTTP service processing method and device
CN111160845B (en) Service processing method and device
CN111062024B (en) Application login method and device
CN109218368B (en) Method, device, electronic equipment and readable medium for realizing Http reverse proxy
US11368447B2 (en) Oauth2 SAML token service
CN110958237A (en) Authority verification method and device
US20220337562A1 (en) Connecting Web Publisher Inventory to Programmatic Exchanges without Third-Party Cookies
CN113282591B (en) Authority filtering method, authority filtering device, computer equipment and storage medium
CN112015383A (en) Login method and device
CN107634942B (en) Method and device for identifying malicious request
CN112905990A (en) Access method, client, server and access system
CN111953718B (en) Page debugging method and device
CN113271300B (en) Authentication system and method
CN113326142B (en) Message processing method and device
CN113765876B (en) Report processing software access method and device
CN110909269B (en) Log reporting method and device
CN112272211A (en) Service request processing method, device and system
CN112214500A (en) Data comparison method and device, electronic equipment and storage medium
CN113242306B (en) Block chain consensus method and device
US20240187431A1 (en) System and method for monitoring user actions with respect to a resource presented by a web browser
CN111371745B (en) Method and apparatus for determining SSRF vulnerability
CN113704080A (en) Automatic testing method and device
CN114422166A (en) Webpage access method, device, electronic equipment, medium and product
WO2022094289A1 (en) Server-side anonymous identifier web service
CN115643253A (en) Cross-domain file request method and device and business service system

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