CN111198773B - Message-based application communication method and device - Google Patents

Message-based application communication method and device Download PDF

Info

Publication number
CN111198773B
CN111198773B CN201911410969.5A CN201911410969A CN111198773B CN 111198773 B CN111198773 B CN 111198773B CN 201911410969 A CN201911410969 A CN 201911410969A CN 111198773 B CN111198773 B CN 111198773B
Authority
CN
China
Prior art keywords
application
rpc
request
http
message
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.)
Active
Application number
CN201911410969.5A
Other languages
Chinese (zh)
Other versions
CN111198773A (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.)
Shanghai Huifu Payment Co ltd
Original Assignee
Shanghai Huifu Payment 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 Shanghai Huifu Payment Co ltd filed Critical Shanghai Huifu Payment Co ltd
Priority to CN201911410969.5A priority Critical patent/CN111198773B/en
Publication of CN111198773A publication Critical patent/CN111198773A/en
Application granted granted Critical
Publication of CN111198773B publication Critical patent/CN111198773B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/541Client-server
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses an application communication method and equipment based on a message, wherein the method comprises the following steps: the first application sends an RPC/Http request; after receiving the RPC/Http request, the second application sends an MQ request, and the second application receives the MQ request and processes corresponding business logic; and the second application sends the processed request result to the first application through the RPC/Http callback interface of the first application. Through the technical scheme, the invention can at least reduce the dependence of the front-end service system on the MQ middleware.

Description

Message-based application communication method and device
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a message-based application communication method and device.
Background
With the continuous development of the business of internet companies, the access amount of the system is continuously increased, and the pressure borne by the system is also increased. How does it guarantee that the user can access normally without high delay or access timeout anomalies? This requires background system applications to promote concurrency capabilities. For example: during double eleven days, 8 tens of millions of transactions need to be processed in one second, and the high concurrency capability of the day cat system ensures that the shopping experience of a user is not affected by long-time processing delay; 12306 during holidays such as spring festival, the system can still return to the user's train ticket order purchase status in a short time in the face of a trillion level of daily access. How can the concurrency of the system be improved? First, the concurrency capability of the application in the system is to be improved. The scheme for improving the concurrency capability of the applications in the market is to add a layer of MQ message middleware between the applications, and change the original rpc synchronous calling mode into an asynchronous processing mode through messaging. As shown in fig. 1A and fig. 1B, the two modes can well implement call asynchronization between applications, and improve throughput of front-end applications. And can also realize the functions of application decoupling, flow peak elimination and the like.
However, the application asynchronous call processing scheme based on the message middleware communication improves concurrency capacity and simultaneously brings some problems:
(1) The application a cannot know whether the application B receives the request or not, nor can it make a pre-determination on the request.
(2) If a large number of error requests occur to the application A, the application A is unknown to the MQ and can only backlog without any reason, so that the subsequent correct transaction is affected.
(3) If application B makes an idempotent request, application a repeatedly transacts a lot and must return with an asynchronous request, at which point it will be found that the asynchronous request solution is not being used on the correct lot of data processing. Resulting in a large number of repeated backlogs.
(4) The application A and the application B are strongly dependent on the MQ and become centralized processing middleware among various systems, and in case of the problem of the MQ, the influence is large.
(5) Application a and application B are difficult to expand in capacity, and the performance problem of the global MQ needs to be considered.
(6) It is difficult for application a and application B to implement fusing, downgrade, routing, load balancing policies at the MQ level.
Disclosure of Invention
Aiming at the problems in the related art, the invention provides an application communication method and equipment based on a message, which can reduce the dependence of a front-end service system on MQ middleware.
The technical scheme of the invention is realized as follows:
according to one aspect of the present invention, there is provided a message-based application communication method including:
the first application sends an RPC/Http request;
after receiving the RPC/Http request, the second application sends an MQ request, and the second application receives the MQ request and processes corresponding business logic;
and the second application sends the request result after processing to the first application through the RPC/Http callback interface of the first application.
According to an embodiment of the present invention, after receiving the RPC/Http request, the second application further includes: and the second application carries out logic verification on the RPC/Http request, and returns an RPC/Http response to the first application directly under the condition that the logic verification is passed.
According to an embodiment of the present invention, after receiving the RPC/Http request, the second application further includes: and in the case that the logic verification is not passed, storing the logic verification into a database.
According to the embodiment of the invention, after receiving the RPC/Http callback response of the second application, the first application sends a callback MQ to perform traffic peak elimination processing.
According to the embodiment of the invention, the MQ request is sent in an asynchronous sending mode.
According to another aspect of the present invention, there is also provided a message-based application communication device for communicating between a first application and a second application, comprising:
an application service module for receiving the RPC/Http request sent by the first application,
the sending MQ module is used for sending an MQ request;
the processing MQ module is used for receiving the MQ request and processing corresponding business logic;
and the response MQ module is used for sending the request result after the processing is completed to the first application through the RPC/Http callback interface of the first application by the second application.
According to an embodiment of the present invention, the message-based application communication device further includes a verification module, configured to perform logic verification on the RPC/Http request, and directly return an RPC/Http response to the first application if the logic verification passes.
According to an embodiment of the invention, the verification module is further configured to: and in the case that the logic verification is not passed, storing the logic verification into a database.
According to the embodiment of the invention, the first application comprises a callback module, and the callback module is used for sending a callback MQ to perform traffic peak elimination processing after receiving the RPC/Http callback response of the second application.
According to the embodiment of the invention, the MQ sending module sends the MQ request in an asynchronous sending mode.
According to the technical scheme, the message middleware is sunk into the application, communication between the application and the application completely depends on the synchronous RPC/Http protocol, and the dependence of a front-end service system on the MQ middleware is reduced through the synchronous RPC/Http communication framework. Furthermore, the processing of routing, partitioning, current limiting, fusing and the like can be better realized through the synchronous communication framework. And the concurrency can be improved by the horizontal expansion mode quickly. And the self-receiving MQ is completely controlled by a service system, the use amount of the MQ is greatly reduced, and the isolation and expansion of the MQ are greatly increased.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIGS. 1A and 1B are schematic diagrams of a prior art message-based application communication method, respectively;
FIG. 2 is a schematic diagram of a message-based application communication method according to one embodiment of the invention;
FIG. 3 is a schematic diagram of a message-based application communication method according to another embodiment of the present invention;
fig. 4 is a schematic diagram of a message-based application communication method according to another embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which are derived by a person skilled in the art based on the embodiments of the invention, fall within the scope of protection of the invention.
Referring to fig. 2, an embodiment of the present invention provides a message-based application communication method. The method specifically comprises the following steps:
s1, application a (first application) requests application B (second application) using RPC (Remote Procedure Call Protocol )/Http (HyperText Transfer Protocol, hypertext transfer protocol) Request.
Application B authentication logic performs S2 to return an error directly to application a via an RPC/Http Response request if authentication is not passed (e.g., authentication entry authentication, idempotent, security authentication, etc.). In accordance with an embodiment of the present invention, the verification of application B should avoid remote invocation because in asynchronous request mode, the corresponding speed and response speed need to be reached to improve concurrency, and the entire request operation should be within 10 milliseconds. If the verification logic of the application B passes, the application B directly falls into DB or Redis (database) and the like, and returns to the application A directly through the RPC/Http Response request after ensuring the service to be durable and reliable. Among these, if it is a drop DB that requires a fast response, a hot spot table can be considered, such a table being a large number of Insert operations, considering that the concurrency is improved with as few indexes as possible. The entire request operation should be within 20 milliseconds.
S3, the application B sends an MQ (message queue) request as a producer, and is decoupled asynchronously. S4, after the application B itself is used as a consumer to receive the MQ request sent by the application B itself, correct business logic is processed. In one embodiment, sending the MQ requests may employ asynchronous sending, thereby enhancing concurrency, since DB has been successful before, but it is considered that DB verification is required when the receiving end processes the business logic.
S5, the application B processes the completed request result, and then the application A receives the result through the RPC/Http callback service interface exposed by the application A.
According to the embodiment of the invention, the embodiment shown in fig. 1 can be applied to the situation that the concurrency of the synchronous request of the server is relatively large.
In the past, message-based communication schemes in high concurrency scenes all use message middleware as a communication layer between applications, thereby achieving an asynchronous decoupling effect and providing concurrency capability. This, while improving concurrency, presents a number of problems. According to the technical scheme, the message middleware is sunk into the application, communication between the application and the application completely depends on the synchronous RPC/Http protocol, and the dependence of a front-end service system on the MQ middleware is reduced through the synchronous RPC/Http communication framework. Furthermore, the processing of routing, partitioning, current limiting, fusing and the like can be better realized through the synchronous communication framework. And the concurrency can be improved by the horizontal expansion mode quickly. And the self-receiving MQ is completely controlled by a service system, the use amount of the MQ is greatly reduced, and the isolation and expansion of the MQ are greatly increased.
In one embodiment, if the service system has a compensation mechanism for the data reliability requirement, the MQ can be directly sent for processing so as to better promote asynchronous processing performance. In one embodiment, if the RPC/Http communication at step S1 (e.g., FIG. 2) is abnormal, application A needs to be able to quickly return through fusing, and application B should be able to actually concurrently current limit. In one embodiment, if application B verifies that there is an exception, application B may consider the transaction to be strictly idempotent, guaranteeing transaction consistency. In one embodiment, if an MQ exception is raised at step S3, a timing compensation scheduling thread is required to conduct transaction compensation, and the data end state is based on the database DB. In one embodiment, if an MQ anomaly is received at step S4, the MQ retry mechanism may be considered, the number of retries is not excessive, and is not excessive 3 times, and each interval should not be too long, otherwise the MQ may squeeze (some traffic scenarios have requirements on transaction timeliness, such as that a final state must be obtained within 1 minute, etc.).
Fig. 3 is a schematic diagram of a message-based application communication method according to another embodiment of the present invention. The embodiment shown in fig. 3 can be applied to the situation that the concurrency of synchronous requests of the server is relatively large and the concurrency of asynchronous responses of the server is relatively large.
In order to cope with the situation of large asynchronous concurrency, the embodiment shown in fig. 2 is added with service logic processing. As shown in fig. 3, application B processes MQ messages as a producer send reply, which itself is also processed MQ messages as a consumer receive reply. After receiving the response processing MQ message, the processing result is given to the application A through a callback service interface (APP Client callback interface) of the RPC/Http request application A. Therefore, the business logic flow of the application B is not influenced even if the asynchronous response concurrency is relatively large. Other aspects of the embodiment shown in fig. 3 are similar to the embodiment of fig. 2 and will not be repeated here.
Fig. 4 is a schematic diagram of a message-based application communication method according to another embodiment of the present invention. The embodiment shown in fig. 4 can be applied to the case that the synchronous request concurrency is relatively large, the asynchronous response concurrency is relatively large, and the front-end application system asynchronous callback request concurrency is relatively large. The problem of concurrency of the application B is solved, if the callback service interface request of the application A is concurrent. Then, after the application A receives the callback response of the application B, the callback MQ is sent to perform flow peak elimination processing, and then self-service logic processing is performed slowly.
The embodiments of fig. 3 and fig. 4 fully consider the problem that the concurrency capability of the Client (Client) is poor, so that the concurrency capability of the whole service is affected, and provide a method for the server to automatically and automatically receive two groups of messages at the same time to achieve asynchronous decoupling.
In summary, according to the technical scheme of the invention, the application A can clearly know the correct response given by the application B (business logic processing can be performed in time, such as parameter verification errors, idempotent repetition, system abnormality and the like); the application B can clearly give out a synchronous request strong type interface, realize single responsibility of the interface and clear the parameter specification of the interface; the application B is used as a server, and functions such as routing, fusing, current limiting, load balancing strategies and the like brought by an RPC/Http interface can be used; in the release process of the application B, functions such as gray scale, partition, horizontal expansion and the like brought by an RPC/Http interface can be used; the self-receiving MQ of the application B can be easily isolated, and the boundary of the data is clear.
According to an embodiment of the present invention, there is also provided a message-based application communication device for communicating between a first application and a second application, the application communication device including:
an application service module for receiving the RPC/Http request sent by the first application,
the sending MQ module is used for sending an MQ request;
the processing MQ module is used for receiving the MQ request and processing corresponding business logic;
and the response MQ module sends the processed request result to the first application through the RPC/Http callback interface of the first application.
According to an embodiment of the present invention, the message-based application communication device further includes a verification module, configured to perform logic verification on the RPC/Http request, and directly return an RPC/Http response to the first application if the logic verification passes.
According to an embodiment of the invention, the verification module is further configured to store in the database if the logical verification fails.
According to the embodiment of the invention, the first application comprises a callback module which is used for sending a callback MQ to perform traffic peak elimination processing after receiving the RPC/Http callback response of the second application.
According to the embodiment of the invention, the MQ sending module sends the MQ request in an asynchronous sending mode.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, alternatives, and improvements that fall within the spirit and scope of the invention.

Claims (6)

1. A message-based application communication method, comprising:
the first application sends an RPC/Http request;
after receiving the RPC/Http request, the second application sends an MQ request in an asynchronous sending mode, and the second application receives the MQ request and processes corresponding business logic;
the second application sends the request result of the processing completion to the first application through the RPC/Http callback interface of the first application,
wherein, after receiving the RPC/Http callback response of the second application, the first application sends a callback MQ to perform traffic peak elimination processing,
wherein the MQ message middleware is sunk in the second application.
2. The message-based application communication method of claim 1, wherein the second application, after receiving the RPC/Http request, further comprises:
and the second application performs logic verification on the RPC/Http request, and returns an RPC/Http response to the first application directly under the condition that the logic verification is not passed.
3. The message-based application communication method of claim 2, wherein the second application, after receiving the RPC/Http request, further comprises:
and in the case that the logic verification is passed, storing the RPC/Http request into a database.
4. A message-based application communication device for communicating between a first application and a second application, comprising:
an application service module for receiving the RPC/Http request sent by the first application,
the MQ sending module is used for sending an MQ request, and the MQ sending module sends the MQ request in an asynchronous sending mode;
the processing MQ module is used for receiving the MQ request and processing corresponding business logic;
the reply MQ module sends the request result of the processing completion to the first application through the RPC/Http callback interface of the first application,
wherein the first application comprises a callback module which is used for sending a callback MQ to perform traffic peak elimination processing after receiving the RPC/Http callback response of the second application,
wherein the MQ message middleware is sunk in the second application.
5. The message-based application communication device of claim 4, further comprising:
and the verification module is used for carrying out logic verification on the RPC/Http request, and directly returning an RPC/Http response to the first application under the condition that the logic verification is not passed.
6. The message-based application communication device of claim 5, wherein the authentication module is further configured to:
and in the case that the logic verification is passed, storing the RPC/Http request into a database.
CN201911410969.5A 2019-12-31 2019-12-31 Message-based application communication method and device Active CN111198773B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911410969.5A CN111198773B (en) 2019-12-31 2019-12-31 Message-based application communication method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911410969.5A CN111198773B (en) 2019-12-31 2019-12-31 Message-based application communication method and device

Publications (2)

Publication Number Publication Date
CN111198773A CN111198773A (en) 2020-05-26
CN111198773B true CN111198773B (en) 2024-03-29

Family

ID=70746216

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911410969.5A Active CN111198773B (en) 2019-12-31 2019-12-31 Message-based application communication method and device

Country Status (1)

Country Link
CN (1) CN111198773B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256447A (en) * 2020-09-11 2021-01-22 上海汇付数据服务有限公司 Message notification method and system
CN113342771A (en) * 2021-07-01 2021-09-03 上海通联金融服务有限公司 Distributed call log printing method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101552801A (en) * 2009-05-20 2009-10-07 中国电信股份有限公司 A method and system for on-line browsing and downloading the address-book of user group
CN103473489A (en) * 2013-06-09 2013-12-25 洛阳鸿卓电子信息技术有限公司 Permission validation system and permission validation method for safety production comprehensive supervision
CN106130868A (en) * 2016-06-02 2016-11-16 腾讯科技(深圳)有限公司 A kind of processing method adjusting back message and queue management system
CN106888218A (en) * 2017-04-01 2017-06-23 网易(杭州)网络有限公司 Message treatment method, device, client and service end
CN109542639A (en) * 2018-11-06 2019-03-29 用友网络科技股份有限公司 A kind of processing method, processing unit for ensureing micro services and calling data consistency

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20150024056A (en) * 2013-08-26 2015-03-06 삼성전자주식회사 Http(hypertext transfer protocol) message processing method and electronic device implementing the same

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101552801A (en) * 2009-05-20 2009-10-07 中国电信股份有限公司 A method and system for on-line browsing and downloading the address-book of user group
CN103473489A (en) * 2013-06-09 2013-12-25 洛阳鸿卓电子信息技术有限公司 Permission validation system and permission validation method for safety production comprehensive supervision
CN106130868A (en) * 2016-06-02 2016-11-16 腾讯科技(深圳)有限公司 A kind of processing method adjusting back message and queue management system
CN106888218A (en) * 2017-04-01 2017-06-23 网易(杭州)网络有限公司 Message treatment method, device, client and service end
CN109542639A (en) * 2018-11-06 2019-03-29 用友网络科技股份有限公司 A kind of processing method, processing unit for ensureing micro services and calling data consistency

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Niels Zeilemaker.Large-scale message synchronization in challenged networks.《SAC '14: Proceedings of the 29th Annual ACM Symposium on Applied Computing》.2014,481-488. *
吕德奎 ; 崔艳军 ; .开源消息中间件复杂并发连接控制的研究与实现.网络安全技术与应用.2016,(第12期),70-71. *

Also Published As

Publication number Publication date
CN111198773A (en) 2020-05-26

Similar Documents

Publication Publication Date Title
US20200099606A1 (en) Distrubuted testing service
US20140149280A1 (en) Real-time multi master transaction
CN108874567B (en) Service processing method and system
AU2020202554A1 (en) A system, method and computer program product for receiving electronic messages
AU2015365764B2 (en) A device, system, method and computer program product for processing electronic transaction requests
US9798639B2 (en) Failover system and method replicating client message to backup server from primary server
US11528340B2 (en) Providing financial events using a push framework
CN111198773B (en) Message-based application communication method and device
US10467576B2 (en) Distributed software process tracking
AU2015365697A1 (en) An interface, system, method and computer program product for controlling the transfer of electronic messages
EA033980B1 (en) Interface, method and computer program product for controlling the transfer of electronic messages
CN108596582B (en) Polymerization payment platform solution based on dubbo
CN112288577B (en) Transaction processing method, device, electronic equipment and medium for distributed service
CN112446786A (en) Abnormal transaction processing method and device, electronic equipment and readable storage medium
CN112068973A (en) Asynchronous information processing method and device of policy mode, server and storage medium
US20230037390A1 (en) Techniques to provide streaming data resiliency utilizing a distributed message queue system
CN109995585B (en) Exception handling method, device and storage medium
US20160156704A1 (en) Exchange of information between processing servers
US8756320B2 (en) Web service grid architecture
CN107169752B (en) Resource transfer method and device
CA2780467A1 (en) An improved performance testing tool for financial applications
CN111866171B (en) Message processing method, device, electronic equipment and medium
CN113296911B (en) Cluster calling method, cluster calling device, electronic equipment and readable storage medium
CN112994894B (en) Gateway-based single-thread request processing method and information verification AGENT
JP7463606B1 (en) Connection switching server and connection switching method

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
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: 5 / F, building C5, 700 Yishan Road, Xuhui District, Shanghai, 200233

Applicant after: Shanghai HuiFu payment Co.,Ltd.

Address before: 5 / F, building C5, 700 Yishan Road, Xuhui District, Shanghai, 200233

Applicant before: SHANGHAI HUIFU DATA SERVICE Co.,Ltd.

Country or region before: China

GR01 Patent grant
GR01 Patent grant