A kind of method of intermodule communication, device and computing device
Technical field
The present embodiments relate to digital communication technology field, more particularly to a kind of method of intermodule communication, device and
Computing device.
Background technology
, it is necessary to interact formula between software module in the application software developed in operating system and based on operating system
Transceiver communication communication information bag, to realize data exchange.Data interaction between software module and software module communicates, i.e. module
Between communicate and include:Intra process communication and interprocess communication;Wherein, interprocess communication includes:Between process in same computing device
Interprocess communication between communication, different computing devices.
Unified communication interface can just make communication transparent simple, so that in software development phase with all strength in the reality of service logic
Existing, therefore, in most cases, the both sides of intermodule communication are to carry out identification by the IP of binding and port, and
Receive and dispatch communication information bag.
However, inventor has found during the technical scheme in realizing the embodiment of the present invention, communicated between existing module
Method at least there is following technical problem:
In actual applications, the existing intermodule communication method based on IP and port cannot be distinguished by intermodule communication type,
And then can not can improve the intermodule communication side of communication efficiency and bandwidth availability ratio for different intermodule communication type uses
Formula carries out intermodule communication.
The content of the invention
In view of this, the purpose of the embodiment of the present invention is to provide a kind of method of intermodule communication, device and calculate to set
Standby, the intermodule communication method to solve in the prior art based on IP and port cannot be distinguished by lacking for intermodule communication type
Fall into, by using process name, module name, logic machine name and process activestandby state to the software module of module communicating pair and it
Destination address in transmitted communication information bag be identified, realization makes a distinction to intermodule communication type, Jin Erzhen
Communication information bag is sent using corresponding intermodule communication mode to different intermodule communication types, intermodule communication is improved
Communication efficiency and bandwidth availability ratio.
To achieve these goals, the technical scheme used in the embodiment of the present invention is as follows:
In a first aspect, a kind of method of intermodule communication is provided in the embodiment of the present invention, applied to the first computing device, institute
State the first computing device and use with the software module of at least one the second computing device of first computing device communication
Journey name, module name, logic machine name and process activestandby state are identified;Wherein, the process is entitled based on handled industry
It is engaged in predefined process title, the entitled predefined software module title of module, the logic machine is entitled predefined
The logic hardware title of computing device, the process activestandby state be the host process state that is determined by process active and standby management node with
Standby process status;Methods described includes:
After the software module sender of intermodule communication obtains communication information bag, parsing is obtained in the communication information bag
Destination address;Wherein, there is process name, module name, logic machine name and process activestandby state mark in the destination address;
The intermodule communication type related to process is determined based on the destination address;
Using intermodule communication mode corresponding with the intermodule communication type, the communication information bag is sent to institute
State the software module recipient of intermodule communication.
In possible embodiment, determine that the intermodule communication type related to process is if based on the destination address
Intra process communication, it is described to use intermodule communication mode corresponding with the intermodule communication type, by the communication information bag
The step of being sent to the software module recipient of the intermodule communication, be specially:
Using inside story queue communication mode corresponding with intra process communication, the communication information bag is sent to described
The software module recipient of intermodule communication;Wherein, inside story queue communication mode includes common message queue communication
Mode and internal memory message queue communication mode.
In possible embodiment, if inside story queue communication mode is the internal memory message queue communication mode,
It is described to use inside story queue communication mode corresponding with intra process communication, the communication information bag is sent to the module
Between communicate the software module recipient the step of, be specially:
The communication information bag memory pointer is write into internal memory message queue, so that the software of the intermodule communication
Module recipient obtains the memory pointer of the communication information bag from the internal memory message queue, based on the communication information bag
Memory pointer obtain the content of the communication information bag.
In possible embodiment, determine that the intermodule communication type related to process is if based on the destination address
Interprocess communication in same computing device, it is described to use intermodule communication mode corresponding with the intermodule communication type,
The step of communication information bag is sent to the software module recipient of the intermodule communication, be specially:
Using system message queue communication mode corresponding with the interprocess communication in same computing device, by the communication
Message package is sent to the software module recipient of the intermodule communication;Wherein, the system message queue is process pair
The system message queue that outer message interface includes.
In possible embodiment, the intermodule communication type determined if based on the destination address sets for different calculating
Interprocess communication between standby, it is described to use intermodule communication mode corresponding with the intermodule communication type, by the communication
The step of message package is sent to the software module recipient of the intermodule communication, be specially:
Using the corresponding IP of interprocess communication and port numbers communication mode between different computing devices, the communication is disappeared
Breath bag is sent to the software module recipient of the intermodule communication;Wherein, the IP and port numbers be based on it is described enter
The IP that the external message interface of process obtained from the port resource that journey name and the corresponding process of the process name are possessed includes
And port numbers.
In possible embodiment, methods described also includes:
After the software module recipient of the intermodule communication receives the communication information bag, the institute received is parsed
State the destination address in communication information bag;
If the destination address can be resolved to, the communication information bag is distributed based on the destination address;
If the destination address can not be resolved to, the communication information bag is handled as unexpected message.
It is described before the software module sender of intermodule communication obtains communication information bag in possible embodiment
Method also includes:
A transceiver communication module is determined in each process;
The Module registers interface of the transceiver communication module based on each process, will be described soft in each process
Part module is registered in the transceiver communication module based on module name and creates the corresponding message queue of the software module;
After software module registration in all process completion processes, obtaining one is used to carry out mailing address between software module
The address mapping table of conversion;Wherein, the address mapping table be process name, module name, logic machine name and process activestandby state,
The mapping table of message queue, IP and port;The message queue includes inside story queue and system message queue.
A kind of device of intermodule communication is provided in second aspect, the embodiment of the present invention, applied to the first computing device, institute
State the first computing device and use with the software module of at least one the second computing device of first computing device communication
Journey name, module name, logic machine name and process activestandby state are identified;Wherein, the process is entitled based on handled industry
It is engaged in predefined process title, the entitled predefined software module title of module, the logic machine is entitled predefined
The logic hardware title of computing device, the process activestandby state be the host process state that is determined by process active and standby management node with
Standby process status;Described device includes:
Communication information Packet analyzing unit, for the software module sender of intermodule communication obtain communication information bag after,
Parsing obtains the destination address in the communication information bag;Wherein, there is process name, module name, logic in the destination address
Machine name and process activestandby state mark;
Communication type determining unit, for determining the intermodule communication type related to process based on the destination address;
Communication information bag transmitting element, for using intermodule communication mode corresponding with the intermodule communication type,
The communication information bag is sent to the software module recipient of the intermodule communication.
In possible embodiment, determine that the intermodule communication type related to process is if based on the destination address
Intra process communication, the communication information bag transmitting element, specifically for:
Using inside story queue communication mode corresponding with intra process communication, the communication information bag is sent to described
The software module recipient of intermodule communication;Wherein, inside story queue communication mode includes common message queue communication
Mode and internal memory message queue communication mode.
In possible embodiment, if inside story queue communication mode is the internal memory message queue communication mode,
The communication information bag transmitting element, specifically for:
The communication information bag memory pointer is write into internal memory message queue, so that the software of the intermodule communication
Module recipient obtains the memory pointer of the communication information bag from the internal memory message queue, based on the communication information bag
Memory pointer obtain the content of the communication information bag.
In possible embodiment, determine that the intermodule communication type related to process is if based on the destination address
Interprocess communication in same computing device, the communication information bag transmitting element, specifically for:
Using system message queue communication mode corresponding with the interprocess communication in same computing device, by the communication
Message package is sent to the software module recipient of the intermodule communication;Wherein, the system message queue is process pair
The system message queue that outer message interface includes.
In possible embodiment, determine that the intermodule communication type related to process is if based on the destination address
Interprocess communication between different computing devices, the communication information bag transmitting element, specifically for:
Using the corresponding IP of interprocess communication and port numbers communication mode between different computing devices, the communication is disappeared
Breath bag is sent to the software module recipient of the intermodule communication;Wherein, the IP and port numbers be based on it is described enter
The IP that the external message interface of process obtained from the port resource that journey name and the corresponding process of the process name are possessed includes
And port numbers.
In possible embodiment, described device also includes:
Communication information bag reception processing unit, institute is received for the software module recipient in the intermodule communication
State after communication information bag, parse the destination address in the communication information bag received;If the purpose can be resolved to
Address, the communication information bag is distributed based on the destination address;If the destination address can not be resolved to, by the communication
Message package is handled as unexpected message.
In possible embodiment, described device also includes:
Transceiver communication module determining unit, for the software module sender of intermodule communication obtain communication information bag it
Before, a transceiver communication module is determined in each process;The module note of the transceiver communication module based on each process
Volume interface, the software module in each process is registered in the transceiver communication module based on module name and institute is created
State the corresponding message queue of software module;After software module registration in all process completion processes, obtaining one is used for software
Intermodule carries out the address mapping table of mailing address conversion;Wherein, the address mapping table is process name, module name, logical machine
The mapping table of device name and process activestandby state, message queue, IP and port;The message queue includes inside story queue and is
System message queue.
A kind of computing device is provided in the third aspect, the embodiment of the present invention, including:
At least one processor;And,
The memory being connected with least one described processor communication;Wherein,
The memory storage has can be by the instruction of at least one computing device, and the instruction is by described at least one
Individual computing device, so that the method that at least one described processor is able to carry out foregoing intermodule communication.
Based on above-mentioned technical proposal, method, device and the computing device of the intermodule communication in the embodiment of the present invention pass through
Process name, module name, logic machine name, process activestandby state are identified to software module used in computing device, are realized
Software module communication interface is further on the basis of the IP and port that the port resource possessed based on process name and process is obtained
It is unified, IP and port dynamic binding process name, it is not necessary to corresponding change is made to software module because IP and port change
Strategy;So, on the one hand, the process of the destination address in the communication information bag that can be generated by the communication interface of software module
Name, module name, logic machine name and process activestandby state mark, distinguish related with process between software module and software module
Intermodule communication type, so for different intermodule communication types using the communication efficiency that can more improve intermodule communication and
The intermodule communication mode of bandwidth availability ratio sends communication information bag, realizes between computing device internal software modules, calculates and set
The standby adaptive communications between the software module of computing device, remove unnecessary system bandwidth and take, in computing device and meter
When calculating communication between devices, the external bandwidth occupancy of computing device and effectively reduction network interface card load can be effectively reduced, module is improved
Between the communication efficiency and bandwidth availability ratio that communicate;On the other hand, due to realizing that software communication interfaces are unified, make intermodule communication saturating
It is bright simple so that software modularity thought is more than you know, the difficulty and complexity of software development are reduced, so as in software development phase
With all strength in the realization of service logic, software development speed is improved.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the accompanying drawing used required in technology description to be briefly described, it should be apparent that, drawings in the following description are this hairs
Some bright embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can be with root
Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 shows a kind of process schematic of the method for the intermodule communication provided in the embodiment of the present invention;
Fig. 2, which shows to create in each process in the embodiment of the present invention, can be used in transmitting-receiving intra process communication and process
Between communication message package transceiver communication module process schematic;
Fig. 3 shows a kind of structural representation of the device of the intermodule communication provided in the embodiment of the present invention;
Fig. 4 shows a kind of structural representation of the computing device provided in the embodiment of the present invention.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is
A part of embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art
The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
For the ease of clearly and completely understanding the technical scheme of the embodiment of the present invention, below to institute in the embodiment of the present invention
The term being related to is illustrated.
Term " message " (Message), refers to the data transmitted in the process of same computing device and/or between process, or
The data transmitted between the process of different computing devices.
Disappear in term " message queue " (Message queue), i.e. message chained list, the transmitting procedure for being message for preservation
The container of breath, message sender adds the new information to be sent, message receiver into message queue according to certain rule
Message is read from message queue, message queue is acted as an intermediary, message is relayed to its recipient from its sender, led to
Message queue transmission message is crossed, is to provide to route and ensure being delivered successfully for message for message transmission.
Term " process " (Process), is one of a program with certain standalone feature on some data acquisition system
Secondary operation activity, each process has the address space of its own.
The existing intermodule communication method based on IP and port cannot be distinguished by intermodule communication type, and then can not be for not
With the use of intermodule communication type can improve the intermodule communication mode of communication efficiency and bandwidth availability ratio and carry out intermodule and lead to
Letter.
Inventor has found during the technical scheme in realizing the embodiment of the present invention, why based on IP and port
Intermodule communication method cannot be distinguished by intermodule communication type, cannot be distinguished by not due to intermodule communication type, real causes
It is that during intermodule communication, can be changed for the IP of intermodule communication and port, it is impossible to based on IP and port to mould
The software module both sides of inter-block communication are effectively positioned.
Inventor also found that the factor that intermodule communication is related to is included in process, process activestandby state, process under study for action
Software module and process communication used in hardware relevant information.If them can be associated, intermodule can be achieved with
The communication interface of communication is unified, makes intermodule communication transparent simple, and also just the software module both sides of intermodule communication can be carried out
Effectively positioning, so that communication type between discriminating module.
There is provided a kind of method of intermodule communication, device and computing device based on above-mentioned cognition by inventor.
Fig. 1 shows a kind of process schematic of the method for the intermodule communication provided in the embodiment of the present invention;The side
Method, applied to the first computing device, first computing device and with first computing device communication at least one second
The software module of computing device is identified using process name, module name, logic machine name and process activestandby state;Wherein, institute
State the entitled process title based on handled service subscription justice of process, the entitled predefined software module title of module,
The logic hardware title of the entitled predefined computing device of logic machine, the process activestandby state is by the active and standby pipe of process
Manage host process state and standby process status that node is determined.
Wherein, first computing device and second computing device, can specifically be not limited to cloud platform, service
Device, client, work station, personal computer (PC), notebook computer, industrial computer, embedded device, intelligent terminal, net
Network switching equipment, Network Security Device, network-termination device etc. are related to the computing device of software;The software mould of the computing device
Block, can specifically be not limited to system software, application software, the software module of middleware.
The process name (Process Identification), for the process name based on handled service subscription justice
Claim, can specifically be represented with PID;The process activestandby state related to process, is to be determined by the active and standby management node of process
Host process state and standby process status, can specifically be represented with HAState;In predefined process name, processing business identical
Process, using identical process name, for example, state generally different host process that the active and standby management node of process is determined and it is standby enter
Journey, handled business is identical, therefore possesses identical process name;Meanwhile, it is also to be ensured that the entitled globally unique identifier of process, tool
Body can be generated by globally unique ID makers.
The module name (Moudle Identification), is predefined software module title, can specifically use
MoudleID is represented;In predefined software module title, the software module title in same process must ensure uniquely, different
The software module title of process can be with identical.
The logic machine name (Slot Identification), is the logic hardware title of predefined computing device,
It can specifically be represented with SlotID;The logic machine name, can be specifically board slot number etc..
Before intermodule communication, based on Module registers, the software module in each process is registered in process and created
Build the corresponding message queue of the software module;After software module registration in all process completion processes, obtaining one is used for
The address mapping table of mailing address conversion is carried out between software module.
Before intermodule communication, the first computing device and the second computing device carry out process registers, process registers it is specific
Process can be that, when process 1 is initialized, process 1 has initialized the hardware information of oneself, such as logical machine according to hardware environment
Device name (can specifically include frame number, board slot number, chip number etc.), the port resource possessed based on process name and process,
The port numbers in the external message interface of process 1 are obtained, the external IP of board are obtained on this basis, so that it is external to create process 1
Transceiver communication interface and system message team for obtaining the system message that other processes are sent in same computing device
Row.The hardware information of oneself, such as logic machine name (can specifically be included frame number, board slot number, chip number by process 1
Deng), and other proprietary informations, such as process activestandby state, system message queue number, the IP of transceiver interface and port numbers, lead to
The mode for crossing multicast or broadcast notifies other processes, such as process 2, process 3, realizes and finds each other between process, so as to obtain
Address mapping table for process communication.
Referring now to shown in Fig. 1, the detailed process of intermodule communication is as follows in the embodiment of the present invention:
S110, after the software module sender of intermodule communication obtains communication information bag, parsing obtains the communication and disappeared
Destination address in breath bag;Wherein, there is process name, module name, logic machine name and the active and standby shape of process in the destination address
State is marked;
S120, the intermodule communication type related to process is determined based on the destination address;
Wherein, the intermodule communication type related to process determined in step S120, can specifically include leading in process
Interprocess communication between letter, the interprocess communication in same computing device, different computing devices.
Specific implementation process can judge the communication information based on the module name in destination address and logic machine name
Wrap be sent to be different computing devices software module, or the software module in same computing device, if different calculate
The software module of equipment, then the intermodule communication type related from process is the interprocess communication between different computing devices, if
It is the software module in same computing device, then judges it is in same computing device based on process name and process activestandby state again
Interprocess communication or intra process communication.
S130, using intermodule communication mode corresponding with the intermodule communication type, the communication information bag is sent out
Give the software module recipient of the intermodule communication.
It is corresponding with step S120, intermodule communication corresponding with the intermodule communication type is used in step S130
Mode, the communication information bag is sent to the software module recipient of the intermodule communication, can at least pass through following three
Possible embodiment is planted to realize:
The first possible embodiment is:
Determine that the intermodule communication type related to process is intra process communication if based on the destination address, it is described to adopt
With intermodule communication mode corresponding with the intermodule communication type, the communication information bag is sent to the intermodule and led to
The step of software module recipient of letter, it is specially:
Using inside story queue communication mode corresponding with intra process communication, the communication information bag is sent to described
The software module recipient of intermodule communication;Wherein, inside story queue communication mode includes common message queue communication
Mode and internal memory message queue communication mode.Wherein:
It is described using with leading in process if inside story queue communication mode is the internal memory message queue communication mode
Believe corresponding inside story queue communication mode, the communication information bag is sent to the software mould of the intermodule communication
The step of block recipient, it is specially:
The communication information bag memory pointer is write into internal memory message queue, so that the software of the intermodule communication
Module recipient obtains the memory pointer of the communication information bag from the internal memory message queue, based on the communication information bag
Memory pointer obtain the content of the communication information bag.
It is described to use and intra process communication pair if inside story queue communication mode is common message queue communication mode
The inside story queue communication mode answered, the software module that the communication information bag is sent into the intermodule communication connects
The step of debit, it is specially:
The communication information bag is write into common message queue, so that the software module of the intermodule communication is received
Side obtains the copy content of the communication information bag from the common message queue.
In embodiments of the present invention, the inside story queue, for the software mould in the process for same computing device
The message queue of intermodule communication is carried out between block.The internal memory message queue, refers to for the internal memory based on message institute stored memory
The message chained list of pin generation.
In the first possible embodiment, if carrying out intra process communication using common message queue communication mode,
System reclaims the internal memory shared by the content of the communication information bag after the completion of intra process communication, if using internal memory message queue
Communication mode carries out intra process communication, can avoid carrying out communication information bag interaction using copy content mode, also just not communicate
Message package is by the problem of copy causes RAM leakage too much.In addition, being carried out based on inside story queue communication mode in process
Communication, can not only provide route ensures that communication information bag is sent to, moreover it is possible to provides redundancy for the transmission of communication information bag, and can carry
The peak flow of intra process communication is effectively cut down for Asynchronous Invocation, the efficiency and performance of intra process communication is improved.
Second of possible embodiment be:
Determine the intermodule communication type related to process in same computing device if based on the destination address
Interprocess communication, it is described to use intermodule communication mode corresponding with the intermodule communication type, by the communication information bag
The step of being sent to the software module recipient of the intermodule communication, be specially:
Using system message queue communication mode corresponding with the interprocess communication in same computing device, by the communication
Message package is sent to the software module recipient of the intermodule communication;Wherein, the system message queue is process pair
The system message queue that outer message interface includes.
When intermodule communication type is the interprocess communication in same computing device, it would however also be possible to employ based on process name and
IP and port numbers in the external message interface of process obtained from the port resource that process possesses, are carried out in same computing device
Interprocess communication.
Using between the process in the same computing device of system message queue progress based on computing device operation system kernel
Communication, on the one hand, the peak flow of intra process communication can not only be effectively cut down by Asynchronous Invocation, improves interprocess communication
Efficiency and performance, moreover it is possible to for communication information bag transmission provides redundancy and offer route ensure that communication information bag is sent to, Yi Jineng
The degree of coupling effectively between two processes of reduction;On the other hand, make the interprocess communication in same computing device be not take up calculating to set
Standby network interface card load.
In embodiments of the present invention, the system message queue, for the message queue based on operating system nucleus.
The third possible embodiment is:
The intermodule communication type determined if based on the destination address is the interprocess communication between different computing devices,
It is described to use intermodule communication mode corresponding with the intermodule communication type, the communication information bag is sent to the mould
The step of software module recipient of inter-block communication, it is specially:
Using the corresponding IP of interprocess communication and port numbers communication mode between different computing devices, the communication is disappeared
Breath bag is sent to the software module recipient of the intermodule communication;Wherein, the IP and port numbers be based on it is described enter
The IP that the external message interface of process obtained from the port resource that journey name and the corresponding process of the process name are possessed includes
And port numbers.
Process obtained from the port resource possessed based on the process name and the corresponding process of the process name is external
It is dynamic binding relationship between IP and port numbers, with process name that message interface includes, when IP and port numbers change,
Corresponding change strategy, the i.e. communication interface for the interprocess communication between different computing devices need not be made to software module
Can be unified communication interface, so that the interprocess communication between different computing devices is transparent simple.
At least realize that effectively transmission considers in process and/or between process based on communication information bag, further, methods described
Also include:
After the software module recipient of the intermodule communication receives the communication information bag, the institute received is parsed
State the destination address in communication information bag;
If the destination address can be resolved to, the communication information bag is distributed based on the destination address;
If the destination address can not be resolved to, the communication information bag is handled as unexpected message.
Specific implementation process can be that the software module recipient of intermodule communication is obtaining the software module
After the communication information bag that sender sends, the communication information bag is parsed, is distributed based on the destination address being resolved to
The communication information bag, if parsing is handled the communication information bag as unexpected message less than the destination address, is entering
Logic machine name, process activestandby state can be added during the processing of row unexpected message and carries out comprehensive descision.
At least considered based on the communication interface for simplifying intra process communication and/or interprocess communication, further, referring now to Fig. 2
Shown, before the software module sender of intermodule communication obtains communication information bag, methods described also includes:
S010, determines a transceiver communication module in each process;
S020, the Module registers interface of the transceiver communication module based on each process, by each process
The software module is registered in the transceiver communication module based on module name and creates the corresponding message team of the software module
Row;
S030, after the software module registration in all process completion processes, obtaining one is used to be led between software module
Believe the address mapping table of address conversion;Wherein, the address mapping table is process name, module name, logic machine name and process master
The mapping table of standby state, message queue, IP and port;The message queue includes inside story queue and system message queue.
Specific implementation process can be:
The operating system or application software system of computing device, determine a transceiver communication mould inside each process
Block, the transceiver communication module is used to receive and dispatch communication information bag, wherein, the communication information bag, including intra process communication are logical
Believe message package and interprocess communication communication information bag.The transceiver communication module, can specifically include communication receipt module and logical
Believe sending module, wherein, communication receipt module and communication sending module can be a module or two separately designs
Module.
The transceiver communication module has Module registers interface, the operation of the first computing device and/or the second computing device
System or application software system, by calling the Module registers interface of the transceiver communication module, by each process
Interior software module is registered in the transceiver communication module based on module name, and the software module is registered to the transceiver communication
During module, the corresponding message queue of the software module can be created, the message queue specifically can be using deque
Mode is realized, it would however also be possible to employ the realization of single queue mode, wherein, the message queue includes inside story queue and system disappears
Cease queue.After software module registration in all process completion processes, obtaining one is used to carry out mailing address between software module
The address mapping table of conversion;At least one second meter due to first computing device and with first computing device communication
Calculate equipment software module using process name, module name, logic machine name and process activestandby state be identified, and binding IP and
Port, therefore, the address mapping table are process name, module name, logic machine name and process activestandby state, message queue, IP
With the mapping table of port.
As can be seen here, it can lead in the embodiment of the present invention based on the transceiver communication module determined in each process, with described
Believe the corresponding address mapping table transmitting-receiving intra process communication message package of transceiver module and inter-process communication message bag, simplify intermodule and lead to
The communication interface of letter, improves communication efficiency and performance.
The method of the intermodule communication provided in the embodiment of the present invention, by process name, module name, logic machine name, enter
Journey activestandby state is identified to software module used in computing device, realizes software module communication interface based on process name
The IP obtained with the port resource that process possesses and further unify on the basis of port, IP and port dynamic binding process name,
It need not change to make software module because of IP and port and corresponding change strategy;So, on the one hand, software mould can be passed through
The process name of destination address, module name, logic machine name and process in the communication information bag of the communication interface generation of block is active and standby
Status indication, distinguishes intermodule communication type related with process between software module and software module, and then for different
Intermodule communication type is sent out using the intermodule communication mode of the communication efficiency and bandwidth availability ratio that can more improve intermodule communication
Send communication information bag, realize between computing device internal software modules, between the software module of computing device and computing device from
Communication is adapted to, unnecessary system bandwidth is removed and takes, when being communicated between computing device and computing device, can effectively reduce meter
The external bandwidth occupancy of equipment and effectively reduction network interface card load are calculated, the communication efficiency and bandwidth availability ratio of intermodule communication is improved;
On the other hand, due to realizing that software communication interfaces are unified, make intermodule communication transparent simple so that software modularity thought is brighter
, the difficulty and complexity of software development are reduced, with all strength in the realization of service logic, to improve software in software development phase
Development rate.
The step corresponding to process that any embodiment of the embodiment of the method for foregoing intermodule communication of the present invention is disclosed, can
Function and specific implementation application environment according to achieved by one or more step, logic-based function, which is divided, to be obtained with appointing
Multiple functional modules corresponding to process that one embodiment is disclosed, One function module can be corresponding with same step, also may be used
With corresponding with two or more steps, each functional module can be individually physically present, two or more
Functional module can common physical presence.In execution, functional module can be realized by performing the instruction corresponding with functional module
The execution of corresponding step, the executive agent for performing the instruction corresponding with functional module can be one, can also
It is multiple.
In different specific embodiments, by the function to be realized has differences, specific implementation application environment also may be used
Energy can be different, therefore, obtained multiple functional modules corresponding to the process disclosed with specific embodiment, and it is poor also to exist
It is different, in certain embodiments, some functional modules can be omitted, or do not perform, in certain embodiments, can be with
Two or more functional modules are integrated in One function module, in certain embodiments, can by one or
More than one functional module is combined or is integrated into another system.
Any embodiment that foregoing logic-based function divides the embodiment of the method for obtained intermodule communication of the present invention is taken off
Multiple functional modules corresponding to the process shown, can be realized by program code and obtain corresponding program, described program can
It is installed in memory and including one or more software function modules by computing device, computing device is relative with program
The instruction answered performs the method and step corresponding with functional module.
The form of described program, can be outside or resident software, firmware or microcode (source code or object code), this
When, described program can be connected with data handling system, be used by;Any of the embodiment of the method for intermodule communication of the present invention
The described program corresponding to process that embodiment is disclosed, the computer for the non-volatile program code that can be can perform with processor
Computer-readable recording medium is provided, and the computer-readable medium is the computer-readable recording medium for storing program code, the journey
The instruction that sequence code includes can be used for performing the side of the intermodule communication in the embodiment of the method for foregoing intermodule communication of the present invention
Method.The computer-readable medium can be it is any be adapted to include, store, communicate, propagating or transmission procedure element, specifically may be used
Be electronics, magnetic, optical, electromagnetism, infrared or semiconductor type.For example, removable disk, tape, card,
Electric wire, optical fiber, wireless connection, network, broadcast wave, fixed disk of program etc. can be preloaded wherein.
Any embodiment that foregoing logic-based function divides the embodiment of the method for obtained intermodule communication of the present invention is taken off
Multiple functional modules corresponding to the process shown, can also be realized by logic circuit, correspondingly, intermodule communication of the present invention
Embodiment of the method any embodiment disclose process, using a hardware configuration (for example, being integrated in the core of semi-conducting material
In piece), or software that is properly programmed or otherwise configuring realizes with hardware combinations.
No matter realizing any embodiment of the embodiment of the method for intermodule communication of the present invention by any implementation
Step corresponding to the process of announcement, can obtain the device embodiment and/or this hair of corresponding intermodule communication of the present invention
Bright computing device embodiment.Because the embodiment of the method for they and intermodule communication of the present invention is based on identical inventive concept, it
Technical problem to be solved, realize the course of work of function, can be obtained technique effect, it is logical with intermodule of the present invention
The embodiment of the method for letter is same or similar.Therefore, those skilled in the art, can refer to the dress of intermodule communication of the present invention
Put embodiment and/or computing device embodiment of the present invention, understand that the embodiment of the method for intermodule communication of the present invention is implemented
Form, similarly, can refer to the specific descriptions to method and step in the embodiment of the method for intermodule communication of the present invention, understands this
Matching relationship between each functional module, each functional module and module of the present invention in the device embodiment of invention intermodule communication
Between the course of work of device embodiment that communicates, understand the execution of each executive agent and the function in computing device embodiment of the present invention
During the corresponding instruction of module, the process of the performed method and step corresponding with functional module.
For convenience and simplicity of description, during being illustrated to the device embodiment of intermodule communication of the present invention,
The matching relationship between the course of work of each functional module, each functional module, intermodule of the present invention are just no longer specifically repeated one by one
Technical problem and can be obtained technique effect that the device embodiment of communication can be solved.Similarly, to present invention calculating
During apparatus embodiments are illustrated, the method implementation that can refer to intermodule communication of the present invention is also no longer specifically repeated one by one
The content part that example is understood.
A kind of module is provided in the technical scheme of the embodiment of the method based on intermodule communication of the present invention, the embodiment of the present invention
Between the device that communicates, the method for the device of the intermodule communication and the intermodule communication belongs to identical inventive concept.Institute
The device of intermodule communication is stated, program code can be passed through in the corresponding form of the embodiment of the method for intermodule communication of the present invention
The corresponding program that obtains is realized, and applied to software, such as system software, application software, middleware, the software can specifically be answered
With but be not limited to cloud platform, it is server, client, work station, personal computer (PC), notebook computer, industrial computer, embedded
Equipment, intelligent terminal, the network switching equipment, Network Security Device, network-termination device etc. are related to the computing device of software.
Fig. 3 shows a kind of structural representation of the device of the intermodule communication provided in the embodiment of the present invention.The module
Between the device that communicates, applied to the first computing device, first computing device and with first computing device communication extremely
The software module of few second computing device enters rower using process name, module name, logic machine name and process activestandby state
Know;Wherein, the entitled process title based on handled service subscription justice of the process, the entitled predefined software of module
Module title, the logic hardware title of the entitled predefined computing device of logic machine, the process activestandby state is served as reasons
Host process state and standby process status that the active and standby management node of process is determined.
Referring now to shown in Fig. 3, the device 100 of the intermodule communication includes:Communication information Packet analyzing unit 110, communication
Type determining units 120, communication information bag transmitting element 130, moreover, in embodiments of the present invention, communication information Packet analyzing list
Member 110, communication type determining unit 120, communication information bag transmitting element 130 can be by hardware processor (hardware
Processor) related function module is realized.Wherein:
Communication information Packet analyzing unit 110, communication information bag is obtained for the software module sender in intermodule communication
Afterwards, parsing obtains the destination address in the communication information bag;Wherein, there is process name, module name in the destination address, patrol
Collect machine name and process activestandby state mark;
Communication type determining unit 120, for determining the intermodule communication class related to process based on the destination address
Type;
Communication information bag transmitting element 130, for using intermodule communication side corresponding with the intermodule communication type
Formula, the communication information bag is sent to the software module recipient of the intermodule communication.
In possible embodiment, described device also includes:
Communication information bag reception processing unit 140, for the software module recipient receipts in the intermodule communication
To after the communication information bag, the destination address in the communication information bag received is parsed;If can be resolved to described
Destination address, the communication information bag is distributed based on the destination address;, will be described if the destination address can not be resolved to
Communication information bag is handled as unexpected message.
In possible embodiment, described device also includes:
Transceiver communication module determining unit 150, communication information is obtained for the software module sender in intermodule communication
Before bag, a transceiver communication module is determined in each process;The mould of the transceiver communication module based on each process
Block registration interface, the software module in each process is registered in the transceiver communication module and created based on module name
Build the corresponding message queue of the software module;After software module registration in all process completion processes, obtaining one is used for
The address mapping table of mailing address conversion is carried out between software module;Wherein, the address mapping table is process name, module name, patrolled
The mapping table of volume machine name and process activestandby state, message queue, IP and port;The message queue includes inside story queue
And system message queue.
In possible embodiment, determine that the intermodule communication type related to process is if based on the destination address
Intra process communication, the communication information bag transmitting element 130, specifically for:
Using inside story queue communication mode corresponding with intra process communication, the communication information bag is sent to described
The software module recipient of intermodule communication;Wherein, inside story queue communication mode includes common message queue communication
Mode and internal memory message queue communication mode.
In possible embodiment, if inside story queue communication mode is the internal memory message queue communication mode,
The communication information bag transmitting element 130, specifically for:
The communication information bag memory pointer is write into internal memory message queue, so that the software of the intermodule communication
Module recipient obtains the memory pointer of the communication information bag from the internal memory message queue, based on the communication information bag
Memory pointer obtain the content of the communication information bag.
In possible embodiment, determine that the intermodule communication type related to process is if based on the destination address
Interprocess communication in same computing device, the communication information bag transmitting element 130, specifically for:
Using system message queue communication mode corresponding with the interprocess communication in same computing device, by the communication
Message package is sent to the software module recipient of the intermodule communication;Wherein, the system message queue is process pair
The system message queue that outer message interface includes.
In possible embodiment, the intermodule communication type determined if based on the destination address sets for different calculating
Interprocess communication between standby, the communication information bag transmitting element 130, specifically for:
Using the corresponding IP of interprocess communication and port numbers communication mode between different computing devices, the communication is disappeared
Breath bag is sent to the software module recipient of the intermodule communication;Wherein, the IP and port numbers be based on it is described enter
The IP that the external message interface of process obtained from the port resource that journey name and the corresponding process of the process name are possessed includes
And port numbers.
A kind of calculate is provided in the technical scheme of the embodiment of the method based on intermodule communication of the present invention, the embodiment of the present invention
Equipment, the method for the computing device and the intermodule communication belongs to identical inventive concept.The computing device, is this hair
The corresponding computing device that the embodiment of the method application of bright intermodule communication is obtained, the computing device can be, but not limited to cloud and put down
Platform, server, client, work station, personal computer (PC), notebook computer, industrial computer, embedded device, intelligent terminal
Equipment, the network switching equipment, Network Security Device, network-termination device etc. are related to the computing device of software.
Fig. 4 shows a kind of structural representation of the computing device provided in the embodiment of the present invention.The computing device and
The software module of other computing devices of connection can be communicated with using process name, module name, logic machine name and process master
Standby state is identified;Wherein, the entitled process title based on handled service subscription justice of the process, the module is entitled
Predefined software module title, the logic hardware title of the entitled predefined computing device of logic machine, the process
Activestandby state is the host process state and standby process status determined by the active and standby management node of process.
Referring now to shown in Fig. 4, the computing device 200 includes:Bus 230, connects at least one processor of bus 230
210, and communicate to connect memory 220 with least one processor 210.Wherein, be stored with can be by least one for memory 220
The instruction of computing device, instruction is performed by least one processor 210, to perform following steps when performing the instruction:
After the software module sender of intermodule communication obtains communication information bag, parsing is obtained in the communication information bag
Destination address;Wherein, there is process name, module name, logic machine name and process activestandby state mark in the destination address;
The intermodule communication type related to process is determined based on the destination address;
Using intermodule communication mode corresponding with the intermodule communication type, the communication information bag is sent to institute
State the software module recipient of intermodule communication.
At least one processor 210 is additionally operable to:
Before the software module sender of intermodule communication obtains communication information bag, determine that one leads in each process
Believe transceiver module;The Module registers interface of the transceiver communication module based on each process, by the institute in each process
Software module is stated to be registered in the transceiver communication module based on module name and create the corresponding message queue of the software module;
After software module registration in all process completion processes, obtaining one is used for the ground of progress mailing address conversion between software module
Location mapping table;Wherein, the address mapping table is process name, module name, logic machine name and process activestandby state, message team
The mapping table of row, IP and port;The message queue includes inside story queue and system message queue.
At least one processor 210 is additionally operable to:
After the software module recipient of the intermodule communication receives the communication information bag, the institute received is parsed
State the destination address in communication information bag;
If the destination address can be resolved to, the communication information bag is distributed based on the destination address;
If the destination address can not be resolved to, the communication information bag is handled as unexpected message.
In possible embodiment, intermodule communication mode corresponding with the intermodule communication type is used performing,
When the communication information bag is sent into the step of software module recipient of the intermodule communication, if based on the purpose
Address determines that the intermodule communication type related to process is intra process communication, at least one processor 210 specifically for:
Using inside story queue communication mode corresponding with intra process communication, the communication information bag is sent to described
The software module recipient of intermodule communication;Wherein, inside story queue communication mode includes common message queue communication
Mode and internal memory message queue communication mode.
In possible embodiment, inside story queue communication mode corresponding with intra process communication is used performing, will
When the communication information bag is sent to the step of the software module recipient of the intermodule communication, if inside story team
Row communication mode be the internal memory message queue communication mode, at least one processor 210 specifically for:
The communication information bag memory pointer is write into internal memory message queue, so that the software of the intermodule communication
Module recipient obtains the memory pointer of the communication information bag from the internal memory message queue, based on the communication information bag
Memory pointer obtain the content of the communication information bag.
In possible embodiment, intermodule communication mode corresponding with intermodule communication type is used performing, by institute
When stating communication information bag and being sent to the step of the software module recipient of the intermodule communication, if based on the purpose
Address determines that the intermodule communication type related to process is the interprocess communication in same computing device, at least one processor
210 specifically for:
Using system message queue communication mode corresponding with the interprocess communication in same computing device, by the communication
Message package is sent to the software module recipient of the intermodule communication;Wherein, the system message queue is process pair
The system message queue that outer message interface includes.
In possible embodiment, intermodule communication mode corresponding with the intermodule communication type is used performing,
When the communication information bag is sent into the step of software module recipient of the intermodule communication, if based on the purpose
The intermodule communication type that address is determined is the interprocess communication between different computing devices, and at least one processor 210 is specifically used
In:
Using the corresponding IP of interprocess communication and port numbers communication mode between different computing devices, the communication is disappeared
Breath bag is sent to the software module recipient of the intermodule communication;Wherein, the IP and port numbers be based on it is described enter
The IP that the external message interface of process obtained from the port resource that journey name and the corresponding process of the process name are possessed includes
And port numbers.
In summary, in the embodiment of the present invention, by process name, module name, logic machine name, process activestandby state to meter
Software module used in calculating equipment is identified, and realizes software module communication interface at the end possessed based on process name and process
IP that mouthful resource is obtained and further unify on the basis of port, IP and port dynamic binding process name, it is not necessary to because of IP and end
Mouth, which changes, makes corresponding change strategy to software module;So, on the one hand, can be given birth to by the communication interface of software module
Into communication information bag in the process name of destination address, module name, logic machine name and process activestandby state mark, distinguish soft
The intermodule communication type related with process between part module and software module, and then adopted for different intermodule communication types
Communication information bag is sent with the intermodule communication mode of the communication efficiency and bandwidth availability ratio that can more improve intermodule communication, is realized
Between computing device internal software modules, adaptive communications between the software module of computing device and computing device, removal need not
The system bandwidth wanted takes, and when being communicated between computing device and computing device, can effectively reduce the external bandwidth of computing device
Take and network interface card load, improve the communication efficiency and bandwidth availability ratio of intermodule communication;On the other hand, due to realizing software communication
Interface is unified, makes intermodule communication transparent simple so that software modularity thought is more than you know, reduces the difficulty of software development and multiple
Miscellaneous degree, with all strength in the realization of service logic, to improve software development speed in software development phase.
On this basis, entering in the same computing device of scheduling system message queue progress that can be based on system of computational devices
Communicated between journey, the network interface card load of computing device will not be taken;Inside story queue communication mode can be based on, internal memory is based particularly on
Message queue communication mode carries out intra process communication, intra process communication is become more reasonable, more efficient, can be prevented effectively from communication and disappear
Breath bag is copied too much in internal memory, and then improves the efficiency and performance of intermodule communication.
On this basis, can be based on the transceiver communication module determined in each process and the transceiver communication module pair
The address mapping table transmitting-receiving intra process communication message package and inter-process communication message bag answered, the communication for simplifying intermodule communication connect
Mouthful, improve communication efficiency and performance.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method or computer program product.
Therefore, the present invention can be using the embodiment in terms of complete hardware embodiment, complete software embodiment or combination software and hardware
Form.Deposited moreover, the present invention can use to can use in one or more computers for wherein including computer usable program code
The shape for the computer program product that storage media is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.)
Formula.
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program product
Figure and/or block diagram are described.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram
Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided
The processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce
A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real
The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which is produced, to be included referring to
Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or
The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that in meter
Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, thus in computer or
The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one
The step of function of being specified in individual square frame or multiple square frames.
, but those skilled in the art once know basic creation although preferred embodiments of the present invention have been described
Property concept, then can make other change and modification to these embodiments.So, appended claims are intended to be construed to include excellent
Select embodiment and fall into having altered and changing for the scope of the invention.
Obviously, those skilled in the art can carry out the essence of various changes and modification without departing from the present invention to the present invention
God and scope.So, if these modifications and variations of the present invention belong to the scope of the claims in the present invention and its equivalent technologies
Within, then the present invention is also intended to comprising including these changes and modification.