Publish and Subscribe

Posted by Qt Mobility on August 19, 2009 · 5 comments

Recently we have seen a push to add context awareness to applications. What do we mean by context awareness? We mean having your applications automatically respond to changes in the current operating environment. This can be as simple as your instant messaging client automatically setting your status to away when it detects that you are no longer actively using your computer. A more complex example of having the entire user interface of your device automatically reorganise itself to support your different work flows.

We are developing a cross platform publish and subscribe (P&S) API that can be used to publish and retrieve contextual information from the system. This allows the separation of the providers of contextual information from the consumers. In our above example a separate process calculates the users’ activity state and publishes the result in the P&S hierarchy. Other processes, such as an IM client, subscribe to receive notifications about changes of this value and modify the application state accordingly.

The API supports the concept of multiple layers, meaning if there are multiple publish and subscribe systems on the platform they will be stacked on top of each other in priority order. Publishers can specify which layer they publish values to, while subscribers always retrieve values from the layer with the highest priority.

We have implementations for two different layers. On Windows platforms we have the Registry layer, which is based on volatile registry keys. It supports publishing and change notifications. On Unix platforms we have the Shared Memory layer, which is an in-house implementation based on local sockets and shared memory. Currently it only works on Unix platforms, however, we are working on making it cross-platform. Even though both of these layers use non-permanent storage there is nothing in the API that prohibits using permanent storage.

Disappointed that we don’t provide a layer implementation for your favourite publish and subscribe system? No problem. Just provide your own. We actually encourage you to do so with our abstract layer class. Though we should warn you that we are not finished yet :) . Layer implementations for other platforms are being worked on, in particular support for both the Central Repository and Publish’n'Subscribe systems on S60.

As always the code is now available in our public gitorious repository at http://qt.gitorious.org/qt-mobility/context.

QShare(this)

No related posts.


5 comments

1 Scorp1us August 19, 2009 at 3:18 pm
 

How is this different from D-BUS?

2 amccarth August 21, 2009 at 1:14 am
 

Scorp1us: They are both IPC mechanisms. The P&S APIs available on different platforms are designed to solve a single problem (i.e. publishing data for other processes to access). Our P&S API aims to provide a cross platform API for the platform specific P&S implementations. D-Bus on the other hand is a general purpose IPC solution. We are investigating the possibility of implementing layer using D-Bus.

3 jani August 21, 2009 at 11:48 am
 

What does P&S API do that D-Bus cannot do (or vice versa)? Why introduce yet another IPC mechanism?

4 Chris G August 24, 2009 at 3:12 pm
 

D-BUS is Linux only.

5 qwsa September 8, 2009 at 9:05 am
 

“D-BUS is Linux only”

not true; works on windows and mac for me

Comments on this entry are closed.

Previous post:

Next post: