CN109614253A - A kind of method and device for realizing remote procedure call - Google Patents
A kind of method and device for realizing remote procedure call Download PDFInfo
- Publication number
- CN109614253A CN109614253A CN201811520208.0A CN201811520208A CN109614253A CN 109614253 A CN109614253 A CN 109614253A CN 201811520208 A CN201811520208 A CN 201811520208A CN 109614253 A CN109614253 A CN 109614253A
- Authority
- CN
- China
- Prior art keywords
- information
- called side
- message
- mysql
- sent
- 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.)
- Withdrawn
Links
- 238000000034 method Methods 0.000 title claims abstract description 47
- 230000004044 response Effects 0.000 claims abstract description 95
- 238000005538 encapsulation Methods 0.000 claims abstract description 53
- 230000006854 communication Effects 0.000 claims abstract description 29
- 238000004891 communication Methods 0.000 claims abstract description 28
- 238000012544 monitoring process Methods 0.000 claims description 11
- 230000005540 biological transmission Effects 0.000 claims description 9
- 241000208340 Araliaceae Species 0.000 claims 2
- 235000005035 Panax pseudoginseng ssp. pseudoginseng Nutrition 0.000 claims 2
- 235000003140 Panax quinquefolius Nutrition 0.000 claims 2
- 235000013399 edible fruits Nutrition 0.000 claims 2
- 235000008434 ginseng Nutrition 0.000 claims 2
- 238000012545 processing Methods 0.000 abstract description 10
- 238000004458 analytical method Methods 0.000 abstract description 2
- 101000629913 Homo sapiens Translocon-associated protein subunit beta Proteins 0.000 description 18
- 102100026229 Translocon-associated protein subunit beta Human genes 0.000 description 18
- 101000629937 Homo sapiens Translocon-associated protein subunit alpha Proteins 0.000 description 16
- 102100026231 Translocon-associated protein subunit alpha Human genes 0.000 description 16
- 238000003860 storage Methods 0.000 description 14
- 230000002085 persistent effect Effects 0.000 description 5
- 230000008901 benefit Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 230000000712 assembly Effects 0.000 description 3
- 238000000429 assembly Methods 0.000 description 3
- 238000007726 management method Methods 0.000 description 3
- 230000000717 retained effect Effects 0.000 description 3
- 230000001360 synchronised effect Effects 0.000 description 3
- 238000012546 transfer Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 239000003999 initiator Substances 0.000 description 1
- 230000014759 maintenance of location Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002688 persistence Effects 0.000 description 1
- 230000002787 reinforcement Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephonic Communication Services (AREA)
Abstract
This application discloses a kind of method and devices for realizing remote procedure call, comprising: receives called side to the first request message of called side, parses the solicited message of the first request message, will be sent in the required list of MySQL after the solicited message encapsulation after parsing;The required list more new information of MySQL is periodically listened for, analysis request table updates the information of the called side of acquisition of information, and the required list after parsing is updated Information encapsulation and is sent to called side at the second request message;Called side is received to the second response message of second request message, parses the result information of the second response message, the result table of MySQL will be sent to after the result information encapsulation after parsing;The result table more new information of MySQL is periodically listened for, parsing result table updates the information of acquisition of information called side, and the result table after parsing is updated Information encapsulation into the first response message, is sent to called side.Request/response uses asynchronous communication means in the application, and the oncurrent processing ability of whole system can be improved.
Description
Technical field
The present invention relates to the technology of the invocation of procedure, espespecially a kind of method for realizing remote procedure call.
Background technique
It is single as operating system security reinforces the increase of SysteM Security ReinforceMent (SSR) portfolio
Only system is no longer satisfied requirement, amount of access increase and processing capacity enhancing pressure under, distributed SSR system or
Person splits into micro services and is inevitable.Remote procedure call between distributed SSR system or micro services system
ReMote Procedure Call (RPC) communication is a very important technical problem.RPC be it is a kind of by network from remote
Service is requested on journey computer program, the technology that the agreement without understanding underlying network technology needs needs to take into account communication
The reliability of data and the high efficiency of communication, data cannot lose in communication process, and the network delay of request service and response is wanted
It is as low as possible.
Summary of the invention
In view of the above technical problems, this application provides a kind of method and device for realizing remote procedure call, Ke Yishi
The communication data reliability and communication high efficiency of existing remote procedure call.
According to the one aspect of the application, a kind of method for realizing remote procedure call is provided, comprising:
Called side is received to the first request message of called side, parses the solicited message of first request message, it will
It is sent in the required list of MySQL after solicited message encapsulation after parsing;
The required list more new information for periodically listening for the MySQL parses the required list update acquisition of information and is adjusted
With the information of side, the required list after parsing is updated into Information encapsulation and is sent to the called side at the second request message;
The called side is received to the second response message of second request message, parses second response message
Result information, the result table of MySQL will be sent to after the result information encapsulation after parsing;
The result table more new information for periodically listening for the MySQL parses the result table and updates acquisition of information calling
The result table after parsing is updated Information encapsulation into the first response message, is sent to the called side by the information of side.
Optionally, wherein
Light weight is respectively adopted in first request message, the second request message, the first response message and the second response message
The data exchange JSON format of grade;
First request message and the second request message respectively include: the IP address for the side that is called, port information, entrance
Parameter, outlet parameter, first service interface message and called side information;
First response message includes at least: the implementing result for the side that is called, whether calling succeeds and called side information;
Second response message includes at least: the implementing result for the side that is called calls whether successful, second service interface
Information and called side information.
Optionally, wherein the solicited message of the parsing first request message, by the solicited message after parsing
It is sent to after encapsulation in the required list of MySQL, comprising: first request message is parsed, asking for unserializing is obtained
Information is sought, is sent to according to the format of MySQL in the required list of the corresponding MySQL of the first service interface;
The required list by after parsing updates Information encapsulation into the second request message, is sent to described called
Side, comprising: the required list after parsing is updated into Information encapsulation into JSON format, is sent to the called side.
Optionally, described to receive the called side to the second response message of second request message, described in parsing
The result information of second response message will be sent to the result table of MySQL after the result information encapsulation after parsing, comprising:
Second response message is parsed, the result information of unserializing is obtained, is sent to described according to the format of MySQL
In the result table of the corresponding MySQL of two service interfaces;
The result table by after parsing updates Information encapsulation into the first response message, is sent to the called side,
Include: that the result table after parsing is updated into Information encapsulation into JSON format, is sent to the called side.
Optionally, in the above method, first request message, the second request message, the first response message and the second sound
Message is answered, the Socket communication based on TCP is sent and received.
According to the another aspect of the application, a kind of device for realizing remote procedure call is additionally provided, comprising:
Request reception unit parses first request for receiving called side to the first request message of called side
The solicited message of message will be sent in the required list of MySQL after the solicited message encapsulation after parsing;
Request monitoring unit parses the required list for periodically listening for the required list more new information of the MySQL
Required list after parsing is updated Information encapsulation and is sent to institute at the second request message by the information for updating the called side of acquisition of information
State called side;
Receiving unit is responded, for receiving the called side to the second response message of second request message, solution
The result information for analysing second response message will be sent to the result table of MySQL after the result information encapsulation after parsing;
It responds transmission unit and parses the result table for periodically listening for the result table more new information of the MySQL
The result table after parsing is updated Information encapsulation into the first response message, sent by the information for updating acquisition of information called side
To the called side.
Optionally, wherein
Light weight is respectively adopted in first request message, the second request message, the first response message and the second response message
The data exchange JSON format of grade;
First request message and the second request message respectively include: the IP address for the side that is called, port information, entrance
Parameter, outlet parameter, first service interface message and called side information;
First response message includes at least: the implementing result for the side that is called, whether calling succeeds and called side information;
Second response message includes at least: the implementing result for the side that is called calls whether successful, second service interface
Information and called side information.
Optionally, wherein the request reception unit is specifically used for: receiving called side and reported to the first request of called side
Text, parses first request message, obtains the solicited message of unserializing, is sent to institute according to the format of MySQL
In the required list for stating the corresponding MySQL of first service interface;
The request monitoring unit is specifically used for: periodically listening for the required list more new information of the MySQL, parses institute
The information that required list updates the called side of acquisition of information is stated, the required list after parsing is updated into Information encapsulation into JSON lattice
Formula is sent to the called side.
Optionally, wherein the response receiving unit is specifically used for: receiving the called side and reported to second request
Second response message of text, parses second response message, the result information of unserializing is obtained, according to MySQL
Format be sent in the result table of the corresponding MySQL of the second service interface;
The response transmission unit is specifically used for: periodically listening for the result table more new information of the MySQL, parses institute
The information that result table updates acquisition of information called side is stated, the result table after parsing is updated into Information encapsulation into JSON format,
It is sent to the called side.
Optionally, wherein first request message, the second request message, the first response message and the second response message,
Socket communication based on TCP is sent and received.
Embodiment provided by the present application, at the called side of called side remote procedure call, by relational data depositary management
Reason system MySQL provides the transfer service of request message and response message, since MySQL database has the energy of persistent storage
Power, it can be ensured that the reliability of request/response data, and entire request/response process is the form of asynchronous communication, Ke Yiji
The big oncurrent processing ability for improving whole system.
Further, the request/response message of whole system can be communicated based on the Socket of TCP and be sent and be connect
It receives.Socket communication based on TCP, it is more high-efficient than traditional RPC-over-HTTP communication mode, it can be ensured that RPC request/sound
The high efficiency answered.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification
It obtains it is clear that understand through the implementation of the invention.The objectives and other advantages of the invention can be by specification, right
Specifically noted structure is achieved and obtained in claim and attached drawing.
Detailed description of the invention
Attached drawing is used to provide to further understand technical solution of the present invention, and constitutes part of specification, with this
The embodiment of application technical solution for explaining the present invention together, does not constitute the limitation to technical solution of the present invention.
Fig. 1 is a kind of method schematic diagram for realizing remote procedure call that the application first embodiment provides;
Fig. 2 is a kind of schematic device for realizing remote procedure call that the application second embodiment provides;
Fig. 3 is a kind of exemplary embodiment schematic diagram provided by the present application.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention
Embodiment be described in detail.It should be noted that in the absence of conflict, in the embodiment and embodiment in the application
Feature can mutual any combination.
Step shown in the flowchart of the accompanying drawings can be in a computer system such as a set of computer executable instructions
It executes.Also, although logical order is shown in flow charts, and it in some cases, can be to be different from herein suitable
Sequence executes shown or described step.
As shown in Figure 1, the application first embodiment provides a kind of method for realizing remote procedure call, comprising:
Step S02: called side is received to the first request message of called side, parses the request of first request message
Information will be sent in the required list of MySQL after the solicited message encapsulation after parsing;
Step S04: the required list more new information of the MySQL is periodically listened for, the required list more new information is parsed
Required list after parsing is updated Information encapsulation and is sent to described be called at the second request message by the information for obtaining the side that is called
Side;
Step S06: the called side is received to the second response message of second request message, parsing described second
The result information of response message will be sent to the result table of MySQL after the result information encapsulation after parsing;
Step S08: periodically listening for the result table more new information of the MySQL, parses the result table more new information
The result table after parsing is updated Information encapsulation into the first response message, is sent to the tune by the information for obtaining called side
With side.
According to an embodiment of the present application, called side can be SSR system 1, and called side is SSR system 2, be also possible to it
The remote procedure call of its application system.Embodiments herein, at the called side of called side remote procedure call, by pass
It is that type data base management system MySQL provides the transfer service of request message and response message.Due to called side such as SSR system 1
With called side SSR system 2, it is different from Relational DBMS MySQL, it is therefore desirable to RPC request message and sound
Message is answered to be converted, to meet the call format of MySQL database.
For example, the RPC request message that SSR system 1 is sent to called side SSR system 2, can use the data of lightweight
The request message of exchange format JavaScript Object Notation (JSON), called side side are entering MySQL data
Before library, the request message encapsulated to JSON format is needed to parse, obtain message information therein, carried out at unserializing
Reason makes corresponding message information meet the call format of MySQL database storage.
After step S02 will be sent to the required list of MySQL after the solicited message encapsulation after parsing, MySQL can be incited somebody to action
Persistent storage is carried out in relevant request information write-in MySQL table structure, can prevent program crashing or server from falling in this way
Solicited message is lost caused by electricity, guarantees the high reliability of system.
Called side can periodically listen for the required list more new information of the MySQL, parse the required list and update
The information of the called side of acquisition of information, updates Information encapsulation for the required list after parsing and is sent to the quilt at the second request message
Called side.
In step S04, be called side side, can actively establish a connection with MySQL database, using periodical wheel
Inquiry mode inquires the request table status of the MySQL of preset interface, if it find that the required list of MySQL has more new information, that is, solves
The required list more new information is analysed, the information for the side that is called is obtained, the required list after parsing is updated into Information encapsulation and is asked at second
Message is sought, such as is sent to the called side after can encapsulating using JSON format.
In step S06, be called side side, can receive the called side to the second sound of second request message
Message is answered, for example, response message can be encapsulated using JSON format, the result information of second response message is parsed, will solve
The result information after analysis is sent to after handling according to MySQL database call format the result information unserializing
The result table of MySQL.
In this step, after being sent to the result table of MySQL after the result information encapsulation after parsing, MySQL meeting
Relevant request information is written in MySQL table structure and carries out persistent storage, program crashing or server can be prevented in this way
Solicited message is lost caused by power down, guarantees the high reliability of system.
In step S08, called side side can actively establish a connection with MySQL database, using polling mode week
The result table more new information of the MySQL is monitored to phase property, if it find that the result table of MySQL has more new information, parses institute
The information that result table updates acquisition of information called side is stated, and the result table after parsing is updated into Information encapsulation into the first response
Message, such as response message can be encapsulated using JSON format, and be sent to the called side.
The method of remote procedure call provided by the present application is suitable for distributed system, is reference, Ke Yihua with MySQL
Divide called side side and called square side, distribution is arranged.Called side side includes calling initiator and message converting unit,
Called side side includes called side and message converting unit, can be arranged in a distributed manner.It is held since MySQL database has
The ability of longization storage, therefore above-mentioned steps S02, step S04, step S06, step S08, can concurrently hold in practical applications
Row is limited without strict sequence.
Embodiment provided by the present application, at the called side of called side remote procedure call, by relational data depositary management
Reason system MySQL provides the transfer service of request message and response message, since MySQL database has the energy of persistent storage
Power, entire request/response process are the forms of asynchronous communication, after called side sends far call solicited message, do not need into
The synchronous waiting of row, can carry out other task operatings, after called side receives solicited message and executes completion, can lead to
Corresponding component is crossed by information back to called side, the concurrent processing energy of whole system can be greatly improved in this asynchronous mode
Power.
Optionally, first request message, the second request message, the first response message and the second response message are adopted respectively
With the data exchange JSON format of lightweight, the format of other agreements can also be used.
First request message and the second request message respectively include: the IP address for the side that is called, port information, entrance
Parameter, outlet parameter, first service interface message and called side information;
First response message includes at least: the implementing result for the side that is called, whether calling succeeds and called side information;
Second response message includes at least: the implementing result for the side that is called calls whether successful, second service interface
Information and called side information.
According to a kind of embodiment of the application, first request message and the second request message can use JSON lattice
Formula, in request message respectively include: the IP address for the side that is called, port information, suction parameter, outlet parameter, first service connect
Message breath and called side information.Wherein, first service interface can be service interface title or address, for requesting first
The solicited message of message, such as the solicited message of JSON format encapsulation, are sent out after unserializing processing by the first service interface
It gives in the default required list of MySQL database.For example, by the driving packet of MySQL, by the first service interface to
Data are inserted into the default required list of MySQL.Called side side, can ask according to the first service interface, preset monitored
Whether in table have more new information, such as counter can be set if asking, compare the count difference value of poll twice, required list can be confirmed
In whether have more new information.If any just parsing obtains corresponding solicited message.
According to a kind of embodiment of the application, first response message is included at least: the implementing result for the side that is called is adjusted
With whether successful and called side information;
Second response message includes at least: the implementing result for the side that is called calls whether successful, second service interface
Information and called side information.
Wherein, second service interface message can be interface name or address, for reporting for request by called side
Literary response message, such as the response message of JSON format encapsulation are sent to after unserializing processing by the second service interface
In the default result table of MySQL database.For example, by the driving packet of MySQL, by the second service interface to MySQL
Default result table in be inserted into data.Called side side can be in preset monitored result table according to the second service interface
It is no to have more new information, such as counter can be set, compare the count difference value of poll twice, whether can be confirmed in required list has
More new information.If any just parsing obtains corresponding result information.
First response message includes at least: the implementing result for the side that is called, whether calling succeeds and called side information,
Second service Interface Information field can also be retained, so that follow-up function is expanded and is debugged.
In embodiment provided by the present application, first request message, the second request message, the first response message and second
Response message can be communicated based on the Socket of TCP and be sent and received.Socket communication based on TCP, than traditional
RPC-over-HTTP communication mode is high-efficient, and efficiency is the three times of http communication or more, so as to ensure RPC request/response
Efficiency.
Embodiment provided by the present application, has the advantage that
1, ease in use, just as calling nation method.MySQL provides powerful SQL query ability, a SQL
Sentence can complete complicated data query;
2, communication is fast high-efficient.Use MySQL as middleware, the socket communication based on TCP is more logical than traditional HTTP
Letter mode is high-efficient, and efficiency is the three times of http communication or more.
3, the case where high reliablity is not in loss of data.Highly reliable storage and the data for relying on MySQL data are extensive
It is multiple, it is ensured that the reliability of message in data transmission.
4. entire RPC request/response process is the form of asynchronous communication, after called side sends call request, do not need into
The synchronous waiting of row can carry out other task operatings, after called side receives solicited message and executes completion, can lead to
It crosses corresponding component and information is returned into called side.The mode of this asynchronous communication, compared to traditional synchronization call, Ke Yiti
The oncurrent processing ability of high whole system solves the problems, such as SSR distributed deployment or microserver deployable communication.
Correspondingly, as shown in Fig. 2, a kind of device for realizing remote procedure call, comprising:
Request reception unit 10, for receiving called side to the first request message of called side, parsing described first is asked
The solicited message for seeking message will be sent in the required list of MySQL after the solicited message encapsulation after parsing;
Request monitoring unit 12 parses the request for periodically listening for the required list more new information of the MySQL
Table updates the information of the called side of acquisition of information, and the required list after parsing is updated Information encapsulation and is sent at the second request message
The called side;
Receiving unit 14 is responded, for receiving the called side to the second response message of second request message,
The result information for parsing second response message will be sent to the result of MySQL after the result information encapsulation after parsing
Table;
It responds transmission unit 16 and parses the result for periodically listening for the result table more new information of the MySQL
Table updates the information of acquisition of information called side, and the result table after parsing is updated Information encapsulation into the first response message, hair
Give the called side.
Optionally, in described device,
Light weight is respectively adopted in first request message, the second request message, the first response message and the second response message
The data exchange JSON format of grade;
First request message and the second request message respectively include: the IP address for the side that is called, port information, entrance
Parameter, outlet parameter, first service interface message and called side information;
First response message includes at least: the implementing result for the side that is called, whether calling succeeds and called side information;
Second service Interface Information field can also be retained.
Second response message includes at least: the implementing result for the side that is called calls whether successful, second service interface
Information and called side information.
Optionally, the request reception unit 10 is specifically used for: receive called side to the first request message of called side,
First request message is parsed, the solicited message of unserializing is obtained, is sent to described according to the format of MySQL
In the required list of the corresponding MySQL of one service interface;
The request monitoring unit 12 is specifically used for: periodically listening for the required list more new information of the MySQL, parses
The required list updates the information of the called side of acquisition of information, and the required list after parsing is updated Information encapsulation into JSON lattice
Formula is sent to the called side.
Optionally, the response receiving unit 14 is specifically used for: receiving the called side to second request message
The second response message, second response message is parsed, the result information of unserializing is obtained, according to MySQL's
Format is sent in the result table of the corresponding MySQL of the second service interface;
The response transmission unit specific 16 is used for: being periodically listened for the result table more new information of the MySQL, is parsed
The result table updates the information of acquisition of information called side, and the result table after parsing is updated Information encapsulation into JSON lattice
Formula is sent to the called side.
Optionally, in described device, first request message, the second request message, the first response message and the second sound
Message is answered, can be communicated and be sent and received based on the Socket of TCP.
Below with reference to an exemplary embodiment, the application is described in more detail.
As shown in Figure 3, it is assumed that first server is mounted with SSR1, and second server is mounted with SSR2, first server with
The setting of second server strange land, SSR1 need to request service call from long-range SSR2 by network.For example, first server position
Intranet in somewhere, second server are located remotely from the Intranet or outer net on another ground of first server.It can be in first service
Request receiver module and result transmitter module is arranged in device side, such as the gateway in first server can be set;Second
Server is arranged request monitoring module and result receiving module and can be arranged directly on second according to the position of second server
Gateway where server or second server.MySQL database system is set on third-party server, it in this way can be independent
It in SSR1 and SSR2, can be used for the RPC of other systems, there is better versatility.Certainly, if only between SSR1 and SSR2
Remote procedure call, MySQL database is set directly on second server and nor affects on the realization of the application.In view of one
As distributed system framework, this exemplary embodiment assume that SSR1, SSR2, MySQL database, request receiving module,
The distributed setting of request monitoring module, result receiving module, result sending module, wherein requesting party SSR1, request receive mould
Block, result sending module constitute requesting party side, and Requested Party SSR2, request monitoring module, result receiving module composition are asked
The side of asking side.
As described in Figure 3, step 1, request receiving module receives the of the RPC access SSR2 that SSR1 is issued using JSON format
One request message, include: in message SSR2 the address Ip:ip, por: port information, inParam: suction parameter information,
OutParam: outlet parameter information, interName1:MySQL provide the interface name of service, consumer interface caller letter
The fields such as breath, wherein the IP address of called side SSR1 and port information are included in consumer field.The request message is parsed,
Called square information (such as SSR2, called port), suction parameter, outlet parameter, the corresponding interface of MySQL, tune can be obtained
With square information (such as SSR1, calling port);Unserializing processing after, by step 2 be sent in MySQL with it is preset
The corresponding required list of interName1 interface.
MySQL receives the information that request receiving module is sent, and writes information into MySQL request table structure and carries out persistence
Storage, to prevent program crashing or server power failure from leading to the loss of solicited message, guarantees the reliability of system.
Step 3: request monitoring module uses polling mode periodically active sniffing MySQL required list, if the request
Table has more new information, such as counter updates, then successively pulls corresponding more new information, parsed and therefrom obtain quilt
Called side information, such as the information of SSR2;
Step 4: request monitoring module establishes socket actively to connect SSR2, by IP, port of SSR2, inParam,
The field informations such as outParam, interName1, consumer (IP, the port information of called side SSR1) are packaged into JSON lattice
Formula is transferred to SSR2.
Step 5: result receiving module receives the implementing result that called side SSR2 is returned with JSON format, the execution
As a result include but is not limited to: Result (implementing result of SSR2 interface), status (whether RPC calls success), time are (current
System time), consumer (caller information), interName2 etc. field, wherein consumer field includes called side
The IP and port information of SSR1.
Step 6: result receiving module, it will be relevant after unserializing processing by the implementing result of received JSON format
Execution result information is sent to the result table of MySQL by preset interName2 interface.
After the execution result information that MySQL reception result receiving module is sent, MySQL result is written into the result information
Table simultaneously carries out persistent storage, to prevent result information caused by program crashing or server power failure from losing, guarantees the height of system
Reliability.
Step 7: it is corresponding that result sending module uses polling mode to periodically listen for default interName2 interface
The result table of MySQL then successively pulls simultaneously parsing result if result table has more new information, such as counter variation
More new information obtains called side information, such as SSR1.
Step 8: by the result of parsing more new information, such as (RPC is by Result (SSR2 interface implementing result), status
It is no to call successfully), time (present system time), consumer (caller information) etc., interName2 can also be retained
Field, as the implementing result of this RPC of SSR1 request, is packaged into the transmission of JSON format so that follow-up function is expanded and is debugged
Give requesting party SSR1.
Wherein, between above-mentioned each module or entity, the Socket communication mode for being all made of TCP is communicated, to ensure RPC
The high efficiency of request/response.
Above-mentioned whole process is the mode of asynchronous communication, after SSR1 sends the solicited message for calling SSR2, do not need into
The synchronous waiting of row can carry out other task operatings, and SSR2 receives solicited message and executes can be by corresponding after completion
Component by information return to SSR1.This asynchronous mode greatly improves the entire oncurrent processing ability of system, effectively solves
It has determined the problem of SSR distributed deployment or microserver deployable communication.
It will appreciated by the skilled person that whole or certain steps, system, dress in method disclosed hereinabove
Functional module/unit in setting may be implemented as software, firmware, hardware and its combination appropriate.In hardware embodiment,
Division between the functional module/unit referred in the above description not necessarily corresponds to the division of physical assemblies;For example, one
Physical assemblies can have multiple functions or a function or step and can be executed by several physical assemblies cooperations.Certain groups
Part or all components may be implemented as by processor, such as the software that digital signal processor or microprocessor execute, or by
It is embodied as hardware, or is implemented as integrated circuit, such as specific integrated circuit.Such software can be distributed in computer-readable
On medium, computer-readable medium may include computer storage medium (or non-transitory medium) and communication media (or temporarily
Property medium).As known to a person of ordinary skill in the art, term computer storage medium is included in for storing information (such as
Computer readable instructions, data structure, program module or other data) any method or technique in the volatibility implemented and non-
Volatibility, removable and nonremovable medium.Computer storage medium include but is not limited to RAM, ROM, EEPROM, flash memory or its
His memory technology, CD-ROM, digital versatile disc (DVD) or other optical disc storages, magnetic holder, tape, disk storage or other
Magnetic memory apparatus or any other medium that can be used for storing desired information and can be accessed by a computer.This
Outside, known to a person of ordinary skill in the art to be, communication media generally comprises computer readable instructions, data structure, program mould
Other data in the modulated data signal of block or such as carrier wave or other transmission mechanisms etc, and may include any information
Delivery media.
Claims (10)
1. a kind of method for realizing remote procedure call characterized by comprising
Called side is received to the first request message of called side, the solicited message of first request message is parsed, will parse
It is sent in the required list of MySQL after solicited message encapsulation afterwards;
The required list more new information for periodically listening for the MySQL parses the required list and updates the called side of acquisition of information
Information, the required list after parsing is updated into Information encapsulation and at the second request message is sent to the called side;
The called side is received to the second response message of second request message, parses the knot of second response message
Fruit information will be sent to the result table of MySQL after the result information encapsulation after parsing;
The result table more new information for periodically listening for the MySQL parses the result table and updates acquisition of information called side
The result table after parsing is updated Information encapsulation into the first response message, is sent to the called side by information.
2. the method according to claim 1, wherein
Lightweight is respectively adopted in first request message, the second request message, the first response message and the second response message
Data exchange JSON format;
First request message and the second request message respectively include: IP address, port information, the entrance ginseng for the side that is called
Number, outlet parameter, first service interface message and called side information;
First response message includes at least: the implementing result for the side that is called, whether calling succeeds and called side information;
Second response message includes at least: the implementing result for the side that is called calls whether successful, second service interface message
With called side information.
3. according to the method described in claim 2, it is characterized in that, the solicited message of the parsing first request message,
It will be sent in the required list of MySQL after solicited message encapsulation after parsing, comprising: first request message is carried out
Parsing, obtains the solicited message of unserializing, is sent to the corresponding MySQL of the first service interface according to the format of MySQL
Required list in;
The required list by after parsing updates Information encapsulation into the second request message, is sent to the called side, wraps
It includes: the required list after parsing being updated into Information encapsulation into JSON format, is sent to the called side.
4. according to the method described in claim 2, it is characterized in that,
It is described to receive the called side to the second response message of second request message, parse second response message
Result information, the result table of MySQL will be sent to after the result information encapsulation after parsing, comprising: to second sound
It answers message to be parsed, obtains the result information of unserializing, be sent to the second service interface pair according to the format of MySQL
In the result table of the MySQL answered;
The result table by after parsing updates Information encapsulation into the first response message, is sent to the called side, comprising:
The result table after parsing is updated into Information encapsulation into JSON format, is sent to the called side.
5. method according to claim 1-4, first request message, the second request message, the first response
Message and the second response message, the Socket communication based on TCP are sent and received.
6. a kind of device for realizing remote procedure call characterized by comprising
Request reception unit parses first request message for receiving called side to the first request message of called side
Solicited message, by after parsing the solicited message encapsulation after be sent in the required list of MySQL;
Request monitoring unit parses the required list and updates for periodically listening for the required list more new information of the MySQL
The information of the called side of acquisition of information, updates Information encapsulation for the required list after parsing and is sent to the quilt at the second request message
Called side;
Receiving unit is responded, for receiving the called side to the second response message of second request message, parses institute
The result information for stating the second response message will be sent to the result table of MySQL after the result information encapsulation after parsing;
Transmission unit is responded, for periodically listening for the result table more new information of the MySQL, the result table is parsed and updates
The result table after parsing is updated Information encapsulation into the first response message, is sent to institute by the information of acquisition of information called side
State called side.
7. device according to claim 6, which is characterized in that
Lightweight is respectively adopted in first request message, the second request message, the first response message and the second response message
Data exchange JSON format;
First request message and the second request message respectively include: IP address, port information, the entrance ginseng for the side that is called
Number, outlet parameter, first service interface message and called side information;
First response message includes at least: the implementing result for the side that is called, whether calling succeeds and called side information;
Second response message includes at least: the implementing result for the side that is called calls whether successful, second service interface message
With called side information.
8. device according to claim 7, which is characterized in that the request reception unit is specifically used for: receiving called side
To the first request message of called side, first request message is parsed, the solicited message of unserializing is obtained, presses
It is sent in the required list of the corresponding MySQL of the first service interface according to the format of MySQL;
The request monitoring unit is specifically used for: periodically listening for the required list more new information of the MySQL, asks described in parsing
It asks table to update the information of the called side of acquisition of information, the required list after parsing is updated into Information encapsulation into JSON format, hair
Give the called side.
9. device according to claim 7, which is characterized in that
The response receiving unit is specifically used for: receiving the called side and reports to the second response of second request message
Text, parses second response message, obtains the result information of unserializing, is sent to institute according to the format of MySQL
In the result table for stating the corresponding MySQL of second service interface;
The response transmission unit is specifically used for: periodically listening for the result table more new information of the MySQL, parses the knot
Fruit table updates the information of acquisition of information called side, and the result table after parsing is updated Information encapsulation into JSON format, is sent
To the called side.
10. according to the described in any item devices of claim 6-9, which is characterized in that first request message, the second request report
Text, the first response message and the second response message, the Socket communication based on TCP are sent and received.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811520208.0A CN109614253A (en) | 2018-12-12 | 2018-12-12 | A kind of method and device for realizing remote procedure call |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811520208.0A CN109614253A (en) | 2018-12-12 | 2018-12-12 | A kind of method and device for realizing remote procedure call |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109614253A true CN109614253A (en) | 2019-04-12 |
Family
ID=66007691
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811520208.0A Withdrawn CN109614253A (en) | 2018-12-12 | 2018-12-12 | A kind of method and device for realizing remote procedure call |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109614253A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110909359A (en) * | 2019-10-29 | 2020-03-24 | 百富计算机技术(深圳)有限公司 | Communication method based on dual-system architecture and terminal equipment |
CN111010438A (en) * | 2019-12-13 | 2020-04-14 | 北京达佳互联信息技术有限公司 | Remote procedure calling method, device, server and storage medium |
CN113691533A (en) * | 2021-08-24 | 2021-11-23 | 武汉光影智能技术有限公司 | Aggregation method and system for router capability interface |
CN114257648A (en) * | 2020-09-22 | 2022-03-29 | 腾讯科技(深圳)有限公司 | Method for determining call relation in distributed system and related equipment |
CN114697371A (en) * | 2022-04-13 | 2022-07-01 | 中国农业银行股份有限公司 | Remote calling method and device |
CN115118757A (en) * | 2022-06-24 | 2022-09-27 | 浙江海规技术有限公司 | Network remote calling method and device, computer equipment and storage medium |
-
2018
- 2018-12-12 CN CN201811520208.0A patent/CN109614253A/en not_active Withdrawn
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110909359A (en) * | 2019-10-29 | 2020-03-24 | 百富计算机技术(深圳)有限公司 | Communication method based on dual-system architecture and terminal equipment |
CN111010438A (en) * | 2019-12-13 | 2020-04-14 | 北京达佳互联信息技术有限公司 | Remote procedure calling method, device, server and storage medium |
CN114257648A (en) * | 2020-09-22 | 2022-03-29 | 腾讯科技(深圳)有限公司 | Method for determining call relation in distributed system and related equipment |
CN114257648B (en) * | 2020-09-22 | 2024-07-30 | 腾讯科技(深圳)有限公司 | Method for determining call relationship in distributed system and related equipment |
CN113691533A (en) * | 2021-08-24 | 2021-11-23 | 武汉光影智能技术有限公司 | Aggregation method and system for router capability interface |
CN113691533B (en) * | 2021-08-24 | 2023-02-14 | 武汉光影智能技术有限公司 | Aggregation method and system for router capability interface |
CN114697371A (en) * | 2022-04-13 | 2022-07-01 | 中国农业银行股份有限公司 | Remote calling method and device |
CN115118757A (en) * | 2022-06-24 | 2022-09-27 | 浙江海规技术有限公司 | Network remote calling method and device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109614253A (en) | A kind of method and device for realizing remote procedure call | |
US20150382132A1 (en) | Method and Device for Monitoring | |
US11765055B2 (en) | UPF service-based packet delay status event exposure service method and device | |
CN112711635B (en) | Method for cross-regional data consistency of distributed Internet of things equipment and service cluster | |
CN109639782A (en) | Message sends platform, method | |
CN111726414B (en) | Vehicle reporting data processing method and vehicle data reporting system | |
CN108347445A (en) | Realize the method and device of far call | |
CN115114044B (en) | Message pushing method, device, equipment and medium | |
CN105635083A (en) | Service processing method and service processing system based on server and client architecture | |
CN112256246A (en) | Micro-service integration framework for supporting cross-language calling in power system | |
CN110138753A (en) | Distributed message service system, method, equipment and computer readable storage medium | |
CN102984272B (en) | A kind of system of remote control mobile terminal communication capacity and method thereof | |
CN110620819A (en) | Block chain interaction method and device, computer equipment and readable storage medium | |
CN112711625B (en) | Bidirectional self-adaptive multi-source heterogeneous big data dynamic processing method | |
Pencheva et al. | Mission critical messaging using multi-access edge computing | |
CN105827672A (en) | Remote call method and remote call device | |
CN110413677A (en) | A kind of Distributed Data Synchronization method and system for supporting concurrently to apply | |
KR20210136850A (en) | Apparatus and method for dynamic instantiation of eas using ue application status | |
CN116095152B (en) | Multi-terminal-based multi-screen communication collaboration method | |
WO2023169097A1 (en) | 5g message terminal identification method, service platform and storage medium | |
Tanaem et al. | STARS: Websocket Design and Implementation | |
CN106254122B (en) | Simple network management protocol agent implementation method based on EOC equipment | |
CN111935316B (en) | Method and device for acquiring front-end equipment catalog | |
CN115174340A (en) | Communication method supporting interaction between multiple protocol types and operating system of Internet of things | |
CN110958148A (en) | Deployment system of distributed access equipment |
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 | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20190412 |