next up previous contents
Next: Handling a request Up: RequestCorrelator Previous: Sending a request

Receiving a request

The user of a request correlator has to take care to receive regular and suspicion messages, and to 'feed' them to the request correlator. When a regular message is received, method Receive is called. It peeks at the header and checks for 2 things: a) whether the header is of the correct type (RequestCorrelatorHeader) and, if yes, b) whether the name field in the header matches the request correlator's name. If either condition is false, Receive will return false. A user will thus typically try to feed an incoming message to the request correlator, and, if Receive returns false, pass it on to some other layer, e.g. the layer above the current one (when used in a protocol).

If the condition is true, the header type is checked. If it is a request, the message will be added to the request queue (without yet removing the header), where a separate thread will handle it (see 3.4.3). If the header type is a response, the header will be removed from the message and the message added to the response collector that matches the header's ID (calling ReceiveResponse, see 3.4.3).

When the client feeds a suspicion message to the request correlator, the Suspect method callbacks of all request collectors will be called in turn. This allows building blocks on top of request correlators to return gracefully. For example, a group request building block (see 3.4.4) might block indefinitely when trying to send a request to 3 group members and waiting for all responses. If one of the group members crashes, no response from this member would ever be received. Receiving a suspicion notification, however, allows the group request to terminate the group call (if it received responses from the 2 other members)3.7.


next up previous contents
Next: Handling a request Up: RequestCorrelator Previous: Sending a request

1999-08-19