PushNewest Pattern

Figure: PushNewest Pattern

  • The second example demonstrates the usage of a push newest server and a push newest 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. Compared to the query pattern, a push service is superior to polling in case several clients need the same data or in case the update rate is dictated by the server.
  • The push patterns are, for example, used to distribute laser range scans to various components and to provide an updated local map patch as soon as something has changed (which is known at the server side).
  • The push newest server has to be fed with new data by the user and then distributes the data to all subscribed clients.
  • A client needs to be subscribed to a service provider to get updated as soon as new data is available at the server. Once subscribed, a client always holds the latest data from the service provider (a client has a buffer size of one).
  • Since the purpose of a push pattern is to always provide the most recent data, there is no need to hold outdated data. Thus, a wrong usage of a push pattern would be to assume that each single update can be received at the client side. The only allowed assumption is that a client side getUpdate method returns the most recent value and that the getUpdateWait method returns with the next update. A wrong usage would be to try to get each single update by several subsequent calls of the getUpdate / getUpdateWait methods.
  • A client gets its first data with the first update after subscription and not with subscribing. This prevents the client from holding data which has been calculated before subscription. This, of course, can result in a quite long time until the first data is available at the client. If this is undesired for a service, it is the responsibility of the component builder to eventually distribute the same data several times to increase the update cycles. This avoids that new subscriptions are kept uninformed for a too long time.
  • The server can handle an arbitrary number of connected clients (see figure below).

Figure: PushNewest clients