Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of a service data publishing method according to an embodiment of the present application, and as shown in fig. 1, the service data publishing method includes:
s101: the data life cycle perception server cluster receives a service subscription registration request sent by a service subscriber, the service subscription registration request is processed by one data life cycle perception server in the data life cycle perception server cluster to generate subscription data, and the subscription data is synchronized to the rest data life cycle perception servers in the data life cycle perception server cluster;
s102: the data life cycle perception server cluster receives service data and heartbeat data sent by a service providing end, the service data and the heartbeat data are processed by one data life cycle perception server in the data life cycle perception server cluster, the service data are pushed to a corresponding service subscription end according to the subscription data, and the survival state of the service data is determined according to the heartbeat data.
The execution subject of the service data publishing method shown in fig. 1 is a data lifecycle aware server within a data lifecycle aware server cluster. The service subscription end may be a mobile terminal (e.g., a mobile phone, a PDA) or a server, and the service provider end may also be a mobile terminal (e.g., a mobile phone, a PDA) or a server. Fig. 2 is a schematic view of an application scenario of the present application, as shown in fig. 2, reference numerals 101 and 102 are service providers, reference numerals 103, 104 and 105 in a circle are data lifecycle aware servers in a data lifecycle aware server cluster, and reference numerals 106, 107 and 108 are service subscribers. The service provider 101 and the service provider 102 are connected to one of the data lifecycle aware servers, the data lifecycle aware server 103, the data lifecycle aware server 104, and the data lifecycle aware server 105 are connected to each other, and the service subscriber 106, the service subscriber 107, and the service subscriber 108 are assigned to different data lifecycle aware servers.
As can be seen from the flow shown in fig. 1, in the embodiment of the present application, a registration request is subscribed according to a service of a service subscriber, and the registration request is processed by one data lifecycle aware server in the data lifecycle aware server cluster. The data lifecycle aware server synchronizes the subscription data to the rest of the data lifecycle aware servers in the data lifecycle aware server cluster, which can ensure the effectiveness of the service. After one of the data life cycle aware servers of the data life cycle aware server cluster receives the service data sent by the service provider, the service data can be pushed to the corresponding service subscriber according to the subscription data. The heartbeat data sent by the service providing end can be received regularly, the survival state of the service data can be determined according to the heartbeat data, the life cycle of the service data can be sensed, and the data processing of the life cycle can be carried out in real time.
A user is interested in a certain service (such as purchasing electronic products and the like), wants to subscribe to the certain service, and can send a service subscription registration request to the data life cycle awareness server cluster through a service subscriber.
After receiving the service subscription registration request, the data life cycle awareness server cluster can automatically allocate a data life cycle awareness server to the service subscription terminal in the data life cycle awareness server cluster, and establish connection between the service subscription terminal and the data life cycle awareness server.
There are many methods for distributing data lifecycle aware servers by a data lifecycle aware server cluster, and in an embodiment, the service subscriber may be distributed to one of the data lifecycle aware servers according to a load balancing policy. There are many load balancing policies, for example, the service subscriber may be allocated according to the IP address, which is not described in this application.
The service subscription registration request includes subscription information of the service data, the data lifecycle aware server may generate subscription data according to the subscription information, and synchronize the subscription data to the remaining data lifecycle aware servers in the data lifecycle aware server cluster, and the subscription data may be a subscription table. Each data life cycle perception server generates a subscription table according to all subscription information of the service subscription terminals distributed on the data life cycle perception server, and then synchronizes the subscription table to the rest data life cycle perception servers in the data life cycle perception server cluster, so that each data life cycle perception server in the data life cycle perception server cluster knows that each service subscription terminal subscribes to data.
Before issuing service data to the data life cycle sensing server cluster, the service providing end needs to send a connection request to the data life cycle sensing server cluster, the data life cycle sensing server cluster allocates (the allocation method is the same as that of the service subscription end) a data life cycle sensing server for the data life cycle sensing server cluster to establish a connection channel with the service providing end, and the connection channel is a multiplexing channel. The connection channel establishment process is briefly described as follows:
1. the method comprises the steps that a service providing end establishes a connection channel with a data life cycle sensing server;
2. the service provider sends a request command to the data lifecycle aware server, where the request command includes information such as IP information and port information of the sender, and the service provider needs to cache the information such as IP information and port information.
3. After receiving the request command, the data lifecycle aware server records information such as IP information and port information, and the thread for processing the request command is not closed. When the data life cycle sensing server sends information to the service providing end, the data life cycle sensing server also sends the information through the connecting channel.
Through the connecting channel, the service providing end can send various data to the corresponding data life cycle sensing server, firstly, the service providing end can send service data to the data life cycle sensing server to inform the data life cycle sensing server of the services provided by the data life cycle sensing server, such as the sale of electronic products, the sale of books and the like. After receiving the service data, the data lifecycle aware server sends the service data to one or more corresponding data lifecycle aware servers according to the subscription table. Since the subscription table records which service subscribers subscribe to the service corresponding to the service data, the data life cycle sensing server connected with the service provider knows that the service subscribers are allocated to one or more data life cycle sensing servers, so that the data life cycle sensing server connected with the service provider can send the service data to the corresponding one or more data life cycle sensing servers according to the subscription table.
After receiving the service data, the one or more data lifecycle aware servers push the service data to a service subscriber connected to the one or more data lifecycle aware servers, and record version numbers of data push, where each piece of pushed data corresponds to a unique pushed version number, and push conditions (including version numbers and the like) need to be synchronized in a cluster of the data lifecycle aware servers.
The data life cycle perception server in the data life cycle perception server cluster is provided with a process, the data pushing condition can be checked regularly according to the process, and if a certain data life cycle perception server is down and does not perform corresponding data pushing tasks, the data pushing tasks can be dispatched to other data life cycle perception servers in the data life cycle perception server cluster.
Through the connecting channel, the service providing end can also periodically send heartbeat data to the data life cycle perception server connected with the service providing end, and according to the heartbeat data, the data life cycle perception server can determine the survival state of the service data and inform the determined survival state to the rest data life cycle perception servers in the data life cycle perception server cluster.
If the survival state of the service data is determined to be non-survival according to the heartbeat data, the corresponding service subscriber needs to be notified according to the subscription data, and the service subscriber can know that the service data is invalid and unavailable.
Before the service is unavailable (service data is invalid, for example, sales service of electronic products is no longer provided), the service providing end can send the invalidation command through the multiplexing channel, and after the data life cycle sensing server receives the service data invalidation command sent by the service providing end, the data life cycle sensing server can inform the corresponding data life cycle sensing server of the service data invalidation command according to the subscription data, so that the corresponding data life cycle sensing server informs the corresponding service subscribing end of the service data invalidation command.
By receiving the heartbeat data of the service providing end, the change track of the life cycle of the data can be detected, and the change of the data can be monitored.
In addition, the data lifecycle aware server may also check whether the service provider connected thereto is down at regular time, that is, determine whether the service provider is disconnected, and if the service provider is disconnected, notify the service provider that the service data is invalid according to the subscription data.
Fig. 3 is a flowchart of a service data publishing method according to an embodiment of the present application, and as shown in fig. 3, the service data publishing method includes:
s301: establishing a multiplexing channel with one of the data lifecycle aware servers in the data lifecycle aware server cluster, the multiplexing channel being in an unclosed state;
s302: sending service data to the data lifecycle awareness server through the multiplexing channel;
s303: and sending heartbeat data to the data life cycle sensing server at regular time through the multiplexing channel so that the data life cycle sensing server informs other corresponding data life cycle sensing servers according to the subscription condition of the service subscription end.
The main execution body of the service data publishing method shown in fig. 3 is a service provider, and the service provider may also be a mobile terminal (e.g., a mobile phone, a PDA) or a server.
As can be seen from the flow shown in fig. 1, in the embodiment of the present application, when a service provider issues a service, a multiplexing channel may be first established between the service provider and one data lifecycle aware server in a data lifecycle aware server cluster, and then service data and heartbeat data are sent to the data lifecycle aware server through the multiplexing channel, so that the data lifecycle aware server notifies other corresponding data lifecycle aware servers according to a subscription condition of a service subscriber. The service provider does not need to directly face the service subscriber one by one, so that the service provider has the expansion capability in a distribution scene. By sending heartbeat data to the data life cycle sensing server, the change track of the data life cycle can be detected, and the change of the data can be monitored.
In S301, the multiplexing channel establishment procedure is briefly described as follows:
1. the method comprises the steps that a service providing end establishes a connection channel with a data life cycle sensing server;
2. the service provider sends a request command to the data lifecycle aware server, where the request command includes information such as IP information and port information of the sender, and the service provider needs to store the information such as IP information and port information.
3. After receiving the request command, the data lifecycle aware server records information such as IP information and port information, and since the information such as IP information and port information of the service provider is recorded, the thread is not closed, and the data lifecycle aware server also sends information through the connection channel when sending information to the service provider.
According to the embodiment of the application, the mode that the continuous connection of the channels is not disconnected is adopted, so that the high efficiency and the low delay of data transmission are ensured, and the performance loss is saved.
Before the service is unavailable (service data is invalid, for example, sales service of electronic products is no longer provided), the service provider can send an invalidation command to the data lifecycle aware server through the multiplexing channel, so that the service subscriber can know in time when the service data is invalid.
Before a service provider establishes a multiplexing channel with one of the data lifecycle aware servers in the data lifecycle aware server cluster, service data needs to be prepared first, so that the service data is sent out immediately after the multiplexing channel is established.
Based on the same inventive concept as the service data publishing method shown in fig. 1, the embodiment of the present application further provides a service publishing device, as described in the following embodiments. Because the principle of the service issuing device for solving the problem is similar to the service data issuing method, the implementation of the service issuing device can refer to the implementation of the service data issuing method, and repeated parts are not described again.
Fig. 4 is a schematic structural diagram of a service distribution apparatus according to an embodiment of the present application, and as shown in fig. 4, the service distribution apparatus includes: a request processing unit 401 and a data processing unit 402.
The request processing unit 401 is configured to receive a service subscription registration request sent by a service subscriber, where the service subscription registration request is processed by one data lifecycle aware server in the data lifecycle aware server cluster to generate subscription data, and synchronize the subscription data to the remaining data lifecycle aware servers in the data lifecycle aware server cluster; the request processing unit 401 is a part of the service publishing device that processes the service subscription request, and may be software, hardware, or a combination of the two, for example, an input/output interface, a processing chip, or other components that perform the service subscription request processing function.
The data processing unit 401 is configured to receive service data and heartbeat data sent by a service provider, where the service data and the heartbeat data are processed by one data lifecycle aware server in the data lifecycle aware server cluster, so as to push the service data to a corresponding service subscriber according to the subscription data, and determine a survival state of the service data according to the heartbeat data. The data processing unit 402 is a part of the service delivery apparatus that processes data, and may be software, hardware, or a combination of the two, and may be, for example, an input/output interface, a processing chip, or other components that perform a data processing function.
In an embodiment, as shown in fig. 5, the service publishing device in the embodiment of the present application further includes: a data sending unit 501, configured to send the survival status of the service data and/or the service data to the remaining data lifecycle aware servers in the data lifecycle aware server cluster according to the subscription data. The data transmission unit 501 is a part of the service delivery apparatus that transmits data, and may be software, hardware, or a combination of both, and may be, for example, an input/output interface that performs a data transmission function, a processing chip, or other components.
In an embodiment, as shown in fig. 6, the service publishing device in the embodiment of the present application further includes: the failure notification unit 601, when the service data is not alive, the failure notification unit 601 is configured to notify the corresponding service subscriber according to the subscription data. The failure notification unit 601 is a part of the service distribution apparatus that transmits data, and may be software, hardware, or a combination of both, for example, an input/output interface that performs a data notification function, a processing chip, or other components.
In an embodiment, as shown in fig. 7, the service publishing device in the embodiment of the present application further includes: a version number recording unit 701, configured to record a version number of the pushed service data, and synchronize the version number to other data lifecycle aware servers in the data lifecycle aware server cluster. The version number recording unit 701 is a part for recording a version number in the service distribution apparatus, and may be software, hardware, or a combination of the two, for example, an input/output interface, a processing chip, or other components that perform a version number recording function.
In an embodiment, as shown in fig. 8, the service publishing device in the embodiment of the present application further includes: a failure command informing unit 801, configured to receive a service data failure command sent by the service provider, inform the corresponding data lifecycle aware server of the service data failure command according to the subscription data, so that the corresponding data lifecycle aware server informs the service data failure command to the corresponding service subscriber. The failure command notification unit 801 is a part of the service issuing apparatus that notifies of a failure of service data, and may be software, hardware, or a combination of both, and may be, for example, an input/output interface, a processing chip, or other components that perform a failure notification function.
In an embodiment, as shown in fig. 9, the service publishing device in the embodiment of the present application further includes: a connection determining unit 901, configured to determine whether to disconnect from a service provider, and if so, notify a corresponding service subscriber (a service subscriber subscribing to a service provided by the service provider) according to the subscription data, where the service data of the service provider is invalid. The connection determination unit 901 is a part of the service delivery apparatus that determines the service providing side, and may be software, hardware, or a combination of both, for example, an input/output interface, a processing chip, or other components that perform the connection determination function.
In the embodiment of the application, the service subscription end is dispersed to a plurality of data life cycle perception servers, so that the problem of overlarge pressure of the service providing end is solved. The validity of the service can be ensured by synchronizing the subscription data of the service subscriber among the plurality of data life cycle perception servers. By receiving the heartbeat data of the service providing end, the change track of the life cycle of the data can be detected, and the change of the data can be monitored.
Based on the same inventive concept as the service data publishing method shown in fig. 3, the embodiment of the present application further provides a service publishing device, as described in the following embodiments. Because the principle of the service issuing device for solving the problem is similar to the service data issuing method, the implementation of the service issuing device can refer to the implementation of the service data issuing method, and repeated parts are not described again.
Fig. 10 is a schematic structural diagram of a service distribution apparatus according to an embodiment of the present application, and as shown in fig. 10, the service distribution apparatus includes: a channel creating unit 1001, a service data transmitting unit 1002, and a heartbeat data transmitting unit 103.
The channel creating unit 1001 is configured to create a multiplexing channel with one of the data lifecycle aware servers in the data lifecycle aware server cluster, where the multiplexing channel is in an unclosed state; the channel creating unit 1001 is a part of the service distribution apparatus that creates the multiplexing channel, and may be software, hardware, or a combination of the two, for example, an input/output interface, a processing chip, or other components that perform the channel creating function.
The service data sending unit 1002 sends service data to the data lifecycle aware server through the multiplexing channel; the service data transmitting unit 1002 is a part of the service distribution apparatus that transmits service data, and may be software, hardware, or a combination of both, and may be, for example, an input/output interface, a processing chip, or other components that perform a service data transmitting function.
The heartbeat data sending unit 1003 is configured to send heartbeat data to the data lifecycle aware server at regular time through the multiplexing channel, so that the data lifecycle aware server notifies corresponding other data lifecycle aware servers according to a subscription condition of a service subscriber. The heartbeat data transmitting unit 1003 is a part of the service distribution apparatus that transmits heartbeat data, and may be software, hardware, or a combination of the two, for example, an input/output interface that performs a heartbeat data transmitting function, a processing chip, or other components.
In an embodiment, as shown in fig. 11, the service publishing device in the embodiment of the present application further includes: an invalidation command sending unit 1101, configured to send a service data invalidation command to the data lifecycle aware server.
The embodiment of the application adopts a mode that the continuous connection of the channels is not disconnected, so that the high efficiency and the low delay of data transmission are ensured, and the performance loss is saved.
Before the service is unavailable (service data is invalid, for example, sales service of electronic products is no longer provided), the service provider can send an invalidation command to the data lifecycle aware server through the multiplexing channel, so that the service subscriber can know in time when the service data is invalid.
Before a service provider establishes a multiplexing channel with one of the data lifecycle aware servers in the data lifecycle aware server cluster, service data needs to be prepared first, so that the service data is sent out immediately after the multiplexing channel is established.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.