Communication service container in a kind of distributed system and communication means
Technical field
The present invention relates to the technical field of distributed system, particularly relate to the communication service container in a kind of distributed system and communication means.
Background technology
Distributed system (distributedsystem) is the software systems be based upon on network.Exactly because the characteristic of software, so distributed system has cohesion and the transparency of height.In a distributed system, one group independently computer is presented to user is a unified entirety, just looks like be like a system.System has physics and the logical resource of many general, can allocating task dynamically, and physics and the logical resource of dispersion realize information exchange by computer network.One is had with the mode supervisory computer distribution of resource formula operating system of the overall situation in system.Usually, concerning user, distributed system only has a model or pattern.On operating system, there is one deck software middleware to be responsible for realizing this model.The example of a famous distributed system is World Wide Web (WWW), and in World Wide Web (WWW), all seem that just looking like is that a document is the same.
When building distributed system, the primary problem solved is intersubsystem communication problem.In a distributed system, communicated with remote message by remote service between subsystem.In prior art, realize the communication between subsystem in the following manner:
(1) the simple Spring of employing container realizes
(2) the simple JBoss of employing realizes
But the communication mode between existing subsystem has following deficiency:
(1) Spring container needs to realize as Springbean, and JBoss needs to realize as Ejb;
(2) no matter be Spring or Jboss, all need the connection management redesigning distributed system, and unrealized subsystem and the many Dependence Problems of other subsystems;
(3) function such as remote service, remote message is isolated, all undefined standard interface of above-mentioned functions and do not consider the feature of distributed system, poor in reusability and maintainability.
(4) same distributed system this, the realization of subsystems communication cannot standardization, makes specific implementation to occur differentiation, causes system not easy care.
Summary of the invention
The shortcoming of prior art in view of the above, the object of the present invention is to provide the communication service container in a kind of distributed system and communication means, for issuing remote service, obtaining remote service, giving out information and subscribe to remote message; This communication service container defines the framework and standard interface that communicate between distributed subsystem, but specific service, message with which kind of technology realize then determining according to the actual demand of distributed system, thus has durability, and easy to maintenance.
For achieving the above object and other relevant objects, the invention provides communication service container in a kind of distributed system, comprise subsystem connection management module, subsystem link block, remote communications partner, remote service release module and remote message release module; Described subsystem connection management module is used for the connection initiating to connect or accept other subsystems to other subsystems, and the connection status of other subsystems of buffer memory; Described subsystem link block for connecting other subsystems, and produces the remote communications partner with opposite end subsystem communication after successful connection; Described remote communications partner is used for after current sub-system successfully connects other subsystems, realizes the acquisition of current sub-system to the remote service of other subsystems and the subscription of remote message; Described remote service release module is used for service to be issued as remote service, is supplied to other subsystems and calls; Described remote message release module is used for after other subsystems have subscribed the message of current sub-system, sends a message to other subsystems.
In one embodiment of the invention, the standard interface communicated between described subsystem connection management module definition distributed subsystem.
In one embodiment of the invention, the standard interface communicated between described distributed subsystem comprises remote service issuing interface, news release interface and the remote communications partner for obtaining remote service and subscription remote message.
In one embodiment of the invention, if current sub-system connects other subsystems multiple, then current sub-system is by remote communications partner corresponding for other subsystems multiple for buffer memory.
In one embodiment of the invention, when current sub-system issues remote service, the subsystem connection manager of other subsystems can initiate to connect to current sub-system, and after successful connection, obtain the remote communications partner of current sub-system, thus gets the remote service of current sub-system issue.
In one embodiment of the invention, when described news release module gives out information, comprise the following steps:
1) connection status of current sub-system and other subsystems is judged;
2) if current sub-system and other subsystem successful connections, 3 are proceeded to); Otherwise, do not give out information;
3) judge whether the message issued is subscribed to by other subsystems;
4) if the message issued is subscribed to by other subsystems, other subsystems will receive this message; Otherwise this message can not be sent to other subsystems.
In one embodiment of the invention, the specific implementation of journey service and remote message is determined by the actual demand of distributed system.
In addition, the present invention also provides a kind of communication means as the communication service container in above-mentioned arbitrary distributed system, wherein:
When current distributed subsystem needs with other subsystem communications, initiate connection request by subsystem connection management module to other subsystems; In request by afterwards, connect other subsystems by subsystem link block; The remote communications partner with opposite end subsystem communication is produced after successful connection; The acquisition of current sub-system to the remote service of other subsystems and the subscription of remote message is realized by remote communications partner;
Current distributed subsystem rely on by other subsystems time, the connection request of other subsystems is accepted by subsystem connection management module, and after successful connection, issue remote service and remote message by the remote communications partner of the correspondence of other subsystems to other subsystems.
As mentioned above, the communication service container in distributed system of the present invention and communication means, have following beneficial effect:
(1) in conjunction with the connection performance of distributed system, build remote communications partner and communicate with multiple subsystem, availability is strong;
(2) be a software level by the communication definitions between distributed subsystem, define standardized interface, improve the durability of distributed system, stability and development efficiency.
Accompanying drawing explanation
Fig. 1 is shown as the structural representation of the design system of communication service container in distributed system of the present invention.
Element numbers explanation
1 subsystem connection management module
2 subsystem link blocks
3 remote communications partner
4 remote service release module
5 remote message release module
Embodiment
Below by way of specific instantiation, embodiments of the present invention are described, those skilled in the art the content disclosed by this specification can understand other advantages of the present invention and effect easily.The present invention can also be implemented or be applied by embodiments different in addition, and the every details in this specification also can based on different viewpoints and application, carries out various modification or change not deviating under spirit of the present invention.It should be noted that, when not conflicting, the feature in following examples and embodiment can combine mutually.
It should be noted that, the diagram provided in following examples only illustrates basic conception of the present invention in a schematic way, then only the assembly relevant with the present invention is shown in graphic but not component count, shape and size when implementing according to reality is drawn, it is actual when implementing, and the kenel of each assembly, quantity and ratio can be a kind of change arbitrarily, and its assembly layout kenel also may be more complicated.
A distributed system is made up of multiple subsystem, Existence dependency relationship between subsystem.If subsystem 1 depends on subsystem 2, so subsystem 1 communicates with subsystem 2 just needs to obtain the remote service of subsystem 2, then calls method of servicing and communicates; If subsystem 1 needs the message of receiving subsystem 2, subsystem 1 just needs the message of subscribing to subsystem 2; Subsystem 1 may depend on multiple subsystem.Communicated with other subsystems by the remote communications partner of the multiple subscription for obtaining remote service and realizing remote message of definition in the present invention.
The major function of the communication service container in distributed system of the present invention is for issuing remote service, obtaining remote service, giving out information and subscribe to remote message, and according to the framework communicated between above-mentioned functions definition distributed subsystem and standard interface, but specific service, message with which kind of technology realize then determining according to the actual demand of distributed system, thus strengthen system function module durability and maintainability.
With reference to Fig. 1, in distributed system of the present invention, communication service container comprises subsystem connection management module 1, subsystem link block 2, remote communications partner 3, remote service release module 4 and remote message release module 5.
Subsystem connection management module 1 connects for initiating to connect or accept other subsystems to other subsystems, and the connection status of other subsystems of buffer memory.
Particularly, subsystem connection management module 1 defines the standard interface communicated between distributed subsystem.The standard interface communicated between distributed subsystem comprise remote service issuing interface, news release interface, for obtaining remote service and subscribing to the remote communications partner of remote message.
If current sub-system connects other subsystems multiple, then current sub-system is by multiple for buffer memory remote communications partner and corresponding subsystem communication.
Subsystem link block 2 for connecting other subsystems, and produces the remote communications partner with opposite end subsystem communication after successful connection.
Remote communications partner 3, for after current sub-system successfully connects other subsystems, realizes the acquisition of current sub-system to the remote service of other subsystems and the subscription of remote message.
Particularly, between current sub-system and other subsystems of relying on after successful connection, current sub-system obtains the remote communications partner of other subsystems, and on other subsystems, obtains remote service by this remote communications partner and subscribe to remote message.If current sub-system depends on multiple subsystem, then initiate connection request, to obtain the remote communications partner of multiple subsystem to multiple subsystem.
Remote service release module 4, for service is issued as remote service, is supplied to other subsystems and calls.
Particularly, if a subsystem is relied on by other subsystems, mean that this subsystem needs to provide some remote service to call to other subsystems, so this subsystem just needs to issue these services as remote service, the subsystem connection manager of other subsystems can initiate to connect to current sub-system, obtains the remote service that remote communications partner just can get the issue of this subsystem after successful connection.
Remote message release module 5 for have subscribed current sub-system at other subsystems message after, send a message to other subsystems.
If a subsystem is relied on by other system, mean that current sub-system needs Message Transmission to other subsystems.First, current sub-system judges the connection status with other subsystems; If current sub-system and other subsystem successful connections, then judge whether the message issued is subscribed to by other subsystems again, if do not subscribed to, this message to be sent to other subsystems, only has the subsystem subscribing to this message just can receive this message.
Particularly, when remote message release module 5 gives out information, comprise the following steps:
1) connection status of current sub-system and other subsystems is judged;
2) if current sub-system and other subsystem successful connections, 3 are proceeded to); Otherwise, do not give out information;
3) judge whether the message issued is subscribed to by other subsystems;
4) if the message issued is subscribed to by other subsystems, other subsystems will receive this message; Otherwise this message can not be sent to other subsystems.
Therefore, in communication service container in distributed system of the present invention, when current sub-system needs with other subsystem communications, connection request is initiated to other subsystems by subsystem connection management module, and in request by afterwards, connect other subsystems by subsystem link block, and after successful connection, produce the remote communications partner with opposite end subsystem communication; The acquisition of current sub-system to the remote service of other subsystems and the subscription of remote message is realized finally by remote communications partner.
In communication service container in distributed system of the present invention, current sub-system rely on by other subsystems time, the connection request of other subsystems is accepted by subsystem connection management module, and after successful connection, issue remote service and remote message by the remote communications partner of the correspondence of other subsystems to other subsystems.
In sum, the connection performance of the communication service container combination distributed system in distributed system of the present invention, build remote communications partner and communicate with multiple subsystem, availability is strong; Be a software level by the communication definitions between distributed subsystem, define standardized interface, improve the durability of distributed system, stability and development efficiency.So the present invention effectively overcomes various shortcoming of the prior art and tool high industrial utilization.
Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all without prejudice under spirit of the present invention and category, can modify above-described embodiment or changes.Therefore, such as have in art usually know the knowledgeable do not depart from complete under disclosed spirit and technological thought all equivalence modify or change, must be contained by claim of the present invention.