Python Manual Benutzerhandbuch

Seite von 124
57
Service Requests
The ability within the service agent framework to find out what services exist and the ability of a serv-
ice agent to publish reports can be useful in itself, but more often than not one wants to make a specific
request of a service to perform some action. In most cases such an action would result in a response,
be it the return of data related to the request being made or an error indication. Referred to as request/
reply, this is probably the most fundamental feature of message oriented middleware software.
As with the implementation of the publish/subscribe feature, simplicity has been a major driving force
in influencing the design. As a result, the implementation of the request/reply feature should not be
likened to that of point to point messages using persistant messages queues. In this implementation, if
a service to which you want to send a request doesn’t exist you will not be able to send your request,
nor is a service able to receive any requests sent when it wasn’t running.
Although persistant message queues are not a feature of this implementation, the request/reply and
publish/subscribe features can actually be seen as sitting at a lower level of abstraction. As a result, it
would be possible to build on top of these features and implement persistent message queues and gau-
ranteed modes of delivery if required. For many systems such features aren’t required though, so they
are not implemented with the aim being to make the software as simple as possible to use and under-
stand.
Sending a Request
In order to send a request to a service you need to first obtain a service endpoint object. This is a special
Python object which holds an internal reference to the service binding object for the service and which
will automatically dispatch your request for you. To obtain a service endpoint, the member function
"
serviceEndPoint()
" is used.