The message queue disposal route of dispatching system
Technical field
The invention belongs to communication technique field, especially relate to a kind of message queue disposal route of dispatching system.
Background technology
In dispatching services system, message queue is the container preserving message in the transmitting procedure of message, the fundamental purpose of message queue is to provide route and ensures the transmission of message, communicated by message between all nodes, the operation of scheduling strategy to whole cluster of message queue has vital effect.Scheduling operation message in traditional dispatching services system, dispatching response message and module responds message add message queue according to time order and function relation, message processing module therefrom obtains message from message queue and processes, the scheduling strategy design of this kind of mode message queue is unreasonable, the message still simultaneously sent for two different disposal ranks cannot accomplish to respond fast for high-priority message, and receive a low priority message, receive a high-priority message at once, two message operate identical member, existing dispatching system first can process low priority message, receive high-priority message, operation before covering, wherein just there is necessity that original low priority message does not process, and need the rollback operation doing low priority message before the overlapping operation of process high-priority message, considerably increase the complicacy of system, and in the message handling task that message is assigned in the many message handling tasks of pending message or priority ratio is lower, so just may cause in the message handling task that timely message blocks in the message handling task that pending message is many or priority is lower, and then cause timely message time-out or process not in time, timely message can not get rapid process, the operational efficiency of whole dispatching services system is finally caused to be affected.
In order to solve prior art Problems existing, people have carried out long-term exploration, propose solution miscellaneous.Such as, Chinese patent literature discloses a kind of method and device application number that timely message processes in time: 200910087065.3], the method comprises: pending message is divided into timely message and non-timely message, and timely message and non-timely message is inserted into accordingly in the message queue of message handling task respectively; Judge whether contain pending timely message in message handling task, when containing pending timely message, then improve the priority of this message handling task; This message handling task processes pending timely message according to the priority after raising again.Correspondingly, the invention provides the device that a kind of timely message processes in time, comprising: message queue creation module, scheduler task module and message handling task module.
Such scheme to some extent solves the problem that in existing message queue, message cannot process in time, but the program still also exists: processing procedure is loaded down with trivial details, and response speed is low, the problem that system resource is high.
Summary of the invention
The object of the invention is for the problems referred to above, provide a kind of simple and reasonable, the message queue disposal route of the dispatching system of good stability.
For achieving the above object, present invention employs following technical proposal: the message queue disposal route of this dispatching system, it is characterized in that, this method comprises the steps:
A, receipt message: receive by the message sent that accesses terminal of dispatching system, described message is all with the first label and the second label, wherein the first tag characterization type of message and the priority of the first different labels is different, the priority of this message in second tag characterization the type message, the priority of the first described label is higher than the priority of the second label;
B, form message queue: message to be arranged in order according to right of priority according to the first label and the second label thus to form message queue;
C, message call: message processing module therefrom obtains message from message queue and processes.
This method can realize the summary responses of dispatching system use scenes, the message still simultaneously sent for two different disposal ranks can realize responding fast for high-priority message, improve the response speed of system, decrease system resource, improve the stability of system.
In the message queue disposal route of above-mentioned dispatching system, when receive same type message and priority higher than the type when the priority of first message, current message is inserted in described the type before first message, then judge current message and whether be that identical member is operated in first message, if identical member, then described the type is abandoned in first message; If different members, then retain described the type in first message.When receiving a low priority message, receive a high-priority message at once, and two message are when being to identical member, first can process high-priority message, after the low priority message that receives then directly abandon, improve system performance, reduce the complexity of system, and the sequence problem that identical message different operating is introduced well is improved.
In the message queue disposal route of above-mentioned dispatching system, the first described label comprises dispatching response label, module responds label and scheduling operation label, and wherein, dispatching response label is the first priority, module responds label is the second priority, and scheduling operation label is the 3rd priority.
In the message queue disposal route of above-mentioned dispatching system, the second described label is dynamic labels.
In the message queue disposal route of above-mentioned dispatching system, when a new message is received, utilize the pointer that Hash lookup algorithm is corresponding to the second label lookup according to the first label, the message queue described in being inserted by described new information.
Compared with prior art, the advantage of the message queue disposal route of this dispatching system is: the response speed obviously improving system when multiple client carries out automation mechanized operation, decrease system resource, situation about calling out improves the stability of system, realizes the summary responses of dispatching system use scenes.
Accompanying drawing explanation
Structured flowchart when Fig. 1 is receipt message in the present invention.
Fig. 2 is structured flowchart when forming message queue in the present invention.
Structured flowchart when Fig. 3 is message call in the present invention.
In figure, message 1, message queue 2, message processing module 3, dispatching response label B, the first priority scheduling responsive tags B1, the second priority scheduling responsive tags B2, module responds label C, the first priority block responsive tags C1, the second priority block responsive tags C2, scheduling operation label A, the first operation of priority scheduling operation label A 1, second priority scheduling label A 2, pointer P.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention will be further described in detail.
As Figure 1-3, the message queue disposal route of this dispatching system, comprise the steps: A, receipt message: receive by the message 1 sent that accesses terminal of dispatching system, message 1 is all with the first label and the second label, wherein the first tag characterization message 1 type and the priority of the first different labels is different, the priority of this message 1 in second tag characterization the type message 1, the priority of the first label is higher than the priority of the second label; B, form message queue: message 1 to be arranged in order according to right of priority according to the first label and the second label thus to form message queue 2; C, message call: message processing module 3 therefrom obtains message 1 from message queue 2 and processes, this method can realize the summary responses of dispatching system use scenes, the message 1 still simultaneously sent for two different disposal ranks can realize responding fast for high-priority message 1, improve the response speed of system, decrease system resource, improve the stability of system.
Particularly, in the present embodiment, when receive same type message 1 and priority higher than the type when the priority of first message 1, current message 1 is inserted in described the type before first message 1, then judge current message 1 and whether be that identical member is operated in first message 1, if identical member, then described the type is abandoned in first message 1; If different members, then retain described the type in first message 1, namely when receiving a low priority message 1, receive a high-priority message 1 at once, and when two message 1 are to identical member, first can process high-priority message 1, after the low priority message 1 that receives directly abandon, improve system performance, reduce the complexity of system, and the sequence problem that identical message 1 different operating is introduced well is improved.
Wherein, the first label in the present embodiment comprises dispatching response label B, module responds label C and scheduling operation label A, wherein, dispatching response label B is the first priority, module responds label C is the second priority, scheduling operation label A is the 3rd priority, and the second label is here dynamic labels.Suppose according to the second label, all have two priority in dispatching response label B, module responds label C and scheduling operation label A, then dispatching response label B is here divided into the first priority scheduling responsive tags B1 and the second priority scheduling responsive tags B2; Module responds label C is divided into the first priority block responsive tags C1 and the second priority block responsive tags C2; Scheduling operation label A is divided into the first priority scheduling operation label A 1 and the second priority scheduling operation label A 2.
When receiving new information 1, suppose that pointer P points to dispatching response label B and points to the second priority scheduling responsive tags B2, then utilize the pointer P that Hash lookup algorithm is corresponding to the second label lookup according to the first label, described new information 1 is inserted message queue 2.
Specific embodiment described herein is only to the explanation for example of the present invention's spirit.Those skilled in the art can make various amendment or supplement or adopt similar mode to substitute to described specific embodiment, but can't depart from spirit of the present invention or surmount the scope that appended claims defines.
Although more employ message 1, message queue 2, message processing module 3, dispatching response label B, the first priority scheduling responsive tags B1, the second priority scheduling responsive tags B2, module responds label C, the first priority block responsive tags C1, the second priority block responsive tags C2, scheduling operation label A, the first term such as the operation of priority scheduling operation label A 1, second priority scheduling label A 2, pointer P etc. herein, do not get rid of the possibility using other term.These terms are used to be only used to describe and explain essence of the present invention more easily; The restriction that they are construed to any one additional is all contrary with spirit of the present invention.