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, for meeting the needs of dispatch automated system to polymorphic applied environment, belong to power network schedule automation field.
Background technology
In automation system for the power network dispatching now, application is the combination of a data entity and one group of service routine that this data entity is processed, and the composition of applying such as SCADA has: the real-time storehouse of SCADA, data, services process, operate services process, remote signalling remote measurement and operating mode are processed service processes etc.State is that the processing logic of this group application is identical in order to complete the set of one group of application of some objective function, and data entity has certain incidence relation, but the data environment of operation is different.Application between state has separately independently data entity and service processes, and processing logic does not interfere with each other.On same node, can move a plurality of states simultaneously.
Under polymorphic environment, an identical process can be moved respectively in different states, and in each process, messaging bus example can be subscribed to identical passage, and messaging bus is as the bottom communication support of dispatch automated system, it is unique requiring again each channel number in whole system.Existing messaging bus (message-oriented middleware) product is not supported this function.
Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of method that messaging bus is supported polymorphic function, meets dispatch automated system to polymorphic applied environment needs.
For solving the problems of the technologies described above, the invention provides a kind of method that messaging bus is supported polymorphic function, defining an example with self message attributes and one group of message operating function interface is a message instance.
The invention is characterized in and comprise the following steps:
(1), definition message instance, message instance is carried out to initialization, initialization information comprises state sign, process identification (PID);
(2), message instance is by subscribing interface subscribe message, logical channel is mapped as unique physical channel in messaging bus according to state under message instance, is recorded in this node subscription information table;
(3), messaging bus is broadcast to other nodes by property information cycle in node subscription information table;
(4), messaging bus receives the subscription information that other nodes send over;
(5), message instance is while sending a message to a certain passage by transmission interface, logical channel is mapped as unique physical channel according to state under message instance, messaging bus sends a message on the node of subscribing to this physical channel;
(6), after messaging bus receipt message, the mapping ruler according to logical channel to physical channel, finds out the message instance of subscribing to this physical channel, then message is submitted to these message instance.
Aforesaid a kind of messaging bus is supported the method for polymorphic function, it is characterized in that: in step 1), message instance has state sign, process identification (PID) two tuples, this two tuples unique identification a message instance, even while moving a plurality of state on same node, still can conveniently distinguish each message instance.
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 state and certain rule.Logical channel for application program directly, facilitates application program to use; When physical channel communicates for messaging bus, from network service level, isolated the not message between homomorphism.During subscription information, logical channel is mapped as 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 reaches:
Use message instance of a two tuple unique identification, realized isolation mutually between message instance, on same node, can move the message instance of a plurality of states; 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, when using messaging bus example, can not subscribed to identical logical channel, has simplified program structure, the whole strong maintainability of application program; Messaging bus internal control and maintenance are convenient in physical channel, on network service level, have just isolated the not message between homomorphism completely, guarantee the principle that between state, message can not be communicated by letter mutually.
Accompanying drawing explanation
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 the message sink flow chart of supporting polymorphic function.
Embodiment
Below in conjunction with accompanying drawing, messaging bus mechanism of the present invention is done to 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 homomorphism, and messaging bus is directly used physical channel to communicate on communication gradation.
Fig. 2 is the message transmission flow figure that supports polymorphic function.
Context
iunder state, App
athe lower process Proc of application
pneed to be to channel C hannel
xsend message, first define message instance, and carry out initialization, initiation parameter is <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 messaging bus inspection
1node, message is sent to these nodes.
Fig. 3 is the message sink flow chart of supporting polymorphic function.
Context
iunder state, App
bthe lower process Proc of application
qneed receive path Channel
xmessage, first define message instance, and carry out initialization, initiation parameter is < 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 is managed passage subscription information periodically by broadcasting to other nodes this node property.After the message receiving on network, messaging bus checks all subscription channel on this node
xmessage instance, and message is passed to these message instance.Process Proc
qby calling receiving interface, obtain message.
The present invention is illustrated according to the preferred embodiment, should be appreciated that above-described embodiment does not limit the present invention in any form, and all employings are equal to replaces or technical scheme that the mode of equivalent transformation obtains, all drops in protection scope of the present invention.