CN112860447B - Interaction method and system between different applications - Google Patents

Interaction method and system between different applications Download PDF

Info

Publication number
CN112860447B
CN112860447B CN201911185619.3A CN201911185619A CN112860447B CN 112860447 B CN112860447 B CN 112860447B CN 201911185619 A CN201911185619 A CN 201911185619A CN 112860447 B CN112860447 B CN 112860447B
Authority
CN
China
Prior art keywords
application
computing task
task
calculation
computing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911185619.3A
Other languages
Chinese (zh)
Other versions
CN112860447A (en
Inventor
李卫超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Wodong Tianjun Information Technology Co Ltd
Priority to CN201911185619.3A priority Critical patent/CN112860447B/en
Publication of CN112860447A publication Critical patent/CN112860447A/en
Application granted granted Critical
Publication of CN112860447B publication Critical patent/CN112860447B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/482Application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses an interaction method and system between different applications, and relates to the technical field of computers. One embodiment of the method comprises the following steps: receiving a service request by using a first application edited by a first language, and generating a calculation task according to the service request, wherein the calculation task indicates a calculation task identifier and an input parameter of the calculation task; the first application sends the computing task identification to a second application written in a second language; the second application executes the calculation task by using the input parameters of the calculation task according to the calculation task identification so as to generate a calculation result; and the second application stores the calculation result and the calculation task identification in the message queue correspondingly, so that the first application obtains the calculation result corresponding to the calculation task from the message queue. The implementation mode realizes interaction or calling among different applications and can decouple the different applications of the interaction.

Description

Interaction method and system between different applications
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and a system for interaction between different applications.
Background
With the development of computer technology, more and more computer languages with different performances, such as Java, C language, python, PHP, C ++, and the like, emerge. Because the characteristics of different languages are different, for example, the Python language has the advantages of high development efficiency, portability, expandability, embeddability and the like, and the Java has the advantages of realizing cross-platform and the like. Thus, to combine the advantages and complement each language, calls or interactions between applications written in different languages are often involved in the actual development or application process. Specifically, taking a call or interaction between Java applications as an example, the existing methods for implementing interaction between Java applications and Python applications mainly include the following two methods: compiling Python source codes into JVM byte codes through Jython (namely Python realized on the JVM), and executing the corresponding byte codes by the JVM to realize the call of Python application; and executing the Python script file under a specific path by a run method provided in a software development tool of Java languages such as JDK and the like, so as to realize the calling of the Python.
In the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art: the method called by Jython needs Python to convert JVM byte codes, has low execution efficiency, can not well support a third party library in a Python program, and has poor expansibility; the run time method has high requirements on the running environment, and needs to have two running environments of Java and Python; in addition, coupling exists in the process of realizing interaction between Java application and Python application, the Java application and the Python application cannot be used independently, and the expansibility is poor.
Disclosure of Invention
In view of this, the present invention provides an interaction method between applications, which can not only realize interaction or call between different applications, such as Java applications and Python applications, but also decouple communication between different applications of interaction through message queues.
To achieve the above object, according to a first aspect of the present invention, there is provided an interaction method between different applications, including:
Receiving a service request by using a first application edited by a first language, and generating a calculation task according to the service request, wherein the calculation task indicates a calculation task identifier and an input parameter of the calculation task;
The first application sends the computing task identification to a second application written in a second language;
The second application executes the calculation task by using the input parameters of the calculation task according to the calculation task identification so as to generate a calculation result;
and the second application stores the calculation result and the calculation task identification in the message queue correspondingly, so that the first application obtains the calculation result corresponding to the calculation task from the message queue.
Optionally, the first application sends the computing task identification to the second application through one or more of the following interfaces: restful, SOAP, RPC and HTTP.
Optionally, the first application stores the computing task identifier and the input parameters of the computing task in the message queue correspondingly, and sends the computing task identifier to the second application;
The second application obtains the input parameters of the computing task from the message queue according to the computing task identifier, and executes the computing task by using the input parameters of the computing task to generate a computing result
Optionally, the first application sends the computing task identifier and the input parameters of the computing task to the second application;
The second application performs the computing task using the received incoming parameters of the computing task to generate a computing result.
Optionally, the method further comprises:
Before sending the computing task identification to the second application, the first application causes the incoming parameters of the computing task to conform to a parameter format required for the computation of the second application.
Optionally, the second application uses the thread pool to select a thread for executing the computing task for the received computing task identification.
Optionally, in a case that an abnormality occurs when the second application executes the computing task, the second application stores the abnormality to the message queue corresponding to the computing task identifier.
Optionally, the first application written in the first language is a Java application, and the second application written in the second language is a Python application.
Optionally, the Java application is a Java Web application, the service request is generated according to a webpage request from a client, and when an exception occurs when the Java Web application generates an incoming parameter of the computing task according to the webpage request, the exception is sent to the client for presentation.
To achieve the above object, according to a second aspect of the present invention, there is provided an interactive system between different applications, comprising: a first application written in a first language, a second application written in a second language, and a message queue; wherein,
The first application is used for receiving a service request and generating a calculation task according to the service request, wherein the calculation task indicates a calculation task identifier and an incoming parameter of the calculation task;
the first application is further configured to send the computing task identifier to the second application;
the second application is configured to execute the computing task by using the input parameters of the computing task according to the computing task identifier, so as to generate a computing result;
the second application is further configured to store the calculation result and the calculation task identifier in the message queue in correspondence, so that the first application obtains the calculation result corresponding to the calculation task from the message queue;
and the message queue is used for correspondingly storing the calculation result and the calculation task identifier.
Optionally, the first application sends the computing task identification to the second application through one or more of the following interfaces: restful, SOAP, RPC and HTTP.
Optionally, the first application is further configured to store the computing task identifier and the input parameters of the computing task in the message queue correspondingly, and send the computing task identifier to the second application;
The second application is further configured to obtain, according to the computing task identifier, an incoming parameter of the computing task from the message queue, and execute the computing task using the incoming parameter of the computing task to generate a computing result
Optionally, the first application sends the computing task identifier and the input parameters of the computing task to the second application;
The second application performs the computing task using the received incoming parameters of the computing task to generate a computing result.
Optionally, before sending the computing task identifier to the second application, the first application is further configured to make the incoming parameters of the computing task conform to a parameter format required by the computation of the second application.
Optionally, the second application is further configured to select a thread for executing the computing task for the received computing task identification using a thread pool.
Optionally, in a case that an abnormality occurs when the second application executes the computing task, the second application is further configured to store the abnormality to the message queue corresponding to the computing task identifier.
Optionally, the first application written in the first language is a Java application, and the second application written in the second language is a Python application.
Optionally, the Java application is a Java Web application, the service request is generated according to a webpage request from a client, and when an exception occurs when the Java Web application generates an incoming parameter of the computing task according to the webpage request, the exception is sent to the client for presentation.
To achieve the above object, according to a third aspect of the present invention, there is provided a server for application interaction, comprising: one or more processors; and a storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement any of the methods of interaction described above.
To achieve the above object, according to a fourth aspect of the present invention, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements any of the methods of interaction described above.
The invention has the following advantages or beneficial effects: interaction between the first application and the second application is realized through Restful, SOAP, RPC and an HTTP interface; meanwhile, data such as an incoming parameter and a calculation result of a calculation task during interaction between the first application and the second application are transmitted through the message queue, so that asynchronous interaction between the first application and the second application is realized; in addition, the scheduling of the threads in the thread pool by the second application realizes the concurrent processing of a plurality of computing tasks which need to be executed by the first application for responding to the service request.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main flow of an interaction method between different applications according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the main flow of an interaction method between different applications according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the main architecture of an interactive system between different applications according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 5 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of the main flow of an interaction method between different applications according to an embodiment of the present invention. It can be understood that different applications that interact with each other include, but are not limited to, applications written in Java, C language, python, PHP, C ++, and other languages, and specifically, the embodiments of the present invention will be described in detail by taking only a first application written in a first language as a Java application and a second application written in a second language as a Python application as an example.
As shown in fig. 1, the interaction method of the Java application and the Python application specifically includes the following steps:
In step S101, a Java application receives a service request, and generates a computing task according to the service request, where the computing task indicates a computing task identifier and an incoming parameter of the computing task.
Java applications include, but are not limited to, java Web applications, java App applications, and the like, and Python applications also include, but are not limited to, python Web applications, python App applications, and the like. Because the Java application is different from the development language adopted by the Python application, the format of the input parameters that can be supported when the Java application correspondingly executes the calculation task is not feasible, so before the Java application calls the Python application to execute the calculation task, that is, before the calculation task identifier is sent to the Python application, the Java application needs to make the input parameters of the calculation task conform to the parameter format required by the calculation of the Python application. In addition, when a database storing the input parameters of the computing task corresponding to a Java application such as a Java Web application has a database partition, a table partition, or the like, it is also necessary to obtain the input parameters of the corresponding computing task from one or more partitions or tables of the database.
Specifically, taking a Java application as an example, a Java Web application is taken as an illustration, a corresponding service request is generated according to a Web page request from a client, and when an abnormality occurs in the Java Web application when generating an incoming parameter of a computing task according to the Web page request, the abnormality can be sent to the client for display, so as to prompt a user or related personnel to generate the abnormality in the incoming parameter.
Step S102, the Java application sends the computing task identification to the Python application.
The Java application sends the computing task identification to the Python application through one or more of the following interfaces: restful, SOAP, RPC (remote procedure call) and HTTP. Specifically, still taking a Java application as a Java Web application and a corresponding Python application as a PythonWeb application as an example, encapsulating specific implementation codes of a Python algorithm through Web application frameworks such as flash, django and the like and providing a corresponding Restful interface for the outside such as the Java Web application and the like, so that the Java Web application calls the Python Web application through the Restful interface and transmits a computing task identifier corresponding to a computing task to be executed to the Python Web application.
Step S103, the Python application executes the calculation task using the input parameters of the calculation task according to the calculation task identifier, so as to generate a calculation result.
Preferably, the Python application uses a thread pool to select a thread for executing a received computing task for the computing task identification. That is, the Python application schedules threads for executing computing tasks through the thread pool, and when there are multiple computing tasks to be executed, the threads can be started simultaneously to perform concurrent processing; when a specific calculation task is started to be executed, acquiring the input parameters of the calculation task, checking the format, the size and the like of the input parameters of the calculation task, and executing the calculation task by calling a corresponding Python algorithm in the checking process; in addition, if the verification of the incoming parameter fails, an error message is sent to the Java application through a message queue or the like.
It is understood that the Java application may send the computing task identification and the incoming parameters of the computing task directly to the Python application without a message queue; the Python application may also perform the computing task using the received incoming parameters of the computing task to generate a computing result.
Preferably, the Java application stores the computing task identifier and the input parameters of the computing task in the message queue correspondingly, and sends the computing task identifier to the Python application; and the Python application acquires the input parameters of the calculation task from the message queue according to the calculation task identification, and executes the calculation task by using the input parameters of the calculation task to generate a calculation result.
Step S104, the Python application stores the calculation result and the calculation task identification in the message queue correspondingly, so that the Java application obtains the calculation result corresponding to the calculation task from the message queue.
The problems of Java Web application and Python Web application interaction coupling, asynchronous processing, flow cutting and the like are solved through the message queue, and usable message queues include but are not limited to: redis, rabbitMQ, rocketMQ, activeMQ, kafka, etc.
Preferably, in the case that an abnormality occurs when the Python application executes the computing task, the Python application stores the abnormality and the computing task identifier in the message queue in correspondence, so that the Java application can acquire a message of the computing task execution abnormality from the message queue according to the computing task identifier, so as to timely perform processing such as abnormality analysis on the executing task with the abnormality.
Based on the interaction method of the Java application and the Python application in the embodiment, interaction between the Java application and the Python application is realized through Restful, SOAP, RPC and an HTTP interface; meanwhile, information such as an incoming parameter, a calculation result, calculation abnormality and the like of a calculation task during interaction between Java application and Python application is transmitted through a message queue, so that asynchronous communication between the Java application and the Python application is realized, and interaction between the Java application and the Python application is decoupled; in addition, the scheduling of the Python application to the threads in the thread pool realizes the concurrent processing of a plurality of computing tasks requested to be executed by the Java application, and improves the execution efficiency of the computing tasks. It can be understood that, in the embodiment of the present invention, only the first application written in the first language is a Java application, and the second application written in the second language is a Python application. But different applications for interaction by using the interaction method between different applications provided by the embodiment include, but are not limited to, applications written in languages such as Java, C language, python, PHP, C ++, and the like.
Referring to fig. 2, on the basis of the above embodiment, an interaction method of a Java application and a Python application is provided, which specifically includes the following steps:
In step S201, the Java application receives a service request, and generates a computing task according to the service request, where the computing task indicates a computing task identifier and an incoming parameter of the computing task.
In step S202, the Java application stores the computing task identifier and the input parameters of the computing task in the message queue correspondingly.
The Java application causes the incoming parameters of the computing task to conform to a parameter format required for the computation of the Python application before storing the computing task identification and the incoming parameters of the computing task in correspondence to the message queue. And when the Java application is a Java Web application and an exception occurs to enable the input parameters of the computing task to accord with the parameter format required by the computation of the Python application, sending the exception to the client for display.
Step S203, the Java application sends the computing task identifier to the Python application through one or more of the following interfaces: restful, SOAP, RPC and HTTP.
Step S204, the Python application obtains the input parameters of the computing task from the message queue according to the computing task identification.
In step S205, the Python application uses the input parameters of the calculation task to execute the calculation task to generate a calculation result.
The Python application uses a thread pool to select a thread for executing a received computing task for the computing task identification. In the case that an abnormality occurs when the Python application executes the computing task, the Python application stores the abnormality to the message queue corresponding to the computing task identification. Message queues that may be used include, but are not limited to: redis, rabbitMQ, rocketMQ, activeMQ, kafka, etc.
Step S206, the Python application stores the calculation result and the calculation task identifier in the message queue correspondingly.
Step S207, the Java application obtains the corresponding result of the computing task from the message queue according to the computing task identifier.
When the Java Web application obtains the corresponding result of the calculation task from the message queue, the Java Web application performs data cleaning and analysis on the calculation result, and returns the calculation result to the front-end page.
It can be understood that, in the embodiment of the present invention, only the first application written in the first language is a Java application, and the second application written in the second language is a Python application. But different applications for interaction by using the interaction method between different applications provided by the embodiment include, but are not limited to, applications written in languages such as Java, C language, python, PHP, C ++, and the like.
Referring to fig. 3, on the basis of the above embodiment, there is provided an interaction system of a Java application and a Python application, including: java applications, python applications, and message queues; wherein,
The Java application is used for receiving a service request and generating a calculation task according to the service request, wherein the calculation task indicates a calculation task identifier and an incoming parameter of the calculation task;
the Java application is further used for sending the computing task identifier to the Python application;
The Python application is used for executing the calculation task by using the input parameters of the calculation task according to the calculation task identification so as to generate a calculation result;
The Python application is further configured to store the calculation result and the calculation task identifier in the message queue in correspondence, so that the Java application obtains the calculation result corresponding to the calculation task from the message queue;
and the message queue is used for correspondingly storing the calculation result and the calculation task identifier.
Preferably, the Java application sends the computing task identification to the Python application through one or more of the following interfaces: restful, SOAP, RPC and HTTP.
Preferably, the Java application is further configured to store the computing task identifier and the input parameters of the computing task in the message queue correspondingly, and send the computing task identifier to the Python application;
The Python application is further configured to obtain an incoming parameter of the computing task from the message queue according to the computing task identifier, and execute the computing task using the incoming parameter of the computing task to generate a computing result
Preferably, the Java application sends the computing task identifier and the incoming parameters of the computing task to the Python application;
The Python application performs the computing task using the received incoming parameters of the computing task to generate a computing result.
Preferably, before sending the computing task identifier to the Python application, the Java application is further configured to make the incoming parameters of the computing task conform to a parameter format required for the computation of the Python application.
Preferably, the Python application is further configured to select a thread for executing the computing task for the received computing task identification using a thread pool.
Preferably, in the case that an abnormality occurs when the Python application executes the computing task, the Python application is further configured to store the abnormality to the message queue in correspondence with the computing task identifier.
Preferably, the Java application is a Java Web application, the service request is generated according to a webpage request from a client, and when an exception occurs when the Java Web application generates an incoming parameter of the computing task according to the webpage request, the exception is sent to the client for presentation.
It can be understood that, in the embodiment of the present invention, only the first application written in the first language is a Java application, and the second application written in the second language is a Python application. But different applications for interaction by using the interaction system between different applications provided by the embodiment include, but are not limited to, applications written in Java, C language, python, PHP, C ++, and other languages.
Fig. 4 illustrates an exemplary system architecture 400 to which the Java application and Python application interaction method of embodiments of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 is used as a medium to provide communication links between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 405 via the network 404 using the terminal devices 401, 402, 403 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on the terminal devices 401, 402, 403.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 405 may be a server providing various services, such as a background management server providing support for shopping-type websites browsed by the user using the terminal devices 401, 402, 403. The background management server may analyze and process the received data such as the product information query request, and feed back the processing result (for example, the calculation result of the calculation task) to the terminal device.
It should be noted that, the interaction method between the Java application and the Python application provided by the embodiment of the present invention is generally executed by the server 405.
It should be understood that the number of terminal devices, networks and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, there is illustrated a schematic diagram of a computer system 500 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU501, ROM 502, and RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 501.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include: the Java application receives a service request and generates a calculation task according to the service request, wherein the calculation task indicates a calculation task identifier and an incoming parameter of the calculation task; the Java application sends the computing task identifier to the Python application; the Python application executes the calculation task by using the input parameters of the calculation task according to the calculation task identification so as to generate a calculation result; and the Python application stores the calculation result and the calculation task identification in the message queue correspondingly, so that the Java application obtains the calculation result corresponding to the calculation task from the message queue.
According to the technical scheme of the embodiment of the invention, interaction between the first application and the second application is realized through Restful, SOAP, RPC and an HTTP interface; meanwhile, data such as an incoming parameter and a calculation result of a calculation task during interaction between the first application and the second application are transmitted through the message queue, so that asynchronous interaction between the first application and the second application is realized; in addition, the scheduling of the threads in the thread pool by the second application realizes the concurrent processing of a plurality of computing tasks which need to be executed by the first application for responding to the service request.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method of interaction between different applications, comprising:
Receiving a service request by using a first application edited by a first language, and generating a calculation task according to the service request, wherein the calculation task indicates a calculation task identifier and an input parameter of the calculation task; the service request is generated according to a webpage request from a client;
The first application sends the computing task identification to a second application written in a second language; the first application correspondingly stores the computing task identifier and the input parameters of the computing task to a message queue, and sends the computing task identifier to the second application; before sending the computing task identification to the second application, the first application causes the incoming parameters of the computing task to conform to a parameter format required for computation by the second application;
the second application executes the calculation task by using the input parameters of the calculation task according to the calculation task identification so as to generate a calculation result; the second application acquires the input parameters of the computing task from the message queue according to the computing task identifier, and executes the computing task by using the input parameters of the computing task to generate a computing result;
the second application stores the calculation result and the calculation task identifier in the message queue correspondingly, so that the first application obtains the calculation result corresponding to the calculation task from the message queue;
and the first application performs data cleaning and analysis on the calculation result and returns the calculation result to the front-end page.
2. A method of interaction between different applications according to claim 1,
The first application sends the computing task identification to the second application through one or more of the following interfaces: restful, SOAP, RPC and HTTP.
3. A method of interaction between different applications according to claim 1,
The first application sends the computing task identifier and the input parameters of the computing task to the second application;
The second application performs the computing task using the received incoming parameters of the computing task to generate a computing result.
4. A method of interaction between different applications according to claim 1,
The second application uses the thread pool to select a thread for executing the computing task for the received computing task identification.
5. A method of interaction between different applications according to claim 1,
In the case that an abnormality occurs when the second application executes the computing task, the second application stores the abnormality to the message queue in correspondence with the computing task identifier.
6. The method of any of claims 1-5, wherein the first application written in a first language is a Java application and the second application written in a second language is a Python application.
7. The method of interaction between disparate applications of claim 6 wherein,
The Java application is a Java Web application, and when an abnormality occurs in the Java Web application when generating the input parameters of the computing task according to the webpage request, the abnormality is sent to the client for display.
8. An interactive system between different applications, comprising: a first application written in a first language, a second application written in a second language, and a message queue; wherein,
The first application is used for receiving a service request and generating a calculation task according to the service request, wherein the calculation task indicates a calculation task identifier and an incoming parameter of the calculation task; the service request is generated according to a webpage request from a client;
The first application is further configured to send the computing task identifier to the second application; the method is also used for correspondingly storing the computing task identifier and the input parameters of the computing task to the message queue and sending the computing task identifier to the second application; and the first application is further used for enabling the incoming parameters of the computing task to conform to the parameter format required by the computing of the second application before the computing task identification is sent to the second application;
The second application is configured to execute the computing task by using the input parameters of the computing task according to the computing task identifier, so as to generate a computing result; the method is also used for acquiring the input parameters of the computing task from the message queue according to the computing task identifier, and executing the computing task by using the input parameters of the computing task to generate a computing result;
the second application is further configured to store the calculation result and the calculation task identifier in the message queue in correspondence, so that the first application obtains the calculation result corresponding to the calculation task from the message queue;
The message queue is used for correspondingly storing the calculation result and the calculation task identifier;
The first application is further used for performing data cleaning and analysis on the calculation result and returning the calculation result to the front-end page.
9. A server for application interaction, comprising:
One or more processors;
Storage means for storing one or more programs,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-7.
10. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-7.
CN201911185619.3A 2019-11-27 2019-11-27 Interaction method and system between different applications Active CN112860447B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911185619.3A CN112860447B (en) 2019-11-27 2019-11-27 Interaction method and system between different applications

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911185619.3A CN112860447B (en) 2019-11-27 2019-11-27 Interaction method and system between different applications

Publications (2)

Publication Number Publication Date
CN112860447A CN112860447A (en) 2021-05-28
CN112860447B true CN112860447B (en) 2024-06-18

Family

ID=75985779

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911185619.3A Active CN112860447B (en) 2019-11-27 2019-11-27 Interaction method and system between different applications

Country Status (1)

Country Link
CN (1) CN112860447B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113645303B (en) * 2021-08-11 2024-04-23 曙光信息产业(北京)有限公司 Data transmission method, device, computer equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107632894A (en) * 2017-08-09 2018-01-26 中国电力科学研究院 A kind of implementation method and device for power market transaction service call

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9442782B2 (en) * 2014-01-31 2016-09-13 Corero Networks Security, Inc. Systems and methods of interface description language (IDL) compilers
CN106325866B (en) * 2016-08-22 2019-09-20 网易(杭州)网络有限公司 Across engine calling method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107632894A (en) * 2017-08-09 2018-01-26 中国电力科学研究院 A kind of implementation method and device for power market transaction service call

Also Published As

Publication number Publication date
CN112860447A (en) 2021-05-28

Similar Documents

Publication Publication Date Title
CN111045833B (en) Interface calling method and device
CN113010405A (en) Application program testing method and device
CN110888639A (en) Business code compiling and packaging method and device
CN112084042B (en) Message processing method and device
CN113127225A (en) Method, device and system for scheduling data processing tasks
CN112398669A (en) Hadoop deployment method and device
CN112860447B (en) Interaction method and system between different applications
CN110807535A (en) Construction method and construction device of unified reservation platform and unified reservation platform system
CN112685481B (en) Data processing method and device
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN113779122B (en) Method and device for exporting data
CN111831503A (en) Monitoring method based on monitoring agent and monitoring agent device
CN110806967A (en) Unit testing method and device
CN112131095B (en) Pressure testing method and device
CN113779018A (en) Data processing method and device
CN112463616A (en) Chaos testing method and device for Kubernetes container platform
CN113448602A (en) Version updating method and device
CN113760693A (en) Method and apparatus for local debugging of microservice systems
CN113760487A (en) Service processing method and device
CN113448652A (en) Request processing method and device
CN113760482A (en) Task processing method, device and system
CN113468041A (en) Interface comparison test method and device
CN112559001A (en) Method and device for updating application
CN110727739B (en) Data storage method and device
CN113515437B (en) Method and device for debugging interface

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