CN111711620A - Method, device, equipment and storage medium for realizing bidirectional communication between applications - Google Patents

Method, device, equipment and storage medium for realizing bidirectional communication between applications Download PDF

Info

Publication number
CN111711620A
CN111711620A CN202010505734.0A CN202010505734A CN111711620A CN 111711620 A CN111711620 A CN 111711620A CN 202010505734 A CN202010505734 A CN 202010505734A CN 111711620 A CN111711620 A CN 111711620A
Authority
CN
China
Prior art keywords
service
channel
provider
caller
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010505734.0A
Other languages
Chinese (zh)
Other versions
CN111711620B (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.)
Nanjing Leading Technology Co Ltd
Original Assignee
Nanjing Leading 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 Nanjing Leading Technology Co Ltd filed Critical Nanjing Leading Technology Co Ltd
Priority to CN202010505734.0A priority Critical patent/CN111711620B/en
Publication of CN111711620A publication Critical patent/CN111711620A/en
Application granted granted Critical
Publication of CN111711620B publication Critical patent/CN111711620B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephonic Communication Services (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a method, a device, equipment and a storage medium for realizing bidirectional communication between applications. The method comprises the following steps: the communication component receives a service calling request, wherein the service calling request is sent by a service caller through a caller channel, and the caller channel is respectively matched with the service caller and a service provider; the communication component sends the service calling request to a service provider through a provider channel so that the service provider generates a service calling result according to the service calling request, wherein the provider channel is respectively matched with the service caller and the service provider; and the communication component receives the service calling result sent by the service provider through the provider channel and feeds the service calling result back to the service caller through the caller channel. The technical scheme of the embodiment of the invention can realize the two-way communication between the application programs and improve the utilization rate of system resources.

Description

Method, device, equipment and storage medium for realizing bidirectional communication between applications
Technical Field
Embodiments of the present invention relate to communications technologies, and in particular, to a method, an apparatus, a device, and a storage medium for implementing bidirectional communication between applications.
Background
The establishment of communication between applications is the basis for data exchange between applications, and the efficient and low-cost realization of bidirectional communication between applications is particularly important for data interaction between applications in different service scenes.
In the prior art, communication between applications mainly depends on an RPC (Remote Procedure Call) or a message push mode. In the process of implementing the invention, the inventor finds that the prior art has the following defects: in the RPC communication mode, the server side can only respond after the client side sends a request. And the data can be pushed to the client only by the server side by adopting a message pushing mode. If two-way communication between two applications is to be achieved, multiple communication frameworks need to be developed, the development cost is high, and more system resources need to be consumed.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for realizing two-way communication between applications, so as to realize the two-way communication between application programs and improve the utilization rate of system resources.
In a first aspect, an embodiment of the present invention provides a method for implementing bidirectional communication between applications, where the method includes:
the communication component receives a service calling request, wherein the service calling request is sent by a service caller through a caller channel, and the caller channel is respectively matched with the service caller and a service provider;
the communication component sends the service calling request to a service provider through a provider channel so that the service provider generates a service calling result according to the service calling request, wherein the provider channel is respectively matched with the service caller and the service provider;
and the communication component receives the service calling result sent by the service provider through the provider channel and feeds the service calling result back to the service caller through the caller channel.
In a second aspect, an embodiment of the present invention further provides an apparatus for implementing bidirectional communication between applications, where the apparatus includes:
the service calling request receiving module is used for receiving a service calling request, wherein the service calling request is sent by a service caller through a caller channel, and the caller channel is respectively matched with the service caller and a service provider;
the service calling request sending module is used for sending the service calling request to a service provider through a provider channel so that the service provider generates a service calling result according to the service calling request, wherein the provider channel is respectively matched with the service caller and the service provider;
and the service calling result receiving module is used for receiving the service calling result sent by the service provider through the provider channel and feeding back the service calling result to the service caller through the caller channel.
In a third aspect, an embodiment of the present invention further provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the method for implementing bidirectional communication between applications according to any one of the embodiments of the present invention.
In a fourth aspect, embodiments of the present invention further provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are used to perform the method for implementing inter-application bidirectional communication according to any of the embodiments of the present invention.
According to the embodiment of the invention, the communication assembly receives the service calling request sent by the service caller through the caller channel, the service calling request is sent to the service provider through the provider channel, the service provider generates the service calling result according to the service calling request, the service calling result is sent to the communication assembly, and the communication assembly feeds the service calling result back to the service provider. The problem that in the prior art, two-way communication between two applications is realized, a plurality of communication frames need to be developed, development cost is high, and more system resources need to be consumed is solved, the two-way communication between application programs is realized, and the utilization rate of the system resources is improved.
Drawings
FIG. 1 is a flowchart of a method for implementing bidirectional communication between applications according to a first embodiment of the present invention;
FIG. 2a is a flowchart of a method for implementing bidirectional communication between applications according to a second embodiment of the present invention;
FIG. 2b is a schematic diagram of a two-way communication system suitable for use in embodiments of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for implementing bidirectional communication between applications according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer device in the fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a method for implementing bidirectional communication between applications according to an embodiment of the present invention, where the embodiment is applicable to a case where bidirectional communication is implemented between applications, and the method may be performed by an apparatus for implementing bidirectional communication between applications, where the apparatus may be implemented by software and/or hardware and is generally integrated in a computer device.
As shown in fig. 1, the technical solution of the embodiment of the present invention specifically includes the following steps:
s110, the communication assembly receives a service calling request, wherein the service calling request is sent by a service calling party through a calling party channel, and the calling party channel is respectively matched with the service calling party and a service provider.
The communication component is a component for realizing bidirectional communication between the service provider and the service caller. The service calling request is a request generated by a service caller and needing to call a certain service of a service provider. The service caller and the service provider need to realize two-way communication, the service caller sends a service calling request, and the service provider responds according to the service calling request to generate a service calling result. The caller channel is a channel for realizing communication between the service caller and the communication component, and the caller channel is respectively matched with the service caller and the service provider. Illustratively, a service caller a wants to call a service of a service provider B, and the service caller a can realize communication with a communication component through a caller channel 1; when the service invoker a wants to invoke a service of the service provider C, the service invoker a can communicate with the communication component via the invoker channel 2. However, the embodiment of the present invention does not limit the specific matching relationship between the caller channel and the service caller and the service provider, respectively.
In the embodiment of the invention, the service caller sends the service calling request to the communication component through the caller channel matched with the service calling request, and the communication component receives the service calling request.
In an alternative embodiment of the present invention, the communication component may include a client, a server, and a registry, where the tcp connection is established; the client is used for receiving a service calling request and sending the service calling request to the server, so that the server sends the service calling request to a service provider through a provider channel; the server is used for receiving a service calling result and sending the service calling result to the client so that the client sends the service calling result to the service calling party through the calling party channel; the registration center is used for registering the matching relationship among the caller channel, the service caller and the service provider and the matching relationship among the provider channel, the service caller and the service provider.
Among them, Transmission Control Protocol (TCP) connection is a connection mode between a client and a server. In the embodiment of the invention, the TCP connection can establish logical connection between the client and the server, so that both the client and the server confirm that the other side is the transmission connection end point of the client and the server. The client and the server are both sides for establishing TCP connection, and the registration center can register a service provider and a service caller, and the matching relationship between the caller channel and the provider channel and the service caller and the service provider respectively.
Optionally, the communication component may be built through a Netty framework, the Netty framework is an asynchronous communication framework, and the architecture thereof is characterized in that: asynchronous non-blocking, event-driven based, high performance, high reliability, and high customizability. The communication assembly can also be built through a Mina framework, and the Mina framework is a network communication application framework. The embodiment of the invention does not limit the frame for building the communication assembly.
Optionally, the registry may be implemented based on Redis, which is a high performance key-value pair database. The registry can also be realized by zookeeper, which is software for providing consistency service for distributed application and can provide functions of configuration maintenance, domain name service, distributed synchronization, group service and the like. The embodiment of the invention does not limit the specific implementation mode of the registration center.
In the embodiment of the invention, after the service calling party sends the service calling request to the client of the communication component through the calling party channel, the client sends the service calling request to the server through the TCP connection, and the server sends the service calling request to the service provider through the provider channel. And after the service provider sends the service calling result to the server of the communication assembly through the provider channel, the server sends the service calling result to the client through the TCP connection, and the client sends the service calling result to the service caller through the caller channel.
In an optional embodiment of the present invention, the service invocation request received by the communication component may be generated by a service invoker, serialized by a serializer, and obtained by adding a communication protocol header to a caller channel; the service call request sent to the service provider can be obtained by the provider channel parsing the communication protocol header and deserializing the header by the serializer.
In the embodiment of the invention, the service call request is serialized, namely the service call request is converted into the binary content, so that the service call request is convenient to read and write. A communication protocol header may be used to indicate the purpose of the service invocation request.
Alternatively, the sequencer can be protostuff, which is a high-performance tool for encoding and decoding data content. Serialization can also be carried out through a Kryo framework, and the Kryo framework is a fast and efficient Java object graphic serialization framework.
In the embodiment of the invention, after the service calling party generates the service calling request, the sequencer carries out serialization processing on the service calling request and sends the service calling request to the calling party channel, and the calling party channel adds the communication protocol header to the service calling request. The communication assembly sends the service calling request to the provider channel, the provider channel analyzes the communication protocol header, the service calling request after the communication protocol header is analyzed is sent to the serializer to be subjected to deserialization, and the service calling request after the deserialization is sent to the service provider.
In an optional embodiment of the present invention, the service invocation request may be respectively matched with a service invoker, a service provider, an invoker channel, and a provider channel; the service invocation result may be matched with the service invoker, the service provider, the invoker channel, and the provider channel, respectively.
The service invocation request may indicate a service invoker that sends the service invocation request, a service provider that the service invoker needs to invoke a service, and an invoker channel and a provider channel that send the service invocation request. Accordingly, the service invocation result may indicate a service provider that generates and sends the service invocation result, a service invoker that needs to invoke the service, and an invoker channel and a provider channel that send the service invocation result.
S120, the communication component sends the service calling request to a service provider through a provider channel so that the service provider generates a service calling result according to the service calling request, wherein the provider channel is respectively matched with the service caller and the service provider.
The provider channel is a channel for realizing communication between the service provider and the communication component, and the provider channel is respectively matched with the service caller and the service provider. Illustratively, the service provider a wants to feed back a service invocation result to the service invoker B, and the service provider a can realize communication with the communication component through the provider channel 1; when the service provider a wants to feed back the service invocation result to the service invoker C, the service provider a can implement communication with the communication component through the provider channel 2. However, the embodiment of the present invention does not limit the specific matching relationship between the provider channel and the service invoker and the service provider, respectively.
S130, the communication assembly receives the service calling result sent by the service provider through the provider channel, and feeds the service calling result back to the service caller through the caller channel.
In the embodiment of the invention, after the service provider generates the service calling result, the service calling result is sent to the communication component through the provider channel, and the communication component sends the service calling result to the service caller through the caller channel.
In an optional embodiment of the present invention, the service invocation result received by the communication component through the provider channel may be generated by the service provider, serialized by the serializer, and obtained by adding a communication protocol header through the provider channel; the service calling result fed back to the service caller can be obtained by analyzing the communication protocol header by the caller channel and performing deserialization processing by the serializer.
In the embodiment of the invention, after the service provider generates the service calling result, the sequencer carries out serialization processing on the service calling result and sends the service calling result to the provider channel, and the provider channel adds the communication protocol header to the service calling result. The communication component sends the service calling result to the calling party channel, the calling party channel analyzes the communication protocol header, the service calling result after the communication protocol header is analyzed is sent to the sequencer to be subjected to deserialization, and the service calling result after the deserialization is sent to the service calling party.
According to the technical scheme, the communication component receives the service calling request sent by the service caller through the caller channel, the provider channel sends the service calling request to the service provider, the service provider generates a service calling result according to the service calling request, the service calling result is sent to the communication component, and the communication component feeds the service calling result back to the service provider. The problem that in the prior art, two-way communication between two applications is realized, a plurality of communication frames need to be developed, development cost is high, and more system resources need to be consumed is solved, the two-way communication between application programs is realized, and the utilization rate of the system resources is improved.
Example two
Fig. 2a is a flowchart of a method for implementing bidirectional communication between applications according to a second embodiment of the present invention, where the second embodiment of the present invention further embodies a process in which a communication component feeds back a caller channel and a provider channel to a service provider, and a process in which a service invocation request is sent to the service provider.
Correspondingly, as shown in fig. 2a, the technical solution of the embodiment of the present invention specifically includes the following steps:
s210, receiving a channel query request sent by a service calling party through a client, and forwarding the channel query request to a registration center.
The channel query request is used for querying a caller channel for communication between the service caller and the communication component and a provider channel for communication between the service provider and the communication component when the service caller calls the service provided by the service provider.
S220, sending the caller channel and the provider channel matched with the channel query request to the client through the registry so that the client feeds the caller channel and the provider channel back to the service caller.
In the embodiment of the invention, the registration center stores the matching relationship between the caller channel and the provider channel and the service caller and the service provider respectively, so that after receiving the channel query request, the registration center sends the caller channel and the provider channel matched with the channel query request to the client, and the client feeds the caller channel and the provider channel back to the service caller.
S230, the communication component receives a service calling request, wherein the service calling request is sent by a service calling party through a calling party channel, and the calling party channel is respectively matched with the service calling party and a service provider.
S240, the communication component sends the service calling request to a filter through a provider channel, so that the filter filters the service calling request, and sends the service calling request to a service provider according to a filtering result.
The Filter is used for intercepting the service calling request and filtering the invalid service calling request, and the Filter can be a Filter. When the service calling request is an invalid request, the filter filters the invalid request, otherwise, the filter sends the service calling request to the service provider.
And S250, the communication component receives the service calling result sent by the service provider through the provider channel, and feeds the service calling result back to the service caller through the caller channel.
In an alternative embodiment of the present invention, as shown in fig. 2b, fig. 2b provides a schematic structural diagram of a two-way communication system, which includes a service invoker 10, at least one invoker channel 20, a communication component 30, at least one provider channel 40, a service provider 50, and a serializer 60, where the communication component 30 includes a client 31, a server 32, and a registry 33. The working principle of the system is as follows:
the service invoker 10 sends the service invocation request to the serializer 60, after the serializer 60 serializes the service invocation request, the service invocation request is sent to the invoker channel 20, the invoker channel 20 adds a communication protocol header to the service invocation request, and sends the service invocation request to the communication component 30. The communication component 30 sends the service call request to the provider channel 40, the provider channel 40 removes the communication protocol header in the service call request, sends the service call request to the serializer 60, the serializer 60 performs deserialization on the service call request, and the serializer 60 sends the deserialized service call request to the service provider 50. The service provider 50 generates a service invocation result according to the service invocation request, the serializer 60 serializes the service invocation result, and then sends the service invocation result to the provider channel 40, and the provider channel 40 adds a communication protocol header to the service invocation result and sends the service invocation result to the communication component 30. The communication component 30 sends the service calling result to the caller channel 20, the caller channel 20 removes the communication protocol header in the service calling result, sends the service calling result to the serializer 60, the serializer 60 performs deserialization on the service calling result, and the serializer 60 sends the deserialized service calling result to the service caller 10.
Within communication component 30, client 31 and server 32 establish a TCP connection, and the registry registers a match between caller channel 20 and service caller 10 and service provider 50, and a match between provider channel 40 and service caller 10 and service provider 50. The client terminal 31 receives the service invocation request and sends the service invocation request to the server terminal 32. The server 32 receives the service invocation result and sends the service invocation result to the client 31.
According to the technical scheme, a channel query request is sent to a registration center through a client by a service caller, the registration center feeds back a caller channel and a provider channel to the service caller through the client, a communication component receives the service call request sent by the service caller through the caller channel, the service call request is sent to a service provider through the provider channel, the service provider generates a service call result according to the service call request, the service call result is sent to the communication component, and the communication component feeds back the service call result to the service provider. The problem that in the prior art, two-way communication between two applications is realized, a plurality of communication frames need to be developed, development cost is high, and more system resources need to be consumed is solved, the two-way communication between the application programs is realized, the application programs can flexibly select different communication modes according to business needs, and the utilization rate of the system resources is improved.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an apparatus for implementing bidirectional communication between applications according to a third embodiment of the present invention, where the apparatus may be implemented by software and/or hardware and is generally integrated in a computer device. The device includes: a service invocation request receiving module 310, a service invocation request sending module 320 and a service invocation result receiving module 330. Wherein:
a service invocation request receiving module 310, configured to receive a service invocation request, where the service invocation request is sent by a service invoker through an invoker channel, and the invoker channel is respectively matched with the service invoker and a service provider;
a service invocation request sending module 320, configured to send a service invocation request to a service provider through a provider channel, so that the service provider generates a service invocation result according to the service invocation request, where the provider channel is respectively matched with a service invoker and a service provider;
the service call result receiving module 330 is configured to receive a service call result sent by the service provider through the provider channel, and feed back the service call result to the service caller through the caller channel.
According to the technical scheme, the communication component receives the service calling request sent by the service caller through the caller channel, the provider channel sends the service calling request to the service provider, the service provider generates a service calling result according to the service calling request, the service calling result is sent to the communication component, and the communication component feeds the service calling result back to the service provider. The problem that in the prior art, two-way communication between two applications is realized, a plurality of communication frames need to be developed, development cost is high, and more system resources need to be consumed is solved, the two-way communication between application programs is realized, and the utilization rate of the system resources is improved.
On the basis of the above embodiment, the communication component includes a client, a server, and a registration center, where a tcp connection is established;
the client is used for receiving a service calling request and sending the service calling request to the server, so that the server sends the service calling request to a service provider through a provider channel;
the server is used for receiving a service calling result and sending the service calling result to the client so that the client sends the service calling result to the service calling party through the calling party channel;
the registration center is used for registering the matching relationship among the caller channel, the service caller and the service provider and the matching relationship among the provider channel, the service caller and the service provider.
On the basis of the above embodiment, the apparatus further includes:
the system comprises a channel query request receiving module, a service calling party and a registration center, wherein the channel query request receiving module is used for receiving a channel query request sent by the service calling party through a client and forwarding the channel query request to the registration center;
and the channel feedback module is used for sending the caller channel and the provider channel matched with the channel query request to the client through the registration center so that the client feeds the caller channel and the provider channel back to the service caller.
On the basis of the above embodiment, the service invocation request received by the communication component is generated by the service invocation party, is serialized by the serializer, and is obtained by adding a communication protocol header to the invocation party channel;
the service calling request sent to the service provider is obtained by analyzing the communication protocol header by the provider channel and performing deserialization processing by the serializer.
On the basis of the above embodiment, the service call result received by the communication component through the provider channel is generated by the service provider, serialized by the serializer, and obtained by adding a communication protocol header by the provider channel;
the service calling result fed back to the service calling party is obtained by analyzing the communication protocol header by the calling party channel and performing deserialization processing by the serializer.
On the basis of the above embodiment, the service invocation request sending module 320 includes:
and the filter filtering unit is used for sending the service calling request to the filter through the provider channel so that the filter filters the service calling request and sends the service calling request to the service provider according to a filtering result.
On the basis of the above embodiment, the service invocation request is respectively matched with a service invoker, a service provider, an invoker channel and a provider channel;
and the service calling result is respectively matched with the service caller, the service provider, the caller channel and the provider channel.
The device for realizing the bidirectional communication between the applications provided by the embodiment of the invention can execute the method for realizing the bidirectional communication between the applications provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Example four
Fig. 4 is a schematic structural diagram of a computer apparatus according to a fourth embodiment of the present invention, as shown in fig. 4, the computer apparatus includes a processor 70, a memory 71, an input device 72, and an output device 73; the number of processors 70 in the computer device may be one or more, and one processor 70 is taken as an example in fig. 4; the processor 70, the memory 71, the input device 72 and the output device 73 in the computer apparatus may be connected by a bus or other means, and the connection by the bus is exemplified in fig. 4.
The memory 71 is used as a computer-readable storage medium for storing software programs, computer-executable programs, and modules, such as modules corresponding to the method for implementing the inter-application bidirectional communication in the embodiment of the present invention (for example, the service invocation request receiving module 310, the service invocation request sending module 320, and the service invocation result receiving module 330 in the device for implementing the inter-application bidirectional communication). The processor 70 executes various functional applications and data processing of the computer device by executing software programs, instructions and modules stored in the memory 71, namely, implements the above-described method for realizing the bidirectional communication between the applications. The method comprises the following steps:
the communication component receives a service calling request, wherein the service calling request is sent by a service caller through a caller channel, and the caller channel is respectively matched with the service caller and a service provider;
the communication component sends the service calling request to a service provider through a provider channel so that the service provider generates a service calling result according to the service calling request, wherein the provider channel is respectively matched with the service caller and the service provider;
and the communication component receives the service calling result sent by the service provider through the provider channel and feeds the service calling result back to the service caller through the caller channel.
The memory 71 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 71 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 71 may further include memory located remotely from the processor 70, which may be connected to a computer device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 72 may be used to receive input numeric or character information and generate key signal inputs relating to user settings and function controls of the computer apparatus. The output device 73 may include a display device such as a display screen.
EXAMPLE five
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method for implementing bidirectional communication between applications, the method including:
the communication component receives a service calling request, wherein the service calling request is sent by a service caller through a caller channel, and the caller channel is respectively matched with the service caller and a service provider;
the communication component sends the service calling request to a service provider through a provider channel so that the service provider generates a service calling result according to the service calling request, wherein the provider channel is respectively matched with the service caller and the service provider;
and the communication component receives the service calling result sent by the service provider through the provider channel and feeds the service calling result back to the service caller through the caller channel.
Of course, the storage medium containing the computer-executable instructions provided by the embodiments of the present invention is not limited to the method operations described above, and may also perform related operations in the method for implementing bidirectional communication between applications provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the apparatus for implementing bidirectional communication between applications, the included units and modules are only divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method for enabling two-way communication between applications, comprising:
the communication component receives a service calling request, wherein the service calling request is sent by a service caller through a caller channel, and the caller channel is respectively matched with the service caller and a service provider;
the communication component sends the service calling request to a service provider through a provider channel so that the service provider generates a service calling result according to the service calling request, wherein the provider channel is respectively matched with the service caller and the service provider;
and the communication component receives the service calling result sent by the service provider through the provider channel and feeds the service calling result back to the service caller through the caller channel.
2. The method of claim 1, wherein the communication components include a client, a server, and a registry that have established a transmission control protocol connection;
the client is used for receiving a service calling request and sending the service calling request to the server, so that the server sends the service calling request to a service provider through a provider channel;
the server is used for receiving a service calling result and sending the service calling result to the client so that the client sends the service calling result to the service calling party through the calling party channel;
the registration center is used for registering the matching relationship among the caller channel, the service caller and the service provider and the matching relationship among the provider channel, the service caller and the service provider.
3. The method of claim 2, wherein prior to the communication component receiving the service invocation request, further comprising:
receiving a channel query request sent by a service calling party through a client, and forwarding the channel query request to a registration center;
and sending the caller channel and the provider channel matched with the channel query request to the client through the registry so that the client feeds the caller channel and the provider channel back to the service caller.
4. The method of claim 1, wherein the service invocation request received by the communication component is generated by a service invoker, is serialized by a serializer, and is obtained by adding a communication protocol header to a caller channel;
the service calling request sent to the service provider is obtained by analyzing the communication protocol header by the provider channel and performing deserialization processing by the serializer.
5. The method of claim 4, wherein the service call result received by the communication component through the provider channel is generated by the service provider, serialized by the serializer, and obtained by the provider channel adding a communication protocol header;
the service calling result fed back to the service calling party is obtained by analyzing the communication protocol header by the calling party channel and performing deserialization processing by the serializer.
6. The method of claim 1, wherein the communication component sends the service invocation request to the service provider through a provider channel, comprising:
and the communication component sends the service calling request to a filter through a provider channel so that the filter filters the service calling request and sends the service calling request to a service provider according to a filtering result.
7. The method of any of claims 1-6, wherein the service invocation request is matched with a service invoker, a service provider, an invoker channel, and a provider channel, respectively;
and the service calling result is respectively matched with the service caller, the service provider, the caller channel and the provider channel.
8. An apparatus for enabling two-way communication between applications, comprising:
the service calling request receiving module is used for receiving a service calling request, wherein the service calling request is sent by a service caller through a caller channel, and the caller channel is respectively matched with the service caller and a service provider;
the service calling request sending module is used for sending the service calling request to a service provider through a provider channel so that the service provider generates a service calling result according to the service calling request, wherein the provider channel is respectively matched with the service caller and the service provider;
and the service calling result receiving module is used for receiving the service calling result sent by the service provider through the provider channel and feeding back the service calling result to the service caller through the caller channel.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of enabling two-way communication between applications as claimed in any one of claims 1 to 7 when executing the program.
10. A storage medium containing computer-executable instructions for performing the method of enabling inter-application bidirectional communication according to any one of claims 1 to 7 when executed by a computer processor.
CN202010505734.0A 2020-06-05 2020-06-05 Method, device, equipment and storage medium for realizing bidirectional communication between applications Active CN111711620B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010505734.0A CN111711620B (en) 2020-06-05 2020-06-05 Method, device, equipment and storage medium for realizing bidirectional communication between applications

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010505734.0A CN111711620B (en) 2020-06-05 2020-06-05 Method, device, equipment and storage medium for realizing bidirectional communication between applications

Publications (2)

Publication Number Publication Date
CN111711620A true CN111711620A (en) 2020-09-25
CN111711620B CN111711620B (en) 2022-08-09

Family

ID=72539487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010505734.0A Active CN111711620B (en) 2020-06-05 2020-06-05 Method, device, equipment and storage medium for realizing bidirectional communication between applications

Country Status (1)

Country Link
CN (1) CN111711620B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103812838A (en) * 2012-11-13 2014-05-21 中国移动通信集团公司 Service calling method and device and system
WO2015027762A1 (en) * 2013-08-29 2015-03-05 中兴通讯股份有限公司 Remote calling method and apparatus
US20160261395A1 (en) * 2015-03-05 2016-09-08 International Business Machines Corporation Channel ownership in a publish-subscribe system
US10069928B1 (en) * 2015-01-21 2018-09-04 Amazon Technologies, Inc. Translating requests/responses between communication channels having different protocols
CN108600326A (en) * 2018-03-29 2018-09-28 阿里巴巴集团控股有限公司 Communication means, device and equipment
CN110149365A (en) * 2019-04-16 2019-08-20 阿里巴巴集团控股有限公司 Service adapter method, equipment, system and computer-readable medium
CN110808948A (en) * 2019-09-23 2020-02-18 中移(杭州)信息技术有限公司 Remote procedure calling method, device and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103812838A (en) * 2012-11-13 2014-05-21 中国移动通信集团公司 Service calling method and device and system
WO2015027762A1 (en) * 2013-08-29 2015-03-05 中兴通讯股份有限公司 Remote calling method and apparatus
US10069928B1 (en) * 2015-01-21 2018-09-04 Amazon Technologies, Inc. Translating requests/responses between communication channels having different protocols
US20160261395A1 (en) * 2015-03-05 2016-09-08 International Business Machines Corporation Channel ownership in a publish-subscribe system
CN108600326A (en) * 2018-03-29 2018-09-28 阿里巴巴集团控股有限公司 Communication means, device and equipment
CN110149365A (en) * 2019-04-16 2019-08-20 阿里巴巴集团控股有限公司 Service adapter method, equipment, system and computer-readable medium
CN110808948A (en) * 2019-09-23 2020-02-18 中移(杭州)信息技术有限公司 Remote procedure calling method, device and system

Also Published As

Publication number Publication date
CN111711620B (en) 2022-08-09

Similar Documents

Publication Publication Date Title
CN106161537B (en) Method, device and system for processing remote procedure call and electronic equipment
CN111580995B (en) Synchronous communication method and system of distributed cloud platform and Internet of things intelligent terminal based on MQTT asynchronous communication scene
CN113301166A (en) Service calling method and device, storage medium and electronic device
CN110933075B (en) Service calling method and device, electronic equipment and storage medium
CN110677432A (en) Network protocol internal proxy forwarding method, device, medium and terminal equipment
CN111258723B (en) Transaction processing method, device, system, medium and equipment of distributed system
US20240214472A1 (en) Communication protocol conversion method, and device, system, and gateway device
CN110727507B (en) Message processing method and device, computer equipment and storage medium
CN114124929A (en) Cross-network data processing method and device
WO2022262437A1 (en) Power chip-based multichannel ethernet message processing method
CN113965628B (en) Message scheduling method, server and storage medium
CN113641410A (en) Netty-based high-performance gateway system processing method and system
CN112688915A (en) Cross-protocol communication method, device and server
WO2022121492A1 (en) File transmission method and apparatus, computer device, and storage medium
CN110933188A (en) Remote service calling method, system, server and storage medium
CN108810000B (en) Method and device for generating serialization and deserialization API
CN111711620B (en) Method, device, equipment and storage medium for realizing bidirectional communication between applications
CN112395242A (en) Multi-chip control method, device, electronic equipment and computer readable storage medium
CN116881040A (en) Service operation processing method and device, electronic device and storage medium
CN109669793B (en) Object calling method in middleware process
CN111756836B (en) Information sending method and device based on event management model
CN109639795B (en) Service management method and device based on AcitveMQ message queue
KR100494827B1 (en) Distributed object model based radio server with hardware-independent communication interface and communication control method using the same
CN112165529A (en) Method, device, equipment and medium for low-cost cross-network data exchange
CN115085977B (en) System and method for realizing national cryptographic function based on Unix domain socket

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