Summary of the invention
The object of the invention is to propose a kind of event distributing method, it can solve the low problem of event message treatment effeciency.
In order to achieve the above object, the technical solution adopted in the present invention is as follows:
Event distributing method, it comprises the following steps:
Step 1, message queue cluster receive the subscription configuration information producing from the event of the registration of management server with because of user's subscription operation, described event is carried out corresponding binding with the Yi Ge Message Queuing server in message queue cluster, and described subscription configuration information comprises event, event handling concurrent number and the event handling address of subscription;
Step 2, proxy server initiatively pull event informations whole in message queue cluster and preserve;
Step 3, execution server initiatively pull subscription configuration informations whole in message queue cluster and preserve;
Step 4, proxy server receive Client-initiated event message, and according to the binding information of event and Message Queuing server, described event message are pushed to corresponding Message Queuing server;
Step 5, execution server pull described event message, and according to subscribing to configuration information, described event message are carried out concurrent control and is sent to event handling address in message queue cluster;
Wherein, the execution sequence of step 2 and step 3 is unrestricted.
Preferably, the event of the message queue cluster of different machine rooms and subscription configuration information initiatively carry out real-time synchronization operation.
Preferably, in step 1, the event of registration has importance degree mark, and described importance degree mark comprises persistence mark and non-persistentization mark.Further preferred, in step 4, if described event message pushes unsuccessfully, further judge the event severity level mark corresponding with described event message, if described importance degree is labeled as persistence mark, described event message kept in to its database and again push, if described importance degree is labeled as non-persistentization mark, abandoning described event message.
The present invention also proposes a kind of for realizing the case distribution system of above-mentioned event distributing method, and it comprises with lower device:
Message-oriented middleware, it is located at message queue cluster, for receiving the subscription configuration information producing from the event of the registration of management server with because of user's subscription operation, described event is carried out corresponding binding with the Yi Ge Message Queuing server in message queue cluster, and described subscription configuration information comprises event, event handling concurrent number and the event handling address of subscription;
First pulls module, and it is located at proxy server, for initiatively pulling the whole event information of message queue cluster and preserving;
Second pulls module, and it is located at execution server, for initiatively pulling the whole subscription configuration information of message queue cluster and preserving;
Pushing module, it is located at proxy server, for receiving Client-initiated event message, and according to the binding information of event and Message Queuing server, described event message is pushed to corresponding Message Queuing server;
Execution module, it is located at execution server, for pulling described event message at message queue cluster, and according to subscribing to configuration information, described event message is carried out concurrent control and is sent to event handling address;
Wherein, first pull module and second to pull the execution sequence of module unrestricted.
Preferably, the event of the message queue cluster of different machine rooms and subscription configuration information initiatively carry out real-time synchronization operation.
Preferably, in message-oriented middleware, the event of registration has importance degree mark, and described importance degree mark comprises persistence mark and non-persistentization mark.Further preferred, in pushing module, if described event message pushes unsuccessfully, further judge the event severity level mark corresponding with described event message, if described importance degree is labeled as persistence mark, described event message kept in to its database and again push, if described importance degree is labeled as non-persistentization mark, abandoning described event message.
The present invention has following beneficial effect:
Simplified the exploitation that the event message between cross-system transmits, the producer, as long as subscribe to event and subscription configuration information is set at management server, gets final product the transmission system of realization event message, and development efficiency is high, and event message can concurrently send, thus the treatment effeciency of raising event message.
Embodiment
Below, by reference to the accompanying drawings and embodiment, the present invention is described further.
As shown in Figure 1, a kind of event distributing method, it comprises the following steps:
Step S1, message queue cluster receive the subscription configuration information producing from the event of the registration of management server with because of user's subscription operation, described event is carried out corresponding binding with the Yi Ge Message Queuing server in message queue cluster, described subscription configuration information comprises event, event handling concurrent number (for example, 5) and event handling address (being HTTP event handling URL) of subscription.Management server can have keeper to manage, interpolation event (being the registration of event), the corresponding Message Queuing server of this event and brief description.When the event of interpolation, can add importance degree mark according to the significance level of event, described importance degree mark comprises persistence mark and non-persistentization mark, to improve data processing performance.
Step S2, proxy server initiatively pull event informations whole in message queue cluster and preserve.For initialized proxy server, all event informations in message queue cluster are all pulled, after initialization, if there is newly-increased event, only pull newly-increased event, and newly-increased event and the event of having preserved are merged.
Step S3, execution server initiatively pull subscription configuration informations whole in message queue cluster and preserve.For initialized execution server, all subscription configuration informations in message queue cluster are all pulled, after initialization, if there is newly-increased subscription configuration information, only pull newly-increased subscription configuration information, and newly-increased subscription configuration information and the subscription configuration information of having preserved are merged.
Step S4, proxy server receive Client-initiated event message, and according to the binding information of event and Message Queuing server, described event message are pushed to corresponding Message Queuing server.If described event message pushes unsuccessfully, further judge the event severity level mark corresponding with described event message, if described importance degree is labeled as persistence mark, described event message kept in to its database and again push, until send successfully, if described importance degree is labeled as non-persistentization mark, abandon described event message, thereby guarantee information can not lose, can recover, and improve system handling property.
Step S5, execution server pull described event message, and according to subscribing to configuration information, described event message are carried out concurrent control and is sent to event handling address in message queue cluster.
Wherein, the execution sequence of step S2 and step S3 is unrestricted, and step S2 can carry out before step S3, also can before step S2, carry out by step S3, and step S2 and step S3 also can carry out simultaneously.
In the present embodiment, message queue cluster has a plurality of, and is configured in different machine rooms, and the event of the message queue cluster of different machine rooms and subscription configuration information initiatively carry out real-time synchronization operation.
The present embodiment also proposes a kind of for realizing the case distribution system of above-mentioned event distributing method, and it comprises with lower device:
Message-oriented middleware, it is located at message queue cluster, for receiving the subscription configuration information producing from the event of the registration of management server with because of user's subscription operation, described event is carried out corresponding binding with the Yi Ge Message Queuing server in message queue cluster, and described subscription configuration information comprises event, event handling concurrent number and the event handling address of subscription.The event of the message queue cluster of different machine rooms and subscription configuration information initiatively carry out real-time synchronization operation.The event of registration has importance degree mark, and described importance degree mark comprises persistence mark and non-persistentization mark.
First pulls module, and it is located at proxy server, for initiatively pulling the whole event information of message queue cluster and preserving.
Second pulls module, and it is located at execution server, for initiatively pulling the whole subscription configuration information of message queue cluster and preserving.
Pushing module, it is located at proxy server, for receiving Client-initiated event message, and according to the binding information of event and Message Queuing server, described event message is pushed to corresponding Message Queuing server.If described event message pushes unsuccessfully, further judge the event severity level mark corresponding with described event message, if described importance degree is labeled as persistence mark, described event message kept in to its database and again push, if described importance degree is labeled as non-persistentization mark, abandon described event message.
Execution module, it is located at execution server, for pulling described event message at message queue cluster, and according to subscribing to configuration information, described event message is carried out concurrent control and is sent to event handling address.
Wherein, first pull module and second to pull the execution sequence of module unrestricted.
As shown in Figure 2, be the system architecture diagram of the concrete application of the present embodiment.Suppose to include machine room 1 and machine room 2.Two machine rooms all dispose message queue cluster, carry out server and proxy server, and wherein machine room 1 also has management server.Message queue cluster comprises a plurality of increment Message Queuing servers and a plurality of Message Queuing server.The function of each device is as follows:
Management server clothes, be used for and connection message queue cluster, the increase of keeper's registered events, deletion, modification and inspection, the incident management information of keeper's registration is sent to increment Message Queuing server and registered events is bound with corresponding Message Queuing server, increment Message Queuing server is for preserving the service of the event of increment and the subscription of increment, the Message Queuing server that registered events is corresponding is the message sending for preserving user, a corresponding Message Queuing server adapting to it of event that user subscribes to.Management server is also for displaying and the analysis of state-event, mainly to call the http status code that event handling URL returns, for example 200: ask successfully, 404: do not find corresponding interface, 500: interface error etc., also have event to carve at a time number of times and the address of processing, whether successfully to this keeper, can analyze event handling, request number of times etc.Management server is shown content of operation with the WEB page.
Proxy server, for connection message queue cluster, while starting initialization, permission that all can be by http request management server is also obtained whole event informations, and be kept at its internal memory; Initiatively subscribe to increment Message Queuing server, receive after the event information of registration, merge with whole event informations; Persistence event, refers to the attribute that keeper arranges when registered events, shows that this event is to process very important message, if it is abnormal failed that proxy server captures while sending event message, can first be saved in local data base queue, then send one by one, and can recover.
Carry out server, for connection message queue cluster, while starting initialization, pull whole subscription configuration informations, initiatively subscribe to increment Message Queuing server, receive after event message, message is processed at the event handling URL of the event message of management server setting by user; And there is concurrent control function, the maximum concurrent number arranging at management server by user, and take management server and control and carry out server at the process number of the event of processing as overall control center carries out logical operation to current concurrent number.
In fact, also comprise a client, for receiving user's operation, and be connected with management server by proxy server.
The present embodiment adopts Rabbit MQ as message-oriented middleware.
The management server of the present embodiment, message queue cluster, carry out between server, proxy server and client all by RPC(Remote Procedure Call Protocol, remote procedure call protocol) connect.
For a person skilled in the art, can make other various corresponding changes and distortion according to technical scheme described above and design, and these all changes and distortion all should belong to the protection domain of the claims in the present invention within.