A kind of messaging bus is supported the method for polymorphic function
Technical field
The present invention relates to a kind of messaging bus and support the method for polymorphic function, be used for satisfying the needs of dispatch automated system, belong to the power network schedule automation field polymorphic applied environment.
Background technology
In automation system for the power network dispatching now; The combination of the application service routine that to be a data entity and a group handle this data entity, the composition of using such as SCADA has: the real-time storehouse of SCADA, data, services process, operate services process, remote signalling remote measurement and operating mode are handled service processes etc.Attitude is the set for one group of application accomplishing some objective function, and processing logic that this group is used is identical, and data entity has certain incidence relation, but the data environment of operation is different.Application between the attitude has separately independently data entity and service processes, and processing logic does not disturb mutually.Can move a plurality of attitudes simultaneously on same the node.
Under polymorphic environment; An identical process can be moved respectively in different attitudes, and in each process, the messaging bus instance can be subscribed to identical passage; And messaging bus is as the bottom communication support of dispatch automated system, requires again that each channel number is unique in whole system.Existing messaging bus (message-oriented middleware) product is not supported this function.
Summary of the invention
The technical problem that the present invention will solve provides the method that a kind of messaging bus is supported polymorphic function, satisfies dispatch automated system to polymorphic applied environment needs.
For solving the problems of the technologies described above, the method that the present invention provides a kind of messaging bus to support polymorphic function, defining an instance with self message attributes and one group of message operating function interface is a message instance.
The invention is characterized in and may further comprise the steps:
(1), the definition message instance, message instance is carried out initialization, initialization information comprises attitude sign, process identification (PID);
(2), message instance is through the subscribing interface subscribe message, logical channel is mapped as unique physical channel in the messaging bus according to attitude under the message instance, is recorded in this node subscription information table;
(3), messaging bus is broadcast to other nodes with the property information cycle property in the node subscription information table;
(4), messaging bus receives the subscription information that other nodes send over;
(5), when message instance sends a message to a certain passage through transmission interface, logical channel is mapped as unique physical channel according to attitude under the message instance, messaging bus sends a message on the node of subscribing to this physical channel;
(6), after messaging bus receives message,, find out the message instance of subscribing to this physical channel, again message is submitted to these message instance according to the mapping ruler of logical channel to the physical channel.
Aforesaid a kind of messaging bus is supported the method for polymorphic function; It is characterized in that: in step 1); Message instance has attitude sign, process identification (PID) doublet; This doublet unique identification a message instance, even operation still can conveniently be distinguished each message instance during a plurality of attitude on same node.
Aforesaid a kind of messaging bus is supported the method for polymorphic function, it is characterized in that: in step 2), 3) in, message channel information is divided into logical channel and physical channel, logical channel is mapped as unique physical channel according to affiliated attitude and certain rule.The logical channel programs is directly used, and makes things convenient for application program to use; Use when the physical channel supplies messaging bus to communicate, isolated the not message between the homomorphism from the network service level.During subscription information, logical channel is mapped as the physical channel, be kept in the subscription information table of this node, and periodic broadcasting is to other nodes.
The beneficial effect that the present invention reached:
Use message instance of a doublet unique identification, realized isolating each other between the message instance, can move the message instance of a plurality of attitudes on the same node; Message channel is divided into logical channel and physical channel; Logical channel is convenient to application program and is used, and the application process of homomorphism can not subscribed to identical logical channel when using the messaging bus instance, has simplified program structure, the whole strong maintainability of application program; Messaging bus internal control and maintenance are convenient in the physical channel, on the network service level, have just isolated the not message between the homomorphism fully, guarantee the principle that message between the attitude can not mutual communication.
Description of drawings
Fig. 1 logical channel and physical channel corresponding relation figure;
Fig. 2 is the message transmission flow figure that supports polymorphic function;
Fig. 3 is a message sink flow chart of supporting polymorphic function.
Embodiment
Below in conjunction with accompanying drawing messaging bus mechanism of the present invention is done further detailed introduction.
Fig. 1 is logical channel and physical channel mapping relations figure, and same logical channel be not mapped as different physical channels under the homomorphism, and messaging bus directly uses the physical channel to communicate on the communication level.
Fig. 2 is the message transmission flow figure that supports polymorphic function.
Context
iUnder the attitude, App
aUse process Proc down
pNeed be to channel C hannel
xSend message, at first define message instance, and carry out initialization, initiation parameter does<context
i, Proc
p, Procp_alias1>, message instance is called transmission interface and is sent message, logical channel Channel
xBe mapped as physical channel channel
x, channel is subscribed in the messaging bus inspection
1Node, message is sent to these nodes.
Fig. 3 is a message sink flow chart of supporting polymorphic function.
Context
iUnder the attitude, App
bUse process Proc down
qNeed receive path Channel
xMessage, at first define message instance, and carry out initialization, initiation parameter does<context
i, Proc
x, Procq_alias1>, message instance is called subscribing interface and is subscribed to Channel
x, logical channel Channel
xBe mapped as physical channel channel
x, messaging bus all physical channels of this node subscription information periodically through broadcasting to other nodes.After the message that receives on the network, all subscribe to channel on this node of messaging bus inspection
xMessage instance, and message passed to these message instance.Process Proc
qObtain message through calling receiving interface.
The present invention is illustrated according to the preferred embodiment, should be appreciated that the foregoing description does not limit the present invention in any form, and all employings are equal to the technical scheme that mode obtained of replacement or equivalent transformation, all drop in protection scope of the present invention.