Summary of the invention
At the defective of prior art, the embodiment of the invention provides a kind of deferred information to focus on method and system, so that the unified centralized management to deferred information to be provided, avoids loss of data.
To achieve these goals, the embodiment of the invention provides a kind of deferred information centralized processing system, and described system comprises: data center, message forwarder and load equalizer; Described data center receives the message that application system sends to the user, if user's off-line is then stored described message and backup as deferred information is unified; And according to the request of described message forwarder, send the deferred information of respective user to described message forwarder; Described load equalizer is according to the loading condition of link circuit condition and message forwarder, for the user distributes corresponding message forwarder; Described message forwarder when the user reaches the standard grade, is initiated the request of obtaining deferred information to described data center, receives this user's that described data center returns deferred information, and described deferred information is sent to corresponding user.
Described message forwarder, successfully send described deferred information to the user after, return success to described data center and to send notice; Described data center, according to the described notice that successfully sends, deletion is the deferred information of success transmission.
Described message forwarder also is used for the loading condition that it is current and informs described load equalizer; Described load equalizer, concrete being used for connects with the user of login first, according to the loading condition of link circuit condition and described message forwarder, for the user distributes optimum message forwarder; And when the message forwarder that has distributed breaks down, for the user redistributes message forwarder.
Described message forwarder also is used for verifying to certificate server according to user's session identification when the user logins, and checking is logined otherwise refuse this user by then setting up and being connected of this user.
Described message forwarder also be used for upgrading the current presence of user, and the presence that the user is current is informed described data center; Described data center also is used for safeguarding the presence that the whole system user is current, so that the interface of inquiring user state to be provided, and according to the current presence of the user in the system message from described application system is handled.
Described system also comprises: what connect a plurality of data centers in the different machine rooms acts on behalf of the trustship module; Described data center, also be used for will storage deferred information by the described trustship module of acting on behalf of synchronously to other machine room; When the current presence of user changes, notify the described trustship module of acting on behalf of to carry out the User Status renewal.
To achieve these goals, the embodiment of the invention also provides a kind of deferred information to focus on method, described method comprises: data center receives the message that application system sends to the user, if user's off-line is then stored described message and backup as deferred information is unified; Load equalizer is according to the loading condition of link circuit condition and message forwarder, for the user distributes corresponding message forwarder; When the user reaches the standard grade, the request that the message forwarder corresponding with this user obtains deferred information to the initiation of described data center; Described data center sends the deferred information of respective user according to the request of described message forwarder to described message forwarder; Described message forwarder receives this user's that described data center returns deferred information, and described deferred information is sent to corresponding user.
Described method also comprises: successfully send described deferred information to the user after, described message forwarder returns success to described data center and sends notice; Described data center is according to the described notice that successfully sends, and deletion is the deferred information of success transmission.
Described load equalizer is according to the loading condition of link circuit condition and message forwarder, specifically comprise for the user distributes corresponding message forwarder: described load equalizer connects with the user of login first, according to the loading condition of link circuit condition and message forwarder, for the user distributes optimum message forwarder; And when the message forwarder that has distributed breaks down, for the user redistributes message forwarder.
Described method also comprises: described message forwarder upgrades the current presence of user, and the presence that the user is current is informed described data center; Described data center safeguards the current presence of user in the whole system, so that the interface of inquiring user state to be provided, and according to the current presence of the user in the system message from described application system is handled.
Beneficial effect of the present invention is: the deferred information of the embodiment of the invention focuses on method and system, by deferred information is carried out unified management and backup, avoid the drawback that deferred information disperses storage to bring in the prior art, promoted user's experience.
Embodiment
For the purpose, technical scheme and the advantage that make the embodiment of the invention clearer, below in conjunction with the accompanying drawing in the embodiment of the invention, technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that obtains under the creative work prerequisite, all belong to the scope of claim protection of the present invention.
Fig. 1 is the Organization Chart of embodiment of the invention deferred information centralized processing system.As shown in Figure 1, this system comprises three parts: data center (Data Center, DC), message forwarder (Message Broker, MB) and load equalizer (Load Balance, LB).Data center connects application system (APP) and message forwarder; Message forwarder connects data center, load equalizer and client; Load equalizer connection message transponder and client.
Described data center receives the message that application system sends to the user, if user's off-line is then stored described message and backup as deferred information is unified; And according to the request of described message forwarder, send the deferred information of respective user to described message forwarder; Described load equalizer is according to the loading condition of link circuit condition and message forwarder, for the user distributes corresponding message forwarder; Described message forwarder when the user reaches the standard grade, is initiated the request of obtaining deferred information to described data center, receives this user's that described data center returns deferred information, and described deferred information is sent to corresponding user.
Particularly, application system (APP) is the system application that produces instant message, and is rich such as playing soon; Described data center directly is pushed to this user by the message forwarder that is connected with this user with the online message that application system sends when judging that the user is online; When judging that user's off-line and user are provided with the subscription deferred information, with this user's deferred information storage, and when message forwarder sends request, this deferred information is pushed to this user.
Particularly, described message forwarder, successfully send described deferred information to the user after, return success to described data center and to send notice; Described data center, according to the described notice that successfully sends, deletion is the deferred information of success transmission.
Particularly, described message forwarder also is used for the loading condition that it is current and informs described load equalizer; Described load equalizer, concrete being used for connects with the user of login first, according to the loading condition of link circuit condition and described message forwarder, for the user distributes optimum message forwarder; And when the message forwarder that has distributed breaks down, for the user redistributes message forwarder.
Particularly, described message forwarder also is used for verifying to certificate server according to user's session identification (session id) when the user logins, and checking is logined otherwise refuse this user by then setting up and being connected of this user.
Particularly, described message forwarder also be used for upgrading the current presence of user, and the presence that the user is current is informed described data center; Described data center also is used for safeguarding the presence that the whole system user is current, so that the interface of inquiring user state to be provided, and according to the current presence of the user in the system message from described application system is handled.
Alternatively, described system also comprises: what connect a plurality of data centers in the different machine rooms acts on behalf of the trustship module; Described data center, also be used for will storage deferred information by the described trustship module of acting on behalf of synchronously to other machine room; When the current presence of user changes, notify the described trustship module of acting on behalf of to carry out the User Status renewal.By acting on behalf of trustship module (Proxy) butt joint, handle to finish the interdepartmental system of data between the data center.In real network was used, data center can be divided into two of telecommunications and Netcoms, uses two-server respectively, keeps the client of total amount 2,000,000 or more and can continue expansion.
Alternatively, in the present embodiment, adopt the character string type communication protocol based on TCP between App and the DC, be similar to the http agreement, be divided into message header and message body.Message header and message body use CRLF (new line, carriage return/line feed) to cut apart.Field name in the message header and value use the space to cut apart, and use CRLF to cut apart between the field.Except App and DC, other communication protocol is the binary signaling agreement.Wherein communicating by letter between Message Broker and DC and the Load balance is based on the TCP host-host protocol, and the communication relevant with client all is based on the UDP host-host protocol.When using the UDP host-host protocol, need to consider reliability, when data-bag lost, need to retransmit, and when packet is big (greater than 512 bytes), just need subpackage.
Alternatively, in the present embodiment, the heartbeat packet of client size is 16+46=62Byte.Suppose that 100 general-purpose families sent heartbeat packet every 30 seconds, Message Broker holds total utilized bandwidth to be approximately 62Mbyte/30s*8=16.5Mbit/s so.The communication data of message forwarder and client all adopts certain cryptographic algorithm to be encrypted, as: AES.
Below the function of each assembly in the detailed description system.
1) data center
The main functions such as User Status management, deferred information management and data routing distribution that realize.Message forwarder informs by the timing heartbeat message and upgrades current online User Status that data center safeguards online user's state of whole system; Application system (App) produces message and is sent to data center, if data need storage, data center stores this message so, then message is distributed to corresponding message forwarder.If message forwarder sends successfully so the reminder-data center and deletes this message.When this user reaches the standard grade, the request that message forwarder obtains deferred information to data center's initiation, data center distributes the messages to corresponding message forwarder according to the recipient of message then, message forwarder is transmitted the state of message success or not and informed data center, and is successful then delete this deferred information.
The message load mode has one to one and two kinds of one-to-manies.Be man-to-man load mode such as replying message, broadcast and subscribed message then are the load mode of one-to-many.Wherein, the message of one-to-many can be divided into two big classes: directed and nondirectional.Knowing for sure is that the message definition that sends which user's one-to-many to is directed message, indeterminately knows that the message of the one-to-many that need send which user to is then for nondirectional.According to above definition, broadcast system message is defined as nondirectional; If the message of user's issue has been subscribed to by many people, this message is directed so.
System only can store the deferred information of the one-to-many of man-to-man deferred information and orientation in the present embodiment, nondirectional off-line broadcast is not generally deposited, but have except the off-line broadcast of certain life cycle, for example: the off-line broadcast of sending for the login user in the certain hour section can be stored, after life cycle finishes with deleted.
2) message forwarder
The major function of message forwarder is that message is forwarded to the user of appointment and detects state of user, and carries out the user and authenticate.The data that message forwarder need be safeguarded have: land " connection " information of client and the subscription list of client.Message forwarder is informed its current load of load equalizer by heartbeat message.When the user reached the standard grade, message forwarder initiated to obtain the deferred information request to data center.Whether data center's inquiry has this user's deferred information, if having, pushes deferred information so and gives message forwarder, is transmitted to the user by message forwarder.
When the user logined, message forwarder verified to certificate server that according to user's session id (session identification) checking is passed through so just to set up and this user's communications, otherwise refused this user's login.
3) load equalizer
Major function is that the client equilibrium is distributed to message forwarder and administrative messag transponder.Message forwarder registers and regularly circulates a notice of the load of himself to load equalizer.Client can send to load equalizer and obtain the message forwarder request, and load equalizer can select a message forwarder to reply to client, and client communicates with corresponding message forwarder then.
Based on the deferred information centralized processing system of previous embodiment, the embodiment of the invention also provides a kind of deferred information to focus on method.Fig. 2 is the overall flow figure that embodiment of the invention deferred information focuses on method.As shown in Figure 2: this method comprises:
S201, data center receive the message that application system sends to the user, if user's off-line is then stored described message and backup as deferred information is unified;
S202, load equalizer are according to the loading condition of link circuit condition and message forwarder, for the user distributes corresponding message forwarder;
S202 specifically comprises: described load equalizer connects with the user of login first, according to the loading condition of link circuit condition and message forwarder, for the user distributes optimum message forwarder; And when the message forwarder that has distributed breaks down, for the user redistributes message forwarder;
S203, when the user reaches the standard grade, the message forwarder corresponding with this user initiated the request of obtaining deferred information to described data center;
S204, described data center send the deferred information of respective user according to the request of described message forwarder to described message forwarder;
S205, described message forwarder receive this user's that described data center returns deferred information, and described deferred information is sent to corresponding user.
Particularly, described method also comprises: successfully send described deferred information to the user after, described message forwarder returns success to described data center and sends notice; Described data center is according to the described notice that successfully sends, and deletion is the deferred information of success transmission.
Particularly, described method also comprises: described message forwarder upgrades the current presence of user, and the presence that the user is current is informed described data center; Described data center safeguards the current presence of user in the whole system, so that the interface of inquiring user state to be provided, and according to the current presence of the user in the system message from described application system is handled.
Fig. 3 is that the deferred information of the embodiment of the invention sends process chart.As shown in Figure 3, deferred information sends processing procedure and comprises: App produces message, is sent to DC, and DC replys App and represents that data send successfully; When user's off-line, DC judges whether message needs storage, if store deferred information so to DC, otherwise carry out next step; When the user logined, the DC routing was distributed to the MB that is connected with this login user with deferred information, and for non-directional one-to-many broadcast, DC is broadcast to all MB with deferred information; MB sends to corresponding login user with deferred information then, if send successfully, the deferred information of MB notice DC deletion storage and finish this operating process so, otherwise abandon this deferred information or do not delete this deferred information waits until sending when next user logins and finish this process.
Fig. 4 is the process chart that the user of the embodiment of the invention obtains deferred information.As shown in Figure 4, the deferred information processing procedure comprises: at first the user logins the most MB of its distribution, and MB sends the deferred information request of obtaining respective user to DC then; Whether the DC inquiry exists the deferred information of respective user then, carries out next step so if exist, otherwise finishes this operating process; DC is pushed to corresponding MB with deferred information, sends to corresponding user by MB then, if send successfully, MB notice DC deletes the deferred information of the correspondence of storing and finishes this operating process so, otherwise does not delete deferred information and finish this process.
Fig. 5 is user's login process figure of the embodiment of the invention, as shown in Figure 5, process of user login comprises: client at first initiates to obtain the MB request to LB, LB returns corresponding MB address information and gives client, and client is initiated logging request to MB then, with the session id that goes up self, MB initiates the checking request according to this session id to certificate server then, if by checking, MB accepts this client " connection " so, otherwise refuses this client.
Fig. 6 is the interdepartmental system structure principle chart of the embodiment of the invention, in interdepartmental system structure, need the offline user data of data center by acting on behalf of trustship module (Proxy) synchronously to the machine room of other system, simultaneously online user ID is reported to Proxy, provide the inquiring user state interface by Proxy.Data center and the long connection that is based on TCP being connected of Proxy.Data center is sent to Proxy with the offline user data, these data is forwarded to the data center of other machine room by Proxy.Simultaneously, online user's state is submitted to Proxy, the interface of inquiring user state is provided by Proxy.When User Status changes, data center will notify Proxy to do the state renewal.When not being when striding computer room structure, provided the interface of inquiring user state by data center.
Fig. 7 is the detail flowchart that embodiment of the invention deferred information focuses on method.As shown in Figure 7: application system produces deferred information, and data center judges whether to store deferred information according to the application system parameter.If the user has carried out the setting that deferred information is stored in the program of application system, then by data center deferred information is unified storage; If the targeted customer reaches the standard grade, and deferred information is in the time limit scope, then by message forwarder to this deferred information of data center's acquisition request, and push to the targeted customer; After successfully sending to the targeted customer, this deferred information is deleted at the notification data center.If the user does not carry out the setting of deferred information storage, then this deferred information directly is pushed to the message forwarder corresponding with this user, if the current state of targeted customer is online, then by message forwarder this deferred information is transmitted to the targeted customer, otherwise abandons this deferred information.
The deferred information of the embodiment of the invention focuses on method and system and has following characteristics:
1, deferred information is convenient to backup and is prevented loss of data by data center's centralized and unified management;
2, data center can expand, and is docked by Proxy trustship module between the data center;
3, user's link classification, first login user or carry out the reallocation of message forwarder by load equalizer with the user of message forwarder connection failure, message forwarder only is used for maintenance customer's network connection and pushes deferred information giving the user; Particularly, load equalizer is used for connecting with the user of login for the first time, for the user selects the message forwarder of link optimum, simultaneously, when message forwarder goes wrong, for user's message forwarder of reallocating is set up link.
The deferred information of the embodiment of the invention focuses on method and system, by deferred information is carried out unified management and backup, has avoided the drawback that deferred information disperses storage to bring in the prior art, has promoted user's experience.
Above embodiment only in order to the technical scheme of the embodiment of the invention to be described, is not intended to limit; Although with reference to previous embodiment the embodiment of the invention is had been described in detail, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment puts down in writing, and perhaps part technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the spirit and scope of each embodiment technical scheme of the embodiment of the invention.