Dispatcher API

2 min read

2 min read

2 min read

2 min read

2 min read

A dispatcher accepts an incoming request and returns an outgoing response. Servants, middleware and the dispatch pipeline of an object adapter are dispatchers.

A dispatcher is a class derived from Ice::Object that overrides dispatch.

A dispatcher is a class that implements Ice.Object and its dispatchAsync method.

A dispatcher is a class that implements com.zeroc.Ice.Object and overrides its dispatch method.

A dispatcher is a class derived from Ice.Object that overrides dispatch.

Ice for Python has no dispatcher API: the only dispatchers you can implement are servants.

A dispatcher is a type that adopts the Dispatcher protocol and implements its dispatch method.

Your implementation of this method handles every request the dispatcher receives, including the requests for ice_id, ice_ids, ice_isA and ice_ping: you decide whether and how it handles these four operations. You don't need to override the methods that Object provides for them.

A servant is a dispatcher that handles requests itself, rather than passing them to another dispatcher. A servant usually implements a skeleton that the Slice compiler generates for a Slice interface. The skeleton dispatches each request: it unmarshals the parameters, calls the method you implement for the operation, and marshals the return value and out parameters into the response. It also implements the operations of Object: ice_id, ice_ids, ice_isA and ice_ping.

To implement ice_id, ice_ids, ice_isA and ice_ping yourself, make your servant adopt the Ice.Object protocol in addition to the skeleton protocol, and implement its four methods. The dispatch method of the skeleton then calls your methods.

A servant can also implement the dispatch method itself, without a generated skeleton: it reads the parameters from the request's input stream and writes its results to an output stream. Input and Output Streams shows how to read and write Slice types with these streams. You add such a servant to an object adapter like any other servant, in its active servant map or as a default servant.