next up previous contents
Next: Receiving a response Up: RequestCorrelator Previous: Receiving a request

   
Handling a request

When a request is received, it is handled by a separate thread. This thread is only created if a request handler (RequestHandler) was given at the time of the request correlator's creation (parameter of the constructor of RequestCorrelator). Otherwise, if requests are received, they will just be discarded if no request handler was installed.

The thread removes the message header (which was not removed by RequestCorrelator.Receive before !) and determines whether the message is one-way or not, i.e. whether it needs to send a response. It then invokes the request handler's Handle method, which processes the request by interpreting the message's buffer (e.g. extracting an object from it) and returns an object. If a response need to be returned to the sender of the message, then the thread creates a response message, inserts the object into the response's buffer, and adds another header to the message. This header would indicate that the message is in fact a response, and would contain the request's ID. Finally the message is sent using the underlying transport's Send method.




1999-12-13