The content of the invention
It is an object of the invention to propose a kind of event distributing method, it can be solved, and event message treatment effeciency is low to ask
Topic.
In order to achieve the above object, the technical solution adopted in the present invention is as follows:
Event distributing method, it is comprised the following steps:
Step 1, message queue cluster receive the event of the registration from management server and because of the subscription operation of user
The subscription configuration information of generation, the event carries out corresponding binding with a Message Queuing server in message queue cluster,
The configuration information of subscribing to includes event, event handling number of concurrent and the event handling address subscribed to;
Whole event informations and preserved in step 2, proxy server active pull message queue cluster;
Whole subscription configuration informations and preserved in step 3, execute server active pull message queue cluster;
Step 4, proxy server receive Client-initiated event message, and tying up according to event and Message Queuing server
Determine information, the event message is pushed into corresponding Message Queuing server;
Step 5, execute server pull the event message in message queue cluster, and according to subscription configuration information,
Con current control is carried out to the event message and is sent to event handling address;
Wherein, the execution sequence of step 2 and step 3 is unrestricted.
Preferably, the event of the message queue cluster of different computer rooms and subscription configuration information actively carry out real-time synchronization behaviour
Make.
Preferably, in step 1, the event of registration has important scale designation, and the important scale designation includes persistence mark
Note and non-persistentization mark.It is further preferred that in step 4, if the event message pushes failure, determine whether with
The corresponding event severity level mark of the event message, if the importance degree is marked labeled as persistence, the event is disappeared
Breath is kept in into its database and is pushed again, if the importance degree is marked labeled as non-persistentization, abandons the thing
Part message.
The present invention also proposes a kind of event distribution system for realizing above-mentioned event distributing method, and it includes following dress
Put:
Message-oriented middleware, it is located at message queue cluster, for receive the registration from management server event and because
A Message Queuing Services in the subscription operation of user and the subscription configuration information that produces, the event and message queue cluster
Device carries out correspondence binding, and the subscription configuration information includes event, event handling number of concurrent and the event handling address subscribed to;
First pulls module, and it is located at proxy server, for event letter whole in active pull message queue cluster
Cease and preserved;
Second pulls module, and it is located at execute server, matches somebody with somebody for subscription whole in active pull message queue cluster
Confidence ceases and is preserved;
Pushing module, it is located at proxy server, for receiving Client-initiated event message, and according to event and message
The binding information of queue server, corresponding Message Queuing server is pushed to by the event message;
Performing module, it is located at execute server, for pulling the event message in message queue cluster, and according to
Configuration information is subscribed to, con current control is carried out to the event message and is sent to event handling address;
Wherein, first pull module and second pull module execution sequence it is unrestricted.
Preferably, the event of the message queue cluster of different computer rooms and subscription configuration information actively carry out real-time synchronization behaviour
Make.
Preferably, in the message between in part, the event of registration has important scale designation, and the important scale designation includes lasting
Change mark and non-persistentization mark.It is further preferred that in pushing module, if the event message pushes failure, entering one
Step judges event severity level mark corresponding with the event message, if the importance degree is marked labeled as persistence, by institute
State event message to keep in into its database and pushed again, if the importance degree is marked labeled as non-persistentization, lose
Abandon the event message.
The present invention has the advantages that:
The exploitation of the event message transmission between cross-system is simplified, as long as the producer subscribes to event and sets in management server
Put subscription configuration information, you can realize the transmission system of event message, development efficiency is high, and event message can concurrently send,
So as to improve the treatment effeciency of event message.
Specific embodiment
Below, with reference to accompanying drawing and specific embodiment, the present invention is described further.
As shown in figure 1, a kind of event distributing method, it is comprised the following steps:
Step S1, message queue cluster receive the event of the registration from management server and because of the subscription operation of user
The subscription configuration information of generation, the event carries out corresponding binding with a Message Queuing server in message queue cluster,
The configuration information of subscribing to includes event, the event handling number of concurrent subscribed to(For example, 5)With event handling address(That is HTTP
Event handling URL).Management server can have keeper to be managed, and add event(That is the registration of event), the event is corresponding to disappear
Breath queue server and brief description.In the event of addition, important scale designation can be added according to the significance level of event, it is described
Important scale designation includes persistence mark and non-persistentization mark, to improve data processing performance.
Whole event informations and preserved in step S2, proxy server active pull message queue cluster.For
The proxy server of initialization, all pulls all event informations in message queue cluster, after initialization, if there is newly-increased thing
Part, then only pull newly-increased event, and newly-increased event is merged with the event for having preserved.
Whole subscription configuration informations and preserved in step S3, execute server active pull message queue cluster.
For the execute server for initializing, all subscription configuration informations in message queue cluster are all pulled, after initialization, if having
Newly-increased subscription configuration information, then only pull newly-increased subscription configuration information, and by newly-increased subscription configuration information with preserved
Subscription configuration information merge.
Step S4, proxy server receive Client-initiated event message, and according to event and Message Queuing server
Binding information, corresponding Message Queuing server is pushed to by the event message.If the event message pushes failure, enter
One step judges event severity level mark corresponding with the event message, if the importance degree is marked labeled as persistence, will
The event message is kept in into its database and is pushed again, until sending successfully, if the importance degree is labeled as non-
Persistence is marked, then abandon the event message, so that guarantee information can not lose, can recover, and improves system process performance.
Step S5, execute server pull the event message in message queue cluster, and according to subscription configuration information,
Con current control is carried out to the event message and is sent to event handling address.
Wherein, the execution sequence of step S2 and step S3 is unrestricted, i.e. step S2 can be performed before step S3, it is also possible to
Step S3 is performed before step S2, and step S2 and step S3 can also be performed simultaneously.
In the present embodiment, message queue cluster has multiple, and configuration is in different computer rooms, the message queue of different computer rooms
The event and subscription configuration information of cluster actively carry out real-time synchronization operation.
The present embodiment also proposes a kind of event distribution system for realizing above-mentioned event distributing method, and it includes following dress
Put:
Message-oriented middleware, it is located at message queue cluster, for receive the registration from management server event and because
A Message Queuing Services in the subscription operation of user and the subscription configuration information that produces, the event and message queue cluster
Device carries out correspondence binding, and the subscription configuration information includes event, event handling number of concurrent and the event handling address subscribed to.No
Real-time synchronization operation is actively carried out with the event and subscription configuration information of the message queue cluster of computer room.The event of registration has weight
Wanting scale designation, the important scale designation includes persistence mark and non-persistentization mark.
First pulls module, and it is located at proxy server, for event letter whole in active pull message queue cluster
Cease and preserved.
Second pulls module, and it is located at execute server, matches somebody with somebody for subscription whole in active pull message queue cluster
Confidence ceases and is preserved.
Pushing module, it is located at proxy server, for receiving Client-initiated event message, and according to event and message
The binding information of queue server, corresponding Message Queuing server is pushed to by the event message.If the event message
Failure is pushed, then determines whether event severity level mark corresponding with the event message, if the importance degree is labeled as holding
Longization is marked, then keep in into its database the event message and pushed again, if the importance degree is labeled as non-
Persistence is marked, then abandon the event message.
Performing module, it is located at execute server, for pulling the event message in message queue cluster, and according to
Configuration information is subscribed to, con current control is carried out to the event message and is sent to event handling address.
Wherein, first pull module and second pull module execution sequence it is unrestricted.
As shown in Fig. 2 the system architecture diagram of the concrete application for the present embodiment.Assuming that including computer room 1 and computer room 2.Two
Individual computer room is equipped with message queue cluster, execute server and proxy server, and wherein computer room 1 also has management server.
Message queue cluster includes multiple incremental message queue servers and multiple Message Queuing servers.The function of each device is as follows:
Management server takes, for connection message queue cluster, the increase of keeper's registered events, deletions, change and
Check, by keeper register incident management information be sent to incremental message queue server and by registered events with it is corresponding
Message Queuing server is bound, and incremental message queue server is the clothes for preserving the subscription of the event and increment of increment
Business, the corresponding Message Queuing server of registered events is the message for preserving user's transmission, the event pair that a user subscribes to
Answer a Message Queuing server for adapting to therewith.Management server is additionally operable to the displaying and analysis of state-event, mainly adjusts
The http conditional codes returned with event handling URL, such as 200:Ask successfully, 404:Corresponding interface, 500 are not found:Interface
Mistake etc., also event in certain moment number of processing and address, this keeper can be analyzed event handling whether into
Work(, request number of times etc..Management server shows operation content with WEB page.
Proxy server, for connection message queue cluster, when starting initialization, all can be by http request management service
The permission of device simultaneously obtains whole event informations, and be stored in its internal memory;Incremental message queue server is actively subscribed to, registration is received
Event information after, merge with whole event informations;Persistence event, refers to the attribute that keeper is set in registered events, table
The bright event is the very important message for the treatment of, if proxy server captures abnormal failure when sending event message, can be first
Local data base queue is saved in, another one sends, and can recover.
Execute server, for connection message queue cluster, pulls when starting initialization and all subscribes to configuration information, actively
Incremental message queue server is subscribed to, after receiving event message, message is disappeared by user in the event that management server is set
The event handling URL treatment of breath;And with con current control function, it is concurrent in the maximum that management server is set by user
Number, and logical operation control execute server is carried out to current number of concurrent in treatment event by overall control center of management server
Enter number of passes.
In fact, also include a client, the operation for receiving user, and by proxy server and management server
It is attached.
The present embodiment is using Rabbit MQ as message-oriented middleware.
The management server of the present embodiment, message queue cluster, between execute server, proxy server and client
By RPC(Remote Procedure Call Protocol, remote procedure call protocol)It is attached.
For a person skilled in the art, technical scheme that can be as described above and design, make other each
Plant corresponding change and deform, and all these changes and deforms the protection model that should all belong to the claims in the present invention
Within enclosing.