PushTimed Pattern

Figure: PushTimed Pattern

  • The eighth example demonstrates the usage of a push timed server and a push timed client ports.
  • The push patterns (push newest / push timed) provide a publish / subscribe mechanism for data distribution. Every client gets the same data as soon as new data is available at the server without requiring polling. The communication is initiated by the server and not by the clients.
  • The basis of the push timed pattern is the same as that of the push newest pattern. The push timed pattern, however, distributes data on a regular basis and therefore provides an additional mechanism to regularly trigger data distribution.
  • The push timed server is triggered periodically by the framework to acquire new data and distributes the data on a regular basis with individual client update intervals (see figure above). It relieves the component builder from handling timing issues.
  • The server provides a handler which is called each time the next update is due. The handler is operated by the singular component central timer provided by the component management to save resources. Again, a decorator can be used to convert the handler into an active object. That is necessary in case one wants to perform long running activities within the handler. As with the query server, a separate member function is used to provide the data that is to be distributed (asynchronous upcall interface). One of the advantages is that one can use any mechanism to provide the next update without being limited to a specific handler mechanism.
  • The client can subscribe to get every n-th update which often makes sense if the client otherwise gets overwhelmed by updates. To keep the management of the update rates as simple as possible, only whole-numbered multiples of the server cycle time are supported.
  • At the client side, the getServerInfo member function provides all the necessary information to clients to decide on the appropriate update rate.
  • The server can handle an arbitrary number of connected clients (see figure below).

Figure: PushTimed clients