Download The omniORBpy version 3 User's Guide

Transcript
Chapter 9
Interceptors
omniORBpy has limited interceptor support. Interceptors permit the application to
insert processing at various points along the call chain, as requests are processed.
The Portable Interceptors API is not yet supported.
Interceptors are registered using functions in the omniORB.interceptors
module:
addClientSendRequest()
addClientReceiveReply()
addServerReceiveRequest()
addServerSendReply()
addServerSendException()
To register an interceptor function, call the relevant registration function with
a callable argument. The callable will be called with two or three arguments. The
first argument is the name of the operation being invoked; the second is the set of
service contexts to be retrieved or filled in. ServerSendException has a third
argument, the repository id of the exception being thrown.
When receiving service contexts (in the ClientReceiveReply and Server
ReceiveRequest interceptors), the second argument is a tuple of 2-tuples. In
each 2-tuple, the first item is the service context id and the second item is the
CDR encapsulation of the service context. The encapsulation can be decoded with
omniORB.cdrUnmarshal() (but only if you know the type to decode it to).
When sending service contexts (ClientSendRequest, ServerSendReply,
and ServerSendException), the second argument is an empty list. The interceptor function can choose to add one or more service context tuples, with the
same form described above, by appending to the list. Encapsulations are created
with omniORB.cdrMarshal().
Interceptor registration functions may only be called before the ORB is initialised. Attempting to call them later results in a BAD_INV_ORDER exception.
63