Python Manual Benutzerhandbuch

Seite von 124
37
Service Agents
The service agent framework in OSE provides request/reply and publish/subscribe features similar to
that found in message oriented middleware packages. Unlike most of the available packages, the serv-
ice agent framework does not have a flat namespace with respect to naming, but uses an object oriented
model, with each service having its own namespace with respect to subject names for subscriptions
and request method names.
Building on this object oriented approach, it is possible to subscribe to the existence of specific serv-
ices, or to groups of services as well as aspects of the services themselves. By using subscription to
groups, an application can be setup to dynamically handle the introduction and withdrawal of new
services rather than being hardwired. Services are also able to monitor when subscriptions occur and
identify who is making the subscription if necessary.
All the features of the service agent framework can be applied within the scope of a single process, or
across a group of distributed processes. A specific service need not even be aware that a service it
makes use of is in a remote process as the interface and means of interacting with that service are the
same. Services may therefore be moved around between processes or onto different machines and the
key parts of the application will not need to be changed.
As the Python interface is simply a wrapper on top of functionality provided by the OSE C++ class
library, you are not restricted to writing service agents in just Python. In a distributed application for
example, one process may be entirely written in C++, another may use only the Python wrappers, and
a third a mix of both if dynamic loading into a Python program were used. This flexibility means you
can use Python where simplicity is important, but C++ where better performance may be desirable.